Skip to content

Commit 6297fb3

Browse files
authored
Merge pull request #1825 from glotzerlab/fix-brownian-torque
fix Brownian integrators when using anisotropic interactions and zeroing out elements of the moment of inertia tensor
2 parents 9f19af0 + a1d7435 commit 6297fb3

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

hoomd/md/TwoStepBD.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,20 @@ void TwoStepBD::integrateStepOne(uint64_t timestep)
182182
bf_torque.z = NormalDistribution<Scalar>(sigma_r.z)(rng);
183183

184184
if (x_zero)
185+
{
185186
bf_torque.x = 0;
187+
t.x = 0;
188+
}
186189
if (y_zero)
190+
{
187191
bf_torque.y = 0;
192+
t.y = 0;
193+
}
188194
if (z_zero)
195+
{
189196
bf_torque.z = 0;
197+
t.z = 0;
198+
}
190199

191200
// use the damping by gamma_r and rotate back to lab frame
192201
// Notes For the Future: take special care when have anisotropic gamma_r

hoomd/md/TwoStepBDGPU.cu

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,20 @@ __global__ void gpu_brownian_step_one_kernel(Scalar4* d_pos,
233233
bf_torque.z = NormalDistribution<Scalar>(sigma_r.z)(rng);
234234

235235
if (x_zero)
236+
{
236237
bf_torque.x = 0;
238+
t.x = 0;
239+
}
237240
if (y_zero)
241+
{
238242
bf_torque.y = 0;
243+
t.y = 0;
244+
}
239245
if (z_zero)
246+
{
240247
bf_torque.z = 0;
248+
t.z = 0;
249+
}
241250

242251
// use the damping by gamma_r and rotate back to lab frame
243252
// For Future Updates: take special care when have anisotropic gamma_r

hoomd/md/TwoStepRATTLEBD.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,20 @@ template<class Manifold> void TwoStepRATTLEBD<Manifold>::integrateStepOne(uint64
331331
bf_torque.z = NormalDistribution<Scalar>(sigma_r.z)(rng);
332332

333333
if (x_zero)
334+
{
334335
bf_torque.x = 0;
336+
t.x = 0;
337+
}
335338
if (y_zero)
339+
{
336340
bf_torque.y = 0;
341+
t.y = 0;
342+
}
337343
if (z_zero)
344+
{
338345
bf_torque.z = 0;
346+
t.z = 0;
347+
}
339348

340349
// use the d_invamping by gamma_r and rotate back to lab frame
341350
// Notes For the Future: take special care when have anisotropic gamma_r

hoomd/md/TwoStepRATTLEBDGPU.cuh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,20 @@ __global__ void gpu_rattle_brownian_step_one_kernel(Scalar4* d_pos,
291291
bf_torque.z = NormalDistribution<Scalar>(sigma_r.z)(rng);
292292

293293
if (x_zero)
294+
{
294295
bf_torque.x = 0;
296+
t.x = 0;
297+
}
295298
if (y_zero)
299+
{
296300
bf_torque.y = 0;
301+
t.y = 0;
302+
}
297303
if (z_zero)
304+
{
298305
bf_torque.z = 0;
306+
t.z = 0;
307+
}
299308

300309
// use the damping by gamma_r and rotate back to lab frame
301310
// For Future Updates: take special care when have anisotropic gamma_r

0 commit comments

Comments
 (0)