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
94fbbe9c
Commit
94fbbe9c
authored
Apr 20, 2016
by
Peter Eastman
Browse files
Reference implementation of periodic boundary conditions for AMOEBA bonded forces
parent
b4dcef47
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
233 additions
and
55 deletions
+233
-55
platforms/reference/include/ReferenceForce.h
platforms/reference/include/ReferenceForce.h
+28
-0
platforms/reference/src/SimTKReference/ReferenceForce.cpp
platforms/reference/src/SimTKReference/ReferenceForce.cpp
+13
-0
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
...amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
...oeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
...ns/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
.../amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
+9
-5
plugins/amoeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
...oeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
+9
-5
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaPiTorsionForce.cpp
plugins/amoeba/openmmapi/src/AmoebaPiTorsionForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaStretchBendForce.cpp
plugins/amoeba/openmmapi/src/AmoebaStretchBendForce.cpp
+10
-2
plugins/amoeba/openmmapi/src/AmoebaTorsionTorsionForce.cpp
plugins/amoeba/openmmapi/src/AmoebaTorsionTorsionForce.cpp
+10
-2
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
...amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
+21
-1
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
...s/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
+7
-0
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
...eference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
+16
-3
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
.../reference/src/SimTKReference/AmoebaReferenceAngleForce.h
+15
-2
No files found.
platforms/reference/include/ReferenceForce.h
View file @
94fbbe9c
...
@@ -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/src/SimTKReference/ReferenceForce.cpp
View file @
94fbbe9c
...
@@ -73,6 +73,10 @@ void ReferenceForce::getDeltaR(const RealVec& atomCoordinatesI, const RealVec& a
...
@@ -73,6 +73,10 @@ void ReferenceForce::getDeltaR(const RealVec& atomCoordinatesI, const RealVec& a
deltaR
[
RIndex
]
=
(
RealOpenMM
)
SQRT
(
deltaR
[
R2Index
]);
deltaR
[
RIndex
]
=
(
RealOpenMM
)
SQRT
(
deltaR
[
R2Index
]);
}
}
RealVec
ReferenceForce
::
getDeltaR
(
const
RealVec
&
atomCoordinatesI
,
const
RealVec
&
atomCoordinatesJ
)
{
return
atomCoordinatesJ
-
atomCoordinatesI
;
}
void
ReferenceForce
::
getDeltaRPeriodic
(
const
RealVec
&
atomCoordinatesI
,
const
RealVec
&
atomCoordinatesJ
,
void
ReferenceForce
::
getDeltaRPeriodic
(
const
RealVec
&
atomCoordinatesI
,
const
RealVec
&
atomCoordinatesJ
,
const
RealOpenMM
*
boxSize
,
RealOpenMM
*
deltaR
)
{
const
RealOpenMM
*
boxSize
,
RealOpenMM
*
deltaR
)
{
deltaR
[
XIndex
]
=
periodicDifference
(
atomCoordinatesJ
[
0
],
atomCoordinatesI
[
0
],
boxSize
[
0
]);
deltaR
[
XIndex
]
=
periodicDifference
(
atomCoordinatesJ
[
0
],
atomCoordinatesI
[
0
],
boxSize
[
0
]);
...
@@ -96,6 +100,15 @@ void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const Re
...
@@ -96,6 +100,15 @@ void ReferenceForce::getDeltaRPeriodic(const RealVec& atomCoordinatesI, const Re
deltaR
[
RIndex
]
=
SQRT
(
deltaR
[
R2Index
]);
deltaR
[
RIndex
]
=
SQRT
(
deltaR
[
R2Index
]);
}
}
RealVec
ReferenceForce
::
getDeltaRPeriodic
(
const
RealVec
&
atomCoordinatesI
,
const
RealVec
&
atomCoordinatesJ
,
const
RealVec
*
boxVectors
)
{
RealVec
diff
=
atomCoordinatesJ
-
atomCoordinatesI
;
diff
-=
boxVectors
[
2
]
*
floor
(
diff
[
2
]
/
boxVectors
[
2
][
2
]
+
0.5
);
diff
-=
boxVectors
[
1
]
*
floor
(
diff
[
1
]
/
boxVectors
[
1
][
1
]
+
0.5
);
diff
-=
boxVectors
[
0
]
*
floor
(
diff
[
0
]
/
boxVectors
[
0
][
0
]
+
0.5
);
return
diff
;
}
double
*
ReferenceForce
::
getVariablePointer
(
Lepton
::
CompiledExpression
&
expression
,
const
std
::
string
&
name
)
{
double
*
ReferenceForce
::
getVariablePointer
(
Lepton
::
CompiledExpression
&
expression
,
const
std
::
string
&
name
)
{
if
(
expression
.
getVariables
().
find
(
name
)
==
expression
.
getVariables
().
end
())
if
(
expression
.
getVariables
().
find
(
name
)
==
expression
.
getVariables
().
end
())
return
NULL
;
return
NULL
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -166,21 +166,25 @@ public:
...
@@ -166,21 +166,25 @@ public:
* in an angle cannot be changed, nor can new angles be added.
* in an angle cannot be changed, nor can new angles be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
private:
private:
class
AngleInfo
;
class
AngleInfo
;
std
::
vector
<
AngleInfo
>
angles
;
std
::
vector
<
AngleInfo
>
angles
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -138,21 +138,25 @@ public:
...
@@ -138,21 +138,25 @@ public:
* in a bond cannot be changed, nor can new bonds be added.
* in a bond cannot be changed, nor can new bonds be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
double
_globalQuarticK
,
_globalCubicK
;
double
_globalQuarticK
,
_globalCubicK
;
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
private:
private:
class
BondInfo
;
class
BondInfo
;
std
::
vector
<
BondInfo
>
bonds
;
std
::
vector
<
BondInfo
>
bonds
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -171,21 +171,25 @@ public:
...
@@ -171,21 +171,25 @@ public:
* in an angle cannot be changed, nor can new angles be added.
* in an angle cannot be changed, nor can new angles be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
private:
private:
class
AngleInfo
;
class
AngleInfo
;
std
::
vector
<
AngleInfo
>
angles
;
std
::
vector
<
AngleInfo
>
angles
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -163,21 +163,25 @@ public:
...
@@ -163,21 +163,25 @@ public:
* in a term cannot be changed, nor can new terms be added.
* in a term cannot be changed, nor can new terms be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
double
_globalCubicK
,
_globalQuarticK
,
_globalPenticK
,
_globalSexticK
;
private:
private:
class
OutOfPlaneBendInfo
;
class
OutOfPlaneBendInfo
;
std
::
vector
<
OutOfPlaneBendInfo
>
outOfPlaneBends
;
std
::
vector
<
OutOfPlaneBendInfo
>
outOfPlaneBends
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -113,20 +113,24 @@ public:
...
@@ -113,20 +113,24 @@ public:
* in a torsion cannot be changed, nor can new torsions be added.
* in a torsion cannot be changed, nor can new torsions be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
private:
private:
class
PiTorsionInfo
;
class
PiTorsionInfo
;
std
::
vector
<
PiTorsionInfo
>
piTorsions
;
std
::
vector
<
PiTorsionInfo
>
piTorsions
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -119,20 +119,24 @@ public:
...
@@ -119,20 +119,24 @@ public:
* in a term cannot be changed, nor can new terms be added.
* in a term cannot be changed, nor can new terms be added.
*/
*/
void
updateParametersInContext
(
Context
&
context
);
void
updateParametersInContext
(
Context
&
context
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
private:
private:
class
StretchBendInfo
;
class
StretchBendInfo
;
std
::
vector
<
StretchBendInfo
>
stretchBends
;
std
::
vector
<
StretchBendInfo
>
stretchBends
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
View file @
94fbbe9c
...
@@ -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
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -137,15 +137,18 @@ public:
...
@@ -137,15 +137,18 @@ public:
* grid[x][y][5] = dEd(xy) value
* grid[x][y][5] = dEd(xy) value
*/
*/
void
setTorsionTorsionGrid
(
int
index
,
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid
);
void
setTorsionTorsionGrid
(
int
index
,
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
grid
);
/**
* Set whether this force should apply periodic boundary conditions when calculating displacements.
* Usually this is not appropriate for bonded forces, but there are situations when it can be useful.
*/
void
setUsesPeriodicBoundaryConditions
(
bool
periodic
);
/**
/**
* Returns whether or not this force makes use of periodic boundary
* Returns whether or not this force makes use of periodic boundary
* conditions.
* conditions.
*
*
* @returns true if
nonbondedMethod
uses PBC and false otherwise
* @returns true if
force
uses PBC and false otherwise
*/
*/
bool
usesPeriodicBoundaryConditions
()
const
{
bool
usesPeriodicBoundaryConditions
()
const
;
return
false
;
}
protected:
protected:
ForceImpl
*
createImpl
()
const
;
ForceImpl
*
createImpl
()
const
;
private:
private:
...
@@ -153,6 +156,7 @@ private:
...
@@ -153,6 +156,7 @@ private:
class
TorsionTorsionGridInfo
;
class
TorsionTorsionGridInfo
;
std
::
vector
<
TorsionTorsionInfo
>
torsionTorsions
;
std
::
vector
<
TorsionTorsionInfo
>
torsionTorsions
;
std
::
vector
<
TorsionTorsionGridInfo
>
torsionTorsionGrids
;
std
::
vector
<
TorsionTorsionGridInfo
>
torsionTorsionGrids
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/openmmapi/src/AmoebaAngleForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaAngleForce
::
AmoebaAngleForce
()
{
AmoebaAngleForce
::
AmoebaAngleForce
()
:
usePeriodic
(
false
)
{
_globalCubicK
=
_globalQuarticK
=
_globalPenticK
=
_globalSexticK
=
0.0
;
_globalCubicK
=
_globalQuarticK
=
_globalPenticK
=
_globalSexticK
=
0.0
;
}
}
...
@@ -102,3 +102,11 @@ ForceImpl* AmoebaAngleForce::createImpl() const {
...
@@ -102,3 +102,11 @@ ForceImpl* AmoebaAngleForce::createImpl() const {
void
AmoebaAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaAngleForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaAngleForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaBondForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaBondForce
::
AmoebaBondForce
()
{
AmoebaBondForce
::
AmoebaBondForce
()
:
usePeriodic
(
false
)
{
_globalCubicK
=
_globalQuarticK
=
0.0
;
_globalCubicK
=
_globalQuarticK
=
0.0
;
}
}
...
@@ -82,3 +82,11 @@ ForceImpl* AmoebaBondForce::createImpl() const {
...
@@ -82,3 +82,11 @@ ForceImpl* AmoebaBondForce::createImpl() const {
void
AmoebaBondForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaBondForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaBondForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaBondForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaBondForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaInPlaneAngleForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaInPlaneAngleForce
::
AmoebaInPlaneAngleForce
()
{
AmoebaInPlaneAngleForce
::
AmoebaInPlaneAngleForce
()
:
usePeriodic
(
false
)
{
_globalCubicK
=
_globalQuarticK
=
_globalPenticK
=
_globalSexticK
=
0.0
;
_globalCubicK
=
_globalQuarticK
=
_globalPenticK
=
_globalSexticK
=
0.0
;
}
}
...
@@ -104,3 +104,11 @@ ForceImpl* AmoebaInPlaneAngleForce::createImpl() const {
...
@@ -104,3 +104,11 @@ ForceImpl* AmoebaInPlaneAngleForce::createImpl() const {
void
AmoebaInPlaneAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaInPlaneAngleForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaInPlaneAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaInPlaneAngleForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaInPlaneAngleForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaInPlaneAngleForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaOutOfPlaneBendForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaOutOfPlaneBendForce
::
AmoebaOutOfPlaneBendForce
()
{
AmoebaOutOfPlaneBendForce
::
AmoebaOutOfPlaneBendForce
()
:
usePeriodic
(
false
)
{
_globalCubicK
=
-
0.1400000E-01
;
_globalCubicK
=
-
0.1400000E-01
;
_globalQuarticK
=
0.5600000E-04
;
_globalQuarticK
=
0.5600000E-04
;
_globalPenticK
=
-
0.7000000E-06
;
_globalPenticK
=
-
0.7000000E-06
;
...
@@ -106,3 +106,11 @@ ForceImpl* AmoebaOutOfPlaneBendForce::createImpl() const {
...
@@ -106,3 +106,11 @@ ForceImpl* AmoebaOutOfPlaneBendForce::createImpl() const {
void
AmoebaOutOfPlaneBendForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaOutOfPlaneBendForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaOutOfPlaneBendForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaOutOfPlaneBendForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaOutOfPlaneBendForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaOutOfPlaneBendForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaPiTorsionForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaPiTorsionForce
::
AmoebaPiTorsionForce
()
{
AmoebaPiTorsionForce
::
AmoebaPiTorsionForce
()
:
usePeriodic
(
false
)
{
}
}
int
AmoebaPiTorsionForce
::
addPiTorsion
(
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
int
particle5
,
int
particle6
,
double
k
)
{
int
AmoebaPiTorsionForce
::
addPiTorsion
(
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
int
particle5
,
int
particle6
,
double
k
)
{
...
@@ -71,3 +71,11 @@ ForceImpl* AmoebaPiTorsionForce::createImpl() const {
...
@@ -71,3 +71,11 @@ ForceImpl* AmoebaPiTorsionForce::createImpl() const {
void
AmoebaPiTorsionForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaPiTorsionForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaPiTorsionForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaPiTorsionForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaPiTorsionForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaPiTorsionForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaStretchBendForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaStretchBendForce
::
AmoebaStretchBendForce
()
{
AmoebaStretchBendForce
::
AmoebaStretchBendForce
()
:
usePeriodic
(
false
)
{
}
}
int
AmoebaStretchBendForce
::
addStretchBend
(
int
particle1
,
int
particle2
,
int
particle3
,
int
AmoebaStretchBendForce
::
addStretchBend
(
int
particle1
,
int
particle2
,
int
particle3
,
...
@@ -76,3 +76,11 @@ ForceImpl* AmoebaStretchBendForce::createImpl() const {
...
@@ -76,3 +76,11 @@ ForceImpl* AmoebaStretchBendForce::createImpl() const {
void
AmoebaStretchBendForce
::
updateParametersInContext
(
Context
&
context
)
{
void
AmoebaStretchBendForce
::
updateParametersInContext
(
Context
&
context
)
{
dynamic_cast
<
AmoebaStretchBendForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
dynamic_cast
<
AmoebaStretchBendForceImpl
&>
(
getImplInContext
(
context
)).
updateParametersInContext
(
getContextImpl
(
context
));
}
}
void
AmoebaStretchBendForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaStretchBendForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/openmmapi/src/AmoebaTorsionTorsionForce.cpp
View file @
94fbbe9c
...
@@ -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) 2008-201
4
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: *
* Authors: *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
using
namespace
std
;
using
namespace
std
;
AmoebaTorsionTorsionForce
::
AmoebaTorsionTorsionForce
()
{
AmoebaTorsionTorsionForce
::
AmoebaTorsionTorsionForce
()
:
usePeriodic
(
false
)
{
}
}
int
AmoebaTorsionTorsionForce
::
addTorsionTorsion
(
int
particle1
,
int
particle2
,
int
particle3
,
int
AmoebaTorsionTorsionForce
::
addTorsionTorsion
(
int
particle1
,
int
particle2
,
int
particle3
,
...
@@ -183,3 +183,11 @@ AmoebaTorsionTorsionForce::TorsionTorsionGridInfo::TorsionTorsionGridInfo(const
...
@@ -183,3 +183,11 @@ AmoebaTorsionTorsionForce::TorsionTorsionGridInfo::TorsionTorsionGridInfo(const
}
}
}
}
}
}
void
AmoebaTorsionTorsionForce
::
setUsesPeriodicBoundaryConditions
(
bool
periodic
)
{
usePeriodic
=
periodic
;
}
bool
AmoebaTorsionTorsionForce
::
usesPeriodicBoundaryConditions
()
const
{
return
usePeriodic
;
}
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.cpp
View file @
94fbbe9c
...
@@ -104,12 +104,15 @@ void ReferenceCalcAmoebaBondForceKernel::initialize(const System& system, const
...
@@ -104,12 +104,15 @@ void ReferenceCalcAmoebaBondForceKernel::initialize(const System& system, const
}
}
globalBondCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondCubic
());
globalBondCubic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondCubic
());
globalBondQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondQuartic
());
globalBondQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalBondQuartic
());
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaBondForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceBondForce
amoebaReferenceBondForce
;
AmoebaReferenceBondForce
amoebaReferenceBondForce
;
if
(
usePeriodic
)
amoebaReferenceBondForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceBondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
RealOpenMM
energy
=
amoebaReferenceBondForce
.
calculateForceAndEnergy
(
numBonds
,
posData
,
particle1
,
particle2
,
length
,
kQuadratic
,
globalBondCubic
,
globalBondQuartic
,
globalBondCubic
,
globalBondQuartic
,
forceData
);
forceData
);
...
@@ -160,12 +163,15 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const
...
@@ -160,12 +163,15 @@ void ReferenceCalcAmoebaAngleForceKernel::initialize(const System& system, const
globalAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleQuartic
());
globalAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleQuartic
());
globalAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAnglePentic
());
globalAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAnglePentic
());
globalAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleSextic
());
globalAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalAngleSextic
());
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceAngleForce
amoebaReferenceAngleForce
;
AmoebaReferenceAngleForce
amoebaReferenceAngleForce
;
if
(
usePeriodic
)
amoebaReferenceAngleForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceAngleForce
.
calculateForceAndEnergy
(
numAngles
,
RealOpenMM
energy
=
amoebaReferenceAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
globalAngleCubic
,
globalAngleQuartic
,
globalAnglePentic
,
globalAngleSextic
,
forceData
);
posData
,
particle1
,
particle2
,
particle3
,
angle
,
kQuadratic
,
globalAngleCubic
,
globalAngleQuartic
,
globalAnglePentic
,
globalAngleSextic
,
forceData
);
return
static_cast
<
double
>
(
energy
);
return
static_cast
<
double
>
(
energy
);
...
@@ -213,6 +219,7 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system
...
@@ -213,6 +219,7 @@ void ReferenceCalcAmoebaInPlaneAngleForceKernel::initialize(const System& system
globalInPlaneAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
globalInPlaneAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleQuartic
());
globalInPlaneAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAnglePentic
());
globalInPlaneAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAnglePentic
());
globalInPlaneAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleSextic
());
globalInPlaneAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalInPlaneAngleSextic
());
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaInPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaInPlaneAngleForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
...
@@ -220,6 +227,8 @@ double ReferenceCalcAmoebaInPlaneAngleForceKernel::execute(ContextImpl& context,
...
@@ -220,6 +227,8 @@ double ReferenceCalcAmoebaInPlaneAngleForceKernel::execute(ContextImpl& context,
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceInPlaneAngleForce
amoebaReferenceInPlaneAngleForce
;
AmoebaReferenceInPlaneAngleForce
amoebaReferenceInPlaneAngleForce
;
if
(
usePeriodic
)
amoebaReferenceInPlaneAngleForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceInPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
RealOpenMM
energy
=
amoebaReferenceInPlaneAngleForce
.
calculateForceAndEnergy
(
numAngles
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
angle
,
kQuadratic
,
globalInPlaneAngleCubic
,
globalInPlaneAngleQuartic
,
angle
,
kQuadratic
,
globalInPlaneAngleCubic
,
globalInPlaneAngleQuartic
,
globalInPlaneAnglePentic
,
globalInPlaneAngleSextic
,
forceData
);
globalInPlaneAnglePentic
,
globalInPlaneAngleSextic
,
forceData
);
...
@@ -266,12 +275,15 @@ void ReferenceCalcAmoebaPiTorsionForceKernel::initialize(const System& system, c
...
@@ -266,12 +275,15 @@ void ReferenceCalcAmoebaPiTorsionForceKernel::initialize(const System& system, c
particle6
.
push_back
(
particle6Index
);
particle6
.
push_back
(
particle6Index
);
kTorsion
.
push_back
(
static_cast
<
RealOpenMM
>
(
kTorsionParameter
));
kTorsion
.
push_back
(
static_cast
<
RealOpenMM
>
(
kTorsionParameter
));
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaPiTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaPiTorsionForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferencePiTorsionForce
amoebaReferencePiTorsionForce
;
AmoebaReferencePiTorsionForce
amoebaReferencePiTorsionForce
;
if
(
usePeriodic
)
amoebaReferencePiTorsionForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferencePiTorsionForce
.
calculateForceAndEnergy
(
numPiTorsions
,
posData
,
particle1
,
particle2
,
RealOpenMM
energy
=
amoebaReferencePiTorsionForce
.
calculateForceAndEnergy
(
numPiTorsions
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle6
,
particle3
,
particle4
,
particle5
,
particle6
,
kTorsion
,
forceData
);
kTorsion
,
forceData
);
...
@@ -318,12 +330,15 @@ void ReferenceCalcAmoebaStretchBendForceKernel::initialize(const System& system,
...
@@ -318,12 +330,15 @@ void ReferenceCalcAmoebaStretchBendForceKernel::initialize(const System& system,
k1Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k1
));
k1Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k1
));
k2Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k2
));
k2Parameters
.
push_back
(
static_cast
<
RealOpenMM
>
(
k2
));
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaStretchBendForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaStretchBendForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceStretchBendForce
amoebaReferenceStretchBendForce
;
AmoebaReferenceStretchBendForce
amoebaReferenceStretchBendForce
;
if
(
usePeriodic
)
amoebaReferenceStretchBendForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceStretchBendForce
.
calculateForceAndEnergy
(
numStretchBends
,
posData
,
particle1
,
particle2
,
particle3
,
RealOpenMM
energy
=
amoebaReferenceStretchBendForce
.
calculateForceAndEnergy
(
numStretchBends
,
posData
,
particle1
,
particle2
,
particle3
,
lengthABParameters
,
lengthCBParameters
,
angleParameters
,
k1Parameters
,
lengthABParameters
,
lengthCBParameters
,
angleParameters
,
k1Parameters
,
k2Parameters
,
forceData
);
k2Parameters
,
forceData
);
...
@@ -376,13 +391,15 @@ void ReferenceCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& syst
...
@@ -376,13 +391,15 @@ void ReferenceCalcAmoebaOutOfPlaneBendForceKernel::initialize(const System& syst
globalOutOfPlaneBendAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
globalOutOfPlaneBendAngleQuartic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendQuartic
());
globalOutOfPlaneBendAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
globalOutOfPlaneBendAnglePentic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendPentic
());
globalOutOfPlaneBendAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendSextic
());
globalOutOfPlaneBendAngleSextic
=
static_cast
<
RealOpenMM
>
(
force
.
getAmoebaGlobalOutOfPlaneBendSextic
());
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
}
}
double
ReferenceCalcAmoebaOutOfPlaneBendForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
double
ReferenceCalcAmoebaOutOfPlaneBendForceKernel
::
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
{
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceOutOfPlaneBendForce
amoebaReferenceOutOfPlaneBendForce
;
AmoebaReferenceOutOfPlaneBendForce
amoebaReferenceOutOfPlaneBendForce
;
if
(
usePeriodic
)
amoebaReferenceOutOfPlaneBendForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceOutOfPlaneBendForce
.
calculateForceAndEnergy
(
numOutOfPlaneBends
,
posData
,
RealOpenMM
energy
=
amoebaReferenceOutOfPlaneBendForce
.
calculateForceAndEnergy
(
numOutOfPlaneBends
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
particle1
,
particle2
,
particle3
,
particle4
,
kParameters
,
kParameters
,
...
@@ -434,6 +451,7 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
...
@@ -434,6 +451,7 @@ void ReferenceCalcAmoebaTorsionTorsionForceKernel::initialize(const System& syst
chiralCheckAtom
.
push_back
(
chiralCheckAtomIndex
);
chiralCheckAtom
.
push_back
(
chiralCheckAtomIndex
);
gridIndices
.
push_back
(
gridIndex
);
gridIndices
.
push_back
(
gridIndex
);
}
}
usePeriodic
=
force
.
usesPeriodicBoundaryConditions
();
// torsion-torsion grids
// torsion-torsion grids
...
@@ -478,6 +496,8 @@ double ReferenceCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& contex
...
@@ -478,6 +496,8 @@ double ReferenceCalcAmoebaTorsionTorsionForceKernel::execute(ContextImpl& contex
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
posData
=
extractPositions
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
vector
<
RealVec
>&
forceData
=
extractForces
(
context
);
AmoebaReferenceTorsionTorsionForce
amoebaReferenceTorsionTorsionForce
;
AmoebaReferenceTorsionTorsionForce
amoebaReferenceTorsionTorsionForce
;
if
(
usePeriodic
)
amoebaReferenceTorsionTorsionForce
.
setPeriodic
(
extractBoxVectors
(
context
));
RealOpenMM
energy
=
amoebaReferenceTorsionTorsionForce
.
calculateForceAndEnergy
(
numTorsionTorsions
,
posData
,
RealOpenMM
energy
=
amoebaReferenceTorsionTorsionForce
.
calculateForceAndEnergy
(
numTorsionTorsions
,
posData
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
particle1
,
particle2
,
particle3
,
particle4
,
particle5
,
chiralCheckAtom
,
gridIndices
,
torsionTorsionGrids
,
forceData
);
chiralCheckAtom
,
gridIndices
,
torsionTorsionGrids
,
forceData
);
...
...
plugins/amoeba/platforms/reference/src/AmoebaReferenceKernels.h
View file @
94fbbe9c
...
@@ -77,6 +77,7 @@ private:
...
@@ -77,6 +77,7 @@ private:
RealOpenMM
globalBondCubic
;
RealOpenMM
globalBondCubic
;
RealOpenMM
globalBondQuartic
;
RealOpenMM
globalBondQuartic
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -121,6 +122,7 @@ private:
...
@@ -121,6 +122,7 @@ private:
RealOpenMM
globalAnglePentic
;
RealOpenMM
globalAnglePentic
;
RealOpenMM
globalAngleSextic
;
RealOpenMM
globalAngleSextic
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -166,6 +168,7 @@ private:
...
@@ -166,6 +168,7 @@ private:
RealOpenMM
globalInPlaneAnglePentic
;
RealOpenMM
globalInPlaneAnglePentic
;
RealOpenMM
globalInPlaneAngleSextic
;
RealOpenMM
globalInPlaneAngleSextic
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -208,6 +211,7 @@ private:
...
@@ -208,6 +211,7 @@ private:
std
::
vector
<
int
>
particle6
;
std
::
vector
<
int
>
particle6
;
std
::
vector
<
RealOpenMM
>
kTorsion
;
std
::
vector
<
RealOpenMM
>
kTorsion
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -251,6 +255,7 @@ private:
...
@@ -251,6 +255,7 @@ private:
std
::
vector
<
RealOpenMM
>
k1Parameters
;
std
::
vector
<
RealOpenMM
>
k1Parameters
;
std
::
vector
<
RealOpenMM
>
k2Parameters
;
std
::
vector
<
RealOpenMM
>
k2Parameters
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -295,6 +300,7 @@ private:
...
@@ -295,6 +300,7 @@ private:
RealOpenMM
globalOutOfPlaneBendAnglePentic
;
RealOpenMM
globalOutOfPlaneBendAnglePentic
;
RealOpenMM
globalOutOfPlaneBendAngleSextic
;
RealOpenMM
globalOutOfPlaneBendAngleSextic
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
@@ -334,6 +340,7 @@ private:
...
@@ -334,6 +340,7 @@ private:
std
::
vector
<
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
>
torsionTorsionGrids
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
std
::
vector
<
RealOpenMM
>
>
>
>
torsionTorsionGrids
;
const
System
&
system
;
const
System
&
system
;
bool
usePeriodic
;
};
};
/**
/**
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.cpp
View file @
94fbbe9c
/* 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
...
@@ -28,6 +28,13 @@
...
@@ -28,6 +28,13 @@
using
std
::
vector
;
using
std
::
vector
;
using
namespace
OpenMM
;
using
namespace
OpenMM
;
void
AmoebaReferenceAngleForce
::
setPeriodic
(
OpenMM
::
RealVec
*
vectors
)
{
usePeriodic
=
true
;
boxVectors
[
0
]
=
vectors
[
0
];
boxVectors
[
1
]
=
vectors
[
1
];
boxVectors
[
2
]
=
vectors
[
2
];
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get dEdT and energy prefactor given cosine of angle :: the calculation for different
Get dEdT and energy prefactor given cosine of angle :: the calculation for different
...
@@ -132,11 +139,17 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn(const RealVec& positionA
...
@@ -132,11 +139,17 @@ RealOpenMM AmoebaReferenceAngleForce::calculateAngleIxn(const RealVec& positionA
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
std
::
vector
<
RealOpenMM
>
deltaR
[
2
];
std
::
vector
<
RealOpenMM
>
deltaR
[
2
];
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
[
0
]);
if
(
usePeriodic
)
AmoebaReferenceForce
::
loadDeltaRPeriodic
(
positionAtomA
,
positionAtomB
,
deltaR
[
0
],
boxVectors
);
else
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomA
,
positionAtomB
,
deltaR
[
0
]);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
0
]);
RealOpenMM
rAB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
0
]);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
RealOpenMM
rAB
=
SQRT
(
rAB2
);
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomB
,
deltaR
[
1
]);
if
(
usePeriodic
)
AmoebaReferenceForce
::
loadDeltaRPeriodic
(
positionAtomC
,
positionAtomB
,
deltaR
[
1
],
boxVectors
);
else
AmoebaReferenceForce
::
loadDeltaR
(
positionAtomC
,
positionAtomB
,
deltaR
[
1
]);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
1
]);
RealOpenMM
rCB2
=
AmoebaReferenceForce
::
getNormSquared3
(
deltaR
[
1
]);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
RealOpenMM
rCB
=
SQRT
(
rCB2
);
...
...
plugins/amoeba/platforms/reference/src/SimTKReference/AmoebaReferenceAngleForce.h
View file @
94fbbe9c
/* 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
...
@@ -40,7 +40,7 @@ public:
...
@@ -40,7 +40,7 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
AmoebaReferenceAngleForce
()
{};
AmoebaReferenceAngleForce
()
:
usePeriodic
(
false
)
{};
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -50,6 +50,16 @@ public:
...
@@ -50,6 +50,16 @@ public:
~
AmoebaReferenceAngleForce
()
{};
~
AmoebaReferenceAngleForce
()
{};
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
setPeriodic
(
OpenMM
::
RealVec
*
vectors
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Calculate Amoeba angle ixns (force and energy)
Calculate Amoeba angle ixns (force and energy)
...
@@ -86,6 +96,9 @@ public:
...
@@ -86,6 +96,9 @@ public:
private:
private:
bool
usePeriodic
;
RealVec
boxVectors
[
3
];
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Get dEdT and energy prefactor given cosine of angle :: the calculation for different
Get dEdT and energy prefactor given cosine of angle :: the calculation for different
...
...
Prev
1
2
3
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