This is the internal implementation of CustomManyParticleForce.
More...
#include <CustomManyParticleForceImpl.h>
|
static Lepton::ParsedExpression | prepareExpression (const CustomManyParticleForce &force, const std::map< std::string, Lepton::CustomFunction * > &functions, std::map< std::string, std::vector< int > > &distances, std::map< std::string, std::vector< int > > &angles, std::map< std::string, std::vector< int > > &dihedrals) |
| This is a utility routine that parses the energy expression, identifies the angles and dihedrals in it, and replaces them with variables. More...
|
|
static void | buildFilterArrays (const CustomManyParticleForce &force, int &numTypes, std::vector< int > &particleTypes, std::vector< int > &orderIndex, std::vector< std::vector< int > > &particleOrder) |
| Analyze the type filters for a force and build a set of arrays that can be used for reordering the particles in an interaction. More...
|
|
This is the internal implementation of CustomManyParticleForce.
static void buildFilterArrays |
( |
const CustomManyParticleForce & |
force, |
|
|
int & |
numTypes, |
|
|
std::vector< int > & |
particleTypes, |
|
|
std::vector< int > & |
orderIndex, |
|
|
std::vector< std::vector< int > > & |
particleOrder |
|
) |
| |
|
static |
Analyze the type filters for a force and build a set of arrays that can be used for reordering the particles in an interaction.
- Parameters
-
force | the CustomManyParticleForce to process |
numTypes | on exit, the number of unique particle types |
particleTypes | on exit, this contains a type code for each particle. These codes are not necessarily the same as the types assigned by the force. They are guaranteed to be successive integers starting from 0, whereas the force may have used arbitrary integers. |
orderIndex | on exit, this contains a lookup table for selecting the particle order for an interaction. orderIndex[t1+numTypes*t2+numTypes*numTypes*t3+...] is the index of the order to use, where t1, t2, etc. are the type codes of the particles involved in the interaction. If this equals -1, the interaction should be omitted. |
particleOrder | on exit, particleOrder[i][j] tells which particle to use as the j'th particle, where i is the value found in orderIndex. |
double calcForcesAndEnergy |
( |
ContextImpl & |
context, |
|
|
bool |
includeForces, |
|
|
bool |
includeEnergy, |
|
|
int |
groups |
|
) |
| |
|
virtual |
Calculate the force on each particle generated by this ForceImpl and/or this ForceImpl's contribution to the potential energy of the system.
- Parameters
-
context | the context in which the system is being simulated |
includeForces | true if forces should be calculated |
includeEnergy | true if the energy should be calculated |
groups | a set of bit flags for which force groups to include. Group i should be included if (groups&(1<<i)) != 0. |
- Returns
- this force's contribution to the potential energy of the system, or 0 if this force does not contribute to potential energy (or if includeEnergy is false)
Implements ForceImpl.
std::map<std::string, double> getDefaultParameters |
( |
| ) |
|
|
virtual |
Get a map containing the default values for all adjustable parameters defined by this ForceImpl.
These parameters and their default values will automatically be added to the Context.
Implements ForceImpl.
std::vector<std::string> getKernelNames |
( |
| ) |
|
|
virtual |
Get the names of all Kernels used by this Force.
Implements ForceImpl.
This is called after the ForceImpl is created and before updateContextState(), calcForces(), or calcEnergy() is called on it.
This allows it to do any necessary initialization.
Implements ForceImpl.
static Lepton::ParsedExpression prepareExpression |
( |
const CustomManyParticleForce & |
force, |
|
|
const std::map< std::string, Lepton::CustomFunction * > & |
functions, |
|
|
std::map< std::string, std::vector< int > > & |
distances, |
|
|
std::map< std::string, std::vector< int > > & |
angles, |
|
|
std::map< std::string, std::vector< int > > & |
dihedrals |
|
) |
| |
|
static |
This is a utility routine that parses the energy expression, identifies the angles and dihedrals in it, and replaces them with variables.
- Parameters
-
force | the CustomManyParticleForce to process |
functions | definitions of custom function that may appear in the expression |
distances | on exit, this will contain an entry for each distance used in the expression. The key is the name of the corresponding variable, and the value is the list of particle indices. |
angles | on exit, this will contain an entry for each angle used in the expression. The key is the name of the corresponding variable, and the value is the list of particle indices. |
dihedrals | on exit, this will contain an entry for each dihedral used in the expression. The key is the name of the corresponding variable, and the value is the list of particle indices. |
- Returns
- a Parsed expression for the energy
This method is called at the beginning of each time step.
It give the ForceImpl a chance to modify the state variables (positions, velocities, and parameters) stored in the Context in arbitrary ways before integration is performed.
- Parameters
-
context | the context in which the system is being simulated |
Implements ForceImpl.
void updateParametersInContext |
( |
ContextImpl & |
context | ) |
|
The documentation for this class was generated from the following file: