IForceProvider::calculateForces has a
gmx::ForceProviderOutput as a parameter where I should update the forces of relevant atoms.
Well. We have to update the
ForceWithVirial, when the
How to calculate the virial? Is there a sample code for that calculation?
The virial is formula (28) on this page:
That is what you need to compute and to add to the virial matrix.
One way is to increment the forces of the relevant atoms with
Then, compute the virial contribution of those atoms and forces with a local variable
Then, add this matrix
vir to the global virial through
forceProviderOutput->forceWithVirial_.addVirialContribution(vir); which takes into account the boolean