A tool for generating polydisperse polymer systems for LAMMPS simulations.
graph TD
A[input_config.yaml] --> B[Generate System]
B --> C[Chain Coordinates]
B --> D[Topology File]
C --> E[Packmol]
E --> F[Packed System]
D --> G[LAMMPS Data]
F --> G
D --> H[LAMMPS Input]
G --> I[LAMMPS Simulation]
H --> I
I --> J[Trajectory]
I --> K[Thermodynamics]
subgraph Generation
B
C
D
end
subgraph Packing
E
F
end
subgraph Simulation
G
H
I
J
K
end
style A fill:#f9f,stroke:#333,stroke-width:2px
style B fill:#bbf,stroke:#333,stroke-width:2px
style E fill:#bfb,stroke:#333,stroke-width:2px
style I fill:#fbf,stroke:#333,stroke-width:2px
sequenceDiagram
participant U as User
participant F as flow
participant G as generate
participant P as packmol
participant L as lammps
participant S as simulation
U->>F: polydispers flow
activate F
F->>G: Generate System?
G-->>F: Generated Files
F->>P: Run Packmol?
P-->>F: Packed System
F->>L: Prepare LAMMPS?
L-->>F: LAMMPS Files
F->>S: Run Simulation?
S-->>F: Results
deactivate F
Note over U,S: Alternative: Manual Steps
U->>G: polydispers generate
G-->>U: Generated Files
U->>P: packmol < input
P-->>U: Packed System
U->>L: polydispers lammps
L-->>U: LAMMPS Files
U->>S: lmp -in script.in
S-->>U: Results
- Generate polymer systems with specified:
- Number of chains
- Number-average molecular weight (Mn)
- Polydispersity index (PDI)
- Box size
- Bond length
- Bead radius
- Support for different bead types (A-B polymers)
- Automatic LAMMPS input file generation
- Integration with Packmol for system packing
The tool calculates the Schulz-Zimm distribution parameters based on the target chain length and PDI.
- k parameter: 1 / (PDI - 1)
- theta parameter: target chain length / (k + 1)
The tool prints the distribution statistics, including the mean chain length, PDI, and Schulz-Zimm parameters.
- Clone the repository:
git clone https://github.com/jkrajniak/polydispers-lj-generator.git
cd polydispers-lj-generator
- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Unix/macOS
# or
.venv\Scripts\activate # On Windows
- Install the package:
pip install -e .
Create an input configuration file (e.g., input_config.yaml
):
num_chains: 10
mn: 1000
pdi: 1.2
box_size: 100
output_dir: ./sys1
seed: 42
polymer:
bond_length: 0.85
bead_radius: 1.0
repeat_unit_topology: AB
bead_types:
A:
mass: 1.0
type_id: 1
B:
mass: 1.0
type_id: 2
- Generate polymer system:
polydispers generate --config input_config.yaml
- Interactive workflow (recommended):
polydispers flow --config input_config.yaml
This will guide you through:
- System generation
- Packmol packing
- LAMMPS file preparation
- LAMMPS simulation
- Prepare LAMMPS files separately:
polydispers lammps --topology-file topology.yaml --coordinates coordinates.xyz
The tool generates several files in the output directory:
topology.yaml
: System topology descriptionchain_*.xyz
: Individual chain coordinatespackmol_input.txt
: Packmol input scriptlj.xyz
: Packed system coordinates (after running Packmol)lj.data
: LAMMPS data filelj.in
: LAMMPS input scriptinstructions.sh
: Shell script with next stepsthermo.dat
: LAMMPS thermodynamic output (after simulation)traj.lammpstrj
: LAMMPS trajectory file (after simulation)
The generated LAMMPS input script includes:
- LJ potential with cutoff 2.5σ
- FENE bonds
- NPT equilibration with Berendsen thermostat
- NVT production run
- Trajectory and thermodynamic output
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.