I have recently noticed a minor bug in AutoDock Vina that also reproduces in smina under specific conditions.
Dependent on the compiler, with which an executable was built, the output generated with the same seed may be different.
The problem is in the qt random_orientation(rng& generator)
function from the quaternion code https://sourceforge.net/p/smina/code/ci/master/tree/src/lib/quaternion.cpp .
This function is used to generate random rotations. However, since the order of function arguments evaluation is undefined (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-order), the random generation of quaternion components that are passed to the quaternion's constructor
can be evaluated in different order. This does not make any sense if the conformation is randomly generated, but with a fixed seed the evaluation order becomes quite important, as we need to obtain the same sequence of random numbers. In my system (Ubuntu 18), arguments are evaluated from left to right if built with clang, and right to left if built with g++, resulting in the same four numbers arranged 'back and forth', and thus in different conformations.
I think it could be nice to fix it with something like
I can't say that standardizing random number generation across different compilers makes my top 1000 list of desired code improvements
:) I personally never use seeds for docking and discovered this issue when preparing a small educational example that was supposed to be fully reproducable. Before building everything on Mac, I did it on my Linux system with clang, and suddenly discovered that the output poses and energies are different.
Last edit: Maria Kadukova 2020-10-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have recently noticed a minor bug in AutoDock Vina that also reproduces in smina under specific conditions.
Dependent on the compiler, with which an executable was built, the output generated with the same seed may be different.
The problem is in the
qt random_orientation(rng& generator)
function from the quaternion code https://sourceforge.net/p/smina/code/ci/master/tree/src/lib/quaternion.cpp .
This function is used to generate random rotations. However, since the order of function arguments evaluation is undefined (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-order), the random generation of quaternion components that are passed to the quaternion's constructor
can be evaluated in different order. This does not make any sense if the conformation is randomly generated, but with a fixed seed the evaluation order becomes quite important, as we need to obtain the same sequence of random numbers. In my system (Ubuntu 18), arguments are evaluated from left to right if built with clang, and right to left if built with g++, resulting in the same four numbers arranged 'back and forth', and thus in different conformations.
I think it could be nice to fix it with something like
to be sure that the results generated with the same seed will be reproducible for any compiler.
Last edit: Maria Kadukova 2020-10-27
I can't say that standardizing random number generation across different compilers makes my top 1000 list of desired code improvements, but it is a simple and safe change.
https://sourceforge.net/p/smina/code/ci/7bd30e0a654cdee1d4935fea4ad1eec8038e63d2/
Thank you!
:) I personally never use seeds for docking and discovered this issue when preparing a small educational example that was supposed to be fully reproducable. Before building everything on Mac, I did it on my Linux system with clang, and suddenly discovered that the output poses and energies are different.
Last edit: Maria Kadukova 2020-10-27