dimchris / mdanalysis

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

Unitcell information is incorrect when writing DCD files #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed that unit cell information was not correct in dcd files.  

This occurs because dcd files use unitcell information in an unusual order. I 
believe that MDanalysis uses this unusual order internally, but then it is 
transformed into a more conventional order using the dimensions property, which 
is used by the convert_dimensions_to_unitcell method in the base.Writer class 
in coordinates/base.py. 

However, it is not converted back to the special dcd order again before writing 
to dcd files. One way of correcting for this is to override the 
convert_dimensions_to_unitcell method in the DCDWriter class in 
coordinates/DCD.py:

def convert_dimensions_to_unitcell(self, ts):
        """Read dimensions from timestep *ts* and return appropriate unitcell"""
        lengths, angles = ts.dimensions[:3], ts.dimensions[3:]
        self.convert_pos_to_native(lengths)
        return numpy.array((lengths[0],angles[0],lengths[1],angles[1],angles[2],lengths[2]))

Original issue reported on code.google.com by tmkco...@gmail.com on 15 Nov 2012 at 4:35

GoogleCodeExporter commented 9 years ago

Original comment by orbeckst on 15 Nov 2012 at 3:47

GoogleCodeExporter commented 9 years ago
This has been fixed in the latest development release in 
07a1f30b52c4838eaa1abf71cb6ffebfc08c8a09 and a test case is included 
(test_coordinates:TestNCDF2DCD).

Please test the latest development release 
https://code.google.com/p/mdanalysis/wiki/DevelopmentBranch and reopen this 
issue if the problem persists.

Thanks,
Oliver

Original comment by orbeckst on 15 Nov 2012 at 3:59