lammps

Classes

Functions and attributes

atomman.lammps.checkversion(lammps_command: str) dict

Gets the LAMMPS version and date information by testing lammps_command.

Parameters:

lammps_command (str) – A LAMMPS executable.

Returns:

version_info – Dictionary containing ‘version’, the str LAMMPS version, and ‘date’, the corresponding datetime.date for the LAMMPS version.

Return type:

dict

Raises:

ValueError – If lammps fails to run

atomman.lammps.normalize(system, return_transform: bool = False)

The normalize function takes any arbitrary system and transforms it to be compatible with LAMMPS. In particular, LAMMPS systems must have: 1. Right-handed box vectors. 2. avect = [lx, 0.0, 0.0] 3. bvect = [xy, ly, 0.0] 4. cvect = [xz, yz, lz] 5. All atoms initially inside the box dimensions. Note: large box tilt factors are not adjusted with this function. As such, the LAMMPS command ‘box tilt large’ may be needed.

Parameters:
  • system (atomman.System) – The system to normalize.

  • return_transform (bool, optional) – Indicates if the transformation matrix used during the normalization is to be returned as well. Default value is False

Returns:

  • newsystem (atomman.System) – A new system that has been normalized.

  • transform (np.ndarray) – The transformation matrix associated with the normalization. Returned if return_transform is True.

atomman.lammps.run(lammps_command: str, script_name: Optional[str] = None, script: Optional[str] = None, mpi_command: Optional[str] = None, restart_script_name: Optional[str] = None, restart_script: Optional[str] = None, logfile: str = 'log.lammps', screen: bool = True, suffix: Optional[str] = None) Log

Calls LAMMPS to run. Returns a Log object of the screen/logfile output.

Parameters:
  • lammps_command (str) – The LAMMPS inline run command (sans -in script_name).

  • script_name (str, optional) – Path of the LAMMPS input script file to use. Either script_name or script must be given.

  • script (str, optional) – The LAMMPS input script command lines to use. Either script_name or script must be given.

  • mpi_command (str, optional) – The MPI inline command to run LAMMPS in parallel. Default value is None (no mpi).

  • restart_script_name (str, optional) – Path to an alternate LAMMPS input script file to use for restart runs. If given, the restart script will be used if the specified logfile already exists. Requires logfile to not be None.

  • restart_script (str, optional) – Alternate LAMMPS script command lines to use for restart runs. If given, the restart script will be used if the specified logfile already exists. Requires logfile to not be None.

  • logfile (str or None, optional) – Specifies the path to the logfile to write to. Default value is ‘log.lammps’. If set to None, then no logfile will be created.

  • screen (bool, optional) – If True (default), then the resulting Log object is built from the LAMMPS screen output. If False, then LAMMPS outputs no screen info and the Log object will be built by reading logfile.

  • suffix (str, optional) – Allows for the LAMMPS suffix option to be specified to use any of the accelerated versions of pair styles if available.

Returns:

Contains the processed screen/logfile contents. Will not be returned if logfile is None and screen is False as there would be no means to capture the LAMMPS output.

Return type:

atomman.lammps.Log

atomman.lammps.style.timestep(units: str = 'metal') float

Returns the default timestep value for a LAMMPS unit style option.

Parameters:

units (str, optional) – The LAMMPS unit option. Default value is ‘metal’

Returns:

The default timestep value.

Return type:

float

atomman.lammps.style.unit(units: str = 'metal') dict

Returns the units information associated with a LAMMPS units option.

Parameters:

units (str, optional) – The LAMMPS unit option. Default value is ‘metal’

Returns:

The keys are physical quantity types and the values are the associated units to use.

Return type:

dict

atomman.lammps.Potential.Potential(model: Union[str, IOBase], name: Optional[str] = None, pot_dir: Optional[str] = None, kim_id: Optional[str] = None, potkey: Optional[str] = None, potid: Optional[str] = None, symbolset: Optional[Union[str, list]] = None) BasePotentialLAMMPS

Class initializer switch for PotentialLAMMPS or PotentialLAMMPSKIM objects.

Parameters:
  • model (str or file-like object) – A JSON/XML data model containing a potential-LAMMPS or a potential-LAMMPS-KIM branch.

  • name (str, optional) – The record name to use. If not given, this will be set to the potential’s id.

  • pot_dir (str, optional) – The path to a directory containing any artifacts associated with the potential. Default value is None, which assumes any required files will be in the working directory when LAMMPS is executed.

  • kim_id (str, optional) – The full KIM model id indicating the version of a KIM model to use. If not given, then the newest known version will be used.

  • potkey (str, optional) – Specifies which potential (by potkey value) to use. Only important if it is a kim model associated with multiple potential entries. This controls which symbols are available.

  • potid (str, optional) – Specifies which potential (by potid value) to use. Only important if it is a kim model associated with multiple potential entries. This controls which symbols are available.

  • symbolset (str or list, optional) – Specifies which potential (by symbols value) to use. Only important if it is a kim model associated with multiple potential entries. If potkey or potid is not given, then the first potential entry found with all listed symbols will be selected.

Returns:

The matching LAMMPS Potential object

Return type:

potentials.record.BasePotentialLAMMPS.BasePotentialLAMMPS