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 double getGlobalVariableByName(
const std::string& name)
const;
318 void setGlobalVariable(
int index,
double value);
325 void setGlobalVariableByName(
const std::string& name,
double value);
333 void getPerDofVariable(
int index, std::vector<Vec3>& values)
const;
341 void getPerDofVariableByName(
const std::string& name, std::vector<Vec3>& values)
const;
348 void setPerDofVariable(
int index,
const std::vector<Vec3>& values);
355 void setPerDofVariableByName(
const std::string& name,
const std::vector<Vec3>& values);
365 int addComputeGlobal(
const std::string& variable,
const std::string& expression);
376 int addComputePerDof(
const std::string& variable,
const std::string& expression);
388 int addComputeSum(
const std::string& variable,
const std::string& expression);
395 int addConstrainPositions();
402 int addConstrainVelocities();
409 int addUpdateContextState();
421 void getComputationStep(
int index, ComputationType& type, std::string& variable, std::string& expression)
const;
427 const std::string& getKineticEnergyExpression()
const;
433 void setKineticEnergyExpression(
const std::string& expression);
438 return randomNumberSeed;
453 randomNumberSeed = seed;
460 void step(
int steps);
467 void initialize(ContextImpl& context);
480 std::vector<std::string> getKernelNames();
484 double computeKineticEnergy();
486 class ComputationInfo;
487 std::vector<std::string> globalNames;
488 std::vector<std::string> perDofNames;
489 mutable std::vector<double> globalValues;
490 std::vector<std::vector<Vec3> > perDofValues;
491 std::vector<ComputationInfo> computations;
492 std::string kineticEnergy;
493 mutable bool globalsAreCurrent;
494 int randomNumberSeed;
503 class CustomIntegrator::ComputationInfo {
506 std::string variable, expression;
509 ComputationInfo(
ComputationType type,
const std::string& variable,
const std::string& expression) :
510 type(type), variable(variable), expression(expression) {
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:452
int getRandomNumberSeed() const
Get the random number seed.
Definition: CustomIntegrator.h:437
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
Definition: AndersenThermostat.h:40
ComputationType
This is an enumeration of the different types of computations that may appear in an integration algor...
Definition: CustomIntegrator.h:217