Skip to content

Commit

Permalink
Add comment to explain why BoxForce subtracts the neighbor particle f…
Browse files Browse the repository at this point in the history
…orce
  • Loading branch information
LSchwiebert committed Sep 22, 2024
1 parent 1dbb53d commit 71a0c0c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/CalculateEnergy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ CalculateEnergy::BoxForce(SystemPotential potential, XYZArray const &coords,
forceLJ = virComponents * forcefield.particles->CalcVir(
distSq, particleKind[currParticle],
particleKind[nParticle], lambdaVDW);
// Negate the values for nParticle to reverse the orientation of
// the virComponents vector, since it should point in the opposite
// direction.
aForcex[currParticle] += forceLJ.x + forceReal.x;
aForcey[currParticle] += forceLJ.y + forceReal.y;
aForcez[currParticle] += forceLJ.z + forceReal.z;
Expand Down

0 comments on commit 71a0c0c

Please sign in to comment.