HbondΒΆ

try pytraj online:

http://mybinder.org/badge.svg
In [1]:
# load data
# pdb file from: http://www.rcsb.org/pdb/explore/explore.do?pdbId=1l2y
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)

import pytraj as pt

traj = pt.iterload('1L2Y.pdb', top='1L2Y.pdb')
traj
Out[1]:
pytraj.TrajectoryIterator, 38 frames: 
Size: 0.000258 (GB)
<Topology: 304 atoms, 20 residues, 1 mols, PBC with box type = ortho>
           
In [2]:
# search hbonds for all residues
# dump data to `dataset` (similiar to python'list and dict)
dataset = pt.hbond(traj)
print(dataset)
# 0: no hbond
# 1: there is hbond
<pytraj.hbonds.DatasetHBond
donor_acceptor pairs : 31>
In [3]:
# get total solute hbonds
print(dataset.total_solute_hbonds())
[6 7 8 ..., 7 6 6]
In [4]:
# take data for specific hbond
print(dataset.data['ARG16_O-TRP6_NE1-HE1'])
<pytraj.array.DataArray: size=38, key=ARG16_O-TRP6_NE1-HE1, dtype=int32, ndim=1> 
values:
[1 1 1 ..., 1 1 1]

(hbonds_tutorial.ipynb; hbonds_tutorial_evaluated.ipynb; hbonds_tutorial.py)