-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opening universe described in HBondAnalysis docs causes error #838
Comments
Do |
Yeah the PDB file is much longer (it's solvated), I think PSF DCD is the correct combination |
Okay this is an error in the Docs, I'll go ahead and change PDB to DCD. This will be solved by #833. |
Thanks. |
@jdetle also noted that the example wrongly suggests one could use the PSF/DCD combo to analyze water-protein hydrogen bonds. But the PSF/DCD combo was simulated in implicit solvent and does not have TIP3 water inside. Instead use something like the following example where we calculate the average number of hydrogen bond for protein residues that are solvent-exposed: import numpy as np
import MDAnalysis as mda
from MDAnalysis.tests.datafiles import GRO, XTC
from MDAnalysis.analysis.hbonds import HydrogenBondAnalysis
u = mda.Universe(GRO, XTC)
# hydrogen bonds
H = HydrogenBondAnalysis(u, 'protein', 'resname SOL', distance=3, angle=120)
H.run()
counts = H.count_by_time()
print(counts.count)
# [586 594 577 588 573 610 599 596 598 602]
# exposed residues (quick to write, slow to execute...)
Nres_exposed = np.array([u.select_atoms("protein and around 3 resname SOL").n_residues for ts in u.trajectory], dtype=np.float64)
# hbonds per residue
avg_hbonds = counts.count/Nres_exposed
# plot
import matplotlib.pyplot as plt
plt.matplotlib.style.use('ggplot')
fig = plt.figure(figsize=(5,5))
ax = fig.add_subplot(111)
ax.fill_between(counts.time, avg_hbonds, color="blue", alpha=0.3)
ax.set_xlabel(r"time $t$ (ps)")
ax.set_ylabel(r"mean number of hydrogen bonds protein-water $\langle N \rangle$")
fig.savefig("adk_avg_protein_water_hbonds.png") |
Yep!
|
Expected behaviour
Running HBondAnalysis as specified in the docs should work as expected, if I am missing something simple please let me know.
Actual behaviour
Code to reproduce the behaviour
Current version of MDAnalysis:
0.14.1-dev0
The text was updated successfully, but these errors were encountered: