pub fn add_hydrogens(
structure: &mut Structure,
config: &HydroConfig,
) -> Result<(), Error>Expand description
Adds hydrogens to all standard residues in-place, updating protonation states when needed.
This function implements a multi-phase pipeline:
- Disulfide detection — Identifies CYS pairs forming S-S bonds and relabels to CYX.
- Non-HIS protonation — Applies pKa-based titration to ASP, GLU, LYS, ARG, CYS, TYR
(only when
target_phis specified). - HIS protonation — Determines HIS state via pH thresholds, salt bridge detection, and tautomer strategy.
- Hydrogen construction — Builds hydrogens according to template geometry and terminal-specific rules.
§Arguments
structure- Mutable structure whose residues will be protonated and hydrated.config- Hydrogenation configuration controlling pH, strategy, and options.
§Returns
Ok(()) when hydrogenation succeeds.
§Errors
Returns Error::MissingInternalTemplate when no template is found or
Error::IncompleteResidueForHydro when required anchor atoms are missing.