AutoPoly is a Python package for automatically generating LAMMPS data files for polymer systems. It supports both atomistic (OPLS force field) and coarse-grained (bead-spring) polymer models.
- Create polymers with any chain length
- Support for linear and ring polymer topologies
- Easy integration with RDKit for custom monomer creation
- Automated handling of tacticity
- Built-in support for common polymer types
- Coarse-grained bead-spring polymer models
Install AutoPoly via pip:
git clone https://github.com/Chenghao-Wu/AutoPoly.git
cd AutoPoly
pip install .
- PMMA (Tacticity supported)
- PS (Tacticity supported)
- PE (Tacticity supported)
- PI (cis)
- PP (Tacticity supported)
- PVA (Tacticity supported)
- Bead-spring polymer chains
- Linear topology
- Ring topology
- Configurable parameters (mass, bond length, LJ parameters)
- 3D spatial distribution for non-overlapping configurations
import AutoPoly
# Define the system
system = AutoPoly.System(out="pmma_linear")
# Create a linear PMMA polymer with 10 chains, each with 50 monomers
linear_polymer = AutoPoly.Polymer(ChainNum=10, Sequence=["PMMA"]*50, topology="linear")
# Generate the polymer system
poly = AutoPoly.Polymerization(name="LinearPolymer",
system=system,
model=[linear_polymer],
run=True)
import AutoPoly
from AutoPoly.bead_spring import BeadSpringPolymer
# Define the system
system = AutoPoly.System(out="bead_spring_test")
# Create a linear bead-spring polymer
linear_polymer = BeadSpringPolymer(
name="linear_polymer",
system=system,
n_chains=10,
n_beads=50,
topology="linear",
bond_length=1.0,
mass=1.0,
epsilon=1.0,
sigma=1.0
)
linear_polymer.generate_data_file()
# Create a ring bead-spring polymer
ring_polymer = BeadSpringPolymer(
name="ring_polymer",
system=system,
n_chains=60,
n_beads=50,
topology="ring",
bond_length=1.0,
mass=1.0,
epsilon=1.0,
sigma=1.0
)
ring_polymer.generate_data_file()
The bead-spring model features:
- Customizable number of chains and beads per chain
- Linear or ring topology
- Lennard-Jones non-bonded interactions
- Harmonic bond potentials
- Non-overlapping 3D configurations for ring polymers
- Automatic LAMMPS input script generation
# Define the system
system = AutoPoly.System(out="mixed_polymers")
# Create different polymer types
pp_ua = AutoPoly.Polymer(ChainNum=2, Sequence=["PPUA"]*20) # United-atom PP
pe_ua = AutoPoly.Polymer(ChainNum=2, Sequence=["PEUA"]*10) # United-atom PE
pe_aa = AutoPoly.Polymer(ChainNum=3, Sequence=["PEAA"]*15) # All-atom PE
# Generate the mixed polymer system
poly = AutoPoly.Polymerization(name="MixedSystem",
system=system,
model=[pp_ua, pe_ua, pe_aa],
run=True)
# Create a custom monomer using SMILES
rdlt = AutoPoly.RDlt(smiles='c1c2ccccc2ccc1') # Naphthalene
rdlt.run(to_file='Naphthalene.lt')
rdlt.store_bank() # Store in monomer bank for future use
# Create a system using the custom monomer
system = AutoPoly.System(out="custom_system")
custom_polymer = AutoPoly.Polymer(ChainNum=50, Sequence=["Naphthalene"])
poly = AutoPoly.Polymerization(name="CustomPolymer",
system=system,
model=[custom_polymer],
run=True)
# Create a system of 50 benzene molecules
system = AutoPoly.System(out="benzene_system")
benzene = AutoPoly.Polymer(ChainNum=50, Sequence=["Benzene"])
poly = AutoPoly.Polymerization(name="BenzeneSystem",
system=system,
model=[benzene],
run=True)
AutoPoly generates:
- LAMMPS data files (.data)
- Moltemplate files (.lt) for atomistic models
- LAMMPS input scripts
- Force field parameters
- System configuration files
- OPLS force field support
- Tacticity control
- Custom monomer creation via RDKit
- Moltemplate integration
- Bead-spring representation
- Configurable force field parameters
- 3D spatial distribution
- Multiple chain topologies
- Ready-to-run LAMMPS configurations
The package includes a built-in monomer bank with common polymer units. Custom monomers can be created using:
- Avogadro (https://avogadro.cc/)
- RDKit integration (for custom molecular structures)
- Moltemplate: "A Tool for Coarse-Grained Modeling of Complex Biological Matter and Soft Condensed Matter Physics", J. Mol. Biol., 2021, 433(11):166841
- rdlt: Script for automating OPLS atom type assignment and .lt file generation
- Enhanced coarse-grained model support
- Additional polymer architectures
- Pre-relaxation using LAMMPS
- Integration with LigParGen
- Extended force field support
- More polymer topologies
Contributions are welcome! Please feel free to submit a Pull Request.