Skip to content

System preparation

autopath.preparation.SystemPreparation

Prepare a solvated or membrane-embedded simulation system for OpenMM MD.

Orchestrates ligand parametrization (via OpenFF, GAFF, or Espaloma), protein loading, residue-variant assignment, solvation or membrane embedding, and OpenMM system creation. Writes a system.xml, system.pdb, and AMBER-compatible topology/coordinate files to out_dir.

Parameters:

Name Type Description Default
forcefield list of str

OpenMM ForceField XML files to load. Defaults to AMBER14 with TIP3P-FB water.

['amber14-all.xml', 'amber14/tip3pfb.xml', 'amber/tip3pfb_HFE_multivalent.xml']
lig_ff str

Ligand force field including version, e.g. "openff-2.3.0", "espaloma-0.3.2", "gaff-2.11". The family prefix selects the openmmforcefields template generator.

'openff-2.3.0'
hydrogenMass float

Hydrogen mass in amu for mass repartitioning. 1.5 amu allows a 4 fs timestep. Set to None to disable.

1.5
boxShape str

Solvent box shape: "cube" or "dodecahedron".

'dodecahedron'
padding float

Minimum distance in nm between the solute and the box edge. Mutually exclusive with num_solvent.

1.2
num_solvent int

Explicit number of solvent molecules to add. Mutually exclusive with padding.

None
ionicStrength float

Salt concentration in molar.

0.15
ions tuple of str

(positiveIon, negativeIon) residue names, e.g. ("Na+", "Cl-").

('Na+', 'Cl-')
is_membrane bool

When True, add a lipid bilayer instead of bulk solvent.

False
lipid_type str

Lipid residue name (e.g. "POPC") or path to a custom PDB patch. Required when is_membrane=True.

'POPC'
membrane_relax_iterations int

Minimisation iterations run after each of addMembrane's solute re-expansion increments. Stock OpenMM minimises only once for 30 iterations, which is not enough for a large membrane protein and lets the lipids blow up (see :func:relaxed_membrane_packing). Set to 0 for stock behaviour.

0
membrane_ligand_z float or None

Ligand-only membrane systems: z (nm) of the ligand centroid from the membrane centre (default 3.0, in the water above the upper leaflet). None keeps the coordinates of the ligand file.

3.0
nonbondedCutoff float

Nonbonded cutoff in nm. None picks 1.2 nm for CHARMM force fields (any forcefield file name containing "charmm") and 1.0 nm otherwise.

None
switchDistance float

Lennard-Jones switching distance in nm. None picks 1.0 nm for CHARMM force fields and 0.9 nm otherwise. Must be below nonbondedCutoff, so the old CHARMM build (1.0 / 0.9 nm, used before these options existed) needs both arguments. CHARMM boxes must be at least 2.4 nm across their narrowest reduced axis.

None
out_dir str

Directory where all output files are written.

'system'

run

run(protein: str = None, variants: dict = None, ligands: Union[str, List[tuple[str, str, str]]] = None) -> tuple[System, Topology]

Build, solvate, and parametrize the full simulation system.

Stages:

  1. Load protein PDB and optionally apply residue variants (protonation states, disulfide bonds, etc.).
  2. Parametrize and add each ligand to the OpenMM Modeller.
  3. Solvate with explicit water/ions or embed in a lipid bilayer.
  4. Create the OpenMM System with PME electrostatics and HBond constraints.
  5. Write system.xml, system.pdb, and AMBER topology / coordinate files to self.out_dir.

Parameters:

Name Type Description Default
protein str

Path to the prepared protein PDB file. None builds a ligand-only box (requires ligands; a single ligand file with a membrane).

None
variants dict

Residue variant map passed to add_variants() (e.g. to specify HIS protonation states or CYS oxidation).

None
ligands str or list of tuple

Either a single SDF/PDB path (str) or a list of (name, path, smiles, from_xray) tuples for multiple ligands.

None

Returns:

Name Type Description
system System

Fully parametrized OpenMM System object.

topology Topology

Topology of the solvated/membrane system.

Raises:

Type Description
RuntimeError

If membrane building fails.

Exception

Re-raised if the protein PDB cannot be loaded.

autopath.pdb_preprocessor.PDBPreprocessor

Prepare a PDB for MD simulation using PDBFixer and MDAnalysis.

Wraps PDBFixer to fix missing atoms/residues, replace non-standard residues, add hydrogens at a target pH, and optionally cap chain termini with ACE/NME capping groups.

Parameters:

Name Type Description Default
pdbfile str or file - like

Path to the input PDB file, or an already-open file object / StringIO.

None
pdbxfile str or file - like

Same for PDBx/mmCIF input. Mutually exclusive with pdbfile.

None

fix

fix(replace_nonstandard_residues: bool = True, keep_heterogens: bool = False, ignore_terminal_missing_residues: bool = False, pH: float = 7.4, discard_input_hydrogens: bool = False, cap_termini: bool = False) -> PDBFixer

Fix common PDB problems and optionally cap chain termini.

Parameters:

Name Type Description Default
replace_nonstandard_residues bool

Replace non-standard residues with their standard equivalents.

True
keep_heterogens bool

If False, remove all heterogens except water.

False
ignore_terminal_missing_residues bool

If True, missing residues at the very beginning or end of a chain are not modelled in.

False
pH float

pH used to determine protonation states when adding hydrogens.

7.4
discard_input_hydrogens bool

Remove all hydrogens from the input before re-adding them at the requested pH. Useful when input protonation states are incorrect.

False
cap_termini bool

Add ACE (N-terminus) and NME (C-terminus) capping groups to each chain. Chains that already carry ACE or NME are not double-capped.

False

Returns:

Type Description
PDBFixer

The PDBFixer object with the fixed, protonated (and optionally capped) structure.