Hydrogen bond analysis issue

198 views
Skip to first unread message

Ryan Melvin

unread,
Apr 23, 2015, 5:45:16 PM4/23/15
to mdnalysis-...@googlegroups.com
I'm new to using MDAnalysis and am having trouble with hydrogen bonds analysis.  Any help would be appreciated

Here's what I'm trying to do:

import MDAnalysis

import MDAnalysis.analysis.hbonds

u = MDAnalysis.Universe('/Users/melvrl13/Documents/RyanM/F10/f10.psf', '/Users/melvrl13/Desktop/foldingPaperWorking/weighted3200.dcd')

h = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(u,'all') #I've also tried variations where I specify more options. I get the same result shown below.

h.run()

I get the following output when using iPython:


---------------------------------------------------------------------------

IndexError                                Traceback (most recent call last)

<ipython-input-5-b01dbff31667> in <module>()

----> 1 h.run()


/Users/melvrl13/anaconda/lib/python2.7/site-packages/MDAnalysis/analysis/hbonds/hbond_analysis.pyc in run(self, **kwargs)

    781             if self.selection1_type in ('donor', 'both'):

    782                 self.logger_debug("Selection 1 Donors <-> Acceptors")

--> 783                 ns_acceptors = NS.AtomNeighborSearch(self._s2_acceptors)

    784                 for i, donor_h_set in self._s1_donors_h.items():

    785                     d = self._s1_donors[i]


/Users/melvrl13/anaconda/lib/python2.7/site-packages/MDAnalysis/KDTree/NeighborSearch.pyc in __init__(self, atom_list, bucket_size)

    185             raise TypeError('atom_list must have a coordinates() method '

    186                             '(eg a AtomGroup resulting from a Selection)')

--> 187         CoordinateNeighborSearch.__init__(self, atom_list.coordinates(), bucket_size=bucket_size)

    188 

    189     def search(self, center, radius, level="A"):


/Users/melvrl13/anaconda/lib/python2.7/site-packages/MDAnalysis/core/AtomGroup.pyc in get_positions(self, ts, copy, dtype)

   1865         """

   1866         if ts is None:

-> 1867             ts = self.universe.trajectory.ts

   1868         return numpy.array(ts[self.indices()], copy=copy, dtype=dtype)

   1869 


/Users/melvrl13/anaconda/lib/python2.7/site-packages/MDAnalysis/core/AtomGroup.pyc in universe(self)

    817         """The universe to which the atoms belong (read-only)."""

    818         try:

--> 819             return self._atoms[0].universe

    820         except AttributeError:

    821             return None


IndexError: list index out of range



Oliver Beckstein

unread,
Apr 23, 2015, 5:54:22 PM4/23/15
to mdnalysis-...@googlegroups.com
Hi Ryan,

I would guess that the H-bond analysis does not find acceptor atoms and creates and empty AtomGroup.

For a start, does your universe contain atoms, e.g.

print(u.atoms.numberOfAtoms())

Are you looking at a protein + water or at something different?

What force field and code did you use to generate the PSF?

Look at http://docs.MDAnalysis.org/documentation_pages/analysis/hbond_analysis.html#detection-of-hydrogen-bonds and see if you can manually select acceptor atoms, e.g.

acceptors = u.selectAtoms("name O or name OH* or name OW or name OD* or name OE* or name ND* or name NE* or name SD or name OG*")
print(len(acceptors))

This should give you an non-empty atomgroup. If this yields and empty atom group, you will have to manually define the atom types for acceptors (and probably also donors) but we'll talk about this when needed ;-)

Oliver
> --
> You received this message because you are subscribed to the Google Groups "MDnalysis discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mdnalysis-discus...@googlegroups.com.
> To post to this group, send email to mdnalysis-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mdnalysis-discussion.
> For more options, visit https://groups.google.com/d/optout.

--
Oliver Beckstein * orbe...@gmx.net
skype: orbeckst * orbe...@gmail.com

Reply all
Reply to author
Forward
0 new messages