lammps

Functions and attributes

atomman.lammps.checkversion(lammps_command)

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.run(lammps_command, script_name, mpi_command=None, restart_script_name=None, return_style='object', logfile='log.lammps', flatten=None)

Calls LAMMPS to run. Returns data model containing LAMMPS output.

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

  • script_name (str) – Path of the LAMMPS input script to use.

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

  • restart_script_name (str or None, optional) – Alternative script to use for restarting if logfile already exists. Default value is None (no restarting).

  • return_style (str, optional) – The format for the returned data. Default value is ‘object’. ‘object’ – returns an atomman.lammps.Log object. ‘model’ – returns a DataModelDict.

  • logfile (str, optional) – Specifies the path to the logfile to write to. Default value is ‘log.lammps’.

  • flatten (str or None, optional) – Specifies if the simulations are to be flattened, and which flatten style to use: - None does not flatten the simulations (default). - ‘first’ uses the values from the earliest simulation. - ‘last’ uses the values from the latest simulation.

Returns

The content either as a Log object or in data model format.

Return type

atomman.lammps.Log or DataModelDict

atomman.lammps.normalize(system, return_transform=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.style.timestep(units='metal')

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='metal')

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