Skip to content

FBTK + OpenFF | Polymer MD with LAMMPS (PLA)

FBTK + OpenFF | Polymer MD with LAMMPS (PLA)

Section titled “FBTK + OpenFF | Polymer MD with LAMMPS (PLA)”

In this example, we use fbtk to construct a Polylactic Acid (PLA) system with controlled tacticity and apply the latest OpenFF (Sage 2.2.1) force field to generate LAMMPS input files.

In polymer MD simulations (Computational Chemistry), primary challenges include initial structure construction and force field parameter consistency.

Standard OpenFF does not include packing capabilities, often requiring complex scripts to manually stitch coordinates using external tools. FBTK transforms this process into an efficient engineering workflow.

  • Automatic Tacticity Control: Instead of defining bonds line-by-line, simply specifying tacticity="isotactic" automatically manages chiral center configurations.
  • Stable Initial Structures: By resolving overlapping atoms using system.relax() immediately after packing, you can drastically reduce instabilities at the start of a simulation.
  • Consistent Charge Assignment: Massive polymers make MO calculations (like AM1-BCC) difficult. FBTK’s topology-based charges ensure both consistency and processing speed.
Terminal window
# Example installation of OpenFF libraries and fbtk
conda create -n fbtk_openff python=3.10 openff-toolkit openff-interchange -c conda-forge -y
conda activate fbtk_openff
pip install fbtk
import fbtk
# 1. Construct Polymer System (fbtk)
builder = fbtk.Builder(density=1.0)
builder.add_polymer(
name="PLA",
smiles="*OC(C)C(=O)*",
degree=50,
count=10,
tacticity="isotactic"
)
system = builder.build()
# Relaxation
system.relax()
# 2. Apply OpenFF Force Field and Export (Unified API)
interchange = system.to_openff(forcefield="openff-2.2.1.offxml")
interchange.to_lammps("pla_system.data")
print("Success: Generated pla_system.data and its template.")

The key to a stable simulation is running minimize before applying fix shake. This allows FBTK’s preliminary structure to freely relax and converge to OpenFF’s ideal geometry.

  1. Template Tweaking: Verify the read_data path and move the fix ... shake line after the minimize command.
  2. Add MD Conditions:
Terminal window
# --- Example addition to pla_md.in ---
# 1. Perform energy minimization (without SHAKE)
minimize 1.0e-4 1.0e-6 100 1000
reset_timestep 0
# 2. Apply constraints (SHAKE) after geometry is relaxed
# Use the IDs like b 1 9 5 assigned by OpenFF for your system
fix 1 all shake 0.0001 20 0 b 1 9 5
# 3. Start MD
fix 2 all npt temp 300.0 300.0 100.0 iso 1.0 1.0 1000.0
run 5000

The system achieved high thermodynamic stability.

  • Density Reproducibility: The system converged to approximately 1.229 g/cm³, aligning well with the experimental value for amorphous PLA.
  • Thermodynamic Stability: Rapid stabilization was achieved by following the correct minimization sequence and using Sage 2.2.1.