ProteinMotion
Reference navigation
On this page

CLASS · v0.9.1

HydrogenBonds

Detect hydrogen bonds from donor–acceptor distance and hydrogen geometry.

python
from proteinmotion import HydrogenBonds

Constructor

python
HydrogenBonds(
    protein,
    *,
    donors=None,
    acceptors=None,
    max_distance=3.5,
    min_angle=150,
    hydrogens='auto',
    donor_h_cutoff=1.3,
)

Parameters

ParameterDefaultDescription
proteinRequiredProtein object to read or animate.
donorskeyword onlyNoneDonor Region or atom indices; None uses standard amino-acid templates.
acceptorskeyword onlyNoneAcceptor Region or atom indices; None uses standard amino-acid templates.
max_distancekeyword only3.5Maximum donor–acceptor distance in ångströms.
min_anglekeyword only150Minimum donor–hydrogen–acceptor angle in degrees.
hydrogenskeyword only'auto'"explicit", "auto", or "backbone"; controls the use of loaded or inferred hydrogens.
donor_h_cutoffkeyword only1.3Maximum 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.

Code Scene excerpt
python
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)
Output Preview · 6.0 s · 60 fps
Hydrogen bonds

Geometry-based N···O contacts with inferred backbone H.

Methods and properties

NameDescription
hydrogen_position()methodReturn the explicit or inferred hydrogen position for a detected pair.
pairsproperty · inherited from _AnalysisTuple of Interaction records recomputed when coordinates or analysis settings change.
highlight()method · inherited from _AnalysisCreate styled hydrogen-bond lines. Options go to InteractionHighlight.
python
HydrogenBonds.hydrogen_position(pair)

Return the explicit or inferred hydrogen position for a detected pair.

ParameterDefaultDescription
pairRequiredInteraction record returned by this analysis.

Returns: 3D coordinates in model ångströms.

Inherited from interactions._Analysis.

python
HydrogenBonds.pairs

Tuple of Interaction records recomputed when coordinates or analysis settings change.

Inherited from interactions._Analysis.

python
HydrogenBonds.highlight(**kwargs)

Create styled hydrogen-bond lines. Options go to InteractionHighlight.

ParameterDefaultDescription
**kwargsAdditional keyword options described below or in the linked constructor.

Returns: InteractionHighlight