Back to main menu
Name: LAMMPS data file
Extension: unspecified (usually .data, Atomsk uses .lmp)
Specification: LAMMPS online manual
Visualization programs: OVITO
Atomsk can read LAMMPS data files (LMP) corresponding to all "
atom_style", except "
dipole" and "
hybrid". However, all information is not read. Only the box vectors, the particles positions, the particles masses, and velocities, are read and stored by Atomsk. All other sections (like Bonds, Angles, etc.) are ignored.
In the section "Atoms" containing the positions of the particles, if each line ends with three integer numbers, then they are interpreted as flags giving the replica number. The particle is then translated by the corresponding vector.
If a "Masses" section exists before the "Atoms" section, then the particles masses are read and stored as auxiliary properties. Atomsk tries to convert the particles masses into atomic numbers to determine the chemical species of each particle. If, in a line giving the particle type and its mass, the line ends with a comment containing the keywords "core" or "shell", then Atomsk will recognize the particles of the corresponding type as cores or shells, respectively (see this section of the LAMMPS manual about core/shell models).
If a "Velocities" section exists after the "Atoms" section, then velocities are stored as auxiliary properties (vx, vy, vz). In LMP files atoms are distinguished by their "atom type" (1, 2, 3...), which Atomsk recognizes as species (H, He, Li...). These "atom types" can be replaced by atom species thanks to the option
-substitute. In addition, atom types are saved as auxiliary properties to ensure they are conserved when converting to formats that support it. This behavior can be cancelled by removing this auxiliary property with the option
Atomsk can write files to the LMP format, which can be read from a LAMMPS input file thanks to the
read_data command. This LMP file contains atom positions and, if they were defined, atom velocities. Beware that atomic species are replaced by LAMMPS' "atom types" (1, 2, 3...). If these atom types exist as auxiliary properties (either because they were read from an input file, or defined with the option
-properties) then Atomsk will use them to write the LMP file. Otherwise atomic numbers will be replaced by increasing atom types in the order in which they appear.
By default each line is written with the format "
ID type x y z", suited for the style "
atom_style atom" in the LAMMPS input file. But if atom charges are defined (either from the input file or through the option
-properties) then the output format will be "
ID type charge x y z", assuming the use of "
atom_style charge". For other styles one can perform an appropriate search-and-replace in the data file. Atomsk comes with bash scripts that perform such a search-and-replace.
LAMMPS requires that the first vector of the supercell is aligned with the X axis, and the second vector is within the XY plane (see this section of the LAMMPS manual about triclinic boxes). If it is not the case Atomsk will prompt whether to realign the cell vectors or not. If accepted the realignment will apply only to the LAMMPS data file (and not to other output formats). If no alignment is performed then Atomsk will warn that some components of the cell vectors (precisely
H(2,3)) cannot be written to the data file, so the geometry of the system will most likely be wrong. To make sure that the cell is always aligned it is recommended to run Atomsk with the option
If the box skew is too large (for instance if
|H(2,1)|>0.5*H(1,1)), the user will be prompted whether to reduce it before writing the data file (see the error message "Triclinic box skew is too large" in the LAMMPS errors page, and this section of the LAMMPS manual about triclinic boxes). To make sure that the box is never skewed it is recommended to run Atomsk with the option
If shells exist in the system (in the sense of an ionic core-shell model), then Atomsk will write the corresponding information, as specified in this section of the LAMMPS manual. The number of atoms actually includes the total number of cores and shells. The number of bonds and bond types is also written. A section "
Masses" gives the masses of cores and shells. The mass of cores are those of the most common isotopes as provided by the National Institute of Standards and Technology (NIST); the mass of shells is defined as 1/10 of these values. Modify them manually if needed. In the section "
Atoms", each line has the format "
ID molecule-ID type q x y z", where q is the electric charge of the core or shell. When an ion has a shell, the position of the shell appears immediately after the position of the core (and they share the same molecule-ID).
Finally, an additional section "
Bonds" specifies the existing core-shell bonds.
When reading a LMP file containing shells, Atomsk cannot distinguish between cores and shells, so both are saved as atoms. They do however keep their atom types.
Note that the LMP file produced by Atomsk is just a draft, it is NOT fully set for a simulation. Other atom properties (masses...) and parameters (interatomic potential, etc.) are assumed to be set in the LAMMPS input script.
atomsk my_system.cfg lmp
This will read the file
my_system.cfg, and convert it to
atomsk my_system.cfg -alignx -unskew lmp
Back to main menu