iphasimulator.charmmgui_import
Helpers for CHARMM-GUI / CGenFF outputs (CHARMM/GROMACS route).
Nothing here modifies a CHARMM-GUI download. The prepare_* functions write
only into a new folder chosen by the caller, and gmx runs only when the
run_* functions are called explicitly.
Attributes
Classes
One penalised atom charge or bonded parameter. |
|
Penalty scores parsed from a Ligand Reader & Modeler |
|
One |
|
One PASS/FAIL/SKIP line with the evidence behind it. |
|
Functions
|
Classify a CGenFF penalty with the thresholds printed in CGenFF output. |
|
GOOD (< 10), CHECK (10-50) or POOR (> 50) for a CGenFF penalty. |
|
Parse penalty scores from |
|
Return a short plain-text summary suitable for notebook output. |
|
Return one line per check, followed by an overall verdict. |
|
Read every |
|
Return the first |
|
Read the |
|
Read atoms (positions in nm) and box vectors from a |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CIP labels of the ligand in |
|
|
|
The CGenFF topology in a |
|
Atom name -> (CGenFF type, charge) from the ATOM lines of a CHARMM |
|
(CGenFF program version, topology/parameter files version) from a |
|
CGenFF parameter and charge penalties from |
|
Every LIG atom in the GROMACS topology has the type and charge from the rtf |
|
Handedness of each |
|
|
|
|
|
Read-only checks for a folder made by |
|
Read-only checks for a folder made by |
|
Build a solvent-free GROMACS folder from a Ligand Reader & Modeler download. |
|
Turn a Solution Builder download into a run folder, as in the production runs. |
|
Length and main settings of one mdp file (length = nsteps x dt). |
|
The step6.0–step7 stages of a run folder, as set in its mdp files. |
|
Rewrite the |
|
Run |
|
Read the final potential energy and maximum force from an |
|
Write |
Write |
|
Both steps at once: |
|
|
Run |
|
Read-only checks for a solvated folder from |
Module Contents
- iphasimulator.charmmgui_import.RESI_PENALTY_PATTERN
- iphasimulator.charmmgui_import.PARAMETER_PENALTY_PATTERN
- iphasimulator.charmmgui_import.PROGRAM_VERSION_PATTERN
- iphasimulator.charmmgui_import.FILES_VERSION_PATTERN
- iphasimulator.charmmgui_import.TOPOLOGY_FILES = ('lig.rtf', 'lig_g.rtf')
- iphasimulator.charmmgui_import.PARAMETER_FILE = 'lig.prm'
- class iphasimulator.charmmgui_import.PenaltyEntry
One penalised atom charge or bonded parameter.
- source: str
- label: str
- penalty: float
- class iphasimulator.charmmgui_import.CGenFFPenaltyReport
Penalty scores parsed from a Ligand Reader & Modeler
lig/folder.- lig_dir: pathlib.Path
- files_read: tuple[str, ...]
- program_version: str | None
- parameter_files_version: str | None
- resi_penalties: dict[str, tuple[float, float]]
- charge_penalties: tuple[PenaltyEntry, ...]
- parameter_penalties: tuple[PenaltyEntry, ...]
- property max_charge_penalty: float | None
- property max_parameter_penalty: float | None
- top_charge_penalties(n: int = 5) tuple[PenaltyEntry, ...]
- top_parameter_penalties(n: int = 5) tuple[PenaltyEntry, ...]
- iphasimulator.charmmgui_import.penalty_category(penalty: float | None) str
Classify a CGenFF penalty with the thresholds printed in CGenFF output.
- iphasimulator.charmmgui_import.PENALTY_GRADE_RULES
- iphasimulator.charmmgui_import.penalty_grade(penalty: float) str
GOOD (< 10), CHECK (10-50) or POOR (> 50) for a CGenFF penalty.
- iphasimulator.charmmgui_import.read_cgenff_penalties(lig_dir: str | pathlib.Path) CGenFFPenaltyReport
Parse penalty scores from
lig.rtf,lig_g.rtfandlig.prm.Missing files are skipped; at least one of them must exist.
- iphasimulator.charmmgui_import.format_cgenff_penalty_report(report: CGenFFPenaltyReport, top: int = 5) str
Return a short plain-text summary suitable for notebook output.
- iphasimulator.charmmgui_import.CHARMM_GROMACS_TEMPLATE_DIR
- iphasimulator.charmmgui_import.CHARMM_GROMACS_MDP_FILES = ('step6.0_minimization.mdp', 'step6.1_nvt.mdp', 'step6.2_npt.mdp', 'step7_production.mdp')
- iphasimulator.charmmgui_import.LOCAL_SCRIPT = 'run_step6_local.sh'
- iphasimulator.charmmgui_import.HPC_SCRIPT = 'run_hpc_equilibration_production.slurm'
- iphasimulator.charmmgui_import.HPC_SCRIPT_TEMPLATE = 'run_hpc_equilibration_production.slurm.template'
- iphasimulator.charmmgui_import.CHARMM_GUI_INDEX_GROUPS = ('SOLU', 'SOLV')
- iphasimulator.charmmgui_import.CHARMM_DEFAULTS = ('1', '2', 'yes', 1.0, 1.0)
- iphasimulator.charmmgui_import.CGENFF_TYPE_PATTERN
- iphasimulator.charmmgui_import.WATER_MOLECULES = ('TIP3', 'SOL', 'HOH', 'WAT')
- iphasimulator.charmmgui_import.ION_MOLECULES = ('SOD', 'CLA', 'POT', 'NA', 'CL')
- iphasimulator.charmmgui_import.DRY_COORDINATES = 'lig.gro'
- iphasimulator.charmmgui_import.DRY_MDP = 'dry_minimization.mdp'
- iphasimulator.charmmgui_import.DRY_DEFFNM = 'dry_minimization'
- iphasimulator.charmmgui_import.DRY_MINIMIZATION_MDP = Multiline-String
Show Value
"""; Dry (no solvent) steepest-descent minimisation of the CGenFF polymer. ; Sanity check only: GROMACS' Verlet scheme needs a periodic box, so ; the molecule sits alone in a box larger than twice the cut-off. integrator = steep emtol = 100.0 emstep = 0.01 nsteps = 5000 nstlist = 10 cutoff-scheme = Verlet pbc = xyz rlist = 1.2 vdwtype = Cut-off vdw-modifier = Force-switch rvdw_switch = 1.0 rvdw = 1.2 coulombtype = PME rcoulomb = 1.2 constraints = h-bonds constraint_algorithm = LINCS """
- iphasimulator.charmmgui_import.POTENTIAL_ENERGY_PATTERN
- iphasimulator.charmmgui_import.MAXIMUM_FORCE_PATTERN
- iphasimulator.charmmgui_import.ELEMENT_BY_MASS
- class iphasimulator.charmmgui_import.ItpMolecule
One
[ moleculetype ]with its atoms and bonds (0-based indices).- name: str
- bonds: tuple[tuple[int, int], ...]
- property charge: float
- class iphasimulator.charmmgui_import.GroAtom
- residue_number: int
- residue_name: str
- atom_name: str
- position: tuple[float, float, float]
- class iphasimulator.charmmgui_import.CheckResult
One PASS/FAIL/SKIP line with the evidence behind it.
- name: str
- status: str
- evidence: str
- property passed: bool
- class iphasimulator.charmmgui_import.MinimizationResult
- log_path: pathlib.Path
- potential_energy: float | None
- maximum_force: float | None
- iphasimulator.charmmgui_import.format_checks(results: list[CheckResult]) str
Return one line per check, followed by an overall verdict.
- iphasimulator.charmmgui_import.read_topology_molecules(topology_path: str | pathlib.Path) dict[str, ItpMolecule]
Read every
[ moleculetype ]in a topology and its#includefiles.
- iphasimulator.charmmgui_import.read_topology_defaults(topology_path: str | pathlib.Path) tuple[str, ...] | None
Return the first
[ defaults ]line found in the topology or its includes.
- iphasimulator.charmmgui_import.read_topology_molecule_counts(topology_path: str | pathlib.Path) dict[str, int]
Read the
[ molecules ]table in order.
- iphasimulator.charmmgui_import.read_gro(gro_path: str | pathlib.Path) tuple[tuple[GroAtom, ...], tuple[float, ...]]
Read atoms (positions in nm) and box vectors from a
.grofile.
- iphasimulator.charmmgui_import.check_charmm_defaults(topology_path: str | pathlib.Path) CheckResult
- iphasimulator.charmmgui_import.check_includes(folder: str | pathlib.Path, topology_name: str = 'topol.top') CheckResult
- iphasimulator.charmmgui_import.check_atom_counts(folder: str | pathlib.Path, coordinate_name: str, topology_name: str = 'topol.top') CheckResult
- iphasimulator.charmmgui_import.check_molecule_counts(topology_path: str | pathlib.Path, *, ligand: str = 'LIG', require_water: bool) CheckResult
- iphasimulator.charmmgui_import.check_net_charge(topology_path: str | pathlib.Path, tolerance: float = 0.001) CheckResult
- iphasimulator.charmmgui_import.check_cgenff_types(topology_path: str | pathlib.Path, ligand: str = 'LIG') CheckResult
- iphasimulator.charmmgui_import.check_ligand_atom_order(gro_path: str | pathlib.Path, topology_path: str | pathlib.Path, ligand: str = 'LIG') CheckResult
- iphasimulator.charmmgui_import.ligand_stereocentres(gro_path: str | pathlib.Path, topology_path: str | pathlib.Path, sdf_path: str | pathlib.Path, ligand: str = 'LIG') list[tuple[str, str]]
CIP labels of the ligand in
gro_path, using the SDF only for bond orders.The ligand graph comes from the
.itpbonds and its geometry from the.grocoordinates (made whole across the box), so the labels describe the structure GROMACS will simulate, not the uploaded SDF.
- iphasimulator.charmmgui_import.check_ligand_stereocentres(gro_path: str | pathlib.Path, topology_path: str | pathlib.Path, sdf_path: str | pathlib.Path | None, ligand: str = 'LIG', expected: str = 'R') CheckResult
- iphasimulator.charmmgui_import.find_lig_topology(lig_dir: str | pathlib.Path | None) pathlib.Path | None
The CGenFF topology in a
lig/folder:lig_g.rtf, orlig.rtfwhen there is nolig_g.rtf(the charges are identical).Nonewhen neither exists.
- iphasimulator.charmmgui_import.read_rtf_charges(rtf_path: str | pathlib.Path) dict[str, tuple[str, float]]
Atom name -> (CGenFF type, charge) from the ATOM lines of a CHARMM
.rtf.
- iphasimulator.charmmgui_import.read_cgenff_version(path: str | pathlib.Path) tuple[str | None, str | None]
(CGenFF program version, topology/parameter files version) from a
lig.rtf/lig.prmheader.
- iphasimulator.charmmgui_import.check_cgenff_penalties(lig_dir: str | pathlib.Path | None) CheckResult
CGenFF parameter and charge penalties from
lig/: PASS < 10, WARN 10-50, FAIL > 50.
- iphasimulator.charmmgui_import.check_ligand_charges_match_rtf(topology_path: str | pathlib.Path, rtf_path: str | pathlib.Path | None, ligand: str = 'LIG', tolerance: float = 0.001) CheckResult
Every LIG atom in the GROMACS topology has the type and charge from the rtf (
lig_g.rtforlig.rtf; their charges are identical).
- class iphasimulator.charmmgui_import.SignedVolume
- atom: str
- neighbours: str
- volume_md: float
- volume_sdf: float
- sdf_label: str
- label: str
- iphasimulator.charmmgui_import.ligand_signed_volumes(gro_path: str | pathlib.Path, topology_path: str | pathlib.Path, sdf_path: str | pathlib.Path, ligand: str = 'LIG', centre_type: str = 'CG311') list[SignedVolume]
Handedness of each
centre_typestereocentre in the GROMACS coordinates vs the SDF.For every CG311 carbon (the PHA backbone CH), the signed volume of its three heavy neighbours (O, CH2, CH3 for PHB; O, CH2, CH2 for longer side chains), taken in the same order in both structures, is compared with the SDF. The same sign means the same configuration as the SDF (R for an R-configured SDF).
- iphasimulator.charmmgui_import.check_ligand_signed_volumes(gro_path: str | pathlib.Path, topology_path: str | pathlib.Path, sdf_path: str | pathlib.Path | None, ligand: str = 'LIG', expected: str = 'R') CheckResult
- iphasimulator.charmmgui_import.check_gromacs_run_files(folder: str | pathlib.Path, index_groups: tuple[str, ...] = CHARMM_GUI_INDEX_GROUPS) CheckResult
- iphasimulator.charmmgui_import.validate_dry_ligand_folder(folder: str | pathlib.Path, *, sdf_path: str | pathlib.Path | None = None, ligand: str = 'LIG') list[CheckResult]
Read-only checks for a folder made by
prepare_dry_ligand_folder().
- iphasimulator.charmmgui_import.validate_charmm_gui_run_folder(folder: str | pathlib.Path, *, sdf_path: str | pathlib.Path | None = None, ligand: str = 'LIG') list[CheckResult]
Read-only checks for a folder made by
prepare_charmm_gui_run_folder().
- iphasimulator.charmmgui_import.prepare_dry_ligand_folder(ligand_reader_dir: str | pathlib.Path, output_dir: str | pathlib.Path, *, padding_nm: float = 1.7) pathlib.Path
Build a solvent-free GROMACS folder from a Ligand Reader & Modeler download.
Copies
gromacs/topol.top,charmm36.itpandLIG.itp, writeslig.grofromligandrm.pdbcentred in a cubic box of the molecule’s extent plus2 * padding_nm, and writesdry_minimization.mdp.
- iphasimulator.charmmgui_import.prepare_charmm_gui_run_folder(solution_builder_dir: str | pathlib.Path, run_dir: str | pathlib.Path, *, template_dir: str | pathlib.Path | None = None, job_name: str | None = None) pathlib.Path
Turn a Solution Builder download into a run folder, as in the production runs.
Copies
gromacs/(topology,toppar/,index.ndx, coordinates) into the newrun_dir, renamesstep3_input.grotostep5_input.gro, leaves out CHARMM-GUI’sstep4.x/step5mdp files, and adds the CHARMM/GROMACS mdp files and scripts fromtemplate_dir(default: the packaged CHARMM/GROMACS templates). The SLURM job name defaults to the run folder’s name, and the SLURM stage comments are written from the copied mdp files (nsteps x dt).
- iphasimulator.charmmgui_import.SLURM_STAGES = (('step6.1_nvt', 'Step 6.1', 'NVT'), ('step6.2_npt', 'Step 6.2', 'NPT'), ('step7_production',...
- class iphasimulator.charmmgui_import.MdpStage
- name: str
- integrator: str
- nsteps: int
- dt_ps: float | None
- temperature: str | None
- pressure_coupling: str | None
- position_restraints: bool
- property length_ps: float | None
- length_text() str
- iphasimulator.charmmgui_import.read_mdp_stage(mdp_path: str | pathlib.Path) MdpStage
Length and main settings of one mdp file (length = nsteps x dt).
- iphasimulator.charmmgui_import.describe_run_folder_protocol(folder: str | pathlib.Path) list[MdpStage]
The step6.0–step7 stages of a run folder, as set in its mdp files.
- iphasimulator.charmmgui_import.annotate_slurm_stage_lengths(text: str, folder: str | pathlib.Path) str
Rewrite the
# Step 6.1/6.2/7 — ...comments from the folder’s mdp files.
- iphasimulator.charmmgui_import.run_dry_minimization(folder: str | pathlib.Path, *, gmx: str = 'gmx', runner=subprocess.run) MinimizationResult
Run
grompp+mdrunfor the dry folder and return Epot and Fmax.
- iphasimulator.charmmgui_import.read_minimization_result(log_path: str | pathlib.Path) MinimizationResult
Read the final potential energy and maximum force from an
mdrunlog.
- iphasimulator.charmmgui_import.CHARMM_POLYMER_TEMPLATE_DIR
- iphasimulator.charmmgui_import.WATER_ION_ATOMTYPES_INCLUDE = 'tip3_ions_atomtypes.itp'
- iphasimulator.charmmgui_import.WATER_ION_MOLECULE_INCLUDES = ('TIP3_SOL.itp', 'SOD.itp', 'CLA.itp')
- iphasimulator.charmmgui_import.SOLVATE_SCRIPT = 'run_solvate_local.sh'
- class iphasimulator.charmmgui_import.CharmmPolymerWaterFolder
- run_dir: pathlib.Path
- dry_dir: pathlib.Path
- solvated_dir: pathlib.Path
- solvate_script_path: pathlib.Path
- local_script_path: pathlib.Path
- hpc_script_path: pathlib.Path
- iphasimulator.charmmgui_import.prepare_charmm_dry_polymer_folder(ligand_reader_dir: str | pathlib.Path, gromacs_dir: str | pathlib.Path) pathlib.Path
Write
gromacs_dir/dry_polymer: the CGenFF PHA ready for GROMACS, no solvent.The Ligand Reader topology (
topol.top,charmm36.itp,LIG.itp) with the packaged CHARMM TIP3P/SOD/CLA files included,step5_input.groandindex.ndx(the same filesprepare_gromacs_run_folderwrites for a GAFF2 PHA), pluslig.groanddry_minimization.mdpfor an optional solvent-free minimisation.
- iphasimulator.charmmgui_import.write_charmm_polymer_solvation_files(gromacs_dir: str | pathlib.Path, *, box_padding_nm: float = 1.2, ion_concentration_molar: float = 0.15, job_name: str | None = None) CharmmPolymerWaterFolder
Write
gromacs_dir/solvated_polymerfromdry_polymerlike the polymer benchmark.Copies the topology include files and the CHARMM polymer mdp set, then calls
write_gromacs_solvation_files()for the benchmark’srun_solvate_local.sh(box, water, ions),run_step6_local.shand SLURM script. Nothing is solvated untilrun_solvate_local.shruns.
- iphasimulator.charmmgui_import.prepare_charmm_polymer_water_folder(ligand_reader_dir: str | pathlib.Path, run_dir: str | pathlib.Path, *, box_padding_nm: float = 1.2, ion_concentration_molar: float = 0.15, job_name: str | None = None) CharmmPolymerWaterFolder
Both steps at once:
prepare_charmm_dry_polymer_folder(), thenwrite_charmm_polymer_solvation_files(), in a newrun_dir.
- iphasimulator.charmmgui_import.run_charmm_polymer_solvation(solvated_dir: str | pathlib.Path, *, runner=subprocess.run) subprocess.CompletedProcess
Run
run_solvate_local.sh(editconf, solvate, genion, grompp check) insolvated_dir.
- iphasimulator.charmmgui_import.validate_charmm_polymer_water_folder(solvated_dir: str | pathlib.Path, *, sdf_path: str | pathlib.Path | None = None, ligand: str = 'LIG') list[CheckResult]
Read-only checks for a solvated folder from
prepare_charmm_polymer_water_folder().