dimchris / mdanalysis

Automatically exported from code.google.com/p/mdanalysis
0 stars 0 forks source link

Support for Gromacs trr velocities! #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be very nice to add a support for velocities in Gromacs's .trr file.

I think it is not so import to have a low-level binding - as it is - to be able 
to to load the velocities.

Original issue reported on code.google.com by kheyfbo...@gmail.com on 19 Jan 2012 at 12:38

GoogleCodeExporter commented 9 years ago
How would you want to access the velocities? E.g. similar to coordinates()

  x = atoms.coordinates()
  v = atoms.velocities()    # like this?

Original comment by orbeckst on 22 Jan 2012 at 9:49

GoogleCodeExporter commented 9 years ago
from MDAnalysis import Universe
from MDAnalysis.tests.datafiles import GRO,TRR
universe = Universe("bafx_membrane.gro", "traj.trr")
universe.atoms.coordinates()
universe.atoms.velocities()

Also selectAtoms have the pos method:
universe.selectAtoms("name NC1")[0].pos
it should also have a vel one.

Also trajectory. This:
universe.trajectory[0][0]
gives positions of the first atom of the first frame. It should give 
positions&velosities of the first frame.

Also all positions in MDAnalisis are multiplied by 10. Please check it - load a 
gro file - and check the coordinates as it appears in MDAnalisis and - the 
actual gro file coordinates (I'm uploading gro and small trr file).

Also I would like to make $5 donation. Where is a PayPal button?

Original comment by kheyfbo...@gmail.com on 23 Jan 2012 at 4:07

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, thanks for the feedback. We'll see if we can add access to the velocities. 
I won't be able to do it in the next few days but I or someone else will get to 
it; feel free to leave a message here if you think that no progress has been 
made.

I can't promise that universe.trajectory[0][0] will also give the velocities 
because that might break existing scripts that rely on this being a simple 1D 
array.

The reason why coordinates multiplied by ten compared to the gro file is 
because MDAnalysis native units are Ångström for length and ps for time. It 
is actually a feature and it allows you to use the same MDAnalysis script for 
the analysis of a Gromacs and a CHARMM trajectory.

If you really do not want this behaviour then you can set a flag to switch it 
off (see 
http://mdanalysis.googlecode.com/git/package/doc/html/documentation_pages/core/i
nit.html):

  MDAnalysis.core.flags['convert_gromacs_lengths'] = False

Finally, thanks for offering a donation but we don't really have a facility to 
accept it. What helps us most is when you give us feedback (on the mailing list 
or through the issue tracker) or send improvements to the code and when you 
cite our paper in published work. 

Original comment by orbeckst on 26 Jan 2012 at 7:14

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 4be4cb5612a6.

Original comment by orbeckst on 11 Feb 2012 at 10:34

GoogleCodeExporter commented 9 years ago
I added the feature:

- NEW attribute: Atom.velocity
- NEW method: AtomGroup.velocities()

Not implemented: trajectory[0][0] still only returns the coordinates; anything 
else would break existing scripts. See the log notice for details.

Note that velocities are automatically converted to MDAnalysis units (i.e. from 
Gromacs nm/ps to Ångström/ps in MDAnalysis). When writing a TRR, the 
velocities are also automatically converted to nm/ps.

Original comment by orbeckst on 11 Feb 2012 at 10:38

GoogleCodeExporter commented 9 years ago
I've cloned the git-repo and have checked the AtomGroup.velocities() - it works!

It is amaizing that "When writing a TRR, the velocities are also automatically 
converted to nm/ps.".

I'll site Your work in a paper, and will send You a link. Hopefully - within a 
year...

Original comment by kheyfbo...@gmail.com on 11 Feb 2012 at 4:46

GoogleCodeExporter commented 9 years ago
I am glad it works and good luck with your work – I'll look forward to your 
paper.

Original comment by orbeckst on 11 Feb 2012 at 7:09

GoogleCodeExporter commented 9 years ago
p.s.: Fixed a bug with revision 092647cacb – I hope that the final 0.7.5 will 
be all working fine.

Original comment by orbeckst on 11 Feb 2012 at 8:41