1 #ifndef OPENMM_CUSTOMINTEGRATOR_H_
2 #define OPENMM_CUSTOMINTEGRATOR_H_
35 #include "Integrator.h"
37 #include "openmm/Kernel.h"
38 #include "internal/windowsExport.h"
232 ConstrainPositions = 3,
236 ConstrainVelocities = 4,
240 UpdateContextState = 5
252 return globalNames.size();
258 return perDofNames.size();
264 return computations.size();
273 int addGlobalVariable(
const std::string& name,
double initialValue);
280 const std::string& getGlobalVariableName(
int index)
const;
289 int addPerDofVariable(
const std::string& name,
double initialValue);
296 const std::string& getPerDofVariableName(
int index)
const;
303 double getGlobalVariable(
int index)
const;
310 void setGlobalVariable(
int index,
double value);
317 void setGlobalVariableByName(
const std::string& name,
double value);
325 void getPerDofVariable(
int index, std::vector<Vec3>& values)
const;
332 void setPerDofVariable(
int index,
const std::vector<Vec3>& values);
339 void setPerDofVariableByName(
const std::string& name,
const std::vector<Vec3>& values);
349 int addComputeGlobal(
const std::string& variable,
const std::string& expression);
360 int addComputePerDof(
const std::string& variable,
const std::string& expression);
372 int addComputeSum(
const std::string& variable,
const std::string& expression);
379 int addConstrainPositions();
386 int addConstrainVelocities();
393 int addUpdateContextState();
405 void getComputationStep(
int index, ComputationType& type, std::string& variable, std::string& expression)
const;
411 const std::string& getKineticEnergyExpression()
const;
417 void setKineticEnergyExpression(
const std::string& expression);
422 return randomNumberSeed;
433 randomNumberSeed = seed;
440 void step(
int steps);
460 std::vector<std::string> getKernelNames();
464 double computeKineticEnergy();
466 class ComputationInfo;
467 std::vector<std::string> globalNames;
468 std::vector<std::string> perDofNames;
469 mutable std::vector<double> globalValues;
470 std::vector<std::vector<Vec3> > perDofValues;
471 std::vector<ComputationInfo> computations;
472 std::string kineticEnergy;
473 mutable bool globalsAreCurrent;
474 int randomNumberSeed;
483 class CustomIntegrator::ComputationInfo {
486 std::string variable, expression;
489 ComputationInfo(
ComputationType type,
const std::string& variable,
const std::string& expression) :
490 type(type), variable(variable), expression(expression) {