1 #ifndef OPENMM_CUSTOMINTEGRATOR_H_
2 #define OPENMM_CUSTOMINTEGRATOR_H_
35 #include "Integrator.h"
37 #include "openmm/Kernel.h"
38 #include "internal/windowsExport.h"
233 ConstrainPositions = 3,
237 ConstrainVelocities = 4,
241 UpdateContextState = 5
253 return globalNames.size();
259 return perDofNames.size();
265 return computations.size();
274 int addGlobalVariable(
const std::string& name,
double initialValue);
281 const std::string& getGlobalVariableName(
int index)
const;
290 int addPerDofVariable(
const std::string& name,
double initialValue);
297 const std::string& getPerDofVariableName(
int index)
const;
304 double getGlobalVariable(
int index)
const;
311 void setGlobalVariable(
int index,
double value);
318 void setGlobalVariableByName(
const std::string& name,
double value);
326 void getPerDofVariable(
int index, std::vector<Vec3>& values)
const;
333 void setPerDofVariable(
int index,
const std::vector<Vec3>& values);
340 void setPerDofVariableByName(
const std::string& name,
const std::vector<Vec3>& values);
350 int addComputeGlobal(
const std::string& variable,
const std::string& expression);
361 int addComputePerDof(
const std::string& variable,
const std::string& expression);
373 int addComputeSum(
const std::string& variable,
const std::string& expression);
380 int addConstrainPositions();
387 int addConstrainVelocities();
394 int addUpdateContextState();
406 void getComputationStep(
int index, ComputationType& type, std::string& variable, std::string& expression)
const;
412 const std::string& getKineticEnergyExpression()
const;
418 void setKineticEnergyExpression(
const std::string& expression);
423 return randomNumberSeed;
434 randomNumberSeed = seed;
441 void step(
int steps);
461 std::vector<std::string> getKernelNames();
465 double computeKineticEnergy();
467 class ComputationInfo;
468 std::vector<std::string> globalNames;
469 std::vector<std::string> perDofNames;
470 mutable std::vector<double> globalValues;
471 std::vector<std::vector<Vec3> > perDofValues;
472 std::vector<ComputationInfo> computations;
473 std::string kineticEnergy;
474 mutable bool globalsAreCurrent;
475 int randomNumberSeed;
484 class CustomIntegrator::ComputationInfo {
487 std::string variable, expression;
490 ComputationInfo(
ComputationType type,
const std::string& variable,
const std::string& expression) :
491 type(type), variable(variable), expression(expression) {
This is the internal implementation of a Context.
Definition: ContextImpl.h:53
int getNumPerDofVariables() const
Get the number of per-DOF variables that have been defined.
Definition: CustomIntegrator.h:258
This is an Integrator that can be used to implemented arbitrary, user defined integration algorithms...
Definition: CustomIntegrator.h:212
int getNumGlobalVariables() const
Get the number of global variables that have been defined.
Definition: CustomIntegrator.h:252
void setRandomNumberSeed(int seed)
Set the random number seed.
Definition: CustomIntegrator.h:433
int getRandomNumberSeed() const
Get the random number seed.
Definition: CustomIntegrator.h:422
An Integrator defines a method for simulating a System by integrating the equations of motion...
Definition: Integrator.h:54
DataType
This is an enumeration of the types of data which may be stored in a State.
Definition: State.h:61
int getNumComputations() const
Get the number of computation steps that have been added.
Definition: CustomIntegrator.h:264
A Kernel encapsulates a particular implementation of a calculation that can be performed on the data ...
Definition: Kernel.h:58
ComputationType
This is an enumeration of the different types of computations that may appear in an integration algor...
Definition: CustomIntegrator.h:217