Comprehensive Guide to LAMMPS Scripting for Molecular Dynamics


Molecular dynamics (MD) simulation is one of the most essential in materials science, as it allows researchers to analyze atomic-scale interactions with high precision. The most widely used MD simulation package is LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator). This article provides an in-depth explanation of the structure of a typical LAMMPS input script. It usually has four parts.

  1. Initialization
  2. System definition
  3. Simulation settings
  4. Run the simulation
1. Initialization
The initialization section sets the basic properties of the simulation. Some of the relevant commands are units, atom_style, and boundary. 

units style

The style can be real, lj, metal, si, cgs, nano, electron, or micro. Ex: units real
This command sets the unit style for the simulation. It determines how input and output values ​​are represented. It affects quantities like mass, distance, energy, and time.

atom_style style 

Style can be atomic, bond, charge, full, or molecular. Ex: atom_style full
These are some of the types of styles. The atom_style command defines the properties of the atom required for the simulation. Properties contain ID, type, position, velocity, forces, and optional properties like charge, bonds, and dipoles.

boundary a b c 

a, b, and c can be p, f, or s. p is periodic, f is fixed (no interaction beyond the boundary), and s is shrink-wrapped (allowing dynamic resizing). Ex: boundary p p p
The boundary command in LAMMPS sets boundary conditions for the simulation box in each dimension. It can assign the same style to all three faces or different styles to all three faces.



2. System definition

In this section, it is necessary to include setting up the simulation cell and defining atomic positions, molecular topology, and force field information. There are three ways to do it.
  • Reading from a Data File (read_data)
In this method, a pre-defined atomic configuration from an external data file is used. This file contains information about atoms, bonds, angles, and molecular topology and is useful for complex systems. Ex: read_data system.data
  • Reading from a Restart File (read_restart)
In this method a previously saved simulation state from a restart file is used. This is important because a simulation can be continued without restarting the system. Typically used in long simulations where you need to restart from a previous state. Ex: read_restart restart.lammps
  • Creating a Simulation Cell and Filling it with Atoms
If there is no predefined data or restart file, LAMMPS provides commands for manually creating a simulation system.
    • Define a lattice (lattice) – Specifies atomic arrangement (e.g., FCC, BCC). 
Ex: lattice fcc 3.52
    • Define a simulation box (region) – Sets the simulation boundaries. 
Ex: region box block 0 10 0 10 0 10
    • Create the simulation box (create_box) – Initializes atomic types. 
Ex: create_box 1 box
    • Fill the Box with Atoms (create_atoms) – Places atoms inside the box. 
Ex: create_atoms 1 box



3. Simulation settings

After defining the atoms and molecular topology, various parameters need to be set. This includes force field coefficients, simulation parameters, and output options.
  • Force Field Coefficients
Force field coefficients define atomic interactions Ex: pair_coeff, bond_coeff, angle_coeff, dihedral_coeff
  • Simulation Parameters
Normal simulation parameters include timestep, neighbor, group, reset_timestep, run_style, etc.
  • Output Settings
Output options are thermo (controls thermodynamic output frequency), dump (writes atomic trajectories to a file), and restart (saves periodic restart files) commands.


4. Run the simulation

Once the setup is complete, the simulation is executed using the run command, and energy minimization is done using the minimize command. temper command runs a parallel tempering simulation.

LAMMPS's dump command provides regular atomic configurations, allowing users to monitor the evolution of the system. To store the final system configuration, the write_data command is used.


By understanding each section, researchers can efficiently set up and analyze molecular dynamics simulations. By using appropriate commands and parameters, users can customize LAMMPS simulations for various materials science applications.

Thank you for reading. Have a great day! We will see you in the next article.

Comments

Popular posts from this blog

How Does LAMMPS Enable Efficient Molecular Dynamics Simulations? 🚀

What is Eng's Notebook? Our Journey into Materials Science 🍃