Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::RestraintForceProvider Class Referencefinal

#include <gromacs/restraint/restraintmdmodule_impl.h>

+ Inheritance diagram for gmx::RestraintForceProvider:
+ Collaboration diagram for gmx::RestraintForceProvider:


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...

Constructor & Destructor Documentation

gmx::RestraintForceProvider::RestraintForceProvider ( std::shared_ptr< gmx::IRestraintPotential restraint,
const std::vector< int > &  sites 

RAII construction with an IRestraintPotential.

Note, this object must outlive the pointer that will be provided to ForceProviders.

restrainthandle to an object providing restraint potential calculation
sitesList of atomic site indices

Member Function Documentation

void gmx::RestraintForceProvider::calculateForces ( const ForceProviderInput forceProviderInput,
ForceProviderOutput forceProviderOutput 

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.

The documentation for this class was generated from the following files: