pestifer.charmmff.ligand_paramgen.protonation module

Protonate a ligand residue at a target pH while preserving its PDB heavy-atom order, names, and coordinates.

Used as the first stage of the on-the-fly CGenFF parameterization pipeline: the protonated 3D Mol returned here feeds the mol2 writer that drives the cgenff binary.

exception pestifer.charmmff.ligand_paramgen.protonation.LigandProtonationError[source]

Bases: RuntimeError

Raised when a ligand cannot be protonated for CGenFF parameterization.

pestifer.charmmff.ligand_paramgen.protonation.protonate_ligand(residue: Residue, smiles: str, ph: float = 7.4) Chem.Mol[source]

Protonate a ligand residue at the given pH using Dimorphite-DL.

The input residue supplies heavy-atom coordinates and PDB atom names; the smiles supplies bond orders and formal charges. Heavy-atom order in the returned Mol matches the input residue’s heavy-atom order, and each heavy atom carries its PDB name as the RDKit property _pdb_name. Hydrogens are placed in 3D at the protonation state appropriate for ph.

Parameters:
  • residue – A pestifer Residue for the ligand. Hydrogens in residue.atoms are ignored; only heavy atoms are used.

  • smiles – SMILES describing the ligand’s heavy-atom skeleton and bond orders. Heavy-atom count must match the number of heavy atoms in residue.

  • ph – pH at which to protonate (default 7.4). ph_min and ph_max passed to Dimorphite-DL are both set to this value.