A tool to generate polydisperse Lennard-Jones systems.
Project description
Polydisperse LJ Polymer Generator
A tool for generating polydisperse polymer systems for LAMMPS simulations.
Workflow
Data Flow
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
Command Flow
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
Features
- 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
Schulz-Zimm Distribution
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.
Example of the output
Requirements
Installation
- Clone the repository:
git clone https://github.com/yourusername/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 .
Usage
Configuration
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
Commands
- 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
Output Files
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)
LAMMPS Simulation Details
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
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polydispers_lj_generator-0.3.3.tar.gz.
File metadata
- Download URL: polydispers_lj_generator-0.3.3.tar.gz
- Upload date:
- Size: 132.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e5001ac61bfa352c1f0576f404601125a8114cc3b5116f3141808c5829fe41e
|
|
| MD5 |
60452911fc86f08cb30e611f6724f4a5
|
|
| BLAKE2b-256 |
dea27a16cca0024e26be3b853c2b459ea2d3a0c9c18c2392a98692c1a831fbc3
|
Provenance
The following attestation bundles were made for polydispers_lj_generator-0.3.3.tar.gz:
Publisher:
python-publish.yml on jkrajniak/polydispers-lj-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polydispers_lj_generator-0.3.3.tar.gz -
Subject digest:
0e5001ac61bfa352c1f0576f404601125a8114cc3b5116f3141808c5829fe41e - Sigstore transparency entry: 158042658
- Sigstore integration time:
-
Permalink:
jkrajniak/polydispers-lj-generator@b11974a27b05ab9061b7270e0c59553b6e64033e -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/jkrajniak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b11974a27b05ab9061b7270e0c59553b6e64033e -
Trigger Event:
release
-
Statement type:
File details
Details for the file polydispers_lj_generator-0.3.3-py3-none-any.whl.
File metadata
- Download URL: polydispers_lj_generator-0.3.3-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
008b06d7c0191d5451a8accad97721229faea55042a9dd2686c9cea7c2c6d416
|
|
| MD5 |
3093250f34de079f8fdb413f1d4cc00a
|
|
| BLAKE2b-256 |
ea9bb652c6ee3e66a8c1f96b7cd0bf8304f027bbe9be638501ee268c1b310b8e
|
Provenance
The following attestation bundles were made for polydispers_lj_generator-0.3.3-py3-none-any.whl:
Publisher:
python-publish.yml on jkrajniak/polydispers-lj-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
polydispers_lj_generator-0.3.3-py3-none-any.whl -
Subject digest:
008b06d7c0191d5451a8accad97721229faea55042a9dd2686c9cea7c2c6d416 - Sigstore transparency entry: 158042659
- Sigstore integration time:
-
Permalink:
jkrajniak/polydispers-lj-generator@b11974a27b05ab9061b7270e0c59553b6e64033e -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/jkrajniak
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@b11974a27b05ab9061b7270e0c59553b6e64033e -
Trigger Event:
release
-
Statement type: