OpenFF - OpenMM + Open Force Field + QM Backends
Cluster: XLence (UNIMI Dipartimento di Scienze Farmacologiche e Biomolecolari)
Module: openff/1
Overview
The openff/1 environment provides tools for force field parameterization and GPU-accelerated MD simulation with the Open Force Field (SMIRNOFF) framework, together with multiple QM backends for fragment parameterization and torsion fitting.
This is a dedicated environment separate from md/26 because OpenMM and openff-toolkit depend on a different binary ecosystem (pybind11-abi==4 / pytorch) that is incompatible with the packages in md/26. Do not load both modules at the same time.
Software
MD Engine
| Component | Version |
|---|---|
| OpenMM | 8.5.1 |
| Python | 3.12 |
Force Field Parameterization
| Component | Version |
|---|---|
| openff-toolkit | 0.18.0 |
| openmmforcefields | 0.15.1 |
| openff-nagl | 0.5.5 |
QM Backends
| Component | Version | Level | Notes |
|---|---|---|---|
| xtb | 6.7.1 | Semi-empirical (GFN2-xTB) | Fast torsion scans, geometry opt |
| MOPAC | 23.2.4 | Semi-empirical (PM7/AM1) | Classic semi-empirical |
| PySCF | 2.12.1 | DFT / HF | Ab initio, GPU-ready |
| Gaussian | — | DFT / post-HF | External: module load gaussian |
QM Infrastructure
| Component | Version | Description |
|---|---|---|
| qcengine | 0.34.2 | Unified QM execution layer |
| geomeTRIC | 1.1 | Geometry optimizer |
Loading
module load openff/1
To use Gaussian as a QM backend, load both modules:
module load gaussian openff/1
Conflicts with md/26 — load one or the other, not both.
OpenMM
from openmm.app import *
from openmm import *
from openmm.unit import *
pdb = PDBFile('input.pdb')
forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')
system = forcefield.createSystem(pdb.topology,
nonbondedMethod=PME,
nonbondedCutoff=1*nanometer,
constraints=HBonds)
integrator = LangevinMiddleIntegrator(300*kelvin, 1/picosecond, 0.004*picoseconds)
simulation = Simulation(pdb.topology, system, integrator)
simulation.context.setPositions(pdb.positions)
simulation.minimizeEnergy()
simulation.reporters.append(DCDReporter('traj.dcd', 1000))
simulation.step(10000)
Check available platforms (CUDA should appear on compute nodes):
import openmm
for i in range(openmm.Platform.getNumPlatforms()):
print(openmm.Platform.getPlatform(i).getName())
Force Field Parameterization
OpenFF Toolkit (SMIRNOFF)
from openff.toolkit import Molecule, ForceField
mol = Molecule.from_smiles('c1ccc(cc1)CCO')
mol.generate_conformers()
ff = ForceField('openff-2.2.0.offxml')
interchange = ff.create_interchange(mol.to_topology())
NAGL Neural Network Charges
NAGL provides fast, high-quality partial charges without a QM calculation:
from openff.toolkit import Molecule
from openff.nagl import NAGLMoleculeCharger
from openff.nagl_models import list_available_nagl_models
model = list_available_nagl_models()[0]
charger = NAGLMoleculeCharger(model)
mol = Molecule.from_smiles('CCO')
mol = charger.assign_partial_charges(mol)
print(mol.partial_charges)
OpenMM + OpenFF for Protein-Ligand Systems
from openff.toolkit import Molecule
from openmmforcefields.generators import SystemGenerator
from openmm.app import PDBFile
from openmm.unit import *
pdb = PDBFile('complex.pdb')
ligand = Molecule.from_file('ligand.sdf')
generator = SystemGenerator(
forcefields=['amber/ff14SB.xml', 'amber/tip3p_standard.xml'],
small_molecule_forcefield='openff-2.2.0',
molecules=[ligand]
)
system = generator.create_system(pdb.topology)
QM Backends via qcengine
qcengine provides a unified interface to all QM backends. The backend is selected by name.
xtb (GFN2-xTB) — recommended for torsion scans
import qcengine as qcng
import qcelemental as qcel
mol = qcel.models.Molecule.from_data("""
C 0.0 0.0 0.0
H 0.6 0.6 0.6
H -0.6 -0.6 0.6
H -0.6 0.6 -0.6
H 0.6 -0.6 -0.6
""")
result = qcng.compute({
"molecule": mol,
"driver": "gradient",
"model": {"method": "GFN2-xTB"},
"keywords": {}
}, "xtb")
print(result.return_result)
MOPAC (PM7)
result = qcng.compute({
"molecule": mol,
"driver": "energy",
"model": {"method": "PM7"},
"keywords": {}
}, "mopac")
PySCF (DFT)
result = qcng.compute({
"molecule": mol,
"driver": "energy",
"model": {"method": "B3LYP", "basis": "6-31G*"},
"keywords": {}
}, "pyscf")
Gaussian (requires module load gaussian)
result = qcng.compute({
"molecule": mol,
"driver": "energy",
"model": {"method": "B3LYP", "basis": "6-31G*"},
"keywords": {"nprocs": 8, "memory": "8gb"}
}, "gaussian")
Notes
- openff-bespokefit (automated bespoke torsion fitting) is not yet compatible with this environment — it requires pydantic v1, while openff-toolkit 0.18.0 uses pydantic v2. Will be added when bespokefit migrates to pydantic v2.
- GPU support for PySCF: PySCF has GPU acceleration via the
gpu4pyscfplugin (not installed). Can be added on request. - Trajectory analysis: for post-simulation analysis use
md/26(MDAnalysis, MDTraj). Save trajectories in DCD or XTC format.