Skip to content

Commit

Permalink
Merge pull request #1825 from glotzerlab/fix-brownian-torque
Browse files Browse the repository at this point in the history
fix Brownian integrators when using anisotropic interactions and zeroing out elements of the moment of inertia tensor
  • Loading branch information
joaander committed Jun 27, 2024
2 parents 9f19af0 + a1d7435 commit 6297fb3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hoomd/md/TwoStepBD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,20 @@ void TwoStepBD::integrateStepOne(uint64_t timestep)
bf_torque.z = NormalDistribution<Scalar>(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
Expand Down
9 changes: 9 additions & 0 deletions hoomd/md/TwoStepBDGPU.cu
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,20 @@ __global__ void gpu_brownian_step_one_kernel(Scalar4* d_pos,
bf_torque.z = NormalDistribution<Scalar>(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
Expand Down
9 changes: 9 additions & 0 deletions hoomd/md/TwoStepRATTLEBD.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,20 @@ template<class Manifold> void TwoStepRATTLEBD<Manifold>::integrateStepOne(uint64
bf_torque.z = NormalDistribution<Scalar>(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
Expand Down
9 changes: 9 additions & 0 deletions hoomd/md/TwoStepRATTLEBDGPU.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,20 @@ __global__ void gpu_rattle_brownian_step_one_kernel(Scalar4* d_pos,
bf_torque.z = NormalDistribution<Scalar>(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
Expand Down

0 comments on commit 6297fb3

Please sign in to comment.