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
9f37b18b
Commit
9f37b18b
authored
Jul 03, 2018
by
peastman
Browse files
Code cleanup to reference and CPU platforms
parent
f9106ddb
Changes
50
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
111 additions
and
204 deletions
+111
-204
platforms/cpu/include/CpuBondForce.h
platforms/cpu/include/CpuBondForce.h
+5
-5
platforms/cpu/include/CpuCustomGBForce.h
platforms/cpu/include/CpuCustomGBForce.h
+10
-10
platforms/cpu/include/CpuCustomManyParticleForce.h
platforms/cpu/include/CpuCustomManyParticleForce.h
+5
-5
platforms/cpu/include/CpuCustomNonbondedForce.h
platforms/cpu/include/CpuCustomNonbondedForce.h
+5
-6
platforms/cpu/include/CpuKernels.h
platforms/cpu/include/CpuKernels.h
+15
-18
platforms/cpu/src/CpuBondForce.cpp
platforms/cpu/src/CpuBondForce.cpp
+5
-5
platforms/cpu/src/CpuCustomGBForce.cpp
platforms/cpu/src/CpuCustomGBForce.cpp
+10
-10
platforms/cpu/src/CpuCustomManyParticleForce.cpp
platforms/cpu/src/CpuCustomManyParticleForce.cpp
+5
-5
platforms/cpu/src/CpuCustomNonbondedForce.cpp
platforms/cpu/src/CpuCustomNonbondedForce.cpp
+4
-4
platforms/cpu/src/CpuKernels.cpp
platforms/cpu/src/CpuKernels.cpp
+19
-108
platforms/reference/include/ReferenceAngleBondIxn.h
platforms/reference/include/ReferenceAngleBondIxn.h
+3
-3
platforms/reference/include/ReferenceBondForce.h
platforms/reference/include/ReferenceBondForce.h
+2
-2
platforms/reference/include/ReferenceBondIxn.h
platforms/reference/include/ReferenceBondIxn.h
+2
-2
platforms/reference/include/ReferenceCMAPTorsionIxn.h
platforms/reference/include/ReferenceCMAPTorsionIxn.h
+2
-2
platforms/reference/include/ReferenceCustomAngleIxn.h
platforms/reference/include/ReferenceCustomAngleIxn.h
+2
-2
platforms/reference/include/ReferenceCustomBondIxn.h
platforms/reference/include/ReferenceCustomBondIxn.h
+2
-2
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
+2
-2
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
+1
-1
platforms/reference/include/ReferenceCustomExternalIxn.h
platforms/reference/include/ReferenceCustomExternalIxn.h
+2
-2
platforms/reference/include/ReferenceCustomGBIxn.h
platforms/reference/include/ReferenceCustomGBIxn.h
+10
-10
No files found.
platforms/cpu/include/CpuBondForce.h
View file @
9f37b18b
...
@@ -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-201
7
Stanford University and the Authors. *
* Portions copyright (c) 2014-201
8
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -50,22 +50,22 @@ public:
...
@@ -50,22 +50,22 @@ public:
/**
/**
* Analyze the set of bonds and decide which to compute with each thread.
* Analyze the set of bonds and decide which to compute with each thread.
*/
*/
void
initialize
(
int
numAtoms
,
int
numBonds
,
int
numAtomsPerBond
,
int
**
bondAtoms
,
ThreadPool
&
threads
);
void
initialize
(
int
numAtoms
,
int
numBonds
,
int
numAtomsPerBond
,
std
::
vector
<
std
::
vector
<
int
>
>&
bondAtoms
,
ThreadPool
&
threads
);
/**
/**
* Compute the forces from all bonds.
* Compute the forces from all bonds.
*/
*/
void
calculateForce
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
void
calculateForce
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
/**
/**
* This routine contains the code executed by each thread.
* This routine contains the code executed by each thread.
*/
*/
void
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
parameters
,
void
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
private:
private:
bool
canAssignBond
(
int
bond
,
int
thread
,
std
::
vector
<
int
>&
atomThread
);
bool
canAssignBond
(
int
bond
,
int
thread
,
std
::
vector
<
int
>&
atomThread
);
void
assignBond
(
int
bond
,
int
thread
,
std
::
vector
<
int
>&
atomThread
,
std
::
vector
<
int
>&
bondThread
,
std
::
vector
<
std
::
set
<
int
>
>&
atomBonds
,
std
::
list
<
int
>&
candidateBonds
);
void
assignBond
(
int
bond
,
int
thread
,
std
::
vector
<
int
>&
atomThread
,
std
::
vector
<
int
>&
bondThread
,
std
::
vector
<
std
::
set
<
int
>
>&
atomBonds
,
std
::
list
<
int
>&
candidateBonds
);
int
numBonds
,
numAtomsPerBond
;
int
numBonds
,
numAtomsPerBond
;
int
*
*
bondAtoms
;
std
::
vector
<
int
>
*
bondAtoms
;
ThreadPool
*
threads
;
ThreadPool
*
threads
;
std
::
vector
<
std
::
vector
<
int
>
>
threadBonds
;
std
::
vector
<
std
::
vector
<
int
>
>
threadBonds
;
std
::
vector
<
int
>
extraBonds
;
std
::
vector
<
int
>
extraBonds
;
...
...
platforms/cpu/include/CpuCustomGBForce.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -59,7 +59,7 @@ private:
...
@@ -59,7 +59,7 @@ private:
// The following variables are used to make information accessible to the individual threads.
// The following variables are used to make information accessible to the individual threads.
int
numberOfAtoms
;
int
numberOfAtoms
;
float
*
posq
;
float
*
posq
;
double
*
*
atomParameters
;
std
::
vector
<
double
>
*
atomParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
bool
includeForce
,
includeEnergy
;
bool
includeForce
,
includeEnergy
;
...
@@ -81,7 +81,7 @@ private:
...
@@ -81,7 +81,7 @@ private:
* @param useExclusions specifies whether to use exclusions
* @param useExclusions specifies whether to use exclusions
*/
*/
void
calculateParticlePairValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateParticlePairValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
bool
useExclusions
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
bool
useExclusions
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -95,7 +95,7 @@ private:
...
@@ -95,7 +95,7 @@ private:
* @param atomParameters atomParameters[atomIndex][paramterIndex]
* @param atomParameters atomParameters[atomIndex][paramterIndex]
*/
*/
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
std
::
vector
<
float
>&
valueArray
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
std
::
vector
<
float
>&
valueArray
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -110,7 +110,7 @@ private:
...
@@ -110,7 +110,7 @@ private:
* @param totalEnergy the energy contribution is added to this
* @param totalEnergy the energy contribution is added to this
*/
*/
void
calculateSingleParticleEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
);
void
calculateSingleParticleEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
);
/**
/**
* Calculate an energy term that is based on particle pairs
* Calculate an energy term that is based on particle pairs
...
@@ -125,7 +125,7 @@ private:
...
@@ -125,7 +125,7 @@ private:
* @param totalEnergy the energy contribution is added to this
* @param totalEnergy the energy contribution is added to this
*/
*/
void
calculateParticlePairEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateParticlePairEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
bool
useExclusions
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
bool
useExclusions
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -141,7 +141,7 @@ private:
...
@@ -141,7 +141,7 @@ private:
* @param totalEnergy the energy contribution is added to this
* @param totalEnergy the energy contribution is added to this
*/
*/
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -154,7 +154,7 @@ private:
...
@@ -154,7 +154,7 @@ private:
* @param forces forces on atoms are added to this
* @param forces forces on atoms are added to this
*/
*/
void
calculateChainRuleForces
(
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateChainRuleForces
(
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
float
*
forces
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
float
*
forces
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -169,7 +169,7 @@ private:
...
@@ -169,7 +169,7 @@ private:
* @param isExcluded specifies whether this is an excluded pair
* @param isExcluded specifies whether this is an excluded pair
*/
*/
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
std
::
vector
<
double
>
*
atomParameters
,
float
*
forces
,
bool
isExcluded
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
float
*
forces
,
bool
isExcluded
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
...
@@ -231,7 +231,7 @@ public:
...
@@ -231,7 +231,7 @@ public:
* @param energyParamDerivs derivatives of the energy with respect to global parameters
* @param energyParamDerivs derivatives of the energy with respect to global parameters
*/
*/
void
calculateIxn
(
int
numberOfAtoms
,
float
*
posq
,
double
**
atomParameters
,
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
void
calculateIxn
(
int
numberOfAtoms
,
float
*
posq
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
);
};
};
...
...
platforms/cpu/include/CpuCustomManyParticleForce.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -65,7 +65,7 @@ private:
...
@@ -65,7 +65,7 @@ private:
std
::
vector
<
ThreadData
*>
threadData
;
std
::
vector
<
ThreadData
*>
threadData
;
// The following variables are used to make information accessible to the individual threads.
// The following variables are used to make information accessible to the individual threads.
float
*
posq
;
float
*
posq
;
double
*
*
particleParameters
;
std
::
vector
<
double
>
*
particleParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
bool
includeForces
,
includeEnergy
;
bool
includeForces
,
includeEnergy
;
...
@@ -81,7 +81,7 @@ private:
...
@@ -81,7 +81,7 @@ private:
* interaction for each one.
* interaction for each one.
*/
*/
void
loopOverInteractions
(
std
::
vector
<
int
>&
availableParticles
,
std
::
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
void
loopOverInteractions
(
std
::
vector
<
int
>&
availableParticles
,
std
::
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
double
*
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
std
::
vector
<
double
>
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -104,7 +104,7 @@ private:
...
@@ -104,7 +104,7 @@ private:
* @param boxSize the size of the periodic box
* @param boxSize the size of the periodic box
* @param invBoxSize the inverse size of the periodic box
* @param invBoxSize the inverse size of the periodic box
*/
*/
void
calculateOneIxn
(
std
::
vector
<
int
>&
particleSet
,
double
*
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
void
calculateOneIxn
(
std
::
vector
<
int
>&
particleSet
,
std
::
vector
<
double
>
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
);
/**
/**
* Compute the displacement and squared distance between two points, optionally using
* Compute the displacement and squared distance between two points, optionally using
...
@@ -154,7 +154,7 @@ public:
...
@@ -154,7 +154,7 @@ public:
* @param includeEnergy whether to compute energy
* @param includeEnergy whether to compute energy
* @param energy the total energy is added to this
* @param energy the total energy is added to this
*/
*/
void
calculateIxn
(
AlignedArray
<
float
>&
posq
,
double
**
particleParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
void
calculateIxn
(
AlignedArray
<
float
>&
posq
,
std
::
vector
<
std
::
vector
<
double
>
>&
particleParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
);
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
);
};
};
...
...
platforms/cpu/include/CpuCustomNonbondedForce.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -110,7 +110,6 @@ class CpuCustomNonbondedForce {
...
@@ -110,7 +110,6 @@ class CpuCustomNonbondedForce {
@param posq atom coordinates in float format
@param posq atom coordinates in float format
@param atomCoordinates atom coordinates
@param atomCoordinates atom coordinates
@param atomParameters atom parameters (charges, c6, c12, ...) atomParameters[atomIndex][paramterIndex]
@param atomParameters atom parameters (charges, c6, c12, ...) atomParameters[atomIndex][paramterIndex]
@param fixedParameters non atom parameters (not currently used)
@param globalParameters the values of global parameters
@param globalParameters the values of global parameters
@param forces force array (forces added)
@param forces force array (forces added)
@param totalEnergy total energy
@param totalEnergy total energy
...
@@ -118,9 +117,9 @@ class CpuCustomNonbondedForce {
...
@@ -118,9 +117,9 @@ class CpuCustomNonbondedForce {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculatePairIxn
(
int
numberOfAtoms
,
float
*
posq
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculatePairIxn
(
int
numberOfAtoms
,
float
*
posq
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
double
*
fixedParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
std
::
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
);
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
);
private:
private:
class
ThreadData
;
class
ThreadData
;
...
@@ -144,7 +143,7 @@ private:
...
@@ -144,7 +143,7 @@ private:
int
numberOfAtoms
;
int
numberOfAtoms
;
float
*
posq
;
float
*
posq
;
Vec3
const
*
atomCoordinates
;
Vec3
const
*
atomCoordinates
;
double
*
*
atomParameters
;
std
::
vector
<
double
>
*
atomParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
const
std
::
map
<
std
::
string
,
double
>*
globalParameters
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
std
::
vector
<
AlignedArray
<
float
>
>*
threadForce
;
bool
includeForce
,
includeEnergy
;
bool
includeForce
,
includeEnergy
;
...
...
platforms/cpu/include/CpuKernels.h
View file @
9f37b18b
...
@@ -98,9 +98,8 @@ private:
...
@@ -98,9 +98,8 @@ private:
class
CpuCalcHarmonicAngleForceKernel
:
public
CalcHarmonicAngleForceKernel
{
class
CpuCalcHarmonicAngleForceKernel
:
public
CalcHarmonicAngleForceKernel
{
public:
public:
CpuCalcHarmonicAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CpuCalcHarmonicAngleForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CalcHarmonicAngleForceKernel
(
name
,
platform
),
data
(
data
),
angleIndexArray
(
NULL
),
angleParamArray
(
NULL
),
usePeriodic
(
false
)
{
CalcHarmonicAngleForceKernel
(
name
,
platform
),
data
(
data
),
usePeriodic
(
false
)
{
}
}
~
CpuCalcHarmonicAngleForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -127,8 +126,8 @@ public:
...
@@ -127,8 +126,8 @@ public:
private:
private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numAngles
;
int
numAngles
;
int
**
angleIndexArray
;
std
::
vector
<
std
::
vector
<
int
>
>
angleIndexArray
;
double
**
angleParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
angleParamArray
;
CpuBondForce
bondForce
;
CpuBondForce
bondForce
;
bool
usePeriodic
;
bool
usePeriodic
;
};
};
...
@@ -139,9 +138,8 @@ private:
...
@@ -139,9 +138,8 @@ private:
class
CpuCalcPeriodicTorsionForceKernel
:
public
CalcPeriodicTorsionForceKernel
{
class
CpuCalcPeriodicTorsionForceKernel
:
public
CalcPeriodicTorsionForceKernel
{
public:
public:
CpuCalcPeriodicTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CpuCalcPeriodicTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CalcPeriodicTorsionForceKernel
(
name
,
platform
),
data
(
data
),
torsionIndexArray
(
NULL
),
torsionParamArray
(
NULL
),
usePeriodic
(
false
)
{
CalcPeriodicTorsionForceKernel
(
name
,
platform
),
data
(
data
),
usePeriodic
(
false
)
{
}
}
~
CpuCalcPeriodicTorsionForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -168,8 +166,8 @@ public:
...
@@ -168,8 +166,8 @@ public:
private:
private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndexArray
;
double
**
torsionParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
torsionParamArray
;
CpuBondForce
bondForce
;
CpuBondForce
bondForce
;
bool
usePeriodic
;
bool
usePeriodic
;
};
};
...
@@ -180,9 +178,8 @@ private:
...
@@ -180,9 +178,8 @@ private:
class
CpuCalcRBTorsionForceKernel
:
public
CalcRBTorsionForceKernel
{
class
CpuCalcRBTorsionForceKernel
:
public
CalcRBTorsionForceKernel
{
public:
public:
CpuCalcRBTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CpuCalcRBTorsionForceKernel
(
std
::
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CalcRBTorsionForceKernel
(
name
,
platform
),
data
(
data
),
torsionIndexArray
(
NULL
),
torsionParamArray
(
NULL
),
usePeriodic
(
false
)
{
CalcRBTorsionForceKernel
(
name
,
platform
),
data
(
data
),
usePeriodic
(
false
)
{
}
}
~
CpuCalcRBTorsionForceKernel
();
/**
/**
* Initialize the kernel.
* Initialize the kernel.
*
*
...
@@ -209,8 +206,8 @@ public:
...
@@ -209,8 +206,8 @@ public:
private:
private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numTorsions
;
int
numTorsions
;
int
**
torsionIndexArray
;
std
::
vector
<
std
::
vector
<
int
>
>
torsionIndexArray
;
double
**
torsionParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
torsionParamArray
;
CpuBondForce
bondForce
;
CpuBondForce
bondForce
;
bool
usePeriodic
;
bool
usePeriodic
;
};
};
...
@@ -269,8 +266,8 @@ private:
...
@@ -269,8 +266,8 @@ private:
class
PmeIO
;
class
PmeIO
;
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numParticles
,
num14
,
posqIndex
;
int
numParticles
,
num14
,
posqIndex
;
int
**
bonded14IndexArray
;
std
::
vector
<
std
::
vector
<
int
>
>
bonded14IndexArray
;
double
**
bonded14ParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
bonded14ParamArray
;
double
nonbondedCutoff
,
switchingDistance
,
rfDielectric
,
ewaldAlpha
,
ewaldDispersionAlpha
,
ewaldSelfEnergy
,
dispersionCoefficient
;
double
nonbondedCutoff
,
switchingDistance
,
rfDielectric
,
ewaldAlpha
,
ewaldDispersionAlpha
,
ewaldSelfEnergy
,
dispersionCoefficient
;
int
kmax
[
3
],
gridSize
[
3
],
dispersionGridSize
[
3
];
int
kmax
[
3
],
gridSize
[
3
],
dispersionGridSize
[
3
];
bool
useSwitchingFunction
,
useOptimizedPme
,
hasInitializedPme
,
hasInitializedDispersionPme
;
bool
useSwitchingFunction
,
useOptimizedPme
,
hasInitializedPme
,
hasInitializedDispersionPme
;
...
@@ -314,10 +311,10 @@ public:
...
@@ -314,10 +311,10 @@ public:
* @param force the CustomNonbondedForce to copy the parameters from
* @param force the CustomNonbondedForce to copy the parameters from
*/
*/
void
copyParametersToContext
(
ContextImpl
&
context
,
const
CustomNonbondedForce
&
force
);
void
copyParametersToContext
(
ContextImpl
&
context
,
const
CustomNonbondedForce
&
force
);
private:
private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numParticles
;
int
numParticles
;
double
**
particleParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
particleParamArray
;
double
nonbondedCutoff
,
switchingDistance
,
periodicBoxSize
[
3
],
longRangeCoefficient
;
double
nonbondedCutoff
,
switchingDistance
,
periodicBoxSize
[
3
],
longRangeCoefficient
;
bool
useSwitchingFunction
,
hasInitializedLongRangeCorrection
;
bool
useSwitchingFunction
,
hasInitializedLongRangeCorrection
;
CustomNonbondedForce
*
forceCopy
;
CustomNonbondedForce
*
forceCopy
;
...
@@ -406,7 +403,7 @@ private:
...
@@ -406,7 +403,7 @@ private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numParticles
;
int
numParticles
;
bool
isPeriodic
;
bool
isPeriodic
;
double
**
particleParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
particleParamArray
;
double
nonbondedCutoff
;
double
nonbondedCutoff
;
CpuCustomGBForce
*
ixn
;
CpuCustomGBForce
*
ixn
;
CpuNeighborList
*
neighborList
;
CpuNeighborList
*
neighborList
;
...
@@ -453,7 +450,7 @@ private:
...
@@ -453,7 +450,7 @@ private:
CpuPlatform
::
PlatformData
&
data
;
CpuPlatform
::
PlatformData
&
data
;
int
numParticles
;
int
numParticles
;
double
cutoffDistance
;
double
cutoffDistance
;
double
**
particleParamArray
;
std
::
vector
<
std
::
vector
<
double
>
>
particleParamArray
;
CpuCustomManyParticleForce
*
ixn
;
CpuCustomManyParticleForce
*
ixn
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
std
::
vector
<
std
::
string
>
globalParameterNames
;
NonbondedMethod
nonbondedMethod
;
NonbondedMethod
nonbondedMethod
;
...
...
platforms/cpu/src/CpuBondForce.cpp
View file @
9f37b18b
...
@@ -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-201
7
Stanford University and the Authors. *
* Portions copyright (c) 2014-201
8
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -38,10 +38,10 @@ using namespace std;
...
@@ -38,10 +38,10 @@ using namespace std;
CpuBondForce
::
CpuBondForce
()
{
CpuBondForce
::
CpuBondForce
()
{
}
}
void
CpuBondForce
::
initialize
(
int
numAtoms
,
int
numBonds
,
int
numAtomsPerBond
,
int
**
bondAtoms
,
ThreadPool
&
threads
)
{
void
CpuBondForce
::
initialize
(
int
numAtoms
,
int
numBonds
,
int
numAtomsPerBond
,
vector
<
vector
<
int
>
>&
bondAtoms
,
ThreadPool
&
threads
)
{
this
->
numBonds
=
numBonds
;
this
->
numBonds
=
numBonds
;
this
->
numAtomsPerBond
=
numAtomsPerBond
;
this
->
numAtomsPerBond
=
numAtomsPerBond
;
this
->
bondAtoms
=
bondAtoms
;
this
->
bondAtoms
=
&
bondAtoms
[
0
]
;
this
->
threads
=
&
threads
;
this
->
threads
=
&
threads
;
int
numThreads
=
threads
.
getNumThreads
();
int
numThreads
=
threads
.
getNumThreads
();
int
targetBondsPerThread
=
numBonds
/
numThreads
;
int
targetBondsPerThread
=
numBonds
/
numThreads
;
...
@@ -164,7 +164,7 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
...
@@ -164,7 +164,7 @@ void CpuBondForce::assignBond(int bond, int thread, vector<int>& atomThread, vec
}
}
}
}
void
CpuBondForce
::
calculateForce
(
vector
<
Vec3
>&
atomCoordinates
,
double
**
parameters
,
vector
<
Vec3
>&
forces
,
void
CpuBondForce
::
calculateForce
(
vector
<
Vec3
>&
atomCoordinates
,
vector
<
vector
<
double
>
>&
parameters
,
vector
<
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
)
{
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
)
{
// Have the worker threads compute their forces.
// Have the worker threads compute their forces.
...
@@ -189,7 +189,7 @@ void CpuBondForce::calculateForce(vector<Vec3>& atomCoordinates, double** parame
...
@@ -189,7 +189,7 @@ void CpuBondForce::calculateForce(vector<Vec3>& atomCoordinates, double** parame
*
totalEnergy
+=
threadEnergy
[
i
];
*
totalEnergy
+=
threadEnergy
[
i
];
}
}
void
CpuBondForce
::
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
,
vector
<
Vec3
>&
atomCoordinates
,
double
**
parameters
,
vector
<
Vec3
>&
forces
,
void
CpuBondForce
::
threadComputeForce
(
ThreadPool
&
threads
,
int
threadIndex
,
vector
<
Vec3
>&
atomCoordinates
,
vector
<
vector
<
double
>
>&
parameters
,
vector
<
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
)
{
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
)
{
vector
<
int
>&
bonds
=
threadBonds
[
threadIndex
];
vector
<
int
>&
bonds
=
threadBonds
[
threadIndex
];
int
numBonds
=
bonds
.
size
();
int
numBonds
=
bonds
.
size
();
...
...
platforms/cpu/src/CpuCustomGBForce.cpp
View file @
9f37b18b
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -178,14 +178,14 @@ void CpuCustomGBForce::setPeriodic(Vec3& boxSize) {
...
@@ -178,14 +178,14 @@ void CpuCustomGBForce::setPeriodic(Vec3& boxSize) {
periodicBoxSize
[
2
]
=
boxSize
[
2
];
periodicBoxSize
[
2
]
=
boxSize
[
2
];
}
}
void
CpuCustomGBForce
::
calculateIxn
(
int
numberOfAtoms
,
float
*
posq
,
double
**
atomParameters
,
void
CpuCustomGBForce
::
calculateIxn
(
int
numberOfAtoms
,
float
*
posq
,
vector
<
vector
<
double
>
>&
atomParameters
,
map
<
string
,
double
>&
globalParameters
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
map
<
string
,
double
>&
globalParameters
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
)
{
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
)
{
// Record the parameters for the threads.
// Record the parameters for the threads.
this
->
numberOfAtoms
=
numberOfAtoms
;
this
->
numberOfAtoms
=
numberOfAtoms
;
this
->
posq
=
posq
;
this
->
posq
=
posq
;
this
->
atomParameters
=
atomParameters
;
this
->
atomParameters
=
&
atomParameters
[
0
]
;
this
->
globalParameters
=
&
globalParameters
;
this
->
globalParameters
=
&
globalParameters
;
this
->
threadForce
=
&
threadForce
;
this
->
threadForce
=
&
threadForce
;
this
->
includeForce
=
includeForce
;
this
->
includeForce
=
includeForce
;
...
@@ -352,7 +352,7 @@ void CpuCustomGBForce::threadComputeForce(ThreadPool& threads, int threadIndex)
...
@@ -352,7 +352,7 @@ void CpuCustomGBForce::threadComputeForce(ThreadPool& threads, int threadIndex)
calculateChainRuleForces
(
data
,
numberOfAtoms
,
posq
,
atomParameters
,
forces
,
boxSize
,
invBoxSize
);
calculateChainRuleForces
(
data
,
numberOfAtoms
,
posq
,
atomParameters
,
forces
,
boxSize
,
invBoxSize
);
}
}
void
CpuCustomGBForce
::
calculateParticlePairValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateParticlePairValue
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
bool
useExclusions
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
bool
useExclusions
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
for
(
int
i
=
0
;
i
<
numAtoms
;
i
++
)
values
[
index
][
i
]
=
0.0
f
;
values
[
index
][
i
]
=
0.0
f
;
...
@@ -399,7 +399,7 @@ void CpuCustomGBForce::calculateParticlePairValue(int index, ThreadData& data, i
...
@@ -399,7 +399,7 @@ void CpuCustomGBForce::calculateParticlePairValue(int index, ThreadData& data, i
}
}
}
}
void
CpuCustomGBForce
::
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
vector
<
float
>&
valueArray
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
vector
<
float
>&
valueArray
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
fvec4
deltaR
;
fvec4
deltaR
;
fvec4
pos1
(
posq
+
4
*
atom1
);
fvec4
pos1
(
posq
+
4
*
atom1
);
...
@@ -426,7 +426,7 @@ void CpuCustomGBForce::calculateOnePairValue(int index, int atom1, int atom2, Th
...
@@ -426,7 +426,7 @@ void CpuCustomGBForce::calculateOnePairValue(int index, int atom1, int atom2, Th
}
}
void
CpuCustomGBForce
::
calculateSingleParticleEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
void
CpuCustomGBForce
::
calculateSingleParticleEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
)
{
vector
<
double
>
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
)
{
for
(
int
i
=
data
.
firstAtom
;
i
<
data
.
lastAtom
;
i
++
)
{
for
(
int
i
=
data
.
firstAtom
;
i
<
data
.
lastAtom
;
i
++
)
{
data
.
x
=
posq
[
4
*
i
];
data
.
x
=
posq
[
4
*
i
];
data
.
y
=
posq
[
4
*
i
+
1
];
data
.
y
=
posq
[
4
*
i
+
1
];
...
@@ -450,7 +450,7 @@ void CpuCustomGBForce::calculateSingleParticleEnergyTerm(int index, ThreadData&
...
@@ -450,7 +450,7 @@ void CpuCustomGBForce::calculateSingleParticleEnergyTerm(int index, ThreadData&
}
}
}
}
void
CpuCustomGBForce
::
calculateParticlePairEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateParticlePairEnergyTerm
(
int
index
,
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
bool
useExclusions
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
bool
useExclusions
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
if
(
cutoff
)
{
if
(
cutoff
)
{
// Loop over all pairs in the neighbor list.
// Loop over all pairs in the neighbor list.
...
@@ -492,7 +492,7 @@ void CpuCustomGBForce::calculateParticlePairEnergyTerm(int index, ThreadData& da
...
@@ -492,7 +492,7 @@ void CpuCustomGBForce::calculateParticlePairEnergyTerm(int index, ThreadData& da
}
}
}
}
void
CpuCustomGBForce
::
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
float
*
forces
,
double
&
totalEnergy
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
// Compute the displacement.
// Compute the displacement.
...
@@ -537,7 +537,7 @@ void CpuCustomGBForce::calculateOnePairEnergyTerm(int index, int atom1, int atom
...
@@ -537,7 +537,7 @@ void CpuCustomGBForce::calculateOnePairEnergyTerm(int index, int atom1, int atom
data
.
energyParamDerivs
[
i
]
+=
data
.
energyParamDerivExpressions
[
index
][
i
].
evaluate
();
data
.
energyParamDerivs
[
i
]
+=
data
.
energyParamDerivExpressions
[
index
][
i
].
evaluate
();
}
}
void
CpuCustomGBForce
::
calculateChainRuleForces
(
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateChainRuleForces
(
ThreadData
&
data
,
int
numAtoms
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
float
*
forces
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
float
*
forces
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
if
(
cutoff
)
{
if
(
cutoff
)
{
// Loop over all pairs in the neighbor list.
// Loop over all pairs in the neighbor list.
...
@@ -614,7 +614,7 @@ void CpuCustomGBForce::calculateChainRuleForces(ThreadData& data, int numAtoms,
...
@@ -614,7 +614,7 @@ void CpuCustomGBForce::calculateChainRuleForces(ThreadData& data, int numAtoms,
data
.
energyParamDerivs
[
k
]
+=
dEdV
[
j
][
i
]
*
dValuedParam
[
j
][
k
][
i
];
data
.
energyParamDerivs
[
k
]
+=
dEdV
[
j
][
i
]
*
dValuedParam
[
j
][
k
][
i
];
}
}
void
CpuCustomGBForce
::
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
double
*
*
atomParameters
,
void
CpuCustomGBForce
::
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
ThreadData
&
data
,
float
*
posq
,
vector
<
double
>
*
atomParameters
,
float
*
forces
,
bool
isExcluded
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
float
*
forces
,
bool
isExcluded
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
// Compute the displacement.
// Compute the displacement.
...
...
platforms/cpu/src/CpuCustomManyParticleForce.cpp
View file @
9f37b18b
/* Portions copyright (c) 2009-201
7
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -88,13 +88,13 @@ CpuCustomManyParticleForce::~CpuCustomManyParticleForce() {
...
@@ -88,13 +88,13 @@ CpuCustomManyParticleForce::~CpuCustomManyParticleForce() {
delete
data
;
delete
data
;
}
}
void
CpuCustomManyParticleForce
::
calculateIxn
(
AlignedArray
<
float
>&
posq
,
double
**
particleParameters
,
void
CpuCustomManyParticleForce
::
calculateIxn
(
AlignedArray
<
float
>&
posq
,
vector
<
vector
<
double
>
>&
particleParameters
,
const
map
<
string
,
double
>&
globalParameters
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
const
map
<
string
,
double
>&
globalParameters
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
)
{
bool
includeForces
,
bool
includeEnergy
,
double
&
energy
)
{
// Record the parameters for the threads.
// Record the parameters for the threads.
this
->
posq
=
&
posq
[
0
];
this
->
posq
=
&
posq
[
0
];
this
->
particleParameters
=
particleParameters
;
this
->
particleParameters
=
&
particleParameters
[
0
]
;
this
->
globalParameters
=
&
globalParameters
;
this
->
globalParameters
=
&
globalParameters
;
this
->
threadForce
=
&
threadForce
;
this
->
threadForce
=
&
threadForce
;
this
->
includeForces
=
includeForces
;
this
->
includeForces
=
includeForces
;
...
@@ -209,7 +209,7 @@ void CpuCustomManyParticleForce::setPeriodic(Vec3* periodicBoxVectors) {
...
@@ -209,7 +209,7 @@ void CpuCustomManyParticleForce::setPeriodic(Vec3* periodicBoxVectors) {
}
}
void
CpuCustomManyParticleForce
::
loopOverInteractions
(
vector
<
int
>&
availableParticles
,
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
void
CpuCustomManyParticleForce
::
loopOverInteractions
(
vector
<
int
>&
availableParticles
,
vector
<
int
>&
particleSet
,
int
loopIndex
,
int
startIndex
,
double
*
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
vector
<
double
>
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
int
numParticles
=
availableParticles
.
size
();
int
numParticles
=
availableParticles
.
size
();
double
cutoff2
=
cutoffDistance
*
cutoffDistance
;
double
cutoff2
=
cutoffDistance
*
cutoffDistance
;
int
checkRange
=
(
centralParticleMode
?
1
:
loopIndex
);
int
checkRange
=
(
centralParticleMode
?
1
:
loopIndex
);
...
@@ -243,7 +243,7 @@ void CpuCustomManyParticleForce::loopOverInteractions(vector<int>& availablePart
...
@@ -243,7 +243,7 @@ void CpuCustomManyParticleForce::loopOverInteractions(vector<int>& availablePart
}
}
}
}
void
CpuCustomManyParticleForce
::
calculateOneIxn
(
vector
<
int
>&
particleSet
,
double
*
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
void
CpuCustomManyParticleForce
::
calculateOneIxn
(
vector
<
int
>&
particleSet
,
vector
<
double
>
*
particleParameters
,
float
*
forces
,
ThreadData
&
data
,
const
fvec4
&
boxSize
,
const
fvec4
&
invBoxSize
)
{
// Select the ordering to use for the particles.
// Select the ordering to use for the particles.
vector
<
int
>&
permutedParticles
=
data
.
permutedParticles
;
vector
<
int
>&
permutedParticles
=
data
.
permutedParticles
;
...
...
platforms/cpu/src/CpuCustomNonbondedForce.cpp
View file @
9f37b18b
...
@@ -120,15 +120,15 @@ void CpuCustomNonbondedForce::setPeriodic(Vec3* periodicBoxVectors) {
...
@@ -120,15 +120,15 @@ void CpuCustomNonbondedForce::setPeriodic(Vec3* periodicBoxVectors) {
}
}
void
CpuCustomNonbondedForce
::
calculatePairIxn
(
int
numberOfAtoms
,
float
*
posq
,
vector
<
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
CpuCustomNonbondedForce
::
calculatePairIxn
(
int
numberOfAtoms
,
float
*
posq
,
vector
<
Vec3
>&
atomCoordinates
,
vector
<
vector
<
double
>
>&
atomParameters
,
double
*
fixedParameters
,
const
map
<
string
,
double
>&
globalParameters
,
const
map
<
string
,
double
>&
globalParameters
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
vector
<
AlignedArray
<
float
>
>&
threadForce
,
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
)
{
bool
includeForce
,
bool
includeEnergy
,
double
&
totalEnergy
,
double
*
energyParamDerivs
)
{
// Record the parameters for the threads.
// Record the parameters for the threads.
this
->
numberOfAtoms
=
numberOfAtoms
;
this
->
numberOfAtoms
=
numberOfAtoms
;
this
->
posq
=
posq
;
this
->
posq
=
posq
;
this
->
atomCoordinates
=
&
atomCoordinates
[
0
];
this
->
atomCoordinates
=
&
atomCoordinates
[
0
];
this
->
atomParameters
=
atomParameters
;
this
->
atomParameters
=
&
atomParameters
[
0
]
;
this
->
globalParameters
=
&
globalParameters
;
this
->
globalParameters
=
&
globalParameters
;
this
->
threadForce
=
&
threadForce
;
this
->
threadForce
=
&
threadForce
;
this
->
includeForce
=
includeForce
;
this
->
includeForce
=
includeForce
;
...
...
platforms/cpu/src/CpuKernels.cpp
View file @
9f37b18b
...
@@ -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) 2013-201
6
Stanford University and the Authors. *
* Portions copyright (c) 2013-201
8
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Authors: Peter Eastman *
* Contributors: *
* Contributors: *
* *
* *
...
@@ -302,25 +302,10 @@ double CpuCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, boo
...
@@ -302,25 +302,10 @@ double CpuCalcForcesAndEnergyKernel::finishComputation(ContextImpl& context, boo
return
referenceKernel
.
getAs
<
ReferenceCalcForcesAndEnergyKernel
>
().
finishComputation
(
context
,
includeForce
,
includeEnergy
,
groups
,
valid
);
return
referenceKernel
.
getAs
<
ReferenceCalcForcesAndEnergyKernel
>
().
finishComputation
(
context
,
includeForce
,
includeEnergy
,
groups
,
valid
);
}
}
CpuCalcHarmonicAngleForceKernel
::~
CpuCalcHarmonicAngleForceKernel
()
{
if
(
angleIndexArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numAngles
;
i
++
)
{
delete
[]
angleIndexArray
[
i
];
delete
[]
angleParamArray
[
i
];
}
delete
[]
angleIndexArray
;
delete
[]
angleParamArray
;
}
}
void
CpuCalcHarmonicAngleForceKernel
::
initialize
(
const
System
&
system
,
const
HarmonicAngleForce
&
force
)
{
void
CpuCalcHarmonicAngleForceKernel
::
initialize
(
const
System
&
system
,
const
HarmonicAngleForce
&
force
)
{
numAngles
=
force
.
getNumAngles
();
numAngles
=
force
.
getNumAngles
();
angleIndexArray
=
new
int
*
[
numAngles
];
angleIndexArray
.
resize
(
numAngles
,
vector
<
int
>
(
3
));
for
(
int
i
=
0
;
i
<
numAngles
;
i
++
)
angleParamArray
.
resize
(
numAngles
,
vector
<
double
>
(
2
));
angleIndexArray
[
i
]
=
new
int
[
3
];
angleParamArray
=
new
double
*
[
numAngles
];
for
(
int
i
=
0
;
i
<
numAngles
;
i
++
)
angleParamArray
[
i
]
=
new
double
[
2
];
for
(
int
i
=
0
;
i
<
numAngles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numAngles
;
++
i
)
{
int
particle1
,
particle2
,
particle3
;
int
particle1
,
particle2
,
particle3
;
double
angle
,
k
;
double
angle
,
k
;
...
@@ -363,25 +348,10 @@ void CpuCalcHarmonicAngleForceKernel::copyParametersToContext(ContextImpl& conte
...
@@ -363,25 +348,10 @@ void CpuCalcHarmonicAngleForceKernel::copyParametersToContext(ContextImpl& conte
}
}
}
}
CpuCalcPeriodicTorsionForceKernel
::~
CpuCalcPeriodicTorsionForceKernel
()
{
if
(
torsionIndexArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
{
delete
[]
torsionIndexArray
[
i
];
delete
[]
torsionParamArray
[
i
];
}
delete
[]
torsionIndexArray
;
delete
[]
torsionParamArray
;
}
}
void
CpuCalcPeriodicTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
PeriodicTorsionForce
&
force
)
{
void
CpuCalcPeriodicTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
PeriodicTorsionForce
&
force
)
{
numTorsions
=
force
.
getNumTorsions
();
numTorsions
=
force
.
getNumTorsions
();
torsionIndexArray
=
new
int
*
[
numTorsions
];
torsionIndexArray
.
resize
(
numTorsions
,
vector
<
int
>
(
4
));
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
torsionParamArray
.
resize
(
numTorsions
,
vector
<
double
>
(
3
));
torsionIndexArray
[
i
]
=
new
int
[
4
];
torsionParamArray
=
new
double
*
[
numTorsions
];
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
torsionParamArray
[
i
]
=
new
double
[
3
];
for
(
int
i
=
0
;
i
<
numTorsions
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numTorsions
;
++
i
)
{
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
int
particle1
,
particle2
,
particle3
,
particle4
,
periodicity
;
double
phase
,
k
;
double
phase
,
k
;
...
@@ -427,25 +397,10 @@ void CpuCalcPeriodicTorsionForceKernel::copyParametersToContext(ContextImpl& con
...
@@ -427,25 +397,10 @@ void CpuCalcPeriodicTorsionForceKernel::copyParametersToContext(ContextImpl& con
}
}
}
}
CpuCalcRBTorsionForceKernel
::~
CpuCalcRBTorsionForceKernel
()
{
if
(
torsionIndexArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
{
delete
[]
torsionIndexArray
[
i
];
delete
[]
torsionParamArray
[
i
];
}
delete
[]
torsionIndexArray
;
delete
[]
torsionParamArray
;
}
}
void
CpuCalcRBTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
RBTorsionForce
&
force
)
{
void
CpuCalcRBTorsionForceKernel
::
initialize
(
const
System
&
system
,
const
RBTorsionForce
&
force
)
{
numTorsions
=
force
.
getNumTorsions
();
numTorsions
=
force
.
getNumTorsions
();
torsionIndexArray
=
new
int
*
[
numTorsions
];
torsionIndexArray
.
resize
(
numTorsions
,
vector
<
int
>
(
4
));
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
torsionParamArray
.
resize
(
numTorsions
,
vector
<
double
>
(
6
));
torsionIndexArray
[
i
]
=
new
int
[
4
];
torsionParamArray
=
new
double
*
[
numTorsions
];
for
(
int
i
=
0
;
i
<
numTorsions
;
i
++
)
torsionParamArray
[
i
]
=
new
double
[
6
];
for
(
int
i
=
0
;
i
<
numTorsions
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numTorsions
;
++
i
)
{
int
particle1
,
particle2
,
particle3
,
particle4
;
int
particle1
,
particle2
,
particle3
,
particle4
;
double
c0
,
c1
,
c2
,
c3
,
c4
,
c5
;
double
c0
,
c1
,
c2
,
c3
,
c4
,
c5
;
...
@@ -522,7 +477,7 @@ CpuNonbondedForce* createCpuNonbondedForceVec4();
...
@@ -522,7 +477,7 @@ CpuNonbondedForce* createCpuNonbondedForceVec4();
CpuNonbondedForce
*
createCpuNonbondedForceVec8
();
CpuNonbondedForce
*
createCpuNonbondedForceVec8
();
CpuCalcNonbondedForceKernel
::
CpuCalcNonbondedForceKernel
(
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CalcNonbondedForceKernel
(
name
,
platform
),
CpuCalcNonbondedForceKernel
::
CpuCalcNonbondedForceKernel
(
string
name
,
const
Platform
&
platform
,
CpuPlatform
::
PlatformData
&
data
)
:
CalcNonbondedForceKernel
(
name
,
platform
),
data
(
data
),
bonded14IndexArray
(
NULL
),
bonded14ParamArray
(
NULL
),
hasInitializedPme
(
false
),
hasInitializedDispersionPme
(
false
),
nonbonded
(
NULL
)
{
data
(
data
),
hasInitializedPme
(
false
),
hasInitializedDispersionPme
(
false
),
nonbonded
(
NULL
)
{
if
(
isVec8Supported
())
if
(
isVec8Supported
())
nonbonded
=
createCpuNonbondedForceVec8
();
nonbonded
=
createCpuNonbondedForceVec8
();
else
else
...
@@ -530,14 +485,6 @@ CpuCalcNonbondedForceKernel::CpuCalcNonbondedForceKernel(string name, const Plat
...
@@ -530,14 +485,6 @@ CpuCalcNonbondedForceKernel::CpuCalcNonbondedForceKernel(string name, const Plat
}
}
CpuCalcNonbondedForceKernel
::~
CpuCalcNonbondedForceKernel
()
{
CpuCalcNonbondedForceKernel
::~
CpuCalcNonbondedForceKernel
()
{
if
(
bonded14ParamArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
num14
;
i
++
)
{
delete
[]
bonded14IndexArray
[
i
];
delete
[]
bonded14ParamArray
[
i
];
}
delete
[]
bonded14IndexArray
;
delete
[]
bonded14ParamArray
;
}
if
(
nonbonded
!=
NULL
)
if
(
nonbonded
!=
NULL
)
delete
nonbonded
;
delete
nonbonded
;
}
}
...
@@ -563,12 +510,8 @@ void CpuCalcNonbondedForceKernel::initialize(const System& system, const Nonbond
...
@@ -563,12 +510,8 @@ void CpuCalcNonbondedForceKernel::initialize(const System& system, const Nonbond
// Record the particle parameters.
// Record the particle parameters.
num14
=
nb14s
.
size
();
num14
=
nb14s
.
size
();
bonded14IndexArray
=
new
int
*
[
num14
];
bonded14IndexArray
.
resize
(
num14
,
vector
<
int
>
(
2
));
for
(
int
i
=
0
;
i
<
num14
;
i
++
)
bonded14ParamArray
.
resize
(
num14
,
vector
<
double
>
(
3
));
bonded14IndexArray
[
i
]
=
new
int
[
2
];
bonded14ParamArray
=
new
double
*
[
num14
];
for
(
int
i
=
0
;
i
<
num14
;
i
++
)
bonded14ParamArray
[
i
]
=
new
double
[
3
];
particleParams
.
resize
(
numParticles
);
particleParams
.
resize
(
numParticles
);
charges
.
resize
(
numParticles
);
charges
.
resize
(
numParticles
);
C6params
.
resize
(
numParticles
);
C6params
.
resize
(
numParticles
);
...
@@ -804,11 +747,6 @@ CpuCalcCustomNonbondedForceKernel::CpuCalcCustomNonbondedForceKernel(string name
...
@@ -804,11 +747,6 @@ CpuCalcCustomNonbondedForceKernel::CpuCalcCustomNonbondedForceKernel(string name
}
}
CpuCalcCustomNonbondedForceKernel
::~
CpuCalcCustomNonbondedForceKernel
()
{
CpuCalcCustomNonbondedForceKernel
::~
CpuCalcCustomNonbondedForceKernel
()
{
if
(
particleParamArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
delete
[]
particleParamArray
[
i
];
delete
[]
particleParamArray
;
}
if
(
nonbonded
!=
NULL
)
if
(
nonbonded
!=
NULL
)
delete
nonbonded
;
delete
nonbonded
;
if
(
forceCopy
!=
NULL
)
if
(
forceCopy
!=
NULL
)
...
@@ -831,15 +769,9 @@ void CpuCalcCustomNonbondedForceKernel::initialize(const System& system, const C
...
@@ -831,15 +769,9 @@ void CpuCalcCustomNonbondedForceKernel::initialize(const System& system, const C
// Build the arrays.
// Build the arrays.
int
numParameters
=
force
.
getNumPerParticleParameters
();
int
numParameters
=
force
.
getNumPerParticleParameters
();
particleParamArray
=
new
double
*
[
numParticles
];
particleParamArray
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
particleParamArray
[
i
]
=
new
double
[
numParameters
];
force
.
getParticleParameters
(
i
,
particleParamArray
[
i
]);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
vector
<
double
>
parameters
;
force
.
getParticleParameters
(
i
,
parameters
);
for
(
int
j
=
0
;
j
<
numParameters
;
j
++
)
particleParamArray
[
i
][
j
]
=
parameters
[
j
];
}
nonbondedMethod
=
CalcCustomNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedMethod
=
CalcCustomNonbondedForceKernel
::
NonbondedMethod
(
force
.
getNonbondedMethod
());
nonbondedCutoff
=
force
.
getCutoffDistance
();
nonbondedCutoff
=
force
.
getCutoffDistance
();
if
(
nonbondedMethod
==
NoCutoff
)
if
(
nonbondedMethod
==
NoCutoff
)
...
@@ -935,7 +867,7 @@ double CpuCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool inc
...
@@ -935,7 +867,7 @@ double CpuCalcCustomNonbondedForceKernel::execute(ContextImpl& context, bool inc
if
(
useSwitchingFunction
)
if
(
useSwitchingFunction
)
nonbonded
->
setUseSwitchingFunction
(
switchingDistance
);
nonbonded
->
setUseSwitchingFunction
(
switchingDistance
);
vector
<
double
>
energyParamDerivValues
(
energyParamDerivNames
.
size
()
+
1
,
0.0
);
vector
<
double
>
energyParamDerivValues
(
energyParamDerivNames
.
size
()
+
1
,
0.0
);
nonbonded
->
calculatePairIxn
(
numParticles
,
&
data
.
posq
[
0
],
posData
,
particleParamArray
,
0
,
globalParamValues
,
data
.
threadForce
,
includeForces
,
includeEnergy
,
energy
,
&
energyParamDerivValues
[
0
]);
nonbonded
->
calculatePairIxn
(
numParticles
,
&
data
.
posq
[
0
],
posData
,
particleParamArray
,
globalParamValues
,
data
.
threadForce
,
includeForces
,
includeEnergy
,
energy
,
&
energyParamDerivValues
[
0
]);
map
<
string
,
double
>&
energyParamDerivs
=
extractEnergyParameterDerivatives
(
context
);
map
<
string
,
double
>&
energyParamDerivs
=
extractEnergyParameterDerivatives
(
context
);
for
(
int
i
=
0
;
i
<
energyParamDerivNames
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
energyParamDerivNames
.
size
();
i
++
)
energyParamDerivs
[
energyParamDerivNames
[
i
]]
+=
energyParamDerivValues
[
i
];
energyParamDerivs
[
energyParamDerivNames
[
i
]]
+=
energyParamDerivValues
[
i
];
...
@@ -1032,11 +964,6 @@ void CpuCalcGBSAOBCForceKernel::copyParametersToContext(ContextImpl& context, co
...
@@ -1032,11 +964,6 @@ void CpuCalcGBSAOBCForceKernel::copyParametersToContext(ContextImpl& context, co
}
}
CpuCalcCustomGBForceKernel
::~
CpuCalcCustomGBForceKernel
()
{
CpuCalcCustomGBForceKernel
::~
CpuCalcCustomGBForceKernel
()
{
if
(
particleParamArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
delete
[]
particleParamArray
[
i
];
delete
[]
particleParamArray
;
}
if
(
ixn
!=
NULL
)
if
(
ixn
!=
NULL
)
delete
ixn
;
delete
ixn
;
if
(
neighborList
!=
NULL
)
if
(
neighborList
!=
NULL
)
...
@@ -1071,15 +998,9 @@ void CpuCalcCustomGBForceKernel::initialize(const System& system, const CustomGB
...
@@ -1071,15 +998,9 @@ void CpuCalcCustomGBForceKernel::initialize(const System& system, const CustomGB
// Build the arrays.
// Build the arrays.
int
numPerParticleParameters
=
force
.
getNumPerParticleParameters
();
int
numPerParticleParameters
=
force
.
getNumPerParticleParameters
();
particleParamArray
=
new
double
*
[
numParticles
];
particleParamArray
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
particleParamArray
[
i
]
=
new
double
[
numPerParticleParameters
];
force
.
getParticleParameters
(
i
,
particleParamArray
[
i
]);
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
vector
<
double
>
parameters
;
force
.
getParticleParameters
(
i
,
parameters
);
for
(
int
j
=
0
;
j
<
numPerParticleParameters
;
j
++
)
particleParamArray
[
i
][
j
]
=
parameters
[
j
];
}
for
(
int
i
=
0
;
i
<
numPerParticleParameters
;
i
++
)
for
(
int
i
=
0
;
i
<
numPerParticleParameters
;
i
++
)
particleParameterNames
.
push_back
(
force
.
getPerParticleParameterName
(
i
));
particleParameterNames
.
push_back
(
force
.
getPerParticleParameterName
(
i
));
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
...
@@ -1225,11 +1146,6 @@ void CpuCalcCustomGBForceKernel::copyParametersToContext(ContextImpl& context, c
...
@@ -1225,11 +1146,6 @@ void CpuCalcCustomGBForceKernel::copyParametersToContext(ContextImpl& context, c
}
}
CpuCalcCustomManyParticleForceKernel
::~
CpuCalcCustomManyParticleForceKernel
()
{
CpuCalcCustomManyParticleForceKernel
::~
CpuCalcCustomManyParticleForceKernel
()
{
if
(
particleParamArray
!=
NULL
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
delete
[]
particleParamArray
[
i
];
delete
[]
particleParamArray
;
}
if
(
ixn
!=
NULL
)
if
(
ixn
!=
NULL
)
delete
ixn
;
delete
ixn
;
}
}
...
@@ -1240,15 +1156,10 @@ void CpuCalcCustomManyParticleForceKernel::initialize(const System& system, cons
...
@@ -1240,15 +1156,10 @@ void CpuCalcCustomManyParticleForceKernel::initialize(const System& system, cons
numParticles
=
system
.
getNumParticles
();
numParticles
=
system
.
getNumParticles
();
int
numParticleParameters
=
force
.
getNumPerParticleParameters
();
int
numParticleParameters
=
force
.
getNumPerParticleParameters
();
particleParamArray
=
new
double
*
[
numParticles
];
particleParamArray
.
resize
(
numParticles
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
particleParamArray
[
i
]
=
new
double
[
numParticleParameters
];
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numParticles
;
++
i
)
{
vector
<
double
>
parameters
;
int
type
;
int
type
;
force
.
getParticleParameters
(
i
,
parameters
,
type
);
force
.
getParticleParameters
(
i
,
particleParamArray
[
i
],
type
);
for
(
int
j
=
0
;
j
<
numParticleParameters
;
j
++
)
particleParamArray
[
i
][
j
]
=
parameters
[
j
];
}
}
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
for
(
int
i
=
0
;
i
<
force
.
getNumGlobalParameters
();
i
++
)
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
globalParameterNames
.
push_back
(
force
.
getGlobalParameterName
(
i
));
...
...
platforms/reference/include/ReferenceAngleBondIxn.h
View file @
9f37b18b
...
@@ -77,7 +77,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -77,7 +77,7 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
getPrefactorsGivenAngleCosine
(
double
cosine
,
double
*
angleParameters
,
void
getPrefactorsGivenAngleCosine
(
double
cosine
,
std
::
vector
<
double
>&
angleParameters
,
double
*
dEdR
,
double
*
energyTerm
)
const
;
double
*
dEdR
,
double
*
energyTerm
)
const
;
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -93,8 +93,8 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
...
@@ -93,8 +93,8 @@ class OPENMM_EXPORT ReferenceAngleBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateBondIxn
(
std
::
vector
<
int
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
...
platforms/reference/include/ReferenceBondForce.h
View file @
9f37b18b
...
@@ -67,9 +67,9 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
...
@@ -67,9 +67,9 @@ class OPENMM_EXPORT ReferenceBondForce : public ReferenceForce {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateForce
(
int
numberOfBonds
,
int
**
atomIndices
,
void
calculateForce
(
int
numberOfBonds
,
std
::
vector
<
std
::
vector
<
int
>
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
std
::
vector
<
double
>
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
double
*
totalEnergy
,
ReferenceBondIxn
&
referenceBondIxn
);
};
};
...
...
platforms/reference/include/ReferenceBondIxn.h
View file @
9f37b18b
...
@@ -65,8 +65,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
...
@@ -65,8 +65,8 @@ class OPENMM_EXPORT ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
virtual
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
virtual
void
calculateBondIxn
(
std
::
vector
<
int
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
double
*
totalEnergy
,
double
*
energyParamDerivs
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCMAPTorsionIxn.h
View file @
9f37b18b
...
@@ -95,8 +95,8 @@ public:
...
@@ -95,8 +95,8 @@ public:
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateBondIxn
(
std
::
vector
<
int
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
double
*
totalEnergy
,
double
*
energyParamDerivs
);
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
platforms/reference/include/ReferenceCustomAngleIxn.h
View file @
9f37b18b
...
@@ -84,8 +84,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
...
@@ -84,8 +84,8 @@ class ReferenceCustomAngleIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateBondIxn
(
std
::
vector
<
int
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
...
platforms/reference/include/ReferenceCustomBondIxn.h
View file @
9f37b18b
...
@@ -85,8 +85,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
...
@@ -85,8 +85,8 @@ class ReferenceCustomBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateBondIxn
(
int
*
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateBondIxn
(
std
::
vector
<
int
>&
atomIndices
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
...
platforms/reference/include/ReferenceCustomCentroidBondIxn.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -130,7 +130,7 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
...
@@ -130,7 +130,7 @@ class ReferenceCustomCentroidBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculatePairIxn
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
bondParameters
,
void
calculatePairIxn
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
...
platforms/reference/include/ReferenceCustomCompoundBondIxn.h
View file @
9f37b18b
...
@@ -127,7 +127,7 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
...
@@ -127,7 +127,7 @@ class ReferenceCustomCompoundBondIxn : public ReferenceBondIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculatePairIxn
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
bondParameters
,
void
calculatePairIxn
(
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
bondParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
const
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
...
platforms/reference/include/ReferenceCustomExternalIxn.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
3
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -81,7 +81,7 @@ class ReferenceCustomExternalIxn {
...
@@ -81,7 +81,7 @@ class ReferenceCustomExternalIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateForce
(
int
atomIndex
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateForce
(
int
atomIndex
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
*
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
energy
)
const
;
std
::
vector
<
double
>&
parameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
energy
)
const
;
};
};
...
...
platforms/reference/include/ReferenceCustomGBIxn.h
View file @
9f37b18b
/* Portions copyright (c) 2009-201
6
Stanford University and Simbios.
/* Portions copyright (c) 2009-201
8
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
...
@@ -73,7 +73,7 @@ class ReferenceCustomGBIxn {
...
@@ -73,7 +73,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateSingleParticleValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
);
void
calculateSingleParticleValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -88,7 +88,7 @@ class ReferenceCustomGBIxn {
...
@@ -88,7 +88,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateParticlePairValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculateParticlePairValue
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
);
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -103,7 +103,7 @@ class ReferenceCustomGBIxn {
...
@@ -103,7 +103,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
);
void
calculateOnePairValue
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -119,7 +119,7 @@ class ReferenceCustomGBIxn {
...
@@ -119,7 +119,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateSingleParticleEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
void
calculateSingleParticleEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -136,7 +136,7 @@ class ReferenceCustomGBIxn {
...
@@ -136,7 +136,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateParticlePairEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculateParticlePairEnergyTerm
(
int
index
,
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
bool
useExclusions
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
...
@@ -154,7 +154,7 @@ class ReferenceCustomGBIxn {
...
@@ -154,7 +154,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculateOnePairEnergyTerm
(
int
index
,
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -169,7 +169,7 @@ class ReferenceCustomGBIxn {
...
@@ -169,7 +169,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateChainRuleForces
(
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculateChainRuleForces
(
int
numAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
energyParamDerivs
);
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
energyParamDerivs
);
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -185,7 +185,7 @@ class ReferenceCustomGBIxn {
...
@@ -185,7 +185,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
void
calculateOnePairChainRule
(
int
atom1
,
int
atom2
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
bool
isExcluded
);
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
bool
isExcluded
);
public:
public:
...
@@ -254,7 +254,7 @@ class ReferenceCustomGBIxn {
...
@@ -254,7 +254,7 @@ class ReferenceCustomGBIxn {
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
void
calculateIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
double
**
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
void
calculateIxn
(
int
numberOfAtoms
,
std
::
vector
<
OpenMM
::
Vec3
>&
atomCoordinates
,
std
::
vector
<
std
::
vector
<
double
>
>&
atomParameters
,
const
std
::
vector
<
std
::
set
<
int
>
>&
exclusions
,
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
std
::
map
<
std
::
string
,
double
>&
globalParameters
,
std
::
vector
<
OpenMM
::
Vec3
>&
forces
,
double
*
totalEnergy
,
double
*
energyParamDerivs
);
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
...
...
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