Sire icon indicating copy to clipboard operation
Sire copied to clipboard

Cell representation in DCDFile.py

Open lohedges opened this issue 5 years ago • 2 comments

When adding support for triclinic simulation boxes with SOMD I needed to modify DCDFile.py. In the file I noticed that periodic boxes are written to file with:

boxSize = space.dimensions()
file.write(struct.pack('<i6di', 48, boxSize[0], 0, boxSize[1], 0, 0, boxSize[2], 48))

According the specification described at this MDAnalysis page, the format should be [A, gamma, B, beta, alpha, C], where A, B, C are the magnitudes of the cell vectors, and alpha, beta, and gamma are the angles between the axes: BC, AC, and AB. If correct, should the Python code above not read:

boxSize = space.dimensions()
file.write(struct.pack('<i6di', 48, boxSize[0], 90, boxSize[1], 90, 90, boxSize[2], 48))

(I used the specification described by MDAnalysis when writing out triclinic cell information.)

Perhaps this doesn't matter for the purposes for which you are using DCD files, or perhaps it is assumed that the space is orthorhombic when alpha, beta, and gamma are all zero.

lohedges avatar Sep 02 '20 09:09 lohedges

Hi @jmichel80, any comment on this? It would be good to update this for consistency with the TriclinicBox code if okay.

lohedges avatar Nov 04 '20 12:11 lohedges

Hi @lohedges,

I honestly don't know. We mostly visualise the DCD files in VMD, or process them via tools like MDTraj. There is some code in Nautilus.py that updates a Sire system from info read in a DCD file, but the angles are ignored. I haven't noticed something odd in the past. Could you verify that DCD files generated after updating the code to match MDAnalysis specs and see whether that affects visualisation in VMD ? The issue reported here doesn't fill me with confidence as it looks like different conventions are used by different codes...

jmichel80 avatar Nov 04 '20 13:11 jmichel80