pestifer.charmmff.ligand_paramgen.orchestrator module

Orchestrates the per-PDB pipeline for the make-ligand-mol2 subcommand: fetch or load the PDB, enumerate HETATM residues, drop any whose resname is already covered by the CHARMM force field, and for the remaining ligands run SMILES lookup -> protonation -> mol2 emission.

Same internals will be reused by the build workflow when it needs to either drive a local cgenff binary or pause for the user to upload the mol2 to the CGenFF web tool.

class pestifer.charmmff.ligand_paramgen.orchestrator.LigandGenSummary(successes: 'list[LigandResult]' = <factory>, failures: 'list[LigandResult]' = <factory>, skipped_known: 'list[str]' = <factory>)[source]

Bases: object

failures: list[LigandResult]
skipped_known: list[str]
successes: list[LigandResult]
class pestifer.charmmff.ligand_paramgen.orchestrator.LigandResult(resname: 'str', status: 'str', path: 'Path | None' = None, smiles: 'str | None' = None, message: 'str' = '')[source]

Bases: object

message: str = ''
path: Path | None = None
resname: str
smiles: str | None = None
status: str
pestifer.charmmff.ligand_paramgen.orchestrator.fetch_or_load_pdb(source: str)[source]

Resolve source to a parsed pidibble PDBRecordDict.

A 4-character alphanumeric token is treated as an RCSB PDB code and fetched; anything else is treated as a path to a local .pdb file.

pestifer.charmmff.ligand_paramgen.orchestrator.find_unknown_ligand_residues(parsed, charmmff_content) tuple[dict[str, Residue], list[str]][source]

Group HETATM records by resname; for each resname not covered by the CHARMM force field, return a representative pestifer Residue built from the atoms of its first appearance in the structure.

Returns:

unknown_by_resname maps resname -> a single Residue suitable for protonate_ligand(). skipped_known lists resnames that were filtered out because CHARMM already defines them.

Return type:

(unknown_by_resname, skipped_known)

pestifer.charmmff.ligand_paramgen.orchestrator.generate_ligand_mol2s(parsed, charmmff_content, outdir: Path | str, ph: float = 7.4, smiles_overrides: dict[str, str] | None = None) LigandGenSummary[source]

For each unknown ligand resname in the parsed PDB, fetch a SMILES, protonate at ph, and write a mol2 file under outdir.

On per-ligand failure the function logs a warning and continues; the returned summary lists what succeeded and what failed and why.