Dear Friends,
I am trying to calculate hydrogen bonds between water molecules and facing some difficulties. The MDanalysis software
could not recognize atoms for the calculation. Here is the script that I used for the calculation
########### Script
#!/usr/bin/env python
import MDAnalysis
import MDAnalysis.analysis.hbonds
u = MDAnalysis.Universe("restart1.data", "trajectory2.dcd", format="LAMMPS")
h = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(u, 'type 2', 'type 3', distance=3.0, angle=120.0)
#################### Out_Put
Traceback (most recent call last):
File "test.py", line 6, in <module>
h = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(u, 'type 2', 'type 2 or 3', distance=3.0, angle=120.0)
File "/home/amal/anaconda3/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py", line 602, in __init__
self._update_selection_1()
File "/home/amal/anaconda3/lib/python3.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.py", line 808, in _update_selection_1
'name {0}'.format(' '.join(self.donors)))
File "/home/amal/anaconda3/lib/python3.7/site-packages/MDAnalysis/core/groups.py", line 2387, in select_atoms
selections[0].apply(self))
File "/home/amal/anaconda3/lib/python3.7/site-packages/MDAnalysis/core/selection.py", line 531, in apply
mask |= getattr(group, self.field) == val
File "/home/amal/anaconda3/lib/python3.7/site-packages/MDAnalysis/core/groups.py", line 1823, in __getattr__
cls=self.__class__.__name__, attr=attr))
AttributeError: AtomGroup has no attribute names
############ What am I looking for
How would I select the atoms for hydrogen bond calculation?
By the way, Lammps topology file does not have atom names, and I tested the command "u.select_atoms('type 2')" which
works perfectly.
Best regards