Skip to content

A Python-based tool to automatically generate LAMMPS configurations and input files for polymer-solvent systems with optional crosslinking and crowding effects.

License

Notifications You must be signed in to change notification settings

CarloAndreaDeFilippo/PolymerGeneratorLAMMPS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolymerGeneratorLAMMPS

A Python-based tool to automatically generate LAMMPS configurations and input files for polymer-solvent systems with optional crosslinking and crowding effects.

How to use the script

  1. Edit simulation parameters in PARAMETER_FILE (e.g., number of polymers, solvent, interaction strengths). An example par.json is 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_FILE
    

    Create the corresponding LAMMPS input file:

    python3 generate_input.py PARAMETER_FILE
    
  2. Run the simulation:

lmp_serial -in INPUT_FILE

or, in parallel:

mpirun -np NUM_THREADS lmp_mpi -in INPUT_FILE

Simulation details

Configuration file

The generate_polymers.py script creates a LAMMPS configuration file (atomFile in json file) containing:

  • npol: number of self-avoiding polymers of equal length ns (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 crosslinking
  • nsolvent: 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.

Input file

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/berendsen not 0)
  • totsteps: total number of MD steps of the simulation
  • thermosteps: frequency of thermo output to the terminal
  • dumpsteps: frequency of saving trajectory snapshots to the .lammpstrj file
  • crosslink: 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.

Output files

The scripts will give three files:

  • generate_polymers.pyatomFile (LAMMPS configuration) and polymers.xyz (viewable with VMD)
  • generate_input.pyinputFile (LAMMPS input script)

About

A Python-based tool to automatically generate LAMMPS configurations and input files for polymer-solvent systems with optional crosslinking and crowding effects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages