lammps

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) atomman.lammps.Log.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

members

undoc-members

show-inheritance

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