Wrap HOOMD Force Computes as collective variables #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am opening this PR to solicit input at an early design stage and track progress. The PR aims to eliminate the need to go through snapshots and expensive device/host copies for computing CVs on the GPU, by allowing them to be computed inside the engine and also the forces to be accumulated there.
The minimal information needed to bias a system in a CV is a constant scaling factor applied to all forces, and the value of the CV itself. The new
CollectiveVariable::ApplyBias
method takes care of this. The new collective variableHOOMDCV
is able to take a user-defined HOOMDmd.force
object and wrap it's C++-side implementation into a SSAGES CV.At this point, the changes only compile, and are most likely not doing anything sensible. Most important missing bit is to call the
HalfStepHook
before HOOMD'scomputeNetForce()
, in addition to afterwards (which is currently the case), so as to be able to bias the force before accumulation.When that is done, the snapshot copying can be optimized out entirely dependent on whether all active CVs have the
modifiesParticleForces()
flag set.