From dfcdb61d8764af5a920f6ecb7b56893ffa9e7e54 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Wed, 16 Sep 2020 15:40:04 -0500 Subject: [PATCH] Used existing helper functions to make codes more consise --- src/RIGID/fix_rigid.cpp | 14 ++------------ src/RIGID/fix_rigid_small.cpp | 14 ++------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index aa105d5344..346a9872b5 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -994,12 +994,7 @@ void FixRigid::apply_langevin_thermostat() // convert omega from space frame to body frame - wbody[0] = omega[i][0]*ex_space[i][0] + omega[i][1]*ex_space[i][1] + - omega[i][2]*ex_space[i][2]; - wbody[1] = omega[i][0]*ey_space[i][0] + omega[i][1]*ey_space[i][1] + - omega[i][2]*ey_space[i][2]; - wbody[2] = omega[i][0]*ez_space[i][0] + omega[i][1]*ez_space[i][1] + - omega[i][2]*ez_space[i][2]; + MathExtra::transpose_matvec(ex_space[i],ey_space[i],ez_space[i],omega[i],wbody); // compute langevin torques in the body frame @@ -1012,12 +1007,7 @@ void FixRigid::apply_langevin_thermostat() // convert langevin torques from body frame back to space frame - langextra[i][3] = tbody[0]*ex_space[i][0] + tbody[1]*ey_space[i][0] + - tbody[2]*ez_space[i][0]; - langextra[i][4] = tbody[0]*ex_space[i][1] + tbody[1]*ey_space[i][1] + - tbody[2]*ez_space[i][1]; - langextra[i][5] = tbody[0]*ex_space[i][2] + tbody[1]*ey_space[i][2] + - tbody[2]*ez_space[i][2]; + MathExtra::matvec(ex_space[i],ey_space[i],ez_space[i],tbody,&langextra[i][3]); } } diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 93e9c2050d..5aff1143a3 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -860,12 +860,7 @@ void FixRigidSmall::apply_langevin_thermostat() // convert omega from space frame to body frame - wbody[0] = omega[0]*ex_space[0] + omega[1]*ex_space[1] + - omega[2]*ex_space[2]; - wbody[1] = omega[0]*ey_space[0] + omega[1]*ey_space[1] + - omega[2]*ey_space[2]; - wbody[2] = omega[0]*ez_space[0] + omega[1]*ez_space[1] + - omega[2]*ez_space[2]; + MathExtra::transpose_matvec(ex_space,ey_space,ez_space,omega,wbody); // compute langevin torques in the body frame @@ -878,12 +873,7 @@ void FixRigidSmall::apply_langevin_thermostat() // convert langevin torques from body frame back to space frame - langextra[ibody][3] = tbody[0]*ex_space[0] + tbody[1]*ey_space[0] + - tbody[2]*ez_space[0]; - langextra[ibody][4] = tbody[0]*ex_space[1] + tbody[1]*ey_space[1] + - tbody[2]*ez_space[1]; - langextra[ibody][5] = tbody[0]*ex_space[2] + tbody[1]*ey_space[2] + - tbody[2]*ez_space[2]; + MathExtra::matvec(ex_space,ey_space,ez_space,tbody,&langextra[ibody][3]); } }