iphasimulator.amber_solvation
Amber/OpenMM solvated systems: tleap (GAFF2 + OPC, optional ff19SB) and staged OpenMM MD.
The stage lengths, temperatures and restraints follow the GROMACS references:
POLYMER_IN_WATER_PROTOCOL the polymer benchmark (notebook 06A) and
ENZYME_POLYMER_IN_WATER_PROTOCOL the enzyme–polymer production runs (notebook 06B).
The force fields, thermostat, barostat and non-bonded settings differ (Amber/OpenMM),
so 06C results are not directly comparable with 06B. tleap and OpenMM run only
when a build_/run_ function or the generated run_openmm_md.py is called;
everything else writes text files.
Attributes
Classes
Box and ion choices for the tleap build (lengths in nm, salt in mol/L). |
|
Staged MD settings (times in ps/ns, time steps in fs, restraints in kJ mol^-1 nm^-2). |
Functions
|
Ion pairs for |
|
Convert a system mass in Da and a box volume in nm^3 to g/mL (1 Da/nm^3 = 1.66054e-3 g/mL). |
|
Write a tleap input and return its text. |
|
Waters added by the (last) solvate command, ion frcmod files loaded, error count. |
|
Solvate the 05A polymer (optionally with a posed protein) in OPC and add ions. |
|
Write |
Import the packaged |
|
|
Run stages (e.g. |
|
Minimise, then 10 ps NVT and 10 ps NPT in |
Module Contents
- iphasimulator.amber_solvation.WATER_MOLARITY = 55.5
- iphasimulator.amber_solvation.SYSTEM_PRMTOP = 'system.prmtop'
- iphasimulator.amber_solvation.SYSTEM_INPCRD = 'system.inpcrd'
- iphasimulator.amber_solvation.SYSTEM_PDB = 'system.pdb'
- iphasimulator.amber_solvation.TLEAP_INPUT = 'tleap.in'
- iphasimulator.amber_solvation.TLEAP_LOG = 'tleap.log'
- iphasimulator.amber_solvation.COUNT_INPUT = 'tleap_count_waters.in'
- iphasimulator.amber_solvation.COUNT_LOG = 'tleap_count_waters.log'
- iphasimulator.amber_solvation.RUN_SCRIPT = 'run_openmm_md.py'
- iphasimulator.amber_solvation.PROTOCOL_FILE = 'protocol.json'
- iphasimulator.amber_solvation.LOCAL_SCRIPT = 'run_step6_local.sh'
- iphasimulator.amber_solvation.HPC_SCRIPT = 'run_hpc_equilibration_production.slurm'
- iphasimulator.amber_solvation.RUN_SCRIPT_SOURCE
- iphasimulator.amber_solvation.ADDED_RESIDUES_PATTERN
- iphasimulator.amber_solvation.ION_PARAMETERS_PATTERN
- iphasimulator.amber_solvation.LEAP_ERRORS_PATTERN
- class iphasimulator.amber_solvation.AmberSolvationSettings
Box and ion choices for the tleap build (lengths in nm, salt in mol/L).
- padding_nm: float = 1.2
- box_shape: str = 'box'
- cubic: bool = True
- salt_molar: float = 0.15
- cation: str = 'Na+'
- anion: str = 'Cl-'
- class iphasimulator.amber_solvation.AmberSystemOutputs
- output_dir: pathlib.Path
- tleap_input_path: pathlib.Path
- tleap_log_path: pathlib.Path
- prmtop_path: pathlib.Path
- inpcrd_path: pathlib.Path
- pdb_path: pathlib.Path
- water_count: int
- salt_ion_pairs: int
- ion_parameter_files: tuple[str, ...]
- class iphasimulator.amber_solvation.TleapLogSummary
- water_count: int | None
- ion_parameter_files: tuple[str, ...]
- errors: int | None
- class iphasimulator.amber_solvation.OpenMMProtocol
Staged MD settings (times in ps/ns, time steps in fs, restraints in kJ mol^-1 nm^-2).
- name: str
- temperature_kelvin: float
- minimization_max_iterations: int
- nvt_ps: float
- nvt_timestep_fs: float
- npt_ps: float
- npt_timestep_fs: float
- production_ns: float
- production_frame_ps: float
- production_timestep_fs: float = 2.0
- equilibration_frame_ps: float = 0.0
- report_ps: float = 10.0
- pressure_bar: float = 1.0
- cutoff_nm: float = 1.0
- friction_per_ps: float = 1.0
- barostat_frequency: int = 25
- minimization_tolerance: float = 1000.0
- backbone_restraint: float = 0.0
- sidechain_restraint: float = 0.0
- npt_frame_ps: float | None = None
- nvt_report_ps: float | None = None
- npt_report_ps: float | None = None
- constraint_tolerance: float = 1e-05
- ewald_error_tolerance: float = 0.0005
- iphasimulator.amber_solvation.POLYMER_IN_WATER_PROTOCOL
- iphasimulator.amber_solvation.ENZYME_POLYMER_IN_WATER_PROTOCOL
- iphasimulator.amber_solvation.ENZYME_SOLVATION_SETTINGS
- iphasimulator.amber_solvation.salt_ion_pairs(water_count: int, salt_molar: float) int
Ion pairs for
salt_molarfrom the number of waters (55.5 mol/L water).
- iphasimulator.amber_solvation.density_g_per_ml(total_mass_dalton: float, volume_nm3: float) float
Convert a system mass in Da and a box volume in nm^3 to g/mL (1 Da/nm^3 = 1.66054e-3 g/mL).
- iphasimulator.amber_solvation.write_tleap_input(path: str | pathlib.Path, *, mol2_name: str, frcmod_name: str, settings: AmberSolvationSettings, protein_pdb_name: str | None = None, salt_pairs: int | None = None) str
Write a tleap input and return its text.
With
salt_pairs=Nonethe input only solvates (used to count waters); otherwise it neutralises, addssalt_pairsion pairs and saves the system.
- iphasimulator.amber_solvation.parse_tleap_log(text: str) TleapLogSummary
Waters added by the (last) solvate command, ion frcmod files loaded, error count.
- iphasimulator.amber_solvation.build_solvated_amber_system(mol2_path: str | pathlib.Path, frcmod_path: str | pathlib.Path, output_dir: str | pathlib.Path, *, protein_pdb_path: str | pathlib.Path | None = None, settings: AmberSolvationSettings = AmberSolvationSettings(), tleap: str = 'tleap', runner=subprocess.run) AmberSystemOutputs
Solvate the 05A polymer (optionally with a posed protein) in OPC and add ions.
Copies the inputs into a new
output_dir, runs tleap once to count the waters for the requested padding, then builds the neutralised, salted system and writessystem.prmtop/system.inpcrd/system.pdbwith the tleap input and log next to them.
- iphasimulator.amber_solvation.write_openmm_run_files(system_dir: str | pathlib.Path, protocol: OpenMMProtocol, *, job_name: str, polymer_residues: tuple[str, ...] = ('PHA',)) tuple[pathlib.Path, ...]
Write
run_openmm_md.py,protocol.json,run_step6_local.shand the SLURM file.The layout mirrors the GROMACS run folders: step 6.0 locally, then steps 6.1, 6.2 and 7 on the cluster.
polymer_residuesnames the polymer residue(s) restrained with the backbone force constant.
- iphasimulator.amber_solvation.load_openmm_runner()
Import the packaged
run_openmm_md.py(the same file the run folders use).
- iphasimulator.amber_solvation.run_openmm_stages(system_dir: str | pathlib.Path, stages, *, platform_name: str | None = None) list[dict]
Run stages (e.g.
["step6.0_minimization"]) insystem_dirwith its protocol.json.
- iphasimulator.amber_solvation.run_openmm_short_test(system_dir: str | pathlib.Path, *, platform_name: str | None = None) list[dict]
Minimise, then 10 ps NVT and 10 ps NPT in
system_dir/short_test(protocol otherwise).
- iphasimulator.amber_solvation.LOCAL_SCRIPT_TEXT = Multiline-String
Show Value
"""#!/usr/bin/env bash set -euo pipefail python run_openmm_md.py step6.0_minimization """
- iphasimulator.amber_solvation.HPC_SCRIPT_TEMPLATE = Multiline-String
Show Value
"""#!/bin/bash -l #SBATCH --job-name={JOB_NAME} #SBATCH --partition=gpu #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --cpus-per-task=8 #SBATCH --gres=gpu:1 #SBATCH --mem=16G #SBATCH --time=2-00:00 #SBATCH --output=logs/%x-%j.out #SBATCH --error=logs/%x-%j.err # Activate a Python environment with OpenMM (CUDA build), for example: # module load anaconda3 && conda activate ipha_clean set -euo pipefail cd "${SLURM_SUBMIT_DIR:-$PWD}" mkdir -p logs # Steps 6.1 (NVT), 6.2 (NPT) and 7 (production); settings in protocol.json. # Each MD stage continues from its own checkpoint; completed stages take no new steps. python run_openmm_md.py step6.1_nvt step6.2_npt step7_production --platform CUDA """