qp.protonate.ligand_prop.compute_charge

qp.protonate.ligand_prop.compute_charge(path_ligand, path_pdb)[source]

Compute the formal charge of each ligand from Protoss SDF output.

Parses the ligand SDF file generated by Protoss and extracts formal charges from the M  CHG records. Also handles special cases like metal ions (Na+, K+, Mg2+, etc.) that are not included in Protoss SDF output, and corrects for atoms removed during protonation.

Parameters:
  • path_ligand (str) – Path to the Protoss-generated ligand SDF file.

  • path_pdb (str) – Path to the corresponding PDB file (used to detect removed atoms and standalone metal ions).

Returns:

Mapping of ligand ID strings (e.g., 'FE_A199') to formal charges. Oligomeric ligands use space-separated keys (e.g., 'GAL_A1 GAL_A2').

Return type:

dict