[gmx-developers] Python wrapper for libxdr xtc

Roland Schulz roland at utk.edu
Fri Mar 27 22:17:17 CET 2009


Hi,

I wrote a small python wrapper around the new libxdr.
Nothing has to be compile. It just uses the library.
It requires libxdr as shared library (the library has to be in the LD_PATH)
and it requires ctypes (part of python 2.5 seperate available for older
python)

With it one can print the 1st x-coordinates of each frame by:
from xdrfile import *
x=xdrfile("test.xtc")
for f in x:
  print f.x[0][0]

(all possible errors are raised as python IO exceptions)

Can I commit it to cvs to the src folder? It would not generate any
dependencies. I wouldn't add it to the Makefile.

attached is the wrapper and the test routine.

It could be extended (I don't use numpy yet and it can't do trr yet). But I
think it is already useful like it is.

Roland


-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20090327/57b75ae1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdrfile.py
Type: text/x-python
Size: 1264 bytes
Desc: not available
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20090327/57b75ae1/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdrfile_test.py
Type: text/x-python
Size: 1056 bytes
Desc: not available
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20090327/57b75ae1/attachment-0001.py>


More information about the gromacs.org_gmx-developers mailing list