FBTK + OpenFF | Small Molecule MD with LAMMPS (Ethanol)
FBTK + OpenFF | Small Molecule MD with LAMMPS (Ethanol)
Section titled “FBTK + OpenFF | Small Molecule MD with LAMMPS (Ethanol)”This example demonstrates a workflow for constructing and simulating a pure ethanol system while preserving high-quality AM1-BCC charges calculated via OpenFF.
Background: Why FBTK + OpenFF?
Section titled “Background: Why FBTK + OpenFF?”In small-molecule simulations, precise charge assignment is key to reproducing bulk properties. OpenFF’s standard AM1-BCC is an excellent method, but OpenFF itself lacks a bulk packing engine.
Benefits of introducing FBTK:
- Precise Charge Portability:
Molecule.from_openff()encapsulates AM1-BCC charges within FBTK objects, which can then be duplicated for bulk construction. - Automated Parameter Assignment:
system.to_openff()fully automates complex LAMMPShybridstyle andspecial_bondsconfigurations. - Robust Execution Flow: Following the correct “EM before SHAKE” sequence ensures extremely stable simulations.
Python Script
Section titled “Python Script”import fbtkfrom openff.toolkit import Molecule as OFFMolecule
# 1. Prepare molecules with pre-calculated charges in OpenFFoff_ethanol = OFFMolecule.from_smiles("CCO")off_ethanol.assign_partial_charges(partial_charge_method="am1bcc")ethanol = fbtk.Molecule.from_openff(off_ethanol)
# 2. Build a pure system in FBTK (300 molecules)builder = fbtk.Builder(density=0.789)builder.add_molecule(ethanol, count=300)system = builder.build()system.relax()
# 3. Export to OpenFF (Applying latest Sage 2.2.1)interchange = system.to_openff(forcefield="openff-2.2.1.offxml")interchange.to_lammps("ethanol_system.data")MD Simulation Execution
Section titled “MD Simulation Execution”The key is running minimize before applying fix shake, allowing the preliminary FBTK structure to relax into ideal force field geometries.
MD Conditions Addition
Section titled “MD Conditions Addition”# --- Example addition to ethanol_md.in ---# 1. Perform energy minimization (without SHAKE)minimize 1.0e-4 1.0e-6 100 1000reset_timestep 0
# 2. Apply constraints (SHAKE) after geometry is relaxed# Copy the exact fix shake line from the OpenFF template# (e.g., use the IDs like b 2 4 assigned by OpenFF for your system)fix 100 all shake 0.0001 20 0 b 2 4
# 3. Start MDfix 1 all npt temp 300.0 300.0 100.0 iso 1.0 1.0 1000.0run 5000Results and Validation
Section titled “Results and Validation”Stable thermodynamic trends were observed using the latest Sage 2.2.1 force field.
Evaluation
Section titled “Evaluation”- Rapid Equilibration: Energy shifted to a stable region quickly during the EM step.
- Thermodynamic Stability: The MD run maintained stable temperature and pressure control.
Summary
Section titled “Summary”FBTK allows you to choose the optimal charge strategy for your system—even for pure substances—within a unified and simple code framework.