8.2.1. 2d simulations — LAMMPS documentation

\(\renewcommand{\AA}{\text{Å}}\)

# 8.2.1. 2d simulations

Use the dimension command to specify a 2d simulation.

Make the simulation box periodic in z via the boundary command. This is the default.

If using the create_box command to define a simulation box, set the z dimensions narrow, but finite, so that the create_atoms command will fill the 3d simulation box with a single z plane of atoms - e.g.

    create_box 1 -10 10 -10 10 -0.25 0.25

If using the read_data command to read in a file of atom coordinates, set the “zlo zhi” values to be finite but narrow, similar to the create_box command settings just described. For each atom in the file, assign a z coordinate so it falls inside the z-boundaries of the box - e.g. 0.0.

Use the fix enforce2d command as the last defined fix to ensure that the z-components of velocities and forces are zeroed out every timestep. The reason to make it the last fix is so that any forces induced by other fixes will be zeroed out.

Many of the example input scripts included in the LAMMPS distribution are for 2d models.

Note

Some models in LAMMPS treat particles as finite-size spheres, as opposed to point particles. See the atom_style sphere and fix nve/sphere commands for details. By default, for 2d simulations, such particles will still be modeled as 3d spheres, not 2d discs (circles), meaning their moment of inertia will be that of a sphere. If you wish to model them as 2d discs, see the set density/disc command and the disc option for the fix nve/sphere, fix nvt/sphere, fix nph/sphere, fix npt/sphere commands.