Skip to main content

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 Schulz-Zimm Distribution Statistics

Requirements

  • Python 3.11+
  • Packmol
  • LAMMPS (any variant: lmp, lmp_serial, or lmp_mpi)

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/polydispers-lj-generator.git
cd polydispers-lj-generator
  1. Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate  # On Windows
  1. 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

  1. Generate polymer system:
polydispers generate --config input_config.yaml
  1. Interactive workflow (recommended):
polydispers flow --config input_config.yaml

This will guide you through:

  • System generation
  • Packmol packing
  • LAMMPS file preparation
  • LAMMPS simulation
  1. 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 description
  • chain_*.xyz: Individual chain coordinates
  • packmol_input.txt: Packmol input script
  • lj.xyz: Packed system coordinates (after running Packmol)
  • lj.data: LAMMPS data file
  • lj.in: LAMMPS input script
  • instructions.sh: Shell script with next steps
  • thermo.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polydispers_lj_generator-0.3.3.tar.gz (132.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polydispers_lj_generator-0.3.3-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

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

Hashes for polydispers_lj_generator-0.3.3.tar.gz
Algorithm Hash digest
SHA256 0e5001ac61bfa352c1f0576f404601125a8114cc3b5116f3141808c5829fe41e
MD5 60452911fc86f08cb30e611f6724f4a5
BLAKE2b-256 dea27a16cca0024e26be3b853c2b459ea2d3a0c9c18c2392a98692c1a831fbc3

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polydispers_lj_generator-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for polydispers_lj_generator-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 008b06d7c0191d5451a8accad97721229faea55042a9dd2686c9cea7c2c6d416
MD5 3093250f34de079f8fdb413f1d4cc00a
BLAKE2b-256 ea9bb652c6ee3e66a8c1f96b7cd0bf8304f027bbe9be638501ee268c1b310b8e

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page