Skip to content
kuntalg97Public

About

This comprises the input codes and scripts required for running NNP/CG-MM simulations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

NNP/CG-MM

This comprises the essential input files and scripts necessary for generating the input atomistic trajectories, training the neural network potentials (NNPs), constructing the NNP-CG and CG-CG interactions, and conducting NNP/CG-MM simulations.

Corresponding paper: J. Chem. Theory Comput. 2026

Overview

NNP/CG-MM is a method by which an all-atom neural network potential (NNP) can be systematically embedded into a bottom-up coarse-grained (CG) environment. A small region of the system (e.g., one solute molecule) is kept at atomistic resolution and described by an NNP, while the rest of the system is represented by CG sites. A custom trained or foundational NNP can be used, and the multiscale coarse-graining (MS-CG) method (or force-matching) can be used for constructing the CG environment.

The repository covers three systems:

Directory System
bulk_ccl4/ One atomistic CCl₄ molecule in 499 CG CCl₄ sites
bulk_water/ One atomistic water molecule in 511 CG water sites
hydrophobe_in_water/ One or two atomistic neopentane molecules in 900 CG water sites

Workflow

Key steps:

  1. All-atom molecular dynamics simulations to generate reference trajectories (alternatively, QM/MM or AIMD trajectories can also be used)

  2. Mapping at the CG resolution and constructing the NNP-CG coupling terms and CG-CG interactions using multiscale coarse-graining (MS-CG) force-matching (FM): OpenMSCG

  3. Training a Neural Network Potential (NNP): DeePMD (alternatively, architectures such as MACE and Allegro can also be used)

  1. NNP/CG-MM simulations: LAMMPS patched with DeePMD and PLUMED
  • LAMMPS: main classical MD engine
  • PLUMED: for enhanced sampling

1. All-atom reference simulations

Classical all-atom simulations (OPLS-AA for CCl₄ and neopentane, SPC/Fw for water) are run in LAMMPS: energy minimization, NPT equilibration at 300 K and 1 atm, then NVT production. Positions and forces are saved for mapping, force matching and NNP training.

2. CG mapping and force matching

The all-atom trajectory is mapped with OpenMSCG (cgmap): the molecule(s) in the atomistic region keep all their atoms, and every other molecule is mapped to one CG site at its center of mass. The NNP–CG and CG–CG pair interactions are then obtained by force matching (cgfm, B-spline basis) and tabulated (cgdump). The tables are converted from kcal/mol to eV, the units used by DeePMD.

3. NNP training

Coordinates and forces from the all-atom trajectory are converted to the DeePMD format and split into training and validation sets. A DeePMD se_e2_a model is trained. Foundational models (MACE-OFF24, MACE-POLAR-1) are also used for fully atomistic comparison runs for CCl₄.

4. NNP/CG-MM simulations and analysis

In LAMMPS, the NNP and the tabulated interactions are combined with pair_style hybrid/overlay deepmd ... table ...; the NNP acts only on the atomistic region, and the CG sites interact only through the tables. Structure is compared through radial distribution functions (OpenMSCG cgib) and three-body angular distribution functions (adf.py). For two neopentanes, the potential of mean force along their center-of-mass distance is computed by umbrella sampling with PLUMED.

Repository structure

Each system directory contains some or all of the following:

<system>/
├── AA/                       # all-atom LAMMPS simulation
├── CG_mapping/               # cgmap mapping; RDFs (rdf/) and ADFs (adf/) of the mapped trajectory
├── force_matching/           # cgfm/cgdump force matching
│   └── kcal_to_eV/           # tables converted to eV
├── preparing_data_for_NNP/   # LAMMPS trajectory -> DeePMD training/validation sets
├── training_NNP/             # DeePMD training input and frozen model (*.pb)
├── NNP_CG_runs/              # NNP/CG-MM simulation; RDFs and ADFs
└── full_NNP/                 # fully atomistic NNP simulations for comparison

System-specific directories:

bulk_ccl4/
├── full_NNP/{deepmd, mace_off, mace_polar_1}/   # DeePMD, MACE-OFF24 and MACE-POLAR-1 runs
└── RDFS_LR_role/                                 # CG–CG RDFs from different setups
hydrophobe_in_water/
├── one_hydrophobe/           # one neopentane in CG water (with mapping/ for RDFs and ADFs)
└── two_hydrophobes_US/
    ├── skeleton/             # input files for one umbrella-sampling window
    ├── us_main.sh            # sets up and submits all windows
    └── wham/                 # WHAM input and potential of mean force

Key files

File Description
map.yaml, cgmap.py OpenMSCG mapping definition and mapping script
mscg.sh Force matching (cgfm) and table output (cgdump)
*_eV.table Tabulated NNP–CG and CG–CG potentials (LAMMPS pair_style table format)
convert.py, raw_to_set.sh Conversion of a LAMMPS dump to DeePMD raw and npy files
*.json DeePMD training input
*.pb Frozen DeePMD model
in.*, *.in LAMMPS input scripts
*.data / data.* LAMMPS data files
plumed.in PLUMED input for umbrella sampling
rdf.sh, adf.py RDF and ADF analysis

Installation

Brief instructions only; see each package's documentation for full details.

  • Python dependencies (for the conversion and analysis scripts):
    pip install numpy matplotlib
  • OpenMSCG: follow the installation instructions in the OpenMSCG documentation.
  • DeePMD-kit: install with conda, pip, or the offline installer, following the DeePMD-kit installation guide. For example:
    conda create -n deepmd deepmd-kit lammps -c conda-forge
  • PLUMED: download from plumed.org, then build and install:
    ./configure --prefix=/path/to/plumed
    make && make install
  • LAMMPS + DeePMD + PLUMED: build LAMMPS with the DeePMD-kit interface following Install LAMMPS (DeePMD-kit), and enable the PLUMED package following the LAMMPS PLUMED build instructions. See also the LAMMPS installation page.
  • MACE (optional; for the MACE-OFF and MACE-POLAR-1 comparison runs):
    pip install mace-torch

Paths to executables, environments, models and input files in the scripts are placeholders (/path/to/...) and should be set before running. The submission scripts are written for SLURM.

Usage

The steps below use bulk_ccl4/ as an example; the other systems follow the same pattern.

1. All-atom simulation

cd bulk_ccl4/AA
mpirun -np <N> lmp_mpi -in in.ccl4      # or: sbatch script.sh

2. Mapping and force matching

cd bulk_ccl4/CG_mapping
python cgmap.py                         # maps the AA trajectory -> ccl4_AA_CG.lammpstrj
cd ../force_matching
bash mscg.sh                            # cgfm + cgdump -> Pair_*.table

The tables are converted to eV before use (converted tables are provided in kcal_to_eV/).

3. NNP training

cd bulk_ccl4/preparing_data_for_NNP
python convert.py <traj.lammpstrj> <natoms> <box_length>   # writes box/type/coord/force .raw files
bash raw_to_set.sh                                         # splits into set.000, set.001, ...

Place the sets into training and validation directories, set their paths in the .json file, and train:

cd bulk_ccl4/training_NNP
dp train ccl4_se_e2_a.json
dp freeze -o ccl4_nn_3.pb

4. NNP/CG-MM simulation

cd bulk_ccl4/NNP_CG_runs
mpirun -np <N> lmp_mpi -in in.ccl4 -var SEED $RANDOM      # or: sbatch lammps.sh

RDFs and ADFs are computed by running bash rdf.sh inside rdf/ and python adf.py inside adf/ (the atom types and distance cutoff for the ADF are set inside adf.py).

5. Umbrella sampling (two hydrophobes)

cd hydrophobe_in_water/two_hydrophobes_US
bash us_main.sh

This copies skeleton/ into 18 windows (window_1 … window_18), replaces the XXX placeholder with the window center (4.5–13.0 Å in steps of 0.5 Å), and submits each window. The collective variable is written to COLVAR in each window. The windows are then combined into a potential of mean force with WHAM.

Citation

If you use these files, please cite:

J. Chem. Theory Comput. 2026

Additional resources

Additional analysis codes and the trajectories can be obtained upon reasonable request.

About

This comprises the input codes and scripts required for running NNP/CG-MM simulations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages