Cell representation in DCDFile.py
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.
Hi @jmichel80, any comment on this? It would be good to update this for consistency with the TriclinicBox code if okay.
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...