Skip to content

Fix CIF bugs for atoms with funny cell/pbc

Ask Hjorth Larsen requested to merge cif-fix-bad-coords into master

This ensures the following behaviours for writing CIFs:

  • With 3 cell vectors, write CIF with scaled positions
  • With 0 cell vectors, write CIF with Cartesian positions
  • With 1 or 2 cell vectors, issue UserWarning, strip cell/pbc information, and write Cartesian positions

Tests are added for the different cases.

The last case probably had some kind of undefined behaviour.

Also, it was possible to give a cell/pbc combination which would result in Cartesian positions and cell vectors. This is bad because the CIF roundtrip may effectively rotate the cell, so leaving the Cartesian positions invalid. As of this MR, scaled positions and cell vectors should be handled correctly, together.

Closes: #438 (closed)

Edited by Ask Hjorth Larsen

Merge request reports