Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
dca54ec7
Commit
dca54ec7
authored
Jun 30, 2016
by
Saurabh Belsare
Browse files
Merged fork with latest original master
parents
cace5edf
01f9e415
Changes
384
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
319 additions
and
56 deletions
+319
-56
platforms/reference/include/ReferenceAngleBondIxn.h
platforms/reference/include/ReferenceAngleBondIxn.h
+13
-0
platforms/reference/include/ReferenceCMAPTorsionIxn.h
platforms/reference/include/ReferenceCMAPTorsionIxn.h
+12
-0
platforms/reference/include/ReferenceCustomAngleIxn.h
platforms/reference/include/ReferenceCustomAngleIxn.h
+13
-1
platforms/reference/include/ReferenceCustomBondIxn.h
platforms/reference/include/ReferenceCustomBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
+13
-1
platforms/reference/include/ReferenceCustomDynamics.h
platforms/reference/include/ReferenceCustomDynamics.h
+13
-8
platforms/reference/include/ReferenceCustomTorsionIxn.h
platforms/reference/include/ReferenceCustomTorsionIxn.h
+13
-1
platforms/reference/include/ReferenceForce.h
platforms/reference/include/ReferenceForce.h
+28
-0
platforms/reference/include/ReferenceHarmonicBondIxn.h
platforms/reference/include/ReferenceHarmonicBondIxn.h
+14
-1
platforms/reference/include/ReferenceKernels.h
platforms/reference/include/ReferenceKernels.h
+12
-2
platforms/reference/include/ReferenceProperDihedralBond.h
platforms/reference/include/ReferenceProperDihedralBond.h
+14
-1
platforms/reference/include/ReferenceRbDihedralBond.h
platforms/reference/include/ReferenceRbDihedralBond.h
+14
-1
platforms/reference/include/ReferenceTabulatedFunction.h
platforms/reference/include/ReferenceTabulatedFunction.h
+4
-1
platforms/reference/src/ReferenceKernels.cpp
platforms/reference/src/ReferenceKernels.cpp
+33
-3
platforms/reference/src/ReferenceTabulatedFunction.cpp
platforms/reference/src/ReferenceTabulatedFunction.cpp
+28
-4
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
...ms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
+16
-3
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
.../reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
+25
-8
platforms/reference/src/SimTKReference/ReferenceCustomAngleIxn.cpp
.../reference/src/SimTKReference/ReferenceCustomAngleIxn.cpp
+16
-10
platforms/reference/src/SimTKReference/ReferenceCustomBondIxn.cpp
...s/reference/src/SimTKReference/ReferenceCustomBondIxn.cpp
+12
-9
No files found.
platforms/reference/include/ReferenceAngleBondIxn.h
View file @
dca54ec7
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
~
ReferenceAngleBondIxn
();
~
ReferenceAngleBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get dEdR and energy term for angle bond
Get dEdR and energy term for angle bond
...
...
platforms/reference/include/ReferenceCMAPTorsionIxn.h
View file @
dca54ec7
...
@@ -38,6 +38,8 @@ private:
...
@@ -38,6 +38,8 @@ private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -65,6 +67,16 @@ public:
...
@@ -65,6 +67,16 @@ public:
const
std
::
vector
<
int
>&
torsionMaps
,
const
std
::
vector
<
int
>&
torsionMaps
,
const
std
::
vector
<
std
::
vector
<
int
>
>&
torsionIndices
);
const
std
::
vector
<
std
::
vector
<
int
>
>&
torsionIndices
);
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate torsion interaction
Calculate torsion interaction
...
...
platforms/reference/include/ReferenceCustomAngleIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2010-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2010-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -39,6 +39,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...
@@ -39,6 +39,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
double
*
energyTheta
;
double
*
energyTheta
;
double
*
forceTheta
;
double
*
forceTheta
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -59,6 +61,16 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...
@@ -59,6 +61,16 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
~
ReferenceCustomAngleIxn
();
~
ReferenceCustomAngleIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Angle Ixn
Calculate Custom Angle Ixn
...
...
platforms/reference/include/ReferenceCustomBondIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2009-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -40,6 +40,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
...
@@ -40,6 +40,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
double
*
energyR
;
double
*
energyR
;
double
*
forceR
;
double
*
forceR
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -60,6 +62,16 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
...
@@ -60,6 +62,16 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
~
ReferenceCustomBondIxn
();
~
ReferenceCustomBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Bond Ixn
Calculate Custom Bond Ixn
...
...
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2009-201
5
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -50,6 +50,8 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
...
@@ -50,6 +50,8 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -94,6 +96,16 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
...
@@ -94,6 +96,16 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
~
ReferenceCustomCentroidBondIxn
();
~
ReferenceCustomCentroidBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get the list of groups in each bond.
Get the list of groups in each bond.
...
...
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2009-201
2
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -48,6 +48,8 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...
@@ -48,6 +48,8 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
DistanceTermInfo
>
distanceTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
AngleTermInfo
>
angleTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
std
::
vector
<
DihedralTermInfo
>
dihedralTerms
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -91,6 +93,16 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...
@@ -91,6 +93,16 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
~
ReferenceCustomCompoundBondIxn
();
~
ReferenceCustomCompoundBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get the list atoms in each bond.
Get the list atoms in each bond.
...
...
platforms/reference/include/ReferenceCustomDynamics.h
View file @
dca54ec7
/* Portions copyright (c) 2011-201
5
Stanford University and Simbios.
/* Portions copyright (c) 2011-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -29,7 +29,8 @@
...
@@ -29,7 +29,8 @@
#include "openmm/CustomIntegrator.h"
#include "openmm/CustomIntegrator.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/internal/CustomIntegratorUtilities.h"
#include "openmm/internal/CustomIntegratorUtilities.h"
#include "lepton/ExpressionProgram.h"
#include "openmm/internal/CompiledExpressionSet.h"
#include "lepton/CompiledExpression.h"
#include <map>
#include <map>
#include <string>
#include <string>
...
@@ -44,23 +45,27 @@ private:
...
@@ -44,23 +45,27 @@ private:
std
::
vector
<
RealOpenMM
>
inverseMasses
;
std
::
vector
<
RealOpenMM
>
inverseMasses
;
std
::
vector
<
OpenMM
::
RealVec
>
sumBuffer
,
oldPos
;
std
::
vector
<
OpenMM
::
RealVec
>
sumBuffer
,
oldPos
;
std
::
vector
<
OpenMM
::
CustomIntegrator
::
ComputationType
>
stepType
;
std
::
vector
<
OpenMM
::
CustomIntegrator
::
ComputationType
>
stepType
;
std
::
vector
<
std
::
string
>
stepVariable
,
forceName
,
energyName
;
std
::
vector
<
std
::
string
>
stepVariable
;
std
::
vector
<
std
::
vector
<
Lepton
::
Expression
Program
>
>
stepExpressions
;
std
::
vector
<
std
::
vector
<
Lepton
::
Compiled
Expression
>
>
stepExpressions
;
std
::
vector
<
CustomIntegratorUtilities
::
Comparison
>
comparisons
;
std
::
vector
<
CustomIntegratorUtilities
::
Comparison
>
comparisons
;
std
::
vector
<
bool
>
invalidatesForces
,
needsForces
,
needsEnergy
,
computeBothForceAndEnergy
;
std
::
vector
<
bool
>
invalidatesForces
,
needsForces
,
needsEnergy
,
computeBothForceAndEnergy
;
std
::
vector
<
int
>
forceGroupFlags
,
blockEnd
;
std
::
vector
<
int
>
forceGroupFlags
,
blockEnd
;
RealOpenMM
energy
;
RealOpenMM
energy
;
Lepton
::
Expression
Program
kineticEnergyExpression
;
Lepton
::
Compiled
Expression
kineticEnergyExpression
;
bool
kineticEnergyNeedsForce
;
bool
kineticEnergyNeedsForce
;
CompiledExpressionSet
expressionSet
;
int
xIndex
,
vIndex
,
mIndex
,
fIndex
,
energyIndex
,
gaussianIndex
,
uniformIndex
;
std
::
vector
<
int
>
forceVariableIndex
,
energyVariableIndex
,
perDofVariableIndex
,
stepVariableIndex
;
void
initialize
(
OpenMM
::
ContextImpl
&
context
,
std
::
vector
<
RealOpenMM
>&
masses
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
void
computePerDof
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
results
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
void
computePerDof
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
RealVec
>&
results
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
atomCoordinates
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
const
std
::
vector
<
RealOpenMM
>&
masses
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
velocities
,
const
std
::
vector
<
OpenMM
::
RealVec
>&
forces
,
const
std
::
vector
<
RealOpenMM
>&
masses
,
const
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
,
const
std
::
vector
<
std
::
vector
<
OpenMM
::
RealVec
>
>&
perDof
,
const
std
::
vector
<
std
::
vector
<
OpenMM
::
RealVec
>
>&
perDof
,
const
Lepton
::
CompiledExpression
&
expression
,
int
forceIndex
);
const
Lepton
::
ExpressionProgram
&
expression
,
const
std
::
string
&
forceName
);
void
recordChangedParameters
(
OpenMM
::
ContextImpl
&
context
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
void
recordChangedParameters
(
OpenMM
::
ContextImpl
&
context
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
bool
evaluateCondition
(
int
step
,
std
::
map
<
std
::
string
,
RealOpenMM
>&
globals
);
bool
evaluateCondition
(
int
step
);
public:
public:
...
...
platforms/reference/include/ReferenceCustomTorsionIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2010-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2010-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -39,6 +39,8 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
...
@@ -39,6 +39,8 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
double
*
energyTheta
;
double
*
energyTheta
;
double
*
forceTheta
;
double
*
forceTheta
;
int
numParameters
;
int
numParameters
;
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -59,6 +61,16 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
...
@@ -59,6 +61,16 @@ class ReferenceCustomTorsionIxn : public ReferenceBondIxn {
~
ReferenceCustomTorsionIxn
();
~
ReferenceCustomTorsionIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Custom Torsion Ixn
Calculate Custom Torsion Ixn
...
...
platforms/reference/include/ReferenceForce.h
View file @
dca54ec7
...
@@ -83,6 +83,19 @@ class OPENMM_EXPORT ReferenceForce {
...
@@ -83,6 +83,19 @@ class OPENMM_EXPORT ReferenceForce {
static
void
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
static
void
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
RealOpenMM
*
deltaR
);
RealOpenMM
*
deltaR
);
/**---------------------------------------------------------------------------------------
Get deltaR between atomI and atomJ (static method)
deltaR: j - i
@param atomCoordinatesI atom i coordinates
@param atomCoordinatesI atom j coordinates
@return the displacement
--------------------------------------------------------------------------------------- */
static
RealVec
getDeltaR
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get deltaR and distance and distance**2 between atomI and atomJ, assuming periodic
Get deltaR and distance and distance**2 between atomI and atomJ, assuming periodic
...
@@ -113,6 +126,21 @@ class OPENMM_EXPORT ReferenceForce {
...
@@ -113,6 +126,21 @@ class OPENMM_EXPORT ReferenceForce {
static
void
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
static
void
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
const
OpenMM
::
RealVec
*
boxVectors
,
RealOpenMM
*
deltaR
);
const
OpenMM
::
RealVec
*
boxVectors
,
RealOpenMM
*
deltaR
);
/**---------------------------------------------------------------------------------------
Get deltaR between atomI and atomJ, assuming periodic boundary conditions (static method);
deltaR: j - i
@param atomCoordinatesI atom i coordinates
@param atomCoordinatesI atom j coordinates
@param boxVectors the vectors defining the periodic box
@return the displacement
--------------------------------------------------------------------------------------- */
static
RealVec
getDeltaRPeriodic
(
const
OpenMM
::
RealVec
&
atomCoordinatesI
,
const
OpenMM
::
RealVec
&
atomCoordinatesJ
,
const
OpenMM
::
RealVec
*
boxVectors
);
/**
/**
* Get a pointer to the memory for setting a variable in a CompiledExpression. If the expression
* Get a pointer to the memory for setting a variable in a CompiledExpression. If the expression
* does not use the specified variable, return NULL.
* does not use the specified variable, return NULL.
...
...
platforms/reference/include/ReferenceHarmonicBondIxn.h
View file @
dca54ec7
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -32,6 +32,9 @@ namespace OpenMM {
...
@@ -32,6 +32,9 @@ namespace OpenMM {
class
ReferenceHarmonicBondIxn
:
public
ReferenceBondIxn
{
class
ReferenceHarmonicBondIxn
:
public
ReferenceBondIxn
{
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
...
@@ -51,6 +54,16 @@ class ReferenceHarmonicBondIxn : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class ReferenceHarmonicBondIxn : public ReferenceBondIxn {
~
ReferenceHarmonicBondIxn
();
~
ReferenceHarmonicBondIxn
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Harmonic Bond Ixn
Calculate Harmonic Bond Ixn
...
...
platforms/reference/include/ReferenceKernels.h
View file @
dca54ec7
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2008-201
5
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -172,7 +172,7 @@ public:
...
@@ -172,7 +172,7 @@ public:
* @param b the vector defining the second edge of the periodic box
* @param b the vector defining the second edge of the periodic box
* @param c the vector defining the third edge of the periodic box
* @param c the vector defining the third edge of the periodic box
*/
*/
void
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
)
const
;
void
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
);
/**
/**
* Create a checkpoint recording the current state of the Context.
* Create a checkpoint recording the current state of the Context.
*
*
...
@@ -280,6 +280,7 @@ private:
...
@@ -280,6 +280,7 @@ private:
int
numBonds
;
int
numBonds
;
int
**
bondIndexArray
;
int
**
bondIndexArray
;
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -319,6 +320,7 @@ private:
...
@@ -319,6 +320,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -356,6 +358,7 @@ private:
...
@@ -356,6 +358,7 @@ private:
int
numAngles
;
int
numAngles
;
int
**
angleIndexArray
;
int
**
angleIndexArray
;
RealOpenMM
**
angleParamArray
;
RealOpenMM
**
angleParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -395,6 +398,7 @@ private:
...
@@ -395,6 +398,7 @@ private:
RealOpenMM
**
angleParamArray
;
RealOpenMM
**
angleParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -432,6 +436,7 @@ private:
...
@@ -432,6 +436,7 @@ private:
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
int
**
torsionIndexArray
;
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -469,6 +474,7 @@ private:
...
@@ -469,6 +474,7 @@ private:
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
int
**
torsionIndexArray
;
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -505,6 +511,7 @@ private:
...
@@ -505,6 +511,7 @@ private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
coeff
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
int
>
torsionMaps
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndices
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -544,6 +551,7 @@ private:
...
@@ -544,6 +551,7 @@ private:
RealOpenMM
**
torsionParamArray
;
RealOpenMM
**
torsionParamArray
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
Lepton
::
CompiledExpression
energyExpression
,
forceExpression
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
std
::
vector
<
std
::
string
>
parameterNames
,
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -860,6 +868,7 @@ private:
...
@@ -860,6 +868,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
ReferenceCustomCentroidBondIxn
*
ixn
;
ReferenceCustomCentroidBondIxn
*
ixn
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -898,6 +907,7 @@ private:
...
@@ -898,6 +907,7 @@ private:
RealOpenMM
**
bondParamArray
;
RealOpenMM
**
bondParamArray
;
ReferenceCustomCompoundBondIxn
*
ixn
;
ReferenceCustomCompoundBondIxn
*
ixn
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
bool
usePeriodic
;
};
};
/**
/**
...
...
platforms/reference/include/ReferenceProperDihedralBond.h
View file @
dca54ec7
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceProperDihedralBond : public ReferenceBondIxn {
~
ReferenceProperDihedralBond
();
~
ReferenceProperDihedralBond
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate proper dihedral bond ixn
Calculate proper dihedral bond ixn
...
...
platforms/reference/include/ReferenceRbDihedralBond.h
View file @
dca54ec7
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
* Contributors: Pande Group
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
...
@@ -33,6 +33,9 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
public:
public:
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
...
@@ -51,6 +54,16 @@ class OPENMM_EXPORT ReferenceRbDihedralBond : public ReferenceBondIxn {
~
ReferenceRbDihedralBond
();
~
ReferenceRbDihedralBond
();
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Ryckaert-Bellemans bond ixn
Calculate Ryckaert-Bellemans bond ixn
...
...
platforms/reference/include/ReferenceTabulatedFunction.h
View file @
dca54ec7
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -55,6 +55,7 @@ public:
...
@@ -55,6 +55,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
);
const
Continuous1DFunction
&
function
;
const
Continuous1DFunction
&
function
;
double
min
,
max
;
double
min
,
max
;
std
::
vector
<
double
>
x
,
values
,
derivs
;
std
::
vector
<
double
>
x
,
values
,
derivs
;
...
@@ -71,6 +72,7 @@ public:
...
@@ -71,6 +72,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous2DFunction
(
const
ReferenceContinuous2DFunction
&
other
);
const
Continuous2DFunction
&
function
;
const
Continuous2DFunction
&
function
;
int
xsize
,
ysize
;
int
xsize
,
ysize
;
double
xmin
,
xmax
,
ymin
,
ymax
;
double
xmin
,
xmax
,
ymin
,
ymax
;
...
@@ -89,6 +91,7 @@ public:
...
@@ -89,6 +91,7 @@ public:
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
double
evaluateDerivative
(
const
double
*
arguments
,
const
int
*
derivOrder
)
const
;
CustomFunction
*
clone
()
const
;
CustomFunction
*
clone
()
const
;
private:
private:
ReferenceContinuous3DFunction
(
const
ReferenceContinuous3DFunction
&
other
);
const
Continuous3DFunction
&
function
;
const
Continuous3DFunction
&
function
;
int
xsize
,
ysize
,
zsize
;
int
xsize
,
ysize
,
zsize
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
...
...
platforms/reference/src/ReferenceKernels.cpp
View file @
dca54ec7
...
@@ -280,7 +280,7 @@ void ReferenceUpdateStateDataKernel::getPeriodicBoxVectors(ContextImpl& context,
...
@@ -280,7 +280,7 @@ void ReferenceUpdateStateDataKernel::getPeriodicBoxVectors(ContextImpl& context,
c
=
vectors
[
2
];
c
=
vectors
[
2
];
}
}
void
ReferenceUpdateStateDataKernel
::
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
)
const
{
void
ReferenceUpdateStateDataKernel
::
setPeriodicBoxVectors
(
ContextImpl
&
context
,
const
Vec3
&
a
,
const
Vec3
&
b
,
const
Vec3
&
c
)
{
RealVec
&
box
=
extractBoxSize
(
context
);
RealVec
&
box
=
extractBoxSize
(
context
);
box
[
0
]
=
(
RealOpenMM
)
a
[
0
];
box
[
0
]
=
(
RealOpenMM
)
a
[
0
];
box
[
1
]
=
(
RealOpenMM
)
b
[
1
];
box
[
1
]
=
(
RealOpenMM
)
b
[
1
];
...
@@ -370,6 +370,7 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons
...
@@ -370,6 +370,7 @@ void ReferenceCalcHarmonicBondForceKernel::initialize(const System& system, cons
bondParamArray
[
i
][
0
]
=
(
RealOpenMM
)
length
;
bondParamArray
[
i
][
0
]
=
(
RealOpenMM
)
length
;
bondParamArray
[
i
][
1
]
=
(
RealOpenMM
)
k
;
bondParamArray
[
i
][
1
]
=
(
RealOpenMM
)
k
;
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcHarmonicBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcHarmonicBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -378,6 +379,8 @@ double ReferenceCalcHarmonicBondForceKernel::execute(ContextImpl& context, bool
...
@@ -378,6 +379,8 @@ double ReferenceCalcHarmonicBondForceKernel::execute(ContextImpl& context, bool
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceHarmonicBondIxn
harmonicBond
;
ReferenceHarmonicBondIxn
harmonicBond
;
if
(
usePeriodic
)
harmonicBond
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
harmonicBond
);
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
harmonicBond
);
return
energy
;
return
energy
;
}
}
...
@@ -409,6 +412,7 @@ ReferenceCalcCustomBondForceKernel::~ReferenceCalcCustomBondForceKernel() {
...
@@ -409,6 +412,7 @@ ReferenceCalcCustomBondForceKernel::~ReferenceCalcCustomBondForceKernel() {
void
ReferenceCalcCustomBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomBondForce
&
force
)
{
void
ReferenceCalcCustomBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomBondForce
&
force
)
{
numBonds
=
force
.
getNumBonds
();
numBonds
=
force
.
getNumBonds
();
int
numParameters
=
force
.
getNumPerBondParameters
();
int
numParameters
=
force
.
getNumPerBondParameters
();
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// Build the arrays.
// Build the arrays.
...
@@ -448,8 +452,10 @@ double ReferenceCalcCustomBondForceKernel::execute(ContextImpl& context, bool in
...
@@ -448,8 +452,10 @@ double ReferenceCalcCustomBondForceKernel::execute(ContextImpl& context, bool in
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceCustomBondIxn
harmonicBond
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
ReferenceCustomBondIxn
bond
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
harmonicBond
);
if
(
usePeriodic
)
bond
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numBonds
,
bondIndexArray
,
posData
,
bondParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
bond
);
return
energy
;
return
energy
;
}
}
...
@@ -490,6 +496,7 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con
...
@@ -490,6 +496,7 @@ void ReferenceCalcHarmonicAngleForceKernel::initialize(const System& system, con
angleParamArray
[
i
][
0
]
=
(
RealOpenMM
)
angle
;
angleParamArray
[
i
][
0
]
=
(
RealOpenMM
)
angle
;
angleParamArray
[
i
][
1
]
=
(
RealOpenMM
)
k
;
angleParamArray
[
i
][
1
]
=
(
RealOpenMM
)
k
;
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcHarmonicAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcHarmonicAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -498,6 +505,8 @@ double ReferenceCalcHarmonicAngleForceKernel::execute(ContextImpl& context, bool
...
@@ -498,6 +505,8 @@ double ReferenceCalcHarmonicAngleForceKernel::execute(ContextImpl& context, bool
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceAngleBondIxn
angleBond
;
ReferenceAngleBondIxn
angleBond
;
if
(
usePeriodic
)
angleBond
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
angleBond
);
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
angleBond
);
return
energy
;
return
energy
;
}
}
...
@@ -527,6 +536,7 @@ ReferenceCalcCustomAngleForceKernel::~ReferenceCalcCustomAngleForceKernel() {
...
@@ -527,6 +536,7 @@ ReferenceCalcCustomAngleForceKernel::~ReferenceCalcCustomAngleForceKernel() {
void
ReferenceCalcCustomAngleForceKernel
::
initialize
(
const
System
&
system
,
const
CustomAngleForce
&
force
)
{
void
ReferenceCalcCustomAngleForceKernel
::
initialize
(
const
System
&
system
,
const
CustomAngleForce
&
force
)
{
numAngles
=
force
.
getNumAngles
();
numAngles
=
force
.
getNumAngles
();
int
numParameters
=
force
.
getNumPerAngleParameters
();
int
numParameters
=
force
.
getNumPerAngleParameters
();
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// Build the arrays.
// Build the arrays.
...
@@ -568,6 +578,8 @@ double ReferenceCalcCustomAngleForceKernel::execute(ContextImpl& context, bool i
...
@@ -568,6 +578,8 @@ double ReferenceCalcCustomAngleForceKernel::execute(ContextImpl& context, bool i
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceCustomAngleIxn
customAngle
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
ReferenceCustomAngleIxn
customAngle
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
if
(
usePeriodic
)
customAngle
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
customAngle
);
refBondForce
.
calculateForce
(
numAngles
,
angleIndexArray
,
posData
,
angleParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
customAngle
);
return
energy
;
return
energy
;
}
}
...
@@ -611,6 +623,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c
...
@@ -611,6 +623,7 @@ void ReferenceCalcPeriodicTorsionForceKernel::initialize(const System& system, c
torsionParamArray
[
i
][
1
]
=
(
RealOpenMM
)
phase
;
torsionParamArray
[
i
][
1
]
=
(
RealOpenMM
)
phase
;
torsionParamArray
[
i
][
2
]
=
(
RealOpenMM
)
periodicity
;
torsionParamArray
[
i
][
2
]
=
(
RealOpenMM
)
periodicity
;
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcPeriodicTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcPeriodicTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -619,6 +632,8 @@ double ReferenceCalcPeriodicTorsionForceKernel::execute(ContextImpl& context, bo
...
@@ -619,6 +632,8 @@ double ReferenceCalcPeriodicTorsionForceKernel::execute(ContextImpl& context, bo
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceProperDihedralBond
periodicTorsionBond
;
ReferenceProperDihedralBond
periodicTorsionBond
;
if
(
usePeriodic
)
periodicTorsionBond
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
periodicTorsionBond
);
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
periodicTorsionBond
);
return
energy
;
return
energy
;
}
}
...
@@ -665,6 +680,7 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R
...
@@ -665,6 +680,7 @@ void ReferenceCalcRBTorsionForceKernel::initialize(const System& system, const R
torsionParamArray
[
i
][
4
]
=
(
RealOpenMM
)
c4
;
torsionParamArray
[
i
][
4
]
=
(
RealOpenMM
)
c4
;
torsionParamArray
[
i
][
5
]
=
(
RealOpenMM
)
c5
;
torsionParamArray
[
i
][
5
]
=
(
RealOpenMM
)
c5
;
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcRBTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcRBTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -673,6 +689,8 @@ double ReferenceCalcRBTorsionForceKernel::execute(ContextImpl& context, bool inc
...
@@ -673,6 +689,8 @@ double ReferenceCalcRBTorsionForceKernel::execute(ContextImpl& context, bool inc
RealOpenMM
energy
=
0
;
RealOpenMM
energy
=
0
;
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceRbDihedralBond
rbTorsionBond
;
ReferenceRbDihedralBond
rbTorsionBond
;
if
(
usePeriodic
)
rbTorsionBond
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
rbTorsionBond
);
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
rbTorsionBond
);
return
energy
;
return
energy
;
}
}
...
@@ -722,6 +740,7 @@ void ReferenceCalcCMAPTorsionForceKernel::initialize(const System& system, const
...
@@ -722,6 +740,7 @@ void ReferenceCalcCMAPTorsionForceKernel::initialize(const System& system, const
force
.
getTorsionParameters
(
i
,
torsionMaps
[
i
],
torsionIndices
[
i
][
0
],
torsionIndices
[
i
][
1
],
torsionIndices
[
i
][
2
],
force
.
getTorsionParameters
(
i
,
torsionMaps
[
i
],
torsionIndices
[
i
][
0
],
torsionIndices
[
i
][
1
],
torsionIndices
[
i
][
2
],
torsionIndices
[
i
][
3
],
torsionIndices
[
i
][
4
],
torsionIndices
[
i
][
5
],
torsionIndices
[
i
][
6
],
torsionIndices
[
i
][
7
]);
torsionIndices
[
i
][
3
],
torsionIndices
[
i
][
4
],
torsionIndices
[
i
][
5
],
torsionIndices
[
i
][
6
],
torsionIndices
[
i
][
7
]);
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcCMAPTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcCMAPTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -729,6 +748,8 @@ double ReferenceCalcCMAPTorsionForceKernel::execute(ContextImpl& context, bool i
...
@@ -729,6 +748,8 @@ double ReferenceCalcCMAPTorsionForceKernel::execute(ContextImpl& context, bool i
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
RealOpenMM
totalEnergy
=
0
;
RealOpenMM
totalEnergy
=
0
;
ReferenceCMAPTorsionIxn
torsion
(
coeff
,
torsionMaps
,
torsionIndices
);
ReferenceCMAPTorsionIxn
torsion
(
coeff
,
torsionMaps
,
torsionIndices
);
if
(
usePeriodic
)
torsion
.
setPeriodic
(
extractBoxVectors
(
context
));
torsion
.
calculateIxn
(
posData
,
forceData
,
&
totalEnergy
);
torsion
.
calculateIxn
(
posData
,
forceData
,
&
totalEnergy
);
return
totalEnergy
;
return
totalEnergy
;
}
}
...
@@ -775,6 +796,7 @@ ReferenceCalcCustomTorsionForceKernel::~ReferenceCalcCustomTorsionForceKernel()
...
@@ -775,6 +796,7 @@ ReferenceCalcCustomTorsionForceKernel::~ReferenceCalcCustomTorsionForceKernel()
void
ReferenceCalcCustomTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
CustomTorsionForce
&
force
)
{
void
ReferenceCalcCustomTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
CustomTorsionForce
&
force
)
{
numTorsions
=
force
.
getNumTorsions
();
numTorsions
=
force
.
getNumTorsions
();
int
numParameters
=
force
.
getNumPerTorsionParameters
();
int
numParameters
=
force
.
getNumPerTorsionParameters
();
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// Build the arrays.
// Build the arrays.
...
@@ -817,6 +839,8 @@ double ReferenceCalcCustomTorsionForceKernel::execute(ContextImpl& context, bool
...
@@ -817,6 +839,8 @@ double ReferenceCalcCustomTorsionForceKernel::execute(ContextImpl& context, bool
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
ReferenceBondForce
refBondForce
;
ReferenceBondForce
refBondForce
;
ReferenceCustomTorsionIxn
customTorsion
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
ReferenceCustomTorsionIxn
customTorsion
(
energyExpression
,
forceExpression
,
parameterNames
,
globalParameters
);
if
(
usePeriodic
)
customTorsion
.
setPeriodic
(
extractBoxVectors
(
context
));
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
customTorsion
);
refBondForce
.
calculateForce
(
numTorsions
,
torsionIndexArray
,
posData
,
torsionParamArray
,
forceData
,
includeEnergy
?
&
energy
:
NULL
,
customTorsion
);
return
energy
;
return
energy
;
}
}
...
@@ -1644,6 +1668,7 @@ ReferenceCalcCustomCentroidBondForceKernel::~ReferenceCalcCustomCentroidBondForc
...
@@ -1644,6 +1668,7 @@ ReferenceCalcCustomCentroidBondForceKernel::~ReferenceCalcCustomCentroidBondForc
}
}
void
ReferenceCalcCustomCentroidBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomCentroidBondForce
&
force
)
{
void
ReferenceCalcCustomCentroidBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomCentroidBondForce
&
force
)
{
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// Build the arrays.
// Build the arrays.
...
@@ -1697,6 +1722,8 @@ double ReferenceCalcCustomCentroidBondForceKernel::execute(ContextImpl& context,
...
@@ -1697,6 +1722,8 @@ double ReferenceCalcCustomCentroidBondForceKernel::execute(ContextImpl& context,
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
if
(
usePeriodic
)
ixn
->
setPeriodic
(
extractBoxVectors
(
context
));
ixn
->
calculatePairIxn
(
posData
,
bondParamArray
,
globalParameters
,
forceData
,
includeEnergy
?
&
energy
:
NULL
);
ixn
->
calculatePairIxn
(
posData
,
bondParamArray
,
globalParameters
,
forceData
,
includeEnergy
?
&
energy
:
NULL
);
return
energy
;
return
energy
;
}
}
...
@@ -1728,6 +1755,7 @@ ReferenceCalcCustomCompoundBondForceKernel::~ReferenceCalcCustomCompoundBondForc
...
@@ -1728,6 +1755,7 @@ ReferenceCalcCustomCompoundBondForceKernel::~ReferenceCalcCustomCompoundBondForc
}
}
void
ReferenceCalcCustomCompoundBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomCompoundBondForce
&
force
)
{
void
ReferenceCalcCustomCompoundBondForceKernel
::
initialize
(
const
System
&
system
,
const
CustomCompoundBondForce
&
force
)
{
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// Build the arrays.
// Build the arrays.
...
@@ -1774,6 +1802,8 @@ double ReferenceCalcCustomCompoundBondForceKernel::execute(ContextImpl& context,
...
@@ -1774,6 +1802,8 @@ double ReferenceCalcCustomCompoundBondForceKernel::execute(ContextImpl& context,
map
<
string
,
double
>
globalParameters
;
map
<
string
,
double
>
globalParameters
;
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
globalParameterNames
.
size
();
i
++
)
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
globalParameters
[
globalParameterNames
[
i
]]
=
context
.
getParameter
(
globalParameterNames
[
i
]);
if
(
usePeriodic
)
ixn
->
setPeriodic
(
extractBoxVectors
(
context
));
ixn
->
calculatePairIxn
(
posData
,
bondParamArray
,
globalParameters
,
forceData
,
includeEnergy
?
&
energy
:
NULL
);
ixn
->
calculatePairIxn
(
posData
,
bondParamArray
,
globalParameters
,
forceData
,
includeEnergy
?
&
energy
:
NULL
);
return
energy
;
return
energy
;
}
}
...
...
platforms/reference/src/ReferenceTabulatedFunction.cpp
View file @
dca54ec7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* *
* Portions copyright (c) 2014 Stanford University and the Authors.
*
* Portions copyright (c) 2014
-2016
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -80,6 +80,13 @@ ReferenceContinuous1DFunction::ReferenceContinuous1DFunction(const Continuous1DF
...
@@ -80,6 +80,13 @@ ReferenceContinuous1DFunction::ReferenceContinuous1DFunction(const Continuous1DF
SplineFitter
::
createNaturalSpline
(
x
,
values
,
derivs
);
SplineFitter
::
createNaturalSpline
(
x
,
values
,
derivs
);
}
}
ReferenceContinuous1DFunction
::
ReferenceContinuous1DFunction
(
const
ReferenceContinuous1DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
values
,
min
,
max
);
x
=
other
.
x
;
values
=
other
.
values
;
derivs
=
other
.
derivs
;
}
int
ReferenceContinuous1DFunction
::
getNumArguments
()
const
{
int
ReferenceContinuous1DFunction
::
getNumArguments
()
const
{
return
1
;
return
1
;
}
}
...
@@ -99,7 +106,7 @@ double ReferenceContinuous1DFunction::evaluateDerivative(const double* arguments
...
@@ -99,7 +106,7 @@ double ReferenceContinuous1DFunction::evaluateDerivative(const double* arguments
}
}
CustomFunction
*
ReferenceContinuous1DFunction
::
clone
()
const
{
CustomFunction
*
ReferenceContinuous1DFunction
::
clone
()
const
{
return
new
ReferenceContinuous1DFunction
(
function
);
return
new
ReferenceContinuous1DFunction
(
*
this
);
}
}
ReferenceContinuous2DFunction
::
ReferenceContinuous2DFunction
(
const
Continuous2DFunction
&
function
)
:
function
(
function
)
{
ReferenceContinuous2DFunction
::
ReferenceContinuous2DFunction
(
const
Continuous2DFunction
&
function
)
:
function
(
function
)
{
...
@@ -113,6 +120,14 @@ ReferenceContinuous2DFunction::ReferenceContinuous2DFunction(const Continuous2DF
...
@@ -113,6 +120,14 @@ ReferenceContinuous2DFunction::ReferenceContinuous2DFunction(const Continuous2DF
SplineFitter
::
create2DNaturalSpline
(
x
,
y
,
values
,
c
);
SplineFitter
::
create2DNaturalSpline
(
x
,
y
,
values
,
c
);
}
}
ReferenceContinuous2DFunction
::
ReferenceContinuous2DFunction
(
const
ReferenceContinuous2DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
xsize
,
ysize
,
values
,
xmin
,
xmax
,
ymin
,
ymax
);
x
=
other
.
x
;
y
=
other
.
y
;
values
=
other
.
values
;
c
=
other
.
c
;
}
int
ReferenceContinuous2DFunction
::
getNumArguments
()
const
{
int
ReferenceContinuous2DFunction
::
getNumArguments
()
const
{
return
2
;
return
2
;
}
}
...
@@ -144,7 +159,7 @@ double ReferenceContinuous2DFunction::evaluateDerivative(const double* arguments
...
@@ -144,7 +159,7 @@ double ReferenceContinuous2DFunction::evaluateDerivative(const double* arguments
}
}
CustomFunction
*
ReferenceContinuous2DFunction
::
clone
()
const
{
CustomFunction
*
ReferenceContinuous2DFunction
::
clone
()
const
{
return
new
ReferenceContinuous2DFunction
(
function
);
return
new
ReferenceContinuous2DFunction
(
*
this
);
}
}
ReferenceContinuous3DFunction
::
ReferenceContinuous3DFunction
(
const
Continuous3DFunction
&
function
)
:
function
(
function
)
{
ReferenceContinuous3DFunction
::
ReferenceContinuous3DFunction
(
const
Continuous3DFunction
&
function
)
:
function
(
function
)
{
...
@@ -161,6 +176,15 @@ ReferenceContinuous3DFunction::ReferenceContinuous3DFunction(const Continuous3DF
...
@@ -161,6 +176,15 @@ ReferenceContinuous3DFunction::ReferenceContinuous3DFunction(const Continuous3DF
SplineFitter
::
create3DNaturalSpline
(
x
,
y
,
z
,
values
,
c
);
SplineFitter
::
create3DNaturalSpline
(
x
,
y
,
z
,
values
,
c
);
}
}
ReferenceContinuous3DFunction
::
ReferenceContinuous3DFunction
(
const
ReferenceContinuous3DFunction
&
other
)
:
function
(
other
.
function
)
{
function
.
getFunctionParameters
(
xsize
,
ysize
,
zsize
,
values
,
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
);
x
=
other
.
x
;
y
=
other
.
y
;
z
=
other
.
z
;
values
=
other
.
values
;
c
=
other
.
c
;
}
int
ReferenceContinuous3DFunction
::
getNumArguments
()
const
{
int
ReferenceContinuous3DFunction
::
getNumArguments
()
const
{
return
3
;
return
3
;
}
}
...
@@ -200,7 +224,7 @@ double ReferenceContinuous3DFunction::evaluateDerivative(const double* arguments
...
@@ -200,7 +224,7 @@ double ReferenceContinuous3DFunction::evaluateDerivative(const double* arguments
}
}
CustomFunction
*
ReferenceContinuous3DFunction
::
clone
()
const
{
CustomFunction
*
ReferenceContinuous3DFunction
::
clone
()
const
{
return
new
ReferenceContinuous3DFunction
(
function
);
return
new
ReferenceContinuous3DFunction
(
*
this
);
}
}
ReferenceDiscrete1DFunction
::
ReferenceDiscrete1DFunction
(
const
Discrete1DFunction
&
function
)
:
function
(
function
)
{
ReferenceDiscrete1DFunction
::
ReferenceDiscrete1DFunction
(
const
Discrete1DFunction
&
function
)
:
function
(
function
)
{
...
...
platforms/reference/src/SimTKReference/ReferenceAngleBondIxn.cpp
View file @
dca54ec7
...
@@ -38,7 +38,7 @@ using namespace OpenMM;
...
@@ -38,7 +38,7 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceAngleBondIxn
::
ReferenceAngleBondIxn
()
{
ReferenceAngleBondIxn
::
ReferenceAngleBondIxn
()
:
usePeriodic
(
false
)
{
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
@@ -64,6 +64,13 @@ ReferenceAngleBondIxn::~ReferenceAngleBondIxn() {
...
@@ -64,6 +64,13 @@ ReferenceAngleBondIxn::~ReferenceAngleBondIxn() {
}
}
void
ReferenceAngleBondIxn
::
setPeriodic
(
OpenMM
::
RealVec
*
vectors
)
{
usePeriodic
=
true
;
boxVectors
[
0
]
=
vectors
[
0
];
boxVectors
[
1
]
=
vectors
[
1
];
boxVectors
[
2
]
=
vectors
[
2
];
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get dEdR and energy term for angle bond
Get dEdR and energy term for angle bond
...
@@ -145,8 +152,14 @@ void ReferenceAngleBondIxn::calculateBondIxn(int* atomIndices,
...
@@ -145,8 +152,14 @@ void ReferenceAngleBondIxn::calculateBondIxn(int* atomIndices,
int
atomAIndex
=
atomIndices
[
0
];
int
atomAIndex
=
atomIndices
[
0
];
int
atomBIndex
=
atomIndices
[
1
];
int
atomBIndex
=
atomIndices
[
1
];
int
atomCIndex
=
atomIndices
[
2
];
int
atomCIndex
=
atomIndices
[
2
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
0
]);
if
(
usePeriodic
)
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
1
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
boxVectors
,
deltaR
[
0
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
boxVectors
,
deltaR
[
1
]);
}
else
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
1
]);
}
RealOpenMM
pVector
[
threeI
];
RealOpenMM
pVector
[
threeI
];
SimTKOpenMMUtilities
::
crossProductVector3
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
SimTKOpenMMUtilities
::
crossProductVector3
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
...
...
platforms/reference/src/SimTKReference/ReferenceCMAPTorsionIxn.cpp
View file @
dca54ec7
/* Portions copyright (c) 2010 Stanford University and Simbios.
/* Portions copyright (c) 2010
-2016
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -36,7 +36,14 @@ using namespace OpenMM;
...
@@ -36,7 +36,14 @@ using namespace OpenMM;
ReferenceCMAPTorsionIxn
::
ReferenceCMAPTorsionIxn
(
const
vector
<
vector
<
vector
<
RealOpenMM
>
>
>&
coeff
,
ReferenceCMAPTorsionIxn
::
ReferenceCMAPTorsionIxn
(
const
vector
<
vector
<
vector
<
RealOpenMM
>
>
>&
coeff
,
const
vector
<
int
>&
torsionMaps
,
const
vector
<
vector
<
int
>
>&
torsionIndices
)
:
const
vector
<
int
>&
torsionMaps
,
const
vector
<
vector
<
int
>
>&
torsionIndices
)
:
coeff
(
coeff
),
torsionMaps
(
torsionMaps
),
torsionIndices
(
torsionIndices
)
{
coeff
(
coeff
),
torsionMaps
(
torsionMaps
),
torsionIndices
(
torsionIndices
),
usePeriodic
(
false
)
{
}
void
ReferenceCMAPTorsionIxn
::
setPeriodic
(
OpenMM
::
RealVec
*
vectors
)
{
usePeriodic
=
true
;
boxVectors
[
0
]
=
vectors
[
0
];
boxVectors
[
1
]
=
vectors
[
1
];
boxVectors
[
2
]
=
vectors
[
2
];
}
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -83,13 +90,23 @@ void ReferenceCMAPTorsionIxn::calculateOneIxn(int index, vector<RealVec>& atomCo
...
@@ -83,13 +90,23 @@ void ReferenceCMAPTorsionIxn::calculateOneIxn(int index, vector<RealVec>& atomCo
// Compute deltas between the various atoms involved.
// Compute deltas between the various atoms involved.
RealOpenMM
deltaA
[
3
][
ReferenceForce
::
LastDeltaRIndex
];
RealOpenMM
deltaA
[
3
][
ReferenceForce
::
LastDeltaRIndex
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a2
],
atomCoordinates
[
a1
],
deltaA
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a2
],
atomCoordinates
[
a3
],
deltaA
[
1
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a4
],
atomCoordinates
[
a3
],
deltaA
[
2
]);
RealOpenMM
deltaB
[
3
][
ReferenceForce
::
LastDeltaRIndex
];
RealOpenMM
deltaB
[
3
][
ReferenceForce
::
LastDeltaRIndex
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b2
],
atomCoordinates
[
b1
],
deltaB
[
0
]);
if
(
usePeriodic
)
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b2
],
atomCoordinates
[
b3
],
deltaB
[
1
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
a2
],
atomCoordinates
[
a1
],
boxVectors
,
deltaA
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b4
],
atomCoordinates
[
b3
],
deltaB
[
2
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
a2
],
atomCoordinates
[
a3
],
boxVectors
,
deltaA
[
1
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
a4
],
atomCoordinates
[
a3
],
boxVectors
,
deltaA
[
2
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
b2
],
atomCoordinates
[
b1
],
boxVectors
,
deltaB
[
0
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
b2
],
atomCoordinates
[
b3
],
boxVectors
,
deltaB
[
1
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
b4
],
atomCoordinates
[
b3
],
boxVectors
,
deltaB
[
2
]);
}
else
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a2
],
atomCoordinates
[
a1
],
deltaA
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a2
],
atomCoordinates
[
a3
],
deltaA
[
1
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
a4
],
atomCoordinates
[
a3
],
deltaA
[
2
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b2
],
atomCoordinates
[
b1
],
deltaB
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b2
],
atomCoordinates
[
b3
],
deltaB
[
1
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
b4
],
atomCoordinates
[
b3
],
deltaB
[
2
]);
}
// Visual Studio complains if crossProduct declared as 'crossProduct[2][3]'
// Visual Studio complains if crossProduct declared as 'crossProduct[2][3]'
...
...
platforms/reference/src/SimTKReference/ReferenceCustomAngleIxn.cpp
View file @
dca54ec7
/* Portions copyright (c) 2010-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2010-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -39,7 +39,7 @@ using namespace std;
...
@@ -39,7 +39,7 @@ using namespace std;
ReferenceCustomAngleIxn
::
ReferenceCustomAngleIxn
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
ReferenceCustomAngleIxn
::
ReferenceCustomAngleIxn
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
)
:
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
)
:
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
)
{
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
)
,
usePeriodic
(
false
)
{
energyTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
"theta"
);
energyTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
"theta"
);
forceTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
"theta"
);
forceTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
"theta"
);
...
@@ -61,13 +61,13 @@ ReferenceCustomAngleIxn::ReferenceCustomAngleIxn(const Lepton::CompiledExpressio
...
@@ -61,13 +61,13 @@ ReferenceCustomAngleIxn::ReferenceCustomAngleIxn(const Lepton::CompiledExpressio
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceCustomAngleIxn
::~
ReferenceCustomAngleIxn
()
{
ReferenceCustomAngleIxn
::~
ReferenceCustomAngleIxn
()
{
}
// ---------------------------------------------------------------------------------------
void
ReferenceCustomAngleIxn
::
setPeriodic
(
OpenMM
::
RealVec
*
vectors
)
{
usePeriodic
=
true
;
// static const char* methodName = "\nReferenceCustomAngleIxn::~ReferenceCustomAngleIxn";
boxVectors
[
0
]
=
vectors
[
0
];
boxVectors
[
1
]
=
vectors
[
1
];
// ---------------------------------------------------------------------------------------
boxVectors
[
2
]
=
vectors
[
2
];
}
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -106,8 +106,14 @@ void ReferenceCustomAngleIxn::calculateBondIxn(int* atomIndices,
...
@@ -106,8 +106,14 @@ void ReferenceCustomAngleIxn::calculateBondIxn(int* atomIndices,
int
atomAIndex
=
atomIndices
[
0
];
int
atomAIndex
=
atomIndices
[
0
];
int
atomBIndex
=
atomIndices
[
1
];
int
atomBIndex
=
atomIndices
[
1
];
int
atomCIndex
=
atomIndices
[
2
];
int
atomCIndex
=
atomIndices
[
2
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
0
]);
if
(
usePeriodic
)
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
1
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
boxVectors
,
deltaR
[
0
]);
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
boxVectors
,
deltaR
[
1
]);
}
else
{
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
0
]);
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomCIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
[
1
]);
}
RealOpenMM
pVector
[
3
];
RealOpenMM
pVector
[
3
];
SimTKOpenMMUtilities
::
crossProductVector3
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
SimTKOpenMMUtilities
::
crossProductVector3
(
deltaR
[
0
],
deltaR
[
1
],
pVector
);
RealOpenMM
rp
=
SQRT
(
DOT3
(
pVector
,
pVector
));
RealOpenMM
rp
=
SQRT
(
DOT3
(
pVector
,
pVector
));
...
...
platforms/reference/src/SimTKReference/ReferenceCustomBondIxn.cpp
View file @
dca54ec7
/* Portions copyright (c) 2009-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
* Contributors: Peter Eastman
* Contributors: Peter Eastman
*
*
* Permission is hereby granted, free of charge, to any person obtaining
* Permission is hereby granted, free of charge, to any person obtaining
...
@@ -40,7 +40,7 @@ using namespace OpenMM;
...
@@ -40,7 +40,7 @@ using namespace OpenMM;
ReferenceCustomBondIxn
::
ReferenceCustomBondIxn
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
ReferenceCustomBondIxn
::
ReferenceCustomBondIxn
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
)
:
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
)
:
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
)
{
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
)
,
usePeriodic
(
false
)
{
energyR
=
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
"r"
);
energyR
=
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
"r"
);
forceR
=
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
"r"
);
forceR
=
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
"r"
);
numParameters
=
parameterNames
.
size
();
numParameters
=
parameterNames
.
size
();
...
@@ -61,13 +61,13 @@ ReferenceCustomBondIxn::ReferenceCustomBondIxn(const Lepton::CompiledExpression&
...
@@ -61,13 +61,13 @@ ReferenceCustomBondIxn::ReferenceCustomBondIxn(const Lepton::CompiledExpression&
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
ReferenceCustomBondIxn
::~
ReferenceCustomBondIxn
()
{
ReferenceCustomBondIxn
::~
ReferenceCustomBondIxn
()
{
}
// ---------------------------------------------------------------------------------------
void
ReferenceCustomBondIxn
::
setPeriodic
(
OpenMM
::
RealVec
*
vectors
)
{
usePeriodic
=
true
;
// static const char* methodName = "\nReferenceCustomBondIxn::~ReferenceCustomBondIxn";
boxVectors
[
0
]
=
vectors
[
0
];
boxVectors
[
1
]
=
vectors
[
1
];
// ---------------------------------------------------------------------------------------
boxVectors
[
2
]
=
vectors
[
2
];
}
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -108,7 +108,10 @@ void ReferenceCustomBondIxn::calculateBondIxn(int* atomIndices,
...
@@ -108,7 +108,10 @@ void ReferenceCustomBondIxn::calculateBondIxn(int* atomIndices,
int
atomAIndex
=
atomIndices
[
0
];
int
atomAIndex
=
atomIndices
[
0
];
int
atomBIndex
=
atomIndices
[
1
];
int
atomBIndex
=
atomIndices
[
1
];
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
);
if
(
usePeriodic
)
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
boxVectors
,
deltaR
);
else
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomAIndex
],
atomCoordinates
[
atomBIndex
],
deltaR
);
ReferenceForce
::
setVariable
(
energyR
,
deltaR
[
ReferenceForce
::
RIndex
]);
ReferenceForce
::
setVariable
(
energyR
,
deltaR
[
ReferenceForce
::
RIndex
]);
ReferenceForce
::
setVariable
(
forceR
,
deltaR
[
ReferenceForce
::
RIndex
]);
ReferenceForce
::
setVariable
(
forceR
,
deltaR
[
ReferenceForce
::
RIndex
]);
...
...
Prev
1
…
5
6
7
8
9
10
11
12
13
…
20
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment