The 3-Step Workflow¶
AutoPoly turns SMILES strings into LAMMPS input files through a small, fixed set of objects. Every script — from a single solvent box to a multi-block copolymer melt — follows the same three steps.
Step 1 — System: where the output goes¶
System is a lightweight container for the output directory path. Everything AutoPoly writes lands under this folder. Create one per project.
Step 2 — Polymer / Molecule: what to build¶
Define each chemical species in the box. There are two classes, and you can mix them freely:
Polymer— polymer chains described by an explicit complement SMILES sequence (one entry per monomer). Controls chain count, topology (linear/ring), and tacticity.Molecule— small molecules (solvents, additives) described by a regular SMILES string and a count.
from AutoPoly import Polymer, Molecule
polymer = Polymer(
chain_num=10,
sequence=["CC[*]"] + ["[*]CC[*]"] * 48 + ["[*]CC"],
topology="linear",
tacticity="atactic",
)
water = Molecule(Count=100, Smiles="O", Name="water")
The degree of polymerization is never specified directly — it is always len(sequence).
Step 3 — generate: how to build it¶
from AutoPoly import generate
generate(
system,
"polyethylene",
[polymer, water],
force_field="oplsaa",
)
generate takes the list of models and runs the full three-stage pipeline (Geometry → Typing → Packing):
- Monomer generation — each unique complement SMILES becomes a moltemplate
.lttemplate (six variants per monomer: first/middle/last × two chiralities), with 3D geometry from RDKit. - Atom typing & parameters — the force field manager assigns atom types from SMARTS patterns and collects bond/angle/dihedral/LJ parameters for the six supported force fields.
- Chain placement — chains are grown monomer-by-monomer with the Monte Carlo self-avoiding-walk algorithm (or placed on a deterministic grid) inside a sized simulation box.
- Moltemplate — the assembled
system.ltis compiled into a LAMMPS data file. - Output organization —
system.data,system.in.init,system.in.settings, andsystem.in.chargesare written to<System out>/<name>/.
Need more than one force field?
generate is the one-shot path. For stage-level control — e.g. building
the geometry once and typing it under several force fields — use the
GeometryBuilder / UnitTyper / BoxPacker classes from
AutoPoly.pipeline directly.
See Output Files for what each file contains.
The coarse-grained exception¶
BeadSpringPolymer skips this pipeline entirely: it needs no SMILES, no atom typing, and no moltemplate. It writes a LAMMPS data file directly. See the Bead-Spring guide.
Where to go next¶
- Complement SMILES — the monomer sequence format
- Polymers vs Molecules — choosing the right model class
- Force Fields — the six supported parameter sets
- MC Placement & Chain Growth — how chains fill the box