From fca4f7c4425c8b071d89a59ec7e039019767496e Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 20 Mar 2024 20:56:28 +0100 Subject: [PATCH 1/3] Align names of parameters in Molecule constructors with Quaternion parameters Signed-off-by: Christoph Niethammer --- src/molecules/AutoPasSimpleMolecule.cpp | 4 ++-- src/molecules/AutoPasSimpleMolecule.h | 4 ++-- src/molecules/FullMolecule.cpp | 4 ++-- src/molecules/FullMolecule.h | 2 +- src/molecules/MoleculeRMM.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/molecules/AutoPasSimpleMolecule.cpp b/src/molecules/AutoPasSimpleMolecule.cpp index 2968490833..59e4177f33 100644 --- a/src/molecules/AutoPasSimpleMolecule.cpp +++ b/src/molecules/AutoPasSimpleMolecule.cpp @@ -12,8 +12,8 @@ Component* AutoPasSimpleMolecule::_component = nullptr; Quaternion AutoPasSimpleMolecule::_quaternion = Quaternion(1.0, 0.0, 0.0, 0.0); AutoPasSimpleMolecule::AutoPasSimpleMolecule(unsigned long id, Component* component, double rx, double ry, double rz, - double vx, double vy, double vz, double q0, double q1, double q2, - double q3, double Dx, double Dy, double Dz) + double vx, double vy, double vz, double qw, double qx, double qy, + double qz, double Dx, double Dy, double Dz) : autopas::ParticleFP64({rx, ry, rz}, {vx, vy, vz}, id) { if (_component == nullptr) { _component = component; diff --git a/src/molecules/AutoPasSimpleMolecule.h b/src/molecules/AutoPasSimpleMolecule.h index 561c0c7bbd..db57608366 100644 --- a/src/molecules/AutoPasSimpleMolecule.h +++ b/src/molecules/AutoPasSimpleMolecule.h @@ -18,8 +18,8 @@ class AutoPasSimpleMolecule final : public MoleculeInterface, public autopas::ParticleFP64 { public: explicit AutoPasSimpleMolecule(unsigned long id = 0, Component* component = nullptr, double rx = 0., double ry = 0., - double rz = 0., double vx = 0., double vy = 0., double vz = 0., double q0 = 1., - double q1 = 1., double q2 = 0., double q3 = 0., double Dx = 0., double Dy = 0., + double rz = 0., double vx = 0., double vy = 0., double vz = 0., double qw = 1., + double qx = 1., double qy = 0., double qz = 0., double Dx = 0., double Dy = 0., double Dz = 0.); AutoPasSimpleMolecule(const AutoPasSimpleMolecule& m) = default; diff --git a/src/molecules/FullMolecule.cpp b/src/molecules/FullMolecule.cpp index 0e263fa77e..2c18287919 100644 --- a/src/molecules/FullMolecule.cpp +++ b/src/molecules/FullMolecule.cpp @@ -11,10 +11,10 @@ FullMolecule::FullMolecule(unsigned long id, Component *component, double rx, double ry, double rz, double vx, double vy, double vz, - double q0, double q1, double q2, double q3, + double qw, double qx, double qy, double qz, double Dx, double Dy, double Dz ) - : _q(q0, q1, q2, q3) { + : _q(qw, qx, qy, qz) { _id = id; _component = component; _r[0] = rx; diff --git a/src/molecules/FullMolecule.h b/src/molecules/FullMolecule.h index 93ba81f58a..014ad5151b 100644 --- a/src/molecules/FullMolecule.h +++ b/src/molecules/FullMolecule.h @@ -25,7 +25,7 @@ class FullMolecule : public MoleculeInterface { FullMolecule(unsigned long id = 0, Component *component = nullptr, double rx = 0., double ry = 0., double rz = 0., double vx = 0., double vy = 0., double vz = 0., - double q0 = 1., double q1 = 1., double q2 = 0., double q3 = 0., + double qw = 1., double qx = 1., double qy = 0., double qz = 0., double Dx = 0., double Dy = 0., double Dz = 0. ); FullMolecule(const FullMolecule& m); diff --git a/src/molecules/MoleculeRMM.h b/src/molecules/MoleculeRMM.h index 56d45b861c..8ab1c1ce0a 100644 --- a/src/molecules/MoleculeRMM.h +++ b/src/molecules/MoleculeRMM.h @@ -21,8 +21,8 @@ class MoleculeRMM : public MoleculeInterface { MoleculeRMM(unsigned long id = 0, Component *component = nullptr, double rx = 0., double ry = 0., double rz = 0., double vx = 0., double vy = 0., double vz = 0., - double = 0., double = 0., double = 0., double = 0., /*q0, q1, q2, q3*/ - double = 0., double = 0., double = 0. /*Dx, Dy, Dz*/ + double qw = 0., double qx = 0., double qy = 0., double qz = 0., + double Dx = 0., double Dy = 0., double Dz = 0. ) { _state = STORAGE_AOS; _r[0] = rx; From 9c6d0a2ebe1ecc6575afc4e0ff0820eac5233cd7 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 20 Mar 2024 21:27:58 +0100 Subject: [PATCH 2/3] Fix initialization of molecule orientation in internal generator code 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 --- src/molecules/AutoPasSimpleMolecule.h | 2 +- src/molecules/FullMolecule.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/molecules/AutoPasSimpleMolecule.h b/src/molecules/AutoPasSimpleMolecule.h index db57608366..a34a8f4d84 100644 --- a/src/molecules/AutoPasSimpleMolecule.h +++ b/src/molecules/AutoPasSimpleMolecule.h @@ -19,7 +19,7 @@ class AutoPasSimpleMolecule final : public MoleculeInterface, public autopas::Pa public: explicit AutoPasSimpleMolecule(unsigned long id = 0, Component* component = nullptr, double rx = 0., double ry = 0., double rz = 0., double vx = 0., double vy = 0., double vz = 0., double qw = 1., - double qx = 1., double qy = 0., double qz = 0., double Dx = 0., double Dy = 0., + double qx = 0., double qy = 0., double qz = 0., double Dx = 0., double Dy = 0., double Dz = 0.); AutoPasSimpleMolecule(const AutoPasSimpleMolecule& m) = default; diff --git a/src/molecules/FullMolecule.h b/src/molecules/FullMolecule.h index 014ad5151b..0395318aa3 100644 --- a/src/molecules/FullMolecule.h +++ b/src/molecules/FullMolecule.h @@ -25,7 +25,7 @@ class FullMolecule : public MoleculeInterface { FullMolecule(unsigned long id = 0, Component *component = nullptr, double rx = 0., double ry = 0., double rz = 0., double vx = 0., double vy = 0., double vz = 0., - double qw = 1., double qx = 1., double qy = 0., double qz = 0., + double qw = 1., double qx = 0., double qy = 0., double qz = 0., double Dx = 0., double Dy = 0., double Dz = 0. ); FullMolecule(const FullMolecule& m); From 0a02250a858088a7c12a7e93ca367cda0c7114b2 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 20 Mar 2024 20:52:09 +0100 Subject: [PATCH 3/3] Change default initialization for Quaternions to 1 + 0i + 0j + 0k 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 --- src/molecules/Quaternion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/molecules/Quaternion.h b/src/molecules/Quaternion.h index c537c3968a..e7c65161fa 100644 --- a/src/molecules/Quaternion.h +++ b/src/molecules/Quaternion.h @@ -9,7 +9,7 @@ */ class Quaternion { public: - Quaternion(double qw = 1., double qx = 1., double qy = 0., double qz = 0.) + Quaternion(double qw = 1., double qx = 0., double qy = 0., double qz = 0.) : m_qw(qw), m_qx(qx), m_qy(qy), m_qz(qz) { }