qp.manager.create.get_charge

qp.manager.create.get_charge(structure_dir=None)[source]

Extract total charge and extra spin from charge.csv and spin.csv.

Parses the charge CSV generated by the cluster extraction stage to sum up amino acid charges and ligand charges for residues present in the extracted spheres. Also reads spin.csv if present for radical ligands (e.g., NO, O2).

Parameters:

structure_dir (str, optional) – Path to the chain directory (e.g., output/1os7/A200). If None, inferred from the current working directory.

Returns:

(total_charge, extra_spin) where total_charge is the sum of amino acid and ligand charges, and extra_spin is the additional spin contribution from radical species.

Return type:

tuple of (int, int)