LAMMPS workflow

LAMMPS home
LAMMPS script explanations (example input scripts available in install directory)

Creation of initial geometry files (Avogadro)

Generation of geometry for LAMMPS script

  • generate supercell from basic .cif crystal file using supercell software
    • supercell documentation
    • run input example:
      supercell -i input.cif -v 2 -s 2x2x2 -o output
  • generate .xyz file from .cif file generated by supercell using cif2xyz
    • cif2xyz GitHub repository
    • run input example:
      cif2xyz input.cif -z angle_x,angle_y,angle_z -d dimension_x,dimension_y,dimension_z -o output
  • generate system and initial positions for LAMMPS script using packmol software
    • packmol User's guide
    • generate system in either .xyz or .pdb file format (other supported but not suitable)
      • .xyz file (only positions, no bonds, unlimited system size)
      • .pdb file (positions + bonds, 9,999 atoms system limit)
    • input file example
    • run input example:
      packmol < packmol.inp
  • (optional) generate odd shaped models
    • using cutter.py script
    • cuts out along the specified axis or plane
    • keeps/removes file either over or under axis/plane

Visualizing generated system using OVITO sotfware

Visualization done to check wheter the system was generated correctly and can be used as input geometry in LAMMPS script

Generate LAMMPS input geometry .dat file using OVITO and "swapper"

  • Import file to be exported to .dat
  • Export to .dat using: File > Export File > LAMMPS Data File (Atom style full recommended)
  • Use "swapper" to differentiate same atoms in different molecules (instructions on use in the script beginning)

Writing LAMMPS input script

Any text editor can be used to edit LAMMPS input scripts.
Notepad++ is a better alternative to the default Notepad.
Visual Studio Code is the recommended option.
LAMMPS extentsion for VS Code makes writting LAMMPS scripts much easier thanks to the syntax highlighting, hover explanations, offline documentation and more.

LAMMPS script example

(TBA)
((there are no easy examples))

Running LAMMPS on Windows

Running in serial mode (1 core)

lmp_serial < in.file
--> will run in the console  

Running with MPI (multi-core)

mpiexec -n 4 lmp_mpi -in input.lmp -pk omp 2 -sf omp
--> will run in the console (4 cores, omp hyperthreading)  

Visualizing results

  • LAMMPS output file
    • text editor
  • .lammpstrj file

Processing of results

  • Calculating Diffusion coefficients via MSD (mean square displacement) from .lammpstrj file
    • using "bestScript" link
    • calculation of x_MSD, y_MSD, z_MSD, combined_MSD of each selected atom type
    • MSDs are plotted against time
    • Diffusion coefficient is obtained as slope of initial linear part of the diffusion curve
    • Based on the work of David Keffer ref
  • Visualising trajectories from .lammpstrj file
    • using "bestScript" link
    • generation of coordinates in each timestep for each selected atom type
    • Coordinates are plotted against time to obtain 3D trajectory
      • script for OriginPro to change columns to X1 Y1 Z1; X2 Y2 Z2;