Skip to content

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.

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 LAMMPS hybrid style and special_bonds configurations.
  • Robust Execution Flow: Following the correct “EM before SHAKE” sequence ensures extremely stable simulations.
import fbtk
from openff.toolkit import Molecule as OFFMolecule
# 1. Prepare molecules with pre-calculated charges in OpenFF
off_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")

The key is running minimize before applying fix shake, allowing the preliminary FBTK structure to relax into ideal force field geometries.

Terminal window
# --- Example addition to ethanol_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
# 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 MD
fix 1 all npt temp 300.0 300.0 100.0 iso 1.0 1.0 1000.0
run 5000

Stable thermodynamic trends were observed using the latest Sage 2.2.1 force field.

  • Rapid Equilibration: Energy shifted to a stable region quickly during the EM step.
  • Thermodynamic Stability: The MD run maintained stable temperature and pressure control.

FBTK allows you to choose the optimal charge strategy for your system—even for pure substances—within a unified and simple code framework.