Example 9.1: Aqueous Polymer (PEO) MD in TIP3P Water using GROMACS
Example 9.1: Aqueous Polymer (PEO) MD in TIP3P Water using GROMACS
Section titled “Example 9.1: Aqueous Polymer (PEO) MD in TIP3P Water using GROMACS”In this example, we demonstrate how to use fbtk to construct a system where a single polymer chain (PEO) is solvated by a large number of TIP3P water molecules. We then apply the latest OpenFF (Sage 2.2.1) force field along with the TIP3P water model and export the system to GROMACS format (.gro, .top) for simulation and analysis.
Water Model Handling and Simulation Stability
Section titled “Water Model Handling and Simulation Stability”The combination of FBTK + OpenFF + GROMACS handles water models (specifically TIP3P in this case) in an extremely rational and robust manner.
- Placement by FBTK: When packing a large number of solvent molecules around a polymer, the most critical factor is avoiding “atomic overlaps.” FBTK uses preliminary UFF-based geometries to create high-quality initial configurations without overlaps at high speed.
- Blueprinting by OpenFF:
When
to_openff()is called, the OpenFF Toolkit integrates the specified force field files (e.g.,["openff-2.2.1.offxml", "tip3p.offxml"]). It assigns Sage 2.2.1 parameters to the PEO molecules and strict TIP3P water model parameters (O-H distance 0.9572 Å, H-O-H angle 104.52°, charges, etc.) as the physical “blueprint.” - Geometric Enforcement and Maintenance by GROMACS:
The GROMACS
.topfile includes the[ settles ]directive for water molecules (SOL). Consequently, when performing Energy Minimization (EM) in GROMACS, the preliminary structure created by FBTK rapidly converges to the ideal TIP3P geometry. Furthermore, during the MD run, water molecules are maintained as strict rigid bodies bysettles, ensuring physically correct behavior. Constraints (e.g.,constraints = h-bonds) are applied to other hydrogen bonds, such as those in the PEO molecules, during MD.
Construction Script (run.py)
Section titled “Construction Script (run.py)”import fbtkfrom openff.toolkit import ForceField # Import the ForceField class
# 1. Define the polymer (PEO, 20mer)monomer = fbtk.Molecule.from_smiles("*COC*")peo = fbtk.Molecule.from_polymer(monomer, degree=20, name="PEO")
# 2. Define water molecules (SOL)water = fbtk.Molecule.from_smiles("O", name="SOL")
# 3. Build and relax the mixturebuilder = fbtk.Builder(density=1.0)builder.add_molecule(peo, count=1)builder.add_molecule(water, count=1000)system = builder.build()
# Structural relaxation (resolve overlaps before passing to OpenFF)system.relax()
# 4. Convert to OpenFF format and save as GROMACS# Apply both OpenFF 2.2.1 and the TIP3P water modelcombined_forcefield = ForceField("openff-2.2.1.offxml", "tip3p.offxml")interchange = system.to_openff(forcefield=combined_forcefield)interchange.to_gromacs("peo_water_tip3p") # Updated output filenameGROMACS Configuration Files (.mdp)
Section titled “GROMACS Configuration Files (.mdp)”Below are the configuration settings required to reproduce the simulation.
Energy Minimization (em.mdp)
Section titled “Energy Minimization (em.mdp)”integrator = steepemtol = 1000.0emstep = 0.01nsteps = 5000
cutoff-scheme = Verletnstlist = 20vdw-type = Cut-offvdw-modifier = Force-switchrvdw-switch = 1.0rvdw = 1.2coulombtype = PMErcoulomb = 1.2
; Do not apply constraints during EM to allow the FBTK structure; to naturally converge to the force field's ideal geometry.constraints = nonepbc = xyzNVT Equilibration MD (md.mdp)
Section titled “NVT Equilibration MD (md.mdp)”integrator = mddt = 0.002nsteps = 10000
nstxout-compressed = 1000nstlog = 1000nstenergy = 1000
cutoff-scheme = Verletnstlist = 20vdw-type = Cut-offvdw-modifier = Force-switchrvdw-switch = 1.0rvdw = 1.2coulombtype = PMErcoulomb = 1.2
tcoupl = v-rescaletc-grps = Systemtau-t = 0.1ref-t = 300
; Constraints (PEO H-bonds; Water rigidity is handled by 'settles' in .top file)constraints = h-bondsconstraint-algorithm = LINCSpbc = xyzExecution Commands
Section titled “Execution Commands”Run the simulation using the generated peo_water_tip3p.gro, peo_water_tip3p.top, and the MDP files above.
# 1. Energy Minimizationgmx grompp -f em.mdp -c peo_water_tip3p.gro -p peo_water_tip3p.top -o em.tprgmx mdrun -v -deffnm em
# 2. MD Executiongmx grompp -f md.mdp -c em.gro -p peo_water_tip3p.top -o md.tpr -maxwarn 1gmx mdrun -v -deffnm md
# 3. Convert to multi-frame gro (preparation for analysis)echo 0 | gmx trjconv -f md.xtc -s md.tpr -o trajectory.groApplication to Analysis (fbtk-analyze)
Section titled “Application to Analysis (fbtk-analyze)”Using fbtk-analyze, intuitive analysis is possible without the need for index files.
Example: RDF between PEO oxygen and water oxygen
fbtk-analyze rdf -q "resname PEO and element O with resname SOL and element O" trajectory.gro -o peo_sol_rdf.datResults and Validation
Section titled “Results and Validation”- Fast Convergence: Energy minimization was completed in just 76 steps. Skipping constraints during EM allowed the FBTK packing structure to quickly snap into the force field’s ideal geometry.
- Thermodynamic Data: A stable simulation at 300K was maintained, and the residue names
PEOandSOLwere correctly managed (Performance: ~78.5 ns/day).
Summary
Section titled “Summary”The fbtk + OpenFF + GROMACS toolchain significantly streamlines all stages of MD from aqueous system preparation using the latest force fields to analysis.