Gromacs
2024.3
|
#include <gromacs/restraint/restraintmdmodule_impl.h>
Provide IForceProvider for RestraintMDModuleImpl.
Adapter class from IForceProvider to IRestraintPotential. Objects of this type are uniquely owned by instances of RestraintMDModuleImpl. The object will dispatch calls to IForceProvider->calculateForces() to the functor managed by RestraintMDModuleImpl.
Public Member Functions | |
RestraintForceProvider ()=delete | |
Can only be constructed when initialized from a restraint. | |
RestraintForceProvider (std::shared_ptr< gmx::IRestraintPotential > restraint, const std::vector< int > &sites) | |
RAII construction with an IRestraintPotential. More... | |
void | calculateForces (const ForceProviderInput &forceProviderInput, ForceProviderOutput *forceProviderOutput) override |
Implement the IForceProvider interface. More... | |
|
explicit |
RAII construction with an IRestraintPotential.
Note, this object must outlive the pointer that will be provided to ForceProviders.
restraint | handle to an object providing restraint potential calculation |
sites | List of atomic site indices |
|
overridevirtual |
Implement the IForceProvider interface.
Update the force array with restraint contribution(s) for local atoms.
RestraintForceProvider is implemented with the assumption that few restraints apply to many atoms. That is, the number of restraints affecting a large number of atoms is small, though there may be several restraints that apply to few atoms each. Under this assumption, it is considered computationally inexpensive to iterate over restraints in an outer loop and iterate over atoms within each restraint. This would be an invalid assumption if, say, several restraints applied to an entire membrane or the entire solvent group.
If the assumption causes performance problems, we can look for a good way to reduce from several restraints in a single pass or a very lightweight way to determine whether a given restraint applies to a given atom. There is also the notion in the pulling code of a limited number of "pull groups" used by the "pull coordinates". The right optimization will depend on how the code is being used.
Call the evaluator(s) for the restraints for the configured sites. Forces are applied to atoms in the first and last site listed. Intermediate sites are used as reference coordinates when the relevant vector between sites is on the order of half a box length or otherwise ambiguous in the case of periodic boundary conditions.
Implements gmx::IForceProvider.