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) {