Installation
This guide walks you through compiling LAMMPS 3 Mar 2020 with the
custom bond/create/random
fix needed for the generate_InitCond
polymer-network examples.
The steps assume access to an FASRC‐style cluster, but they also work
on any system that provides recent CMake, GCC ≥ 14, and Open MPI.
Note
bond/create/random
is not part of vanilla 3 Mar 2020.
We patch it in manually from the
pdebuyl/lammps *fbc_random* branch.
Prerequisites
Start an interactive job
salloc -p test --mem 4G -t 0-3:00
Load build tools
module avail # just to confirm the names below module load cmake/3.31.6-fasrc01 module load gcc/14.2.0-fasrc01 module load openmpi/5.0.5-fasrc01
Source code
Download and unpack LAMMPS 3 Mar 2020
wget https://download.lammps.org/tars/lammps-3Mar2020.tar.gz tar -xf lammps-3Mar2020.tar.gz cd lammps-3Mar2020
Add the patched fix
Copy the two files below into src/MC (create the folder if absent):
cp /path/to/fix_bond_create_random.cpp src/MC/ cp /path/to/fix_bond_create_random.h src/MC/
(They come from the fbc_random branch linked above.)
Configure & build
Create a build directory
mkdir build && cd build
Configure with CMake (MPI build):
cmake ../cmake -DBUILD_MPI=on
Enable required packages
The 2020 release still uses old package names:
cmake -DPKG_MC=on \ -DPKG_MOLECULE=on \ -DPKG_USER-MISC=on \ -DPKG_USER-COLVARS=on .
Compile
cmake --build . -j$(nproc)
The resulting executable is:
lammps-3Mar2020/build/lmp
Sanity check
Verify that the new fix is available:
./lmp -h | grep bond/create/random
Expected output:
bond/create/random Create bonds (random partner selection) [MC]
If nothing appears, the patch was not picked up—revisit Step 4 or
ensure -DPKG_MC=on
was passed to CMake.
Optional: Python wrapper
If you plan to control LAMMPS from Jupyter/NumPy:
pip install --user lammps-cython
Troubleshooting
“Package MC is not enabled” Re-run CMake with
-DPKG_MC=on
and rebuild.“New bond exceeded bonds per atom …” Increase maxbond in your
bond/create/random
command or raiseextra/special/per/atom
in theread_data
section.
With LAMMPS successfully built you can run the generate_InitCond pipeline and companion analysis notebooks without further modification.