Skip to content

behrouz-arash/CG-Li-PEO-Diffusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CG-Li-PEO-Diffusion

A coarse-grained molecular dynamics pipeline for studying Li-ion diffusion in PEO polymer electrolytes using LAMMPS

License: MIT


Overview

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

Scientific Background

Coarse-Grained Model

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

Li⁺ Diffusion and MSD

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 → ∞

Repository Structure

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

Requirements

Software

  • LAMMPS (tested with LAMMPS/23Jun2022-foss-2021a-kokkos)
  • Python 3.8+
  • NumPy
  • Matplotlib
  • Jupyter (for notebook post-processing)

HPC Environment

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 jupyter

Usage

Step 1 — Prepare the simulation box

The 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.

Step 2 — Configure the pipeline

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 set

Adjust 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)
}

Step 3 — Run the pipeline

From the root of the repository:

python scripts/run_pipeline_lammps.py

This will:

  1. Generate num_simulations × num_repetitions unique LAMMPS input files
  2. Create corresponding SLURM batch scripts
  3. Submit all jobs to the scheduler with a maximum of max_parallel running simultaneously

Step 4 — Monitor jobs

squeue -u your_username

Step 5 — Analyse results

Once 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

Output Files

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

Citation

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.


Author

Behrouz Arash Associate Professor, Department of Mechanical, Electrical and Chemical Engineering Oslo Metropolitan University, Norway


License

This project is licensed under the MIT License — see the LICENSE file for details.

About

Coarse-grained MD pipeline for Li-ion diffusion in PEO polymer electrolytes using LAMMPS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors