Reference navigation
On this page
CLASS · v0.9.1
HydrogenBonds
Detect hydrogen bonds from donor–acceptor distance and hydrogen geometry.
from proteinmotion import HydrogenBondsConstructor
HydrogenBonds(
protein,
*,
donors=None,
acceptors=None,
max_distance=3.5,
min_angle=150,
hydrogens='auto',
donor_h_cutoff=1.3,
)Parameters
| Parameter | Default | Description |
|---|---|---|
protein | Required | Protein object to read or animate. |
donorskeyword only | None | Donor Region or atom indices; None uses standard amino-acid templates. |
acceptorskeyword only | None | Acceptor Region or atom indices; None uses standard amino-acid templates. |
max_distancekeyword only | 3.5 | Maximum donor–acceptor distance in ångströms. |
min_anglekeyword only | 150 | Minimum donor–hydrogen–acceptor angle in degrees. |
hydrogenskeyword only | 'auto' | "explicit", "auto", or "backbone"; controls the use of loaded or inferred hydrogens. |
donor_h_cutoffkeyword only | 1.3 | Maximum donor–hydrogen assignment distance in ångströms. |
Notes
Pairs pass when 1.5 Å < D–A ≤ max_distance and D–H–A ≥ min_angle. Default templates cover standard amino acids. auto uses loaded hydrogens first and can infer backbone amide hydrogens. Use include_hydrogens=True when loading explicit H. For protonation-dependent or nonstandard groups, supply prepared coordinates and donor/acceptor selections.
Example and output
This excerpt runs inside a scene’s construct() method. The full example file includes imports, structure loading, and camera setup. Run it from a repository checkout.
p = helix_view(self)
hb = HydrogenBonds(
p,
donors=p.select(residues=(23, 34), atoms="N"),
max_distance=3.5,
min_angle=150,
hydrogens="backbone",
)
lines = hb.highlight(
mode="3d",
color="#f2ba67",
radius=0.07,
dash_count=5,
show_distances=False,
)
self.play(Write(lines), run_time=2)
self.play(self.camera.animate.orbit(0.6), run_time=3)
self.wait(1)Geometry-based N···O contacts with inferred backbone H.
Methods and properties
| Name | Description |
|---|---|
| hydrogen_position()method | Return the explicit or inferred hydrogen position for a detected pair. |
| pairsproperty · inherited from _Analysis | Tuple of Interaction records recomputed when coordinates or analysis settings change. |
| highlight()method · inherited from _Analysis | Create styled hydrogen-bond lines. Options go to InteractionHighlight. |
HydrogenBonds.hydrogen_position(pair)Return the explicit or inferred hydrogen position for a detected pair.
| Parameter | Default | Description |
|---|---|---|
pair | Required | Interaction record returned by this analysis. |
Returns: 3D coordinates in model ångströms.
Inherited from interactions._Analysis.
HydrogenBonds.pairsTuple of Interaction records recomputed when coordinates or analysis settings change.
Inherited from interactions._Analysis.
HydrogenBonds.highlight(**kwargs)Create styled hydrogen-bond lines. Options go to InteractionHighlight.
| Parameter | Default | Description |
|---|---|---|
**kwargs | — | Additional keyword options described below or in the linked constructor. |
Returns: InteractionHighlight