LAMMPS
Running Lammps example
To get started with lammps, here is an input file you can use, you can name it in.lj
# LAMMPS input script for a Lennard-Jones fluid simulation
# Initialize simulation
units lj
atom_style atomic
dimension 3
boundary p p p
# Create simulation box and atoms
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0
# Define pair potential
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
# Set up integration
velocity all create 1.44 87287 dist gaussian
fix 1 all nvt temp 1.44 1.44 0.1
# Output settings
thermo 100
thermo_style custom step temp pe ke etotal press
# Run simulation
run 10000
Shown below is an example slurm job script that you can use to run the test
#!/bin/bash
#SBATCH --job-name=lammps_lj_test
#SBATCH --output=lammps_lj_test_%j.out
#SBATCH --error=lammps_lj_test_%j.err
#SBATCH --partition=cpu-queue
#SBATCH --nodes=4
#SBATCH --ntasks-per-node=4
#SBATCH --time=01:00:00
#SBATCH --mem=4G
# Load LAMMPS module
module load lammps
# Run LAMMPS
srun lmp -in in.lj
echo "LAMMPS simulation completed."
If you want to run this locally, you do the following
module load lammps
lmp -in in.lj
Shown below is an example run
Output of Serial run
[shahzebsiddiqui93358008@login lammps]$ ml lammps
[shahzebsiddiqui93358008@login lammps]$ lmp -in in.lj
LAMMPS (22 Jul 2025)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread.
using 1 OpenMP thread(s) per MPI task
Lattice spacing in x,y,z = 1.6795962 1.6795962 1.6795962
Created orthogonal box = (0 0 0) to (16.795962 16.795962 16.795962)
1 by 1 by 1 MPI processor grid
Created 4000 atoms
using lattice units in orthogonal box = (0 0 0) to (16.795962 16.795962 16.795962)
create_atoms CPU = 0.000 seconds
Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
update: every = 1 steps, delay = 0 steps, check = yes
max neighbors/atom: 2000, page size: 100000
master list distance cutoff = 2.8
ghost atom cutoff = 2.8
binsize = 1.4, bins = 12 12 12
1 neighbor lists, perpetual/occasional/extra = 1 0 0
(1) pair lj/cut, perpetual
attributes: half, newton on
pair build: half/bin/atomonly/newton
stencil: half/bin/3d
bin: standard
Setting up Verlet run ...
Unit style : lj
Current step : 0
Time step : 0.005
Per MPI rank memory allocation (min/avg/max) = 3.847 | 3.847 | 3.847 Mbytes
Step Temp PotEng KinEng TotEng Press
0 1.44 -6.7733681 2.15946 -4.6139081 -5.0199732
100 1.2466162 -5.2235184 1.8694568 -3.3540616 3.2706729
200 1.3979833 -4.9313742 2.0964508 -2.8349234 4.7951796
300 1.4490494 -4.9480512 2.1730308 -2.7750204 4.7993795
400 1.4429262 -4.9198948 2.1638482 -2.7560466 4.8901023
500 1.4623065 -4.8861963 2.1929114 -2.6932848 5.0434474
600 1.4879504 -4.9556485 2.2313676 -2.7242809 4.7865749
700 1.4208733 -4.9066708 2.1307772 -2.7758937 4.9063166
800 1.420188 -4.9173936 2.1297494 -2.7876442 4.9235724
900 1.4160777 -4.9383547 2.1235855 -2.8147692 4.8170408
1000 1.445151 -4.918279 2.1671845 -2.7510944 4.9222025
1100 1.441802 -4.8816636 2.1621623 -2.7195013 5.0782738
1200 1.4225037 -4.9252654 2.1332221 -2.7920434 4.9057195
1300 1.4213 -4.9279006 2.131417 -2.7964836 4.8500212
1400 1.4316723 -4.9420426 2.1469716 -2.7950711 4.7950161
1500 1.424279 -4.9151313 2.1358844 -2.7792469 4.9041885
1600 1.4484477 -4.91225 2.1721284 -2.7401216 4.9341227
1700 1.456154 -4.9005125 2.183685 -2.7168275 5.0037475
1800 1.4302852 -4.9169595 2.1448914 -2.7720681 4.9234884
1900 1.441201 -4.915824 2.161261 -2.7545629 4.9370774
2000 1.450631 -4.9384502 2.1754026 -2.7630476 4.8183827
2100 1.4474692 -4.9287083 2.170661 -2.7580473 4.8924483
2200 1.4721748 -4.9242082 2.2077102 -2.716498 4.9056155
2300 1.4412085 -4.9298972 2.1612723 -2.768625 4.8913916
2400 1.4318782 -4.9468059 2.1472803 -2.7995256 4.7620755
2500 1.424971 -4.9252957 2.1369222 -2.7883735 4.8638236
2600 1.44372 -4.9410611 2.1650386 -2.7760225 4.8468886
2700 1.4084825 -4.9535104 2.1121956 -2.8413148 4.6793373
2800 1.422158 -4.9225582 2.1327037 -2.7898544 4.8653882
2900 1.3809106 -4.8908211 2.070848 -2.8199731 5.0163131
3000 1.447082 -4.8951985 2.1700803 -2.7251182 5.0202674
3100 1.4650584 -4.9460888 2.1970382 -2.7490506 4.7759132
3200 1.4297344 -4.8938589 2.1440654 -2.7497935 5.0259491
3300 1.4325761 -4.8849864 2.148327 -2.7366594 5.0335537
3400 1.4563164 -4.8978903 2.1839285 -2.7139619 5.0361556
3500 1.4458712 -4.921177 2.1682647 -2.7529124 4.900445
3600 1.466679 -4.9540192 2.1994685 -2.7545506 4.7870645
3700 1.416574 -4.907046 2.1243298 -2.7827162 4.9514516
3800 1.4532322 -4.9424216 2.1793033 -2.7631183 4.8307774
3900 1.4541771 -4.8947445 2.1807203 -2.7140242 5.0563541
4000 1.4504956 -4.9136691 2.1751994 -2.7384697 4.9575293
4100 1.4406771 -4.9309427 2.1604753 -2.7704673 4.8179245
4200 1.4241148 -4.9565575 2.1356381 -2.8209194 4.7635288
4300 1.4233508 -4.9271036 2.1344924 -2.7926112 4.8383946
4400 1.4577319 -4.9253821 2.1860512 -2.7393309 4.8561848
4500 1.4568272 -4.934536 2.1846946 -2.7498414 4.8518374
4600 1.4482049 -4.9089898 2.1717643 -2.7372255 4.953921
4700 1.4599638 -4.9005055 2.1893982 -2.7111073 5.036714
4800 1.4814969 -4.9118452 2.2216898 -2.6901554 4.9952474
4900 1.455693 -4.9158217 2.1829936 -2.7328281 4.9285565
5000 1.4593809 -4.9356606 2.1885241 -2.7471365 4.8347977
5100 1.4318082 -4.8914161 2.1471753 -2.7442408 5.0110126
5200 1.4596193 -4.9077136 2.1888816 -2.718832 5.0106147
5300 1.4310837 -4.9637587 2.1460889 -2.8176698 4.6863241
5400 1.4503126 -4.9627711 2.174925 -2.7878462 4.7177608
5500 1.4584633 -4.9522905 2.187148 -2.7651426 4.7408268
5600 1.4371955 -4.9074167 2.1552542 -2.7521625 4.9392478
5700 1.4395574 -4.9011293 2.1587963 -2.742333 4.9782033
5800 1.4428568 -4.9461487 2.1637441 -2.7824046 4.7503462
5900 1.4260558 -4.8972944 2.1385489 -2.7587455 4.9722314
6000 1.4521224 -4.9436397 2.177639 -2.7660007 4.8076647
6100 1.4441167 -4.9657393 2.1656335 -2.8001058 4.6744627
6200 1.4651733 -4.9375618 2.1972105 -2.7403513 4.8563569
6300 1.4391252 -4.9080442 2.1581481 -2.7498961 4.9627705
6400 1.4538245 -4.8963363 2.1801915 -2.7161448 5.0225546
6500 1.4551118 -4.9402538 2.182122 -2.7581317 4.7846903
6600 1.4297955 -4.9131347 2.1441571 -2.7689776 4.8903744
6700 1.4760189 -4.9288202 2.2134748 -2.7153453 4.9089995
6800 1.4906989 -4.925178 2.2354893 -2.6896887 4.8875852
6900 1.4480072 -4.9238952 2.1714679 -2.7524274 4.8705333
7000 1.4651697 -4.9150021 2.1972051 -2.7177969 4.9616593
7100 1.4598232 -4.9279074 2.1891874 -2.73872 4.884643
7200 1.4411597 -4.9688847 2.1611991 -2.8076856 4.6689537
7300 1.4309582 -4.9194844 2.1459007 -2.7735837 4.9248107
7400 1.436981 -4.9626813 2.1549327 -2.8077486 4.7188766
7500 1.4370262 -4.9616521 2.1550005 -2.8066516 4.6979093
7600 1.432032 -4.9446691 2.1475109 -2.7971582 4.7935444
7700 1.4435295 -4.9122616 2.1647529 -2.7475087 4.9394094
7800 1.4455991 -4.9283259 2.1678566 -2.7604693 4.8866379
7900 1.4352561 -4.8947456 2.1523459 -2.7423997 5.0671556
8000 1.4569767 -4.9356946 2.1849187 -2.7507759 4.8420179
8100 1.4634048 -4.9314665 2.1945584 -2.7369081 4.8512907
8200 1.4583048 -4.8854431 2.1869104 -2.6985327 5.0457597
8300 1.4607883 -4.9524632 2.1906346 -2.7618286 4.746597
8400 1.4358425 -4.8967403 2.1532253 -2.743515 4.970709
8500 1.4623803 -4.934288 2.1930221 -2.741266 4.8722286
8600 1.4318252 -4.9057034 2.1472008 -2.7585026 4.9799453
8700 1.4496319 -4.9037696 2.1739042 -2.7298654 4.9810337
8800 1.4425726 -4.9045588 2.1633179 -2.7412409 4.950305
8900 1.4590566 -4.9583792 2.1880377 -2.7703414 4.7581267
9000 1.4508584 -4.9349852 2.1757435 -2.7592416 4.8647188
9100 1.4410412 -4.8936332 2.1610214 -2.7326117 5.0167724
9200 1.437924 -4.8740051 2.1563468 -2.7176583 5.0679922
9300 1.484821 -4.8988678 2.2266748 -2.672193 5.0579254
9400 1.4596899 -4.8986507 2.1889874 -2.7096633 5.0061428
9500 1.4239048 -4.920056 2.1353232 -2.7847328 4.8863667
9600 1.4177218 -4.9314502 2.1260511 -2.8053991 4.8366339
9700 1.4168447 -4.9083931 2.1247357 -2.7836573 4.9255887
9800 1.431951 -4.9234346 2.1473895 -2.7760451 4.8809053
9900 1.4322947 -4.9188813 2.1479049 -2.7709763 4.8972172
10000 1.4090563 -4.9190032 2.113056 -2.8059472 4.9056373
Loop time of 23.4649 on 1 procs for 10000 steps with 4000 atoms
Performance: 184104.967 tau/day, 426.169 timesteps/s, 1.705 Matom-step/s
100.0% CPU use with 1 MPI tasks x 1 OpenMP threads
MPI task timing breakdown:
Section | min time | avg time | max time |%varavg| %total
---------------------------------------------------------------
Pair | 12.937 | 12.937 | 12.937 | 0.0 | 55.14
Neigh | 9.6369 | 9.6369 | 9.6369 | 0.0 | 41.07
Comm | 0.32092 | 0.32092 | 0.32092 | 0.0 | 1.37
Output | 0.0034526 | 0.0034526 | 0.0034526 | 0.0 | 0.01
Modify | 0.4451 | 0.4451 | 0.4451 | 0.0 | 1.90
Other | | 0.1212 | | | 0.52
Nlocal: 4000 ave 4000 max 4000 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Nghost: 5505 ave 5505 max 5505 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Neighs: 151312 ave 151312 max 151312 min
Histogram: 1 0 0 0 0 0 0 0 0 0
Total # of neighbors = 151312
Ave neighs/atom = 37.828
Neighbor list builds = 1645
Dangerous builds = 0
Total wall time: 0:00:23
Quick Start Recipe
Interactive Run
Load required modules:
spack load apptainer@1.3.4 module load lammps
Get example files (optional):
git clone git@github.com:CamberCloud-Inc/demos.git cd demos/30-applications/03-molecular_dynamics/lammps
Run LAMMPS simulation:
lammps-run -in unbreakable.lmp