From 0acc3442aad1f3196ff2fecf28cac43c7a8007b2 Mon Sep 17 00:00:00 2001 From: SchoeniPhlippsn Date: Thu, 20 Jun 2024 10:36:15 -0400 Subject: [PATCH 1/2] fix Brownian integrators when using anisotropic interactions and zeroing out entries of the moment of inertia tensor --- hoomd/md/TwoStepBD.cc | 9 +++++++++ hoomd/md/TwoStepBDGPU.cu | 9 +++++++++ hoomd/md/TwoStepRATTLEBD.h | 9 +++++++++ hoomd/md/TwoStepRATTLEBDGPU.cuh | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/hoomd/md/TwoStepBD.cc b/hoomd/md/TwoStepBD.cc index 4154576a76..025d2a4462 100644 --- a/hoomd/md/TwoStepBD.cc +++ b/hoomd/md/TwoStepBD.cc @@ -182,11 +182,20 @@ void TwoStepBD::integrateStepOne(uint64_t timestep) bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) + { bf_torque.x = 0; + t.x = 0; + } if (y_zero) + { bf_torque.y = 0; + t.y = 0; + } if (z_zero) + { bf_torque.z = 0; + t.z = 0; + } // use the damping by gamma_r and rotate back to lab frame // Notes For the Future: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepBDGPU.cu b/hoomd/md/TwoStepBDGPU.cu index 43aea29bff..f90cfbda26 100644 --- a/hoomd/md/TwoStepBDGPU.cu +++ b/hoomd/md/TwoStepBDGPU.cu @@ -233,11 +233,20 @@ __global__ void gpu_brownian_step_one_kernel(Scalar4* d_pos, bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) + { bf_torque.x = 0; + t.x = 0; + } if (y_zero) + { bf_torque.y = 0; + t.y = 0; + } if (z_zero) + { bf_torque.z = 0; + t.z = 0; + } // use the damping by gamma_r and rotate back to lab frame // For Future Updates: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepRATTLEBD.h b/hoomd/md/TwoStepRATTLEBD.h index 45765d546c..d2a5e64aa5 100644 --- a/hoomd/md/TwoStepRATTLEBD.h +++ b/hoomd/md/TwoStepRATTLEBD.h @@ -331,11 +331,20 @@ template void TwoStepRATTLEBD::integrateStepOne(uint64 bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) + { bf_torque.x = 0; + t.x = 0; + } if (y_zero) + { bf_torque.y = 0; + t.y = 0; + } if (z_zero) + { bf_torque.z = 0; + t.z = 0; + } // use the d_invamping by gamma_r and rotate back to lab frame // Notes For the Future: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepRATTLEBDGPU.cuh b/hoomd/md/TwoStepRATTLEBDGPU.cuh index d1e4af65c4..179d90ccd0 100644 --- a/hoomd/md/TwoStepRATTLEBDGPU.cuh +++ b/hoomd/md/TwoStepRATTLEBDGPU.cuh @@ -291,11 +291,20 @@ __global__ void gpu_rattle_brownian_step_one_kernel(Scalar4* d_pos, bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) + { bf_torque.x = 0; + t.x = 0; + } if (y_zero) + { bf_torque.y = 0; + t.y = 0; + } if (z_zero) + { bf_torque.z = 0; + t.z = 0; + } // use the damping by gamma_r and rotate back to lab frame // For Future Updates: take special care when have anisotropic gamma_r From a1d743535ad9fe32b67218efc482e4bb99655e3b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 01:11:54 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- hoomd/md/TwoStepBD.cc | 12 ++++++------ hoomd/md/TwoStepBDGPU.cu | 12 ++++++------ hoomd/md/TwoStepRATTLEBD.h | 12 ++++++------ hoomd/md/TwoStepRATTLEBDGPU.cuh | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/hoomd/md/TwoStepBD.cc b/hoomd/md/TwoStepBD.cc index 025d2a4462..c3ba7cc71e 100644 --- a/hoomd/md/TwoStepBD.cc +++ b/hoomd/md/TwoStepBD.cc @@ -182,20 +182,20 @@ void TwoStepBD::integrateStepOne(uint64_t timestep) bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) - { + { bf_torque.x = 0; t.x = 0; - } + } if (y_zero) - { + { bf_torque.y = 0; t.y = 0; - } + } if (z_zero) - { + { bf_torque.z = 0; t.z = 0; - } + } // use the damping by gamma_r and rotate back to lab frame // Notes For the Future: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepBDGPU.cu b/hoomd/md/TwoStepBDGPU.cu index f90cfbda26..56cc5f69c1 100644 --- a/hoomd/md/TwoStepBDGPU.cu +++ b/hoomd/md/TwoStepBDGPU.cu @@ -233,20 +233,20 @@ __global__ void gpu_brownian_step_one_kernel(Scalar4* d_pos, bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) - { + { bf_torque.x = 0; t.x = 0; - } + } if (y_zero) - { + { bf_torque.y = 0; t.y = 0; - } + } if (z_zero) - { + { bf_torque.z = 0; t.z = 0; - } + } // use the damping by gamma_r and rotate back to lab frame // For Future Updates: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepRATTLEBD.h b/hoomd/md/TwoStepRATTLEBD.h index d2a5e64aa5..7f1a7e10a4 100644 --- a/hoomd/md/TwoStepRATTLEBD.h +++ b/hoomd/md/TwoStepRATTLEBD.h @@ -331,20 +331,20 @@ template void TwoStepRATTLEBD::integrateStepOne(uint64 bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) - { + { bf_torque.x = 0; t.x = 0; - } + } if (y_zero) - { + { bf_torque.y = 0; t.y = 0; - } + } if (z_zero) - { + { bf_torque.z = 0; t.z = 0; - } + } // use the d_invamping by gamma_r and rotate back to lab frame // Notes For the Future: take special care when have anisotropic gamma_r diff --git a/hoomd/md/TwoStepRATTLEBDGPU.cuh b/hoomd/md/TwoStepRATTLEBDGPU.cuh index 179d90ccd0..4ae295a21d 100644 --- a/hoomd/md/TwoStepRATTLEBDGPU.cuh +++ b/hoomd/md/TwoStepRATTLEBDGPU.cuh @@ -291,20 +291,20 @@ __global__ void gpu_rattle_brownian_step_one_kernel(Scalar4* d_pos, bf_torque.z = NormalDistribution(sigma_r.z)(rng); if (x_zero) - { + { bf_torque.x = 0; t.x = 0; - } + } if (y_zero) - { + { bf_torque.y = 0; t.y = 0; - } + } if (z_zero) - { + { bf_torque.z = 0; t.z = 0; - } + } // use the damping by gamma_r and rotate back to lab frame // For Future Updates: take special care when have anisotropic gamma_r