pestifer.charmmff.ligand_paramgen package

On-the-fly CGenFF parameterization for ligands not covered by the standard CHARMM topologies.

The pipeline:
pestifer Residue (HETATM)

-> protonate at target pH (RDKit + Dimorphite-DL) -> write mol2 (Open Babel, format conversion only) -> shell out to the cgenff binary -> parse the .str output -> remap CGenFF-invented heavy-atom names back to the PDB names -> inject into the psfgen session as an extra topology stream

This subpackage builds that pipeline piece by piece.

exception pestifer.charmmff.ligand_paramgen.LigandProtonationError[source]

Bases: RuntimeError

Raised when a ligand cannot be protonated for CGenFF parameterization.

exception pestifer.charmmff.ligand_paramgen.RCSBLookupError[source]

Bases: RuntimeError

Raised when an RCSB SMILES lookup fails.

pestifer.charmmff.ligand_paramgen.fetch_ligand_smiles(comp_id: str, *, timeout: float = 10.0) str[source]

Fetch the best-available SMILES for a PDB chemical component.

Parameters:
  • comp_id – PDB chemical-component ID (e.g. "ATP", "NAG"). Case-insensitive; whitespace stripped.

  • timeout – HTTP request timeout in seconds.

Returns:

SMILES string. Preference order: OpenEye canonical (stereo) > CACTVS canonical (stereo) > OpenEye non-canonical > CACTVS non-canonical > any remaining SMILES_CANONICAL > any remaining SMILES.

Return type:

str

Raises:

RCSBLookupError – If the component ID is not found, the network call fails, or the response carries no SMILES descriptor.

pestifer.charmmff.ligand_paramgen.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.

Submodules