michellab / Sire

Sire Molecular Simulations Framework
http://siremol.org
GNU General Public License v3.0
95 stars 26 forks source link

Store original triclinic box vectors to ensure streaming works correctly #389

Closed lohedges closed 2 years ago

lohedges commented 2 years ago

As reported by @xiki-tempula, pickling doesn't work for BioSimSpace systems with a triclinic "space" property. This is because we had forgotten to store the original box vectors used to instantiate the object (not those generated from the various box transformations, e.g. lattice reduction) so the streaming operators didn't work correctly. This would result in a crash when unpickling, due to all box vectors being zero. The error shown is as follows:

_EndTrace__
Exception 'SireMaths::math_error' thrown by the thread 'master'.
Matrix '/ 0, 0, 0 \
| 0, 0, 0 |
\ 0, 0, 0 /' cannot be inverted!
Thrown from FILE: /Users/runner/miniconda3/envs/sire_build/conda-bld/sire_1651855618549/work/corelib/src/libs/SireMaths/matrix.cpp, LINE: 534, FUNCTION: SireMaths::Matrix SireMaths::Matrix::inverse() const