md analysis query

31 views
Skip to first unread message

Viswanath Vittaladevaram

unread,
May 31, 2022, 12:06:42 PMMay 31
to mdnalysis-...@googlegroups.com

Hi,



I am trying to use this command below


python traj_residue-z.py -g fnIII-12_SAMch3_T298_0.gro -x fnIII-12_SAMch3_T298_pbc.xtc -o1 fnIII-12_SAMch3.protein-z -o2 fnIII-12_SAMch3.res-z --nres 92


I got this error! could you help on this,thanks


/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MDAnalysis/coordinates/XDR.py:196: UserWarning: Reload offsets from trajecto

 ctime or size or n_atoms did not match

  warnings.warn("Reload offsets from trajectory\n "

Traceback (most recent call last):

  File "traj_residue-z.py", line 32, in <module>

    u=MDAnalysis.Universe(groFile,xtcFile)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MDAnalysis/core/universe.py", line 337, in __init__

    self.load_new(coordinatefile, **kwargs)

  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MDAnalysis/core/universe.py", line 613, in load_new

    trj_n_atoms=self.trajectory.n_atoms))

ValueError: The topology and XTC trajectory files don't have the same number of atoms!

Topology number of atoms 47333

Trajectory: fnIII-12_SAMch3_T298_pbc.xtc Number of atoms 1416

Lily Wang

unread,
May 31, 2022, 12:09:51 PMMay 31
to mdnalysis-...@googlegroups.com
Hi Viswanath,

It looks like you’ve post-processed your XTC file to strip out some atoms, e.g. the solvent. The XTC file has 1416 atoms but the GRO file has 47333 atoms. While I don’t know what’s in your script, it looks like you need to either:

  • Use a XTC file with all the atoms, or
  • Process your GRO file to strip out the same atoms as in the XTC

Hope that helps.

Cheers,
Lily

--
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/CAEQtsZjye4_ZMgyyUeRoSCv9myPJXgi84yf5Fn%2BdixX-KAN0_A%40mail.gmail.com.

Viswanath Vittaladevaram

unread,
May 31, 2022, 12:20:56 PMMay 31
to mdnalysis-...@googlegroups.com
Hi,

Thanks for your reply. Did you mean instead pbc.xtc , should I need to use .xtc file in command line?

Regards,
Viswanath.V

Lily Wang

unread,
May 31, 2022, 12:25:08 PMMay 31
to mdnalysis-...@googlegroups.com
Hi Viswanath,

Quite possibly, if you stripped atoms out in pbc.xtc. However, you would be the best person to know what to do here, as we don’t know what is in your XTC files. If you use gmx check -f my_xtc_file.xtc, you can check how many atoms are in them.

Cheers,
Lily

Viswanath Vittaladevaram

unread,
May 31, 2022, 1:56:35 PMMay 31
to mdnalysis-...@googlegroups.com
Hi.
I checked with .xtc file and it is matching with gro file. Then I changed the command line and it worked.

Thanks,
Viswnanath.V



Viswanath Vittaladevaram

unread,
Jun 15, 2022, 8:53:28 AMJun 15
to MDnalysis discussion

python traj_cv.py -g fnIII-12_SAMch3_T298_0.gro -x fnIII-12_SAMch3_T298_pbc.xtc -o1 fnIII-12_SAMch3.protein-z -o2 fnIII-12_SAMch3.res-z --nres 92


I got this error! could you help on this


/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MDAnalysis/coordinates/XDR.py:196: UserWarning: Reload offsets from trajecto

 ctime or size or n_atoms did not match

  warnings.warn("Reload offsets from trajectory\n "



Earlier I did using other python file and it showed some error and was able to load again showing same number of atoms for gro and xtc files. But this time error is just showing as mentioned above and I don't see further!

Oliver Beckstein

unread,
Jun 15, 2022, 7:14:39 PMJun 15
to mdnalysis-discussion
Hi Viswanath,

If you only saw the “Reload offsets” warning and everything worked as expected then there is no problem. It just meant that MDAnalysis did not know what was in your XTC file (maybe it was moved or renamed) and it had to read it again and build the index of all frames. (The offset files are explained in the note for XDRReaders https://docs.mdanalysis.org/stable/documentation_pages/coordinates/XDR.html#MDAnalysis.coordinates.XDR.XDRBaseReader). 

Rebuilding the offset file takes time so if this happens regularly then you should try to figure out what happens to your offset file (a hidden file ending in _offsets.npz) and your trajectory. One possible problem occurs if the directory in which the XTC resides is not writable. Then the offsets are only created in memory and the next time you run your script, the offsets have to be rebuild again, instead of being read from the offset file.

Oliver



--
Oliver Beckstein (he/his/him)

GitHub: @orbeckst

MDAnalysis – a NumFOCUS fiscally sponsored project





Viswanath Vittaladevaram

unread,
Jun 15, 2022, 7:18:00 PMJun 15
to mdnalysis-...@googlegroups.com
Hi,


Thanks for your reply. 

Earlier I tried running the command and it worked but the format of the file was in xtc.

But this time the file format is in trr.

Is it due to this reason?

With regards,
Viswanath.V

You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/s6gBDAoM9rQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/10F84497-AAF8-4113-BEF3-28A315CD06A1%40mdanalysis.org.

Viswanath Vittaladevaram

unread,
Jun 17, 2022, 12:17:03 PMJun 17
to mdnalysis-...@googlegroups.com
Hi,

Residue number at the end of command was modified and it worked.

Thanks,
Viswanath.V

On Thu, Jun 16, 2022 at 12:14 AM Oliver Beckstein <orbe...@mdanalysis.org> wrote:
You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/s6gBDAoM9rQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/10F84497-AAF8-4113-BEF3-28A315CD06A1%40mdanalysis.org.
Reply all
Reply to author
Forward
0 new messages