molecular_simulations.simulate.constantph.constantph module

ConstantPH - Constant pH simulation using AMBER prmtop/inpcrd files directly.

This implementation preserves all force field parameters from the AMBER topology, including custom ligand parameters and Lipid21 modular lipids.

Key features: - Uses AmberPrmtopFile for explicit solvent simulation (preserves all parameters) - Uses ParmEd to create implicit solvent system WITH lipids and ligands - MC energy evaluations include protein-lipid and protein-ligand interactions - Only water and ions are stripped from the implicit system

class molecular_simulations.simulate.constantph.constantph.ResidueState(residueIndex, atomIndices, particleParameters, exceptionParameters, numHydrogens)[source]

Bases: object

Stores parameters for a particular protonation state of a residue.

__init__(residueIndex, atomIndices, particleParameters, exceptionParameters, numHydrogens)[source]
class molecular_simulations.simulate.constantph.constantph.ResidueTitration(variants, referenceEnergies)[source]

Bases: object

Manages titration states for a single residue.

__init__(variants, referenceEnergies)[source]
class molecular_simulations.simulate.constantph.constantph.ConstantPH(prmtop_file, inpcrd_file, pH, residueVariants, referenceEnergies, relaxationSteps, explicitArgs, implicitArgs, integrator, relaxationIntegrator, implicitForceField=None, excludeResidues=None, gbModel='GBn2', weights=None, platform=None, properties=None)[source]

Bases: object

Constant pH simulation using AMBER topology files directly.

This class enables constant pH molecular dynamics while preserving all force field parameters from AMBER prmtop files, including custom ligand parameters and Lipid21 modular lipids.

The approach: 1. Use AmberPrmtopFile.createSystem() for the explicit solvent simulation 2. Use ParmEd to create implicit solvent system WITH lipids and ligands 3. MC energy evaluations include protein-lipid and protein-ligand interactions 4. Only water and ions are stripped from the implicit system 5. Use OpenMM ForceField only for building protonation state parameters

Parameters:
  • prmtop_file (str or Path) – Path to AMBER prmtop file

  • inpcrd_file (str or Path) – Path to AMBER inpcrd file

  • pH (float or list) – The pH value(s) for simulation. If a list, simulated tempering is used.

  • residueVariants (dict) – Maps residue indices to lists of variant names. Example: {10: [‘ASP’, ‘ASH’], 15: [‘GLU’, ‘GLH’]}

  • referenceEnergies (dict) – Maps residue indices to lists of reference energies (kJ/mol). Example: {10: [0.0, 5.2], 15: [0.0, 4.8]}

  • relaxationSteps (int) – Steps to relax solvent after accepting a protonation state change.

  • explicitArgs (dict) – Arguments for createSystem() for explicit solvent.

  • implicitArgs (dict) – Arguments for ParmEd createSystem() for implicit solvent. Supports: implicitSolvent (OBC2, GBn2), solventDielectric, soluteDielectric

  • integrator (openmm.Integrator) – Integrator for the main simulation.

  • relaxationIntegrator (openmm.Integrator) – Integrator for solvent relaxation (frozen solute).

  • implicitForceField (openmm.app.ForceField, optional) – ForceField for building protonation state parameters (protein only). Defaults to amber14 + GBn2.

  • gbModel (str, optional) – GB model for implicit solvent: ‘OBC2’ or ‘GBn2’. Default: ‘GBn2’

  • weights (list, optional) – Simulated tempering weights. None = auto-determine via Wang-Landau.

  • platform (openmm.Platform, optional) – Platform for simulation. None = auto-select.

  • properties (dict, optional) – Platform-specific properties.

PROTEIN_RESIDUES = {'ACE', 'ALA', 'ARG', 'ASH', 'ASN', 'ASP', 'CYM', 'CYS', 'CYX', 'GLH', 'GLN', 'GLU', 'GLY', 'HID', 'HIE', 'HIP', 'HIS', 'ILE', 'LEU', 'LYN', 'LYS', 'MET', 'NHE', 'NME', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL'}
ION_ELEMENTS = (openmm.app.element.cesium, openmm.app.element.potassium, openmm.app.element.lithium, openmm.app.element.sodium, openmm.app.element.rubidium, openmm.app.element.chlorine, openmm.app.element.bromine, openmm.app.element.fluorine, openmm.app.element.iodine)
WATER_ION_NAMES = {'CL', 'CLA', 'Cl-', 'HOH', 'K', 'K+', 'NA', 'Na+', 'OPC', 'POT', 'SOD', 'SPC', 'TIP3', 'WAT'}
TITRATION_H_DIFF = {('ASH', 'ASP'): 1, ('ASP', 'ASH'): -1, ('CYM', 'CYS'): -1, ('CYS', 'CYM'): 1, ('GLH', 'GLU'): 1, ('GLU', 'GLH'): -1, ('HID', 'HIE'): 0, ('HID', 'HIP'): -1, ('HIE', 'HID'): 0, ('HIE', 'HIP'): -1, ('HIP', 'HID'): 1, ('HIP', 'HIE'): 1, ('LYN', 'LYS'): -1, ('LYS', 'LYN'): 1, ('TYD', 'TYR'): -1, ('TYR', 'TYD'): 1}
__init__(prmtop_file, inpcrd_file, pH, residueVariants, referenceEnergies, relaxationSteps, explicitArgs, implicitArgs, integrator, relaxationIntegrator, implicitForceField=None, excludeResidues=None, gbModel='GBn2', weights=None, platform=None, properties=None)[source]
setPH(pH, weights=None)[source]

Set the pH value(s) for simulation.

property weights

Current simulated tempering weights.

printTitrationState()[source]

Print current state of all titrations for debugging.

validateStates()[source]

Validate that titration states are properly set up.

attemptMCStep(temperature, debug=False)[source]

Attempt Monte Carlo moves to change protonation states.

Parameters:
  • temperature (float or Quantity) – Simulation temperature

  • debug (bool) – If True, print debugging information about MC moves

setResidueState(residueIndex, stateIndex, relax=False)[source]

Manually set a residue to a specific protonation state.