No fragments AttributeError

565 views
Skip to first unread message

Marco Di Gennaro

unread,
May 18, 2021, 5:23:19 AM5/18/21
to MDnalysis discussion
Dear all, 

I am trying to unwrap my atoms and I get two errors:

  >> NoDataError: AtomGroup.fragments not available; this requires bonds 
  >> ...
  >> AttributeError: ... has no fragments 

How did I get here:
  • I am simulating a salt into a liquid solvent  (namely TFSI+ and diglyme)
  • both molecules pdb files, as well as the relative force field were downloaded from LigParGen. I added the force field to oplsaa.ff 
  • I am renaming the fragments with arbitrary names
  • Solvent was multiplied with "gmx insert-molecules" to assure a good initial pressure
  • The pdb file, centered in the cubic box does unwrap. 
  • The problem arises when I solvate the salt into the solvent, therefore I guess the problem is in my diglyme
How can I imposes bonds on a molecule? Or I just have to define fragments, and how to do so? Or is it just a gromacs error?
Below, you can find the commands which I have followed and the full error.
Thank you

Marco 
"""
gro =  'em.gro'
trj = 'em.trr'

u = mda.Universe(gro, trj)
transformations.unwrap(u.atoms)
""" 

--------------------------------------------------------------------------- NoDataError Traceback (most recent call last) ~/anaconda3/lib/python3.8/site-packages/MDAnalysis/transformations/wrap.py in unwrap(ag) 136  try: --> 137  ag.fragments 138  except AttributeError:~/anaconda3/lib/python3.8/site-packages/MDAnalysis/core/groups.py in __getattr__(self, attr) 2329  raise NoDataError('This Universe has no coordinates') -> 2330         return super(AtomGroup, self).__getattr__(attr) 2331 ~/anaconda3/lib/python3.8/site-packages/MDAnalysis/core/groups.py in __getattr__(self, attr) 598  else: --> 599  return super(GroupBase, self).__getattr__(attr) 600 ~/anaconda3/lib/python3.8/site-packages/MDAnalysis/core/groups.py in __getattr__(self, attr) 377 'this requires {topattr}') --> 378 raise NoDataError(err.format(selfcls=selfcls, 379 attrname=attrname,NoDataError: AtomGroup.fragments not available; this requires bonds During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) <ipython-input-40-ca67e8253a63> in <module> 12 13 u = mda.Universe(gro, trj) ---> 14 transformations.unwrap(u.atoms) ~/anaconda3/lib/python3.8/site-packages/MDAnalysis/transformations/wrap.py in unwrap(ag) 137 ag.fragments 138except AttributeError: --> 139  raise AttributeError("{} has no fragments".format(ag)) 140141  def wrapped(ts): AttributeError: <AtomGroup [<Atom 1: O00 of type O of resname TFS, resid 1 and segid SYSTEM>, <Atom 2: S01 of type S of resname TFS, resid 1 and segid SYSTEM>, <Atom 3: O02 of type O of resname TFS, resid 1 and segid SYSTEM>, ..., <Atom 934: H0M of type H of resname DIG, resid 41 and segid SYSTEM>, <Atom 935: H0N of type H of resname DIG, resid 41 and segid SYSTEM>, <Atom 936: LI of type LI of resname LI, resid 42 and segid SYSTEM>]> has no fragments


------------------------------------
Marco Di Gennaro, Ph.D.
Toyota Motor Europe NV/SA
Technical Center
Hoge Wei 33
B- 1930 Zaventem
Belgium



Oliver Beckstein

unread,
May 18, 2021, 5:36:19 AM5/18/21
to mdnalysis-discussion
Hi Marco,

Welcome to MDAnalysis.

At first glance the problem comes from the fact that PDB files do not contain bond information. But connectivity is necessary for unwrapping as molecules. If you have a TPR file (it sounds as if you’re using GROMACS) then load from the TPR (which contains bonds) instead of the PDB:

u = mda.Universe(tpr, trj)

and then try again.

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 view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/fa33a726-4a0d-4a08-ae3a-d098af83064en%40googlegroups.com.

--
Oliver Beckstein (he/his/him)







Marco Di Gennaro

unread,
May 21, 2021, 6:13:18 AM5/21/21
to MDnalysis discussion
Dear Oliver,

thank you for the explanation.
For the record all gmx 2021 versions gave this "Error: Your tpx version is 122, which this parser does not support, yet"
I had to go back to gmx version 2020.6 to have this working

Best regards,
Marco

irfan....@googlemail.com

unread,
May 21, 2021, 6:16:02 AM5/21/21
to MDnalysis discussion
> For the record all gmx 2021 versions gave this "Error: Your tpx version is 122, which this parser does not support, yet"
Support for 2021 TPR files isn't included in the current release of MDAnalysis, it'll be released in the upcoming 2.0.0 version.
Reply all
Reply to author
Forward
0 new messages