-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix quaternion default initialisation #300
Fix quaternion default initialisation #300
Conversation
b5128cf
to
e11f7f1
Compare
Still failing the internalGenerator testcase - will need another look at this |
e11f7f1
to
4fe755b
Compare
@HomesGH Tests passing and ready for review. |
To be honest, I still don't see the benefit of changing it to the invalid Q(0,0,0,0). Is it just performance-wise why we don't choose the identity Q(1,0,0,0)? There is much worse performing code, eg. the check for duplicated IDs. For me, it would be ok to initialize the Quaternion class itself with 0,0,0,0, but all molecules should always carry valid data (Q(0,0,0,0) is invalid). Therefore, I see two options:
Furthermore, I can not guarantee that there are no hidden molecule initializations somewhere in the code. Those could break when using invalid data for initialization. |
These lines could also cause trouble, even though, they should not be relevant in theory. Also the I can not guarantee that I found all |
I address the concern about missing initialization values by changing the Molecule constructor to require all parameters to be passed - removing default values from the interface. This should catch all places during compile time! |
This is ok-ish for me. Even though, always having to set all of those zeros including a single |
@cniethammer I did a benchmark using the The second two columns are based on the master branch and just the default values in the constructor were changed.
There is basically no difference since deviations are within uncertainties (I conducted 5 independent simulation runs each). I would recommend reverting all the changes in this PR where the default values of the constructors were deleted and just changing the default values to be (1,0,0,0) in the molecule classes. In the quaternion constructor, we could choose either (1,0,0,0) or (0,0,0,0). |
…rameters Signed-off-by: Christoph Niethammer <[email protected]>
Orientation of Molecules in ls1 is represented by normalied Quaternions. The current initalisation values for the Quaternions is not normalized, at the moment Therefore change it to 1w + 0i + 0j + 0k. Signed-off-by: Christoph Niethammer <[email protected]>
The current initialization is not representing a pure rotation as it is not normalized. Change this to the identity quaternion 1 + 0i + 0j + 0k, i.e., Q(w = 1, x = 0, y = 0, z = 0), to be consistent with the needs of the Molecule interface. Note: Initialisation to Q(0,0,0,0) might show some performance improvement over Q(1,0,0,0) but tests showed neglectable influence on the overall performance of ls1. So we stay with the safe and convenient solution. Signed-off-by: Christoph Niethammer <[email protected]>
be75df9
to
0a02250
Compare
OK, I updated the PR accordingly, so Q(w=1, x=0,y=0,z=0) is the default for Quaternion and Molecule initialisation. |
Look good! We could just fix the line breaks in the AutoPas molecule class so that all quaternions are on the same line. |
That's what the current clang-format style will result in. So I would keep it as is. If we want this kind of special formating and keep it persistent with the upcoming code reformating it will require disabling clang-format with some comments/commands... also in the other places. Let me know if I should include this as a precedential case... |
I see. Than we can just keep it as it is. |
This PR reverts changes to the defaults in the constructor made in 20a6b8f back to 0 + 0i + 0j + 0k (Q(w=0, x=0, y=0, z=0)) to address #291. The issue was first mentioned in #255
This has been tested using