[gmx-developers] Re: Python wrapper for libxdr xtc

Roland Schulz roland at utk.edu
Fri Mar 27 23:28:59 CET 2009


Hi,

I just added also trr and noticed that :
- trr read_trr doesn't return exdrENDOFFILE but exdrINT when all frames have
been read
- there is no function to test whether the trr has forces/velocities.

I'm happy to do both but I'm not quite sure what the best approach is.

For the EOF: Should we check the fread in xdrstdio_getlong for EOF or is it
ok to assume when the first read of the header is not OK, that it is EOF?
For the test: Should we add an additional function which returns whether the
file contains forces/velocities?

Roland

On Fri, Mar 27, 2009 at 5:17 PM, Roland Schulz <roland at utk.edu> wrote:

> 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
>



-- 
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/f1cc2bfe/attachment.html>


More information about the gromacs.org_gmx-developers mailing list