dimchris / mdanalysis

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

XTCWriter broken #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Initialize Universe
2. Initialize an XTCWriter instance
3. Try to write to the file using XTCWriter.write_next_timestep(ts)

There are two problems here. Firstly, there seems to be a simple code error in 
line 365 of MDAnalysis/coordinates/xdrfile/core.py:

  self.xdrfile = libxdrfile.xdr_open(filename, 'w')

xdr_open needs to be changed to xdrfile_open. Presumably xdr_open was an older 
function which is now deprecated. Couldn't find any other examples of the code 
attempting to call xdr_open, so I don't think there should be any other 
problems caused by that.
(I haven't sorted my svn commit issues yet so haven't made the change myself...)

Second problem is with units conversion. The XTCWriter.units is set to None, 
rather than being set to the correct units. I can get writing to work correctly 
if I set XTCWriter.units manually after initializing the XTCWriter instance, 
i.e.

  XTCWriter.units={'length': 'nm', 'time': 'ps'}

I think this is supposed to happen within the XTCWriter code, but something has 
gone wrong somewhere.

Original issue reported on code.google.com by Danny.Pa...@gmail.com on 3 Aug 2010 at 3:37

GoogleCodeExporter commented 9 years ago
Many thanks, your changes were incorporated in r406.

I also added unit tests for the XTC and TRR writers.

Original comment by orbeckst on 3 Aug 2010 at 6:14