Skip to content

Commit

Permalink
Access hbonds results through new results member in count_by_ids() an…
Browse files Browse the repository at this point in the history
…d count_by_type() (#3876)
  • Loading branch information
pgbarletta authored Oct 25, 2022
1 parent d67c1af commit b891157
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The rules for this file:
* 2.4.0

Fixes
* hbond analysis: access hbonds results through new results member in count_by_ids() and count_by_type()
* Added isolayer selection method (Issue #3845)
* Auxiliary; determination of representative frames: Removed undefined
behaviour for cutoff values < -1 (PR # 3749)
Expand Down
10 changes: 5 additions & 5 deletions package/MDAnalysis/analysis/hydrogenbonds/hbond_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ def count_by_type(self):
acceptor atoms in a hydrogen bond.
"""

d = self.u.atoms[self.hbonds[:, 1].astype(np.intp)]
a = self.u.atoms[self.hbonds[:, 3].astype(np.intp)]
d = self.u.atoms[self.results.hbonds[:, 1].astype(np.intp)]
a = self.u.atoms[self.results.hbonds[:, 3].astype(np.intp)]

tmp_hbonds = np.array([d.resnames, d.types, a.resnames, a.types],
dtype=str).T
Expand Down Expand Up @@ -826,9 +826,9 @@ def count_by_ids(self):
in a hydrogen bond.
"""

d = self.u.atoms[self.hbonds[:, 1].astype(np.intp)]
h = self.u.atoms[self.hbonds[:, 2].astype(np.intp)]
a = self.u.atoms[self.hbonds[:, 3].astype(np.intp)]
d = self.u.atoms[self.results.hbonds[:, 1].astype(np.intp)]
h = self.u.atoms[self.results.hbonds[:, 2].astype(np.intp)]
a = self.u.atoms[self.results.hbonds[:, 3].astype(np.intp)]

tmp_hbonds = np.array([d.ids, h.ids, a.ids]).T
hbond_ids, ids_counts = np.unique(tmp_hbonds, axis=0,
Expand Down

0 comments on commit b891157

Please sign in to comment.