Running LAMMPS with PyRETIS¶
This page describes how to use the LAMMPS Molecular Dynamics Simulator with PyRETIS.
Standard LAMMPS input¶
The LAMMPS-PyRETIS interface is designed to use LAMMPS’s internal ability to perform on-the-fly calculations. PyRETIS expects a LAMMPS input file to be present in the folder from which it is executed. This input file should contain all the information LAMMPS needs to run a simulation on your system, including but not limited to:
- Initial coordinates and molecular topology, with force field coefficients if needed, in a LAMMPS data file. This file can be read into LAMMPS using the read_data command.
- Information about units, bonded and non-bonded force field coefficients, and long-range electrostatics methods, if applicable.
- A LAMMPS fix that will integrate the motion of the atoms in the system.
The LAMMPS input file should contain everything that is needed to run a normal MD simulation except for the run command.
PyRETIS requirements for LAMMPS input¶
In addition to the standard input requirements for a LAMMPS simulation, there are additional requirements for running LAMMPS with PyRETIS.
Mandatory format: The target temperature for the RETIS simulations must be set to a LAMMPS equal-style variable called
SET_TEMP. An example is shown below:variable SET_TEMP equal 300.0
In the above example, the system temperature is set to 300.0 K (assuming real LAMMPS units).
Mandatory format: The order parameter(s) that PyRETIS tracks should be declared as LAMMPS equal-style variable(s). Multiple order parameters can be defined, but the first order parameter,
op_1, will be used by PyRETIS to determine interface crossings.variable op_1 equal c_1 variable op_2 equal c_2
In the above example, two order parameters will be tracked and output by LAMMPS to a file called
order.txt. The first column oforder.txtis the LAMMPS step, the second column isop_1, and the third column isop_2. Onlyop_1is used by LAMMPS to determine crossing of the first or last interface and stop the simulation.The above example refers to LAMMPS compute commands, referenced by
c_1andc_2, that return scalar values. By combining LAMMPS compute and LAMMPS variable commands, many calculations can be performed internally by LAMMPS. LAMMPS can also call Python scripts for more calculations. For clearer input files, order parameter calculations can be scripted in a separate file,order.in, and included in the main LAMMPS input script as follows:include order.in
Restrictions¶
There are some restrictions for the LAMMPS-PyRETIS interface.
- Motion should be propagated using NVE dynamics, as NVT/NPT dynamics have not been shown to be accurately time-reversible in practice.
- We recommend that the SHAKE algorithm not be used, because in practice it produces non-time reversible results due to the iterative nature of the algorithm.
- Order parameters must not depend on the direction of velocity components.
Notes¶
The subcycle length, defined in the PyRETIS input file, refers to how often
LAMMPS will print to the log file and the order.txt file.