relentless.simulate.LAMMPS#

class relentless.simulate.LAMMPS(initializer, operations=None, quiet=True, types=None, executable=None)#

Simulation using LAMMPS.

A simulation is performed using LAMMPS. LAMMPS is a molecular dynamics program that can execute on both CPUs and GPUs, as a single process or with MPI parallelism. The launch configuration will be automatically selected for you when the simulation is run.

The version of LAMMPS must be 29 Sep 2021 or newer. It is recommended to build LAMMPS with its Python interface. However, it is possible to run LAMMPS as a binary by specifying executable:

relentless.simulate.LAMMPS(init, ops, executable="lmp_serial")

This can be helpful if you do not have a build of LAMMPS with Python support enabled; however, it will typically be a bit slower than running LAMMPS via Python. To run LAMMPS as an executable with MPI support, you should not launch relentless with mpirexec, and instead should include the mpiexec` command and options in the ``executable:

relentless.simulate.LAMMPS(init, ops, executable="mpiexec -n 8 lmp_mpi")

Warning

LAMMPS requires that tabulated pair potentials do not include an entry for \(r = 0\). Make sure to set rmin to a small value larger than 0.

Parameters:
  • initializer (SimulationOperation) – Operation that initializes the simulation.

  • operations (array_like) – SimulationOperation to execute for run. Defaults to None, which means nothing is done after initialization.

  • quiet (bool) – If True, silence LAMMPS screen output. Setting this to False can be helpful for debugging but would be very noisy in a long production simulation.

  • types (dict) – Mapping from relentless types to LAMMPS integer types. This mapping may be used during initialization (and is required for some operations).

  • executable (str) – LAMMPS executable. If specified, LAMMPS will be run as a binary application rather than its Python library.

Raises:

ImportError – If the lammps package is not found.

Methods

run(potentials, directory)

Run the simulation operations.

Attributes

initializer

Initialization operation.

operations

The operations to be performed during a simulation run.

property initializer#

Initialization operation.

Type:

InitializationOperation

property operations#

The operations to be performed during a simulation run.

Type:

list

run(potentials, directory)#

Run the simulation operations.

A new simulation instance is created to perform the run. It is intended to be destroyed at the end of the run to prevent memory leaks.

Parameters:
  • potentials (Potentials) – The interaction potentials.

  • directory (str or Directory) – Directory for output.

Returns:

The simulation instance after the operations are performed.

Return type:

SimulationInstance