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
5003591d
"platforms/common/vscode:/vscode.git/clone" did not exist on "862e6ac7d8aa80aaafbfb866aaa1263aa8069d96"
Commit
5003591d
authored
Jul 21, 2010
by
Peter Eastman
Browse files
Simplified reference code for accumulating energies
parent
b8c624fa
Changes
28
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
82 deletions
+30
-82
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
...forms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
+3
-7
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
...erence/src/SimTKReference/ReferenceProperDihedralBond.cpp
+5
-16
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.h
...eference/src/SimTKReference/ReferenceProperDihedralBond.h
+3
-7
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
.../reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
+5
-16
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
...ms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
+3
-7
plugins/freeEnergy/platforms/reference/src/ReferenceFreeEnergyKernels.cpp
...gy/platforms/reference/src/ReferenceFreeEnergyKernels.cpp
+2
-6
plugins/freeEnergy/platforms/reference/src/SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.cpp
...SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.cpp
+6
-17
plugins/freeEnergy/platforms/reference/src/SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.h
...c/SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.h
+3
-6
No files found.
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.h
View file @
5003591d
...
...
@@ -57,17 +57,13 @@ class ReferenceLJCoulomb14 : public ReferenceBondIxn {
@param atomCoordinates atom coordinates
@param parameters six RB parameters
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
View file @
5003591d
...
...
@@ -73,25 +73,15 @@ ReferenceProperDihedralBond::~ReferenceProperDihedralBond( ){
parameters[1] = ideal bond angle in radians
parameters[2] = multiplicity
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
ReferenceProperDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
void
ReferenceProperDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
{
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceProperDihedralBond::calculateBondIxn";
// ---------------------------------------------------------------------------------------
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceProperDihedralBond::calculateBondIxn"
;
...
...
@@ -185,7 +175,6 @@ int ReferenceProperDihedralBond::calculateBondIxn( int* atomIndices,
// accumulate energies
updateEnergy
(
energy
,
energiesByBond
,
LastAtomIndex
,
atomIndices
,
energiesByAtom
);
return
ReferenceForce
::
DefaultReturn
;
if
(
totalEnergy
!=
NULL
)
*
totalEnergy
+=
energy
;
}
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.h
View file @
5003591d
...
...
@@ -61,17 +61,13 @@ class ReferenceProperDihedralBond : public ReferenceBondIxn {
parameters[1] = ideal bond angle in radians
parameters[2] = multiplicity
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
View file @
5003591d
...
...
@@ -71,25 +71,15 @@ ReferenceRbDihedralBond::~ReferenceRbDihedralBond( ){
@param atomCoordinates atom coordinates
@param parameters six RB parameters
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
ReferenceRbDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
void
ReferenceRbDihedralBond
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
{
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceRbDihedralBond::calculateBondIxn";
// ---------------------------------------------------------------------------------------
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceRbDihedralBond::calculateBondIxn"
;
...
...
@@ -200,7 +190,6 @@ int ReferenceRbDihedralBond::calculateBondIxn( int* atomIndices,
// accumulate energies
updateEnergy
(
energy
,
energiesByBond
,
LastAtomIndex
,
atomIndices
,
energiesByAtom
);
return
ReferenceForce
::
DefaultReturn
;
if
(
totalEnergy
!=
NULL
)
*
totalEnergy
+=
energy
;
}
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.h
View file @
5003591d
...
...
@@ -59,17 +59,13 @@ class ReferenceRbDihedralBond : public ReferenceBondIxn {
@param atomCoordinates atom coordinates
@param parameters six RB parameters
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
};
...
...
plugins/freeEnergy/platforms/reference/src/ReferenceFreeEnergyKernels.cpp
View file @
5003591d
...
...
@@ -259,7 +259,7 @@ void ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeForces(ContextI
ReferenceFreeEnergyLJCoulomb14Softcore
nonbonded14
;
if
(
nonbondedMethod
==
CutoffNonPeriodic
||
nonbondedMethod
==
CutoffPeriodic
)
nonbonded14
.
setUseCutoff
(
nonbondedCutoff
,
rfDielectric
);
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
0
,
0
,
0
,
nonbonded14
);
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
0
,
nonbonded14
);
}
double
ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel
::
executeEnergy
(
ContextImpl
&
context
)
{
...
...
@@ -289,12 +289,8 @@ double ReferenceFreeEnergyCalcNonbondedSoftcoreForceKernel::executeEnergy(Contex
if
(
nonbondedMethod
==
CutoffNonPeriodic
||
nonbondedMethod
==
CutoffPeriodic
)
nonbonded14
.
setUseCutoff
(
nonbondedCutoff
,
rfDielectric
);
RealOpenMM
*
energyArray
=
new
RealOpenMM
[
num14
];
for
(
int
i
=
0
;
i
<
num14
;
++
i
)
energyArray
[
i
]
=
0
;
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
energyArray
,
0
,
&
energy
,
nonbonded14
);
refBondForce
.
calculateForce
(
num14
,
bonded14IndexArray
,
posData
,
bonded14ParamArray
,
forceData
,
&
energy
,
nonbonded14
);
disposeRealArray
(
forceData
,
numParticles
);
delete
[]
energyArray
;
return
energy
;
}
...
...
plugins/freeEnergy/platforms/reference/src/SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.cpp
View file @
5003591d
...
...
@@ -140,23 +140,13 @@ int ReferenceFreeEnergyLJCoulomb14Softcore::getDerivedParameters( RealOpenMM c6,
parameters[1]= c6*c6/c12 (4*epsilon)
parameters[2]= epsfac*q1*q2
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
ReferenceFreeEnergyLJCoulomb14Softcore
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
ReferenceFreeEnergyLJCoulomb14Softcore
::
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
{
// ---------------------------------------------------------------------------------------
// static const char* methodName = "\nReferenceFreeEnergyLJCoulomb14Softcore::calculateBondIxn";
// ---------------------------------------------------------------------------------------
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceFreeEnergyLJCoulomb14Softcore::calculateBondIxn"
;
...
...
@@ -193,7 +183,7 @@ int ReferenceFreeEnergyLJCoulomb14Softcore::calculateBondIxn( int* atomIndices,
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomBIndex
],
atomCoordinates
[
atomAIndex
],
deltaR
[
0
]
);
if
(
cutoff
&&
deltaR
[
0
][
ReferenceForce
::
RIndex
]
>
cutoffDistance
)
return
ReferenceForce
::
DefaultReturn
;
return
;
RealOpenMM
r2
=
deltaR
[
0
][
ReferenceForce
::
R2Index
];
RealOpenMM
inverseR
=
one
/
(
deltaR
[
0
][
ReferenceForce
::
RIndex
]);
...
...
@@ -229,7 +219,8 @@ int ReferenceFreeEnergyLJCoulomb14Softcore::calculateBondIxn( int* atomIndices,
// accumulate energies
updateEnergy
(
energy
,
energiesByBond
,
LastAtomIndex
,
atomIndices
,
energiesByAtom
);
if
(
totalEnergy
!=
NULL
)
*
totalEnergy
+=
energy
;
// debug
...
...
@@ -283,8 +274,6 @@ int ReferenceFreeEnergyLJCoulomb14Softcore::calculateBondIxn( int* atomIndices,
//SimTKOpenMMLog::printMessage( message );
}
return
ReferenceForce
::
DefaultReturn
;
}
/**---------------------------------------------------------------------------------------
...
...
plugins/freeEnergy/platforms/reference/src/SimTKReference/ReferenceFreeEnergyLJCoulomb14Softcore.h
View file @
5003591d
...
...
@@ -98,16 +98,13 @@ class ReferenceFreeEnergyLJCoulomb14Softcore : public ReferenceBondIxn {
@param atomCoordinates atom coordinates
@param parameters six RB parameters
@param forces force array (forces added to current values)
@param energiesByBond energies by bond: energiesByBond[bondIndex]
@param energiesByAtom energies by atom: energiesByAtom[atomIndex]
@return ReferenceForce::DefaultReturn
@param totalEnergy if not null, the energy will be added to this
--------------------------------------------------------------------------------------- */
int
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
void
calculateBondIxn
(
int
*
atomIndices
,
RealOpenMM
**
atomCoordinates
,
RealOpenMM
*
parameters
,
RealOpenMM
**
forces
,
RealOpenMM
*
energiesByBond
,
RealOpenMM
*
energiesByAtom
)
const
;
RealOpenMM
*
totalEnergy
)
const
;
/**---------------------------------------------------------------------------------------
...
...
Prev
1
2
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