relax_box.py

Calculation functions

cij_run0(lammps_command: str, system: atomman.core.System.System, potential: atomman.lammps.Potential.Potential, mpi_command: Optional[str] = None, strainrange: float = 1e-06, cycle: int = 0) dict

Runs cij_run0.in LAMMPS script to evaluate the elastic constants, pressure and potential energy of the current system.

Parameters
  • lammps_command (str) – Command for running LAMMPS.

  • system (atomman.System) – The system to perform the calculation on.

  • potential (atomman.lammps.Potential) – The LAMMPS implemented potential to use.

  • mpi_command (str, optional) – The MPI command for running LAMMPS in parallel. If not given, LAMMPS will run serially.

  • strainrange (float, optional) – The small strain value to apply when calculating the elastic constants (default is 1e-6).

  • cycle (int, optional) – Indicates the iteration cycle of quick_a_Cij(). This is used to uniquely save the LAMMPS input and output files.

Returns

Dictionary of results consisting of keys:

  • ’E_pot’ (float) - The potential energy per atom for the supplied system.

  • ’pressure’ (numpy.array) - The measured pressure state of the supplied system.

  • ’C_elastic’ (atomman.ElasticConstants) - The supplied system’s elastic constants.

Return type

dict

relax_box(lammps_command: str, system: atomman.core.System.System, potential: atomman.lammps.Potential.Potential, mpi_command: Optional[str] = None, strainrange: float = 1e-06, p_xx: float = 0.0, p_yy: float = 0.0, p_zz: float = 0.0, p_xy: float = 0.0, p_xz: float = 0.0, p_yz: float = 0.0, tol: float = 1e-10, diverge_scale: float = 3.0) dict

Quickly refines static orthorhombic system by evaluating the elastic constants and the virial pressure.

Parameters
  • lammps_command (str) – Command for running LAMMPS.

  • system (atomman.System) – The system to perform the calculation on.

  • potential (atomman.lammps.Potential) – The LAMMPS implemented potential to use.

  • mpi_command (str, optional) – The MPI command for running LAMMPS in parallel. If not given, LAMMPS will run serially.

  • strainrange (float, optional) – The small strain value to apply when calculating the elastic constants (default is 1e-6).

  • p_xx (float, optional) – The value to relax the x tensile pressure component to (default is 0.0).

  • p_yy (float, optional) – The value to relax the y tensile pressure component to (default is 0.0).

  • p_zz (float, optional) – The value to relax the z tensile pressure component to (default is 0.0).

  • p_xy (float, optional) – The value to relax the xy shear pressure component to (default is 0.0).

  • p_xz (float, optional) – The value to relax the xz shear pressure component to (default is 0.0).

  • p_yz (float, optional) – The value to relax the yz shear pressure component to (default is 0.0).

  • tol (float, optional) – The relative tolerance used to determine if the lattice constants have converged (default is 1e-10).

  • diverge_scale (float, optional) – Factor to identify if the system’s dimensions have diverged. Divergence is identified if either any current box dimension is greater than the original dimension multiplied by diverge_scale, or if any current box dimension is less than the original dimension divided by diverge_scale. (Default is 3.0).

Returns

Dictionary of results consisting of keys:

  • ’dumpfile_initial’ (str) - The name of the initial dump file created.

  • ’symbols_initial’ (list) - The symbols associated with the initial dump file.

  • ’dumpfile_final’ (str) - The name of the final dump file created.

  • ’symbols_final’ (list) - The symbols associated with the final dump file.

  • ’lx’ (float) - The relaxed lx box length.

  • ’ly’ (float) - The relaxed ly box length.

  • ’lz’ (float) - The relaxed lz box length.

  • ’xy’ (float) - The relaxed xy box tilt.

  • ’xz’ (float) - The relaxed xz box tilt.

  • ’yz’ (float) - The relaxed yz box tilt.

  • ’E_pot’ (float) - The potential energy per atom for the final configuration.

  • ’measured_pxx’ (float) - The measured x tensile pressure of the relaxed system.

  • ’measured_pyy’ (float) - The measured y tensile pressure of the relaxed system.

  • ’measured_pzz’ (float) - The measured z tensile pressure of the relaxed system.

  • ’measured_pxy’ (float) - The measured xy shear pressure of the relaxed system.

  • ’measured_pxz’ (float) - The measured xz shear pressure of the relaxed system.

  • ’measured_pyz’ (float) - The measured yz shear pressure of the relaxed system.

Return type

dict

Raises

RuntimeError – If system diverges or no convergence reached after 100 cycles.

update_box(system: atomman.core.System.System, C: atomman.core.ElasticConstants.ElasticConstants, pij: numpy.ndarray, target_pxx: float = 0.0, target_pyy: float = 0.0, target_pzz: float = 0.0, target_pxy: float = 0.0, target_pxz: float = 0.0, target_pyz: float = 0.0, tol: float = 1e-10) atomman.core.System.System

Generates a new system with an updated box that attempts to reach the target pressure. The new box dimensions are estimated by assuming linear elasticity and using the pressure and elastic constants of the current system.

Parameters
  • system (atomman.System) – The system to update

  • C (atomman.ElasticConstants) – The computed elastic constants for the system.

  • pij (numpy.NDArray) – The 3x3 array of pressure tensors computed for the system.

  • target_pxx (float, optional) – The value to relax the x tensile pressure component to. Default is 0.0.

  • target_pyy (float, optional) – The value to relax the y tensile pressure component to. Default is 0.0.

  • target_pzz (float, optional) – The value to relax the z tensile pressure component to. Default is 0.0).

  • target_pyz (float, optional) – The value to relax the yz shear pressure component to. Default is 0.0).

  • target_pxz (float, optional) – The value to relax the xz shear pressure component to. Default is 0.0).

  • target_pyz – The value to relax the xy shear pressure component to. Default is 0.0).

  • tol (float, optional) – The target tolerance. Any strains less than this will be ignored. Default value is 1e-10.

Returns

The System with updated box dimensions.

Return type

atomman.System