Guide to Lammps - Simulation Setup

# --------------------- Initialization --------------------------------
units metal
atom_style atomic

boundary p p s
newton on

processors * * *

The command units is used to determine natural units for the simulation. A summary of the different options and their units can be found here

The command atom_style determines the basic attributes of atoms in the simulation. These attributes are determined for all atoms in the simulation and cannot be changed after determined. For the simulation of solids and metals, atomic is a proper choice. More on the proper choice for each type of simulation can be found here.

The command boundary describe the behaviour of the simulation box. The first argument specifies behaviour for faces orthogonal to the X axis, the second argument specifies the behaviour of the faces orthogonal to the Y axis and the third argument for faces orthogonal to the Z axis. In this example, p means periodic, meaning particles crossing one face of the box emerges through the opposite. the value s specifies a non-periodic warped boundary. This means that the simulation box can dynamically grow as particles push the boundary further.

The command newton specifies the use of Newton's 3rd law to reduce computation time in exchange for an increase in communication. Using on or off should result in the same calculation, except for round-off issues.

The command processors overrides the default way Lammps assigns processors for calculations on each axis in a 3-D grid. The argument * lets Lammps choose the number of processors. This command is useful when it is known that changes across a certain axis are limited when compared to the other axes.

# --------------------- Simulation Settings ---------------------------
neighbor 2.0 bin
neigh_modify delay 3

timestep 0.0001
thermo_style custom step pe etotal temp
thermo 10000

dump diamond all xyz 10000 out.diamond.*.xyz

The command neighbor defines the way the neighbours list is built. The first value is the extension for the potential cutoff. Neighbouring atoms, meaning atoms that are likely to interact with each other, are atoms with a maximal distance of the potential cutoff distance and the extension, 2.0 Å in this example. A large value will result in a lot of neighbouring pairs, which requires less updates to the neighbours list, however more pairs to check for possible interaction. The value 'bin' defines the algorithm used to create the list. This choice means the pairs are binned together, which is usually the preferred choice in terms of time complexity.

The command neigh_modify affects different parameters regarding the neighbours list - how often it is updated, which pairs are used etc. In this example, the list is never rebuilt in an interval of 3 time steps from the previous update. After that, it may or may not be rebuilt, depending on required updates.

The command timestep defines the length of each simulation step. Since we use the metal units, the time unit is nsec, rendering each step to be 0.0001 nsec. Choosing a proper value is important and requires consideration. Too large a value may lead to numeric errors and loss of important data. Too small a value may also result in numeric errors, and requires longer computation time, since more computations are needed to achieve the same result. More on this issue in the 'Choosing a Timestep' section.

The command thermo_style defines the format of the log generated by LAMMPS. In this example, each iteration we print the iteration index, total potential energy, total energy and current temperature. More options can be found in the manual here.

The command thermo computes and outputs the parameters defined by thermo_style every certain number of steps. In this example, every 10000 steps.

The command dump writes different parameters to a file, or different files, every certain number of steps. In this example, we write the coordinates of all atoms to files with the name out.diamond.[StepNumber].xyz every 10000. The 'diamond' value is simply a name given to this specific dump, which allows us to change it or stop it later.

To continue in the LAMMPS guide, press here.
To return backwards in the LAMMPS guide, press here.