A coarse-grained molecular dynamics pipeline for studying Li-ion diffusion in PEO polymer electrolytes using LAMMPS
This repository provides a fully automated pipeline for coarse-grained (CG) molecular dynamics (MD) simulations of lithium-ion (Li⁺) diffusion in poly(ethylene oxide) (PEO) polymer electrolyte systems using LAMMPS. The pipeline supports parametric exploration of CG force field parameters, enabling systematic investigation of how intermolecular interactions govern Li⁺ transport properties — a critical factor in the design of next-generation solid-state polymer batteries.
The pipeline:
- Automatically generates LAMMPS input files from a template with randomised or user-defined force field parameters
- Deposits polymer chains, Li⁺ ions, and counter-ions into a simulation box
- Performs NPT equilibration followed by NVT dynamics
- Computes the mean square displacement (MSD) of Li⁺ ions for diffusion coefficient extraction
- Submits parallel jobs to a SLURM HPC scheduler
The polymer electrolyte system is modelled using a coarse-grained (CG) representation in which each PEO monomer unit (–CH₂–CH₂–O–, molecular weight ≈ 44 g/mol) is mapped to a single CG bead. This approach extends accessible time and length scales far beyond all-atom simulations while retaining the key structural and dynamical features relevant to ion transport.
The force field consists of:
- Non-bonded interactions: Lennard-Jones (LJ) + Coulombic potentials for polymer–polymer, ion–ion, and polymer–ion interactions
- Bonded interactions: Harmonic bond and angle potentials governing the chain connectivity and local geometry
Ion transport is characterised through the mean square displacement (MSD):
MSD(t) = <|r(t) - r(0)|²>
The self-diffusion coefficient D is extracted from the long-time slope of the MSD via the Einstein relation:
D = MSD(t) / (6t) as t → ∞
cg-li-peo-diffusion/
│
├── README.md # This file
├── LICENSE # MIT License
│
├── data/
│ ├── polymer_chain.txt # CG PEO chain molecule file (40 beads)
│ ├── li.txt # Li+ ion molecule file (charge +1)
│ ├── ion.txt # Counter-ion molecule file (charge -1)
│ └── xyz.txt # Full simulation data file
│
├── templates/
│ ├── lammps_input_template.txt # LAMMPS simulation protocol template
│ └── lammps_run_template.sh # SLURM batch submission script template
│
├── scripts/
│ └── run_pipeline_lammps.py # Main pipeline: generates inputs and submits jobs
│
├── notebooks/
│ └── analyse_msd.ipynb # Post-processing: MSD analysis and diffusion coefficient
│
└── results/
└── example_msd.txt # Example MSD output for reference
- LAMMPS (tested with LAMMPS/23Jun2022-foss-2021a-kokkos)
- Python 3.8+
- NumPy
- Matplotlib
- Jupyter (for notebook post-processing)
The pipeline is configured for SLURM-based HPC systems. The SLURM batch script (lammps_run_template.sh) is set up for the Norwegian HPC infrastructure (Sigma2/NRIS) but can be adapted to any SLURM environment by modifying the #SBATCH directives.
Install Python dependencies:
pip install numpy matplotlib jupyterThe file data/xyz.txt contains the initial simulation box with 40-bead PEO chains, Li⁺ ions, and counter-ions. Modify the number of atoms, box dimensions, or initial positions as needed for your system size.
Open scripts/run_pipeline_lammps.py and set the following parameters at the top of the main() function:
num_simulations = 4 # Number of different parameter sets to explore
max_parallel = 2 # Maximum number of concurrent SLURM jobs
num_repetitions = 2 # Number of independent runs per parameter setAdjust the force field parameter ranges to suit your system:
param_ranges = {
"s11": (0.5, 2.0), # LJ sigma, polymer-polymer (Angstrom)
"e11": (1.0, 5.0), # LJ epsilon, polymer-polymer (kcal/mol)
"s22": (0.5, 2.0), # LJ sigma, Li+-Li+ (Angstrom)
"e22": (1.0, 5.0), # LJ epsilon, Li+-Li+ (kcal/mol)
"s33": (0.5, 2.0), # LJ sigma, polymer-Li+ cross (Angstrom)
"e33": (1.0, 5.0), # LJ epsilon, polymer-Li+ cross (kcal/mol)
"ks": (50.0, 100.0), # Bond stiffness (kcal/mol/Angstrom^2)
"r0": (3.0, 3.5), # Equilibrium bond length (Angstrom)
"ka": (5.0, 10.0), # Angle stiffness (kcal/mol/rad^2)
"theta0": (110.0, 130.0) # Equilibrium bond angle (degrees)
}From the root of the repository:
python scripts/run_pipeline_lammps.pyThis will:
- Generate
num_simulations × num_repetitionsunique LAMMPS input files - Create corresponding SLURM batch scripts
- Submit all jobs to the scheduler with a maximum of
max_parallelrunning simultaneously
squeue -u your_usernameOnce simulations complete, MSD data is written to results/msd_traj.txt for each run. Use the provided Jupyter notebook to extract diffusion coefficients:
jupyter notebook notebooks/analyse_msd.ipynb| File | Location | Description |
|---|---|---|
config_<id>_<iter> |
deposites/ |
Atom configurations after deposition |
traj_<id>_<iter> |
npt_relax/ |
Trajectory during NPT equilibration |
traj_ions |
results/ |
Ion trajectories during NVT dynamics |
msd_traj.txt |
results/ |
MSD of Li⁺ ions vs time |
If you use this code in your research, please cite:
Behrouz Arash, Oslo Metropolitan University (2025).
CG-Li-PEO-Diffusion: A coarse-grained MD pipeline for Li-ion diffusion
in PEO polymer electrolytes. GitHub repository.
https://github.com/YOUR-USERNAME/cg-li-peo-diffusion
If this work is associated with a publication, the citation will be updated accordingly.
Behrouz Arash Associate Professor, Department of Mechanical, Electrical and Chemical Engineering Oslo Metropolitan University, Norway
- Homepage: https://sites.google.com/view/behrouz-arash
- Google Scholar: https://scholar.google.ca/citations?user=wHasBGEAAAAJ
- Email: behrouza@oslomet.no
This project is licensed under the MIT License — see the LICENSE file for details.