A Python-based tool to automatically generate LAMMPS configurations and input files for polymer-solvent systems with optional crosslinking and crowding effects.
-
Edit simulation parameters in
PARAMETER_FILE(e.g., number of polymers, solvent, interaction strengths). An examplepar.jsonis provided. -
- Option A: generate both configuration (.dat) and input (in.) files with a single command:
python3 main.py PARAMETER_FILE- Option B: generate the files separately.
Generate the configuration file:
python3 generate_configuration.py PARAMETER_FILECreate the corresponding LAMMPS input file:
python3 generate_input.py PARAMETER_FILE -
Run the simulation:
lmp_serial -in INPUT_FILE
or, in parallel:
mpirun -np NUM_THREADS lmp_mpi -in INPUT_FILE
The generate_polymers.py script creates a LAMMPS configuration file (atomFile in json file) containing:
npol: number of self-avoiding polymers of equal lengthns(WCA interaction between the beads)npatch: number of additional patchy spheres on each polymer, placed randomly along the chain; these can be used to simulate crosslinkingnsolvent: number of solvent spheres placed randomly in the box. These interact with polymer beads via WCA and with other solvent atoms via Lennard-Jones potentials.ncolloids: number of colloidal spheres representing additional crowders (LJ interaction with both polymer beads and solvent)
The sizes of all spheres (polymer beads, solvent, colloids, etc.) can be tuned using the various sigma_ parameters in the PARAMETER_FILE file.
A cell linked-list is implemented to accelerate the random placement of spheres within the simulation box.
The generate_input.py script generates the input file for LAMMPS:
- The simulation can be either NVT (Langevin thermostat for Brownian dynamics) or NPT (Berendsen barostat if
press/berendsennot 0) totsteps: total number of MD steps of the simulationthermosteps: frequency of thermo output to the terminaldumpsteps: frequency of saving trajectory snapshots to the.lammpstrjfilecrosslink: switch on/off of the crosslinker interaction. If set to true, two patches that approach within a threshold distance will form a permanent FENE bond.
The scripts will give three files:
generate_polymers.py→atomFile(LAMMPS configuration) andpolymers.xyz(viewable with VMD)generate_input.py→inputFile(LAMMPS input script)
