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
2d2f05ce
Commit
2d2f05ce
authored
Dec 08, 2015
by
Andy Simmonett
Browse files
Merge branch 'master' of github.com:pandegroup/openmm into genpt
parents
94823d84
4d32047c
Changes
235
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
441 additions
and
1708 deletions
+441
-1708
platforms/reference/src/SimTKReference/GBVIParameters.cpp
platforms/reference/src/SimTKReference/GBVIParameters.cpp
+0
-421
platforms/reference/src/SimTKReference/ReferenceGBVI.cpp
platforms/reference/src/SimTKReference/ReferenceGBVI.cpp
+0
-884
platforms/reference/tests/TestReferenceCompoundIntegrator.cpp
...forms/reference/tests/TestReferenceCompoundIntegrator.cpp
+36
-0
plugins/amoeba/CMakeLists.txt
plugins/amoeba/CMakeLists.txt
+3
-3
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
+10
-10
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
+11
-11
plugins/amoeba/openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
...openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
+4
-4
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
...amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
+9
-9
plugins/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
...ns/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
+41
-39
plugins/amoeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
...oeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
+10
-10
plugins/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
...ns/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
+8
-8
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
.../amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
+9
-9
plugins/amoeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
...oeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
+10
-10
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
+263
-263
plugins/amoeba/openmmapi/include/openmm/AmoebaWcaDispersionForce.h
...moeba/openmmapi/include/openmm/AmoebaWcaDispersionForce.h
+3
-3
plugins/amoeba/platforms/cuda/src/kernels/amoebaGk.cu
plugins/amoeba/platforms/cuda/src/kernels/amoebaGk.cu
+6
-6
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
+2
-2
plugins/amoeba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
...eba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
+3
-3
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
+8
-8
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
.../platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
+5
-5
No files found.
platforms/reference/src/SimTKReference/GBVIParameters.cpp
deleted
100644 → 0
View file @
94823d84
/* Portions copyright (c) 2006-2009 Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <math.h>
#include <sstream>
#include <string.h>
#include "openmm/OpenMMException.h"
#include "GBVIParameters.h"
using
std
::
vector
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
GBVIParameters constructor
@param numberOfAtoms number of atoms
--------------------------------------------------------------------------------------- */
GBVIParameters
::
GBVIParameters
(
int
numberOfAtoms
)
:
_numberOfAtoms
(
numberOfAtoms
),
_soluteDielectric
(
1.0
),
_solventDielectric
(
78.3
),
_electricConstant
(
-
0.5
*
ONE_4PI_EPS0
),
_cutoff
(
false
),
_periodic
(
false
),
_bornRadiusScalingMethod
(
0
),
_quinticLowerLimitFactor
(
0.8
),
_quinticUpperBornRadiusLimit
(
5.0
)
{
_atomicRadii
.
resize
(
numberOfAtoms
);
_scaledRadii
.
resize
(
numberOfAtoms
);
_gammaParameters
.
resize
(
numberOfAtoms
);
}
/**---------------------------------------------------------------------------------------
GBVIParameters destructor
--------------------------------------------------------------------------------------- */
GBVIParameters
::~
GBVIParameters
()
{
}
/**---------------------------------------------------------------------------------------
Get number of atoms
@return number of atoms
--------------------------------------------------------------------------------------- */
int
GBVIParameters
::
getNumberOfAtoms
()
const
{
return
_numberOfAtoms
;
}
/**---------------------------------------------------------------------------------------
Get electric constant
@return electric constant
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getElectricConstant
()
const
{
return
_electricConstant
;
}
/**---------------------------------------------------------------------------------------
Get solvent dielectric
@return solvent dielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getSolventDielectric
()
const
{
return
_solventDielectric
;
}
/**---------------------------------------------------------------------------------------
Set solvent dielectric
@param solventDielectric solvent dielectric
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setSolventDielectric
(
RealOpenMM
solventDielectric
)
{
_solventDielectric
=
solventDielectric
;
}
/**---------------------------------------------------------------------------------------
Get solute dielectric
@return soluteDielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getSoluteDielectric
()
const
{
return
_soluteDielectric
;
}
/**---------------------------------------------------------------------------------------
Set solute dielectric
@param soluteDielectric solute dielectric
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setSoluteDielectric
(
RealOpenMM
soluteDielectric
)
{
_soluteDielectric
=
soluteDielectric
;
}
/**---------------------------------------------------------------------------------------
Get AtomicRadii array
@return array of atomic radii
--------------------------------------------------------------------------------------- */
const
vector
<
RealOpenMM
>&
GBVIParameters
::
getAtomicRadii
()
const
{
return
_atomicRadii
;
}
/**---------------------------------------------------------------------------------------
Set AtomicRadii array
@param atomicRadii vector of atomic radii
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setAtomicRadii
(
const
vector
<
RealOpenMM
>&
atomicRadii
)
{
if
(
atomicRadii
.
size
()
==
_atomicRadii
.
size
())
{
for
(
unsigned
int
ii
=
0
;
ii
<
atomicRadii
.
size
();
ii
++
)
{
_atomicRadii
[
ii
]
=
atomicRadii
[
ii
];
}
}
else
{
std
::
stringstream
msg
;
msg
<<
"GBVIParameters: input size for atomic radii does not agree w/ current size: input="
;
msg
<<
atomicRadii
.
size
();
msg
<<
" current size="
<<
_atomicRadii
.
size
();
throw
OpenMM
::
OpenMMException
(
msg
.
str
());
}
}
/**---------------------------------------------------------------------------------------
Return scaled radii
@return array
--------------------------------------------------------------------------------------- */
const
vector
<
RealOpenMM
>&
GBVIParameters
::
getScaledRadii
()
const
{
return
_scaledRadii
;
}
/**---------------------------------------------------------------------------------------
Set scaled radii
@param scaledRadii scaledRadii
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setScaledRadii
(
const
vector
<
RealOpenMM
>&
scaledRadii
)
{
if
(
scaledRadii
.
size
()
==
_scaledRadii
.
size
())
{
for
(
unsigned
int
ii
=
0
;
ii
<
scaledRadii
.
size
();
ii
++
)
{
_scaledRadii
[
ii
]
=
scaledRadii
[
ii
];
}
}
else
{
std
::
stringstream
msg
;
msg
<<
"GBVIParameters: input size for scaled radii does not agree w/ current size: input="
;
msg
<<
scaledRadii
.
size
();
msg
<<
" current size="
<<
_scaledRadii
.
size
();
throw
OpenMM
::
OpenMMException
(
msg
.
str
());
}
}
/**---------------------------------------------------------------------------------------
Return gamma parameters
If not previously set, allocate space
@return array
--------------------------------------------------------------------------------------- */
const
vector
<
RealOpenMM
>&
GBVIParameters
::
getGammaParameters
()
const
{
return
_gammaParameters
;
}
/**---------------------------------------------------------------------------------------
Set gamma parameters
@param gammas gammas
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setGammaParameters
(
const
vector
<
RealOpenMM
>&
gammas
)
{
if
(
gammas
.
size
()
==
_gammaParameters
.
size
())
{
for
(
unsigned
int
ii
=
0
;
ii
<
gammas
.
size
();
ii
++
)
{
_gammaParameters
[
ii
]
=
gammas
[
ii
];
}
}
else
{
std
::
stringstream
msg
;
msg
<<
"GBVIParameters: input size for gammas does not agree w/ current size: input="
;
msg
<<
gammas
.
size
();
msg
<<
" current size="
<<
_gammaParameters
.
size
();
throw
OpenMM
::
OpenMMException
(
msg
.
str
());
}
}
/**---------------------------------------------------------------------------------------
Set the force to use a cutoff.
@param distance the cutoff distance
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setUseCutoff
(
RealOpenMM
distance
)
{
_cutoff
=
true
;
_cutoffDistance
=
distance
;
}
/**---------------------------------------------------------------------------------------
Get whether to use a cutoff.
--------------------------------------------------------------------------------------- */
bool
GBVIParameters
::
getUseCutoff
()
{
return
_cutoff
;
}
/**---------------------------------------------------------------------------------------
Get the cutoff distance.
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getCutoffDistance
()
{
return
_cutoffDistance
;
}
/**---------------------------------------------------------------------------------------
Set the force to use periodic boundary conditions. This requires that a cutoff has
also been set, and the smallest side of the periodic box is at least twice the cutoff
distance.
@param vectors the vectors defining the periodic box
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setPeriodic
(
RealVec
*
vectors
)
{
assert
(
_cutoff
);
assert
(
vectors
[
0
][
0
]
>=
2.0
*
_cutoffDistance
);
assert
(
vectors
[
1
][
1
]
>=
2.0
*
_cutoffDistance
);
assert
(
vectors
[
2
][
2
]
>=
2.0
*
_cutoffDistance
);
_periodic
=
true
;
_periodicBoxVectors
[
0
]
=
vectors
[
0
];
_periodicBoxVectors
[
1
]
=
vectors
[
1
];
_periodicBoxVectors
[
2
]
=
vectors
[
2
];
}
/**---------------------------------------------------------------------------------------
Get whether to use periodic boundary conditions.
--------------------------------------------------------------------------------------- */
bool
GBVIParameters
::
getPeriodic
()
{
return
_periodic
;
}
/**---------------------------------------------------------------------------------------
Get the periodic box dimension
--------------------------------------------------------------------------------------- */
const
OpenMM
::
RealVec
*
GBVIParameters
::
getPeriodicBox
()
{
return
_periodicBoxVectors
;
}
/**---------------------------------------------------------------------------------------
Get tau prefactor
@return (1/e1 - 1/e0), where e1 = solute dielectric, e0 = solvent dielectric
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getTau
()
const
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
0.0
;
static
const
RealOpenMM
one
=
1.0
;
// ---------------------------------------------------------------------------------------
RealOpenMM
tau
;
if
(
getSoluteDielectric
()
!=
zero
&&
getSolventDielectric
()
!=
zero
)
{
tau
=
(
one
/
getSoluteDielectric
())
-
(
one
/
getSolventDielectric
());
}
else
{
tau
=
zero
;
}
return
tau
;
}
/**---------------------------------------------------------------------------------------
Get bornRadiusScalingMethod
@return bornRadiusScalingMethod
--------------------------------------------------------------------------------------- */
int
GBVIParameters
::
getBornRadiusScalingMethod
()
const
{
return
_bornRadiusScalingMethod
;
}
/**---------------------------------------------------------------------------------------
Set bornRadiusScalingMethod
@param bornRadiusScalingMethod bornRadiusScalingMethod
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setBornRadiusScalingMethod
(
int
bornRadiusScalingMethod
)
{
_bornRadiusScalingMethod
=
bornRadiusScalingMethod
;
}
/**---------------------------------------------------------------------------------------
Get quinticLowerLimitFactor
@return quinticLowerLimitFactor
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getQuinticLowerLimitFactor
()
const
{
return
_quinticLowerLimitFactor
;
}
/**---------------------------------------------------------------------------------------
Set quinticLowerLimitFactor
@param quinticLowerLimitFactor quinticLowerLimitFactor
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setQuinticLowerLimitFactor
(
RealOpenMM
quinticLowerLimitFactor
)
{
_quinticLowerLimitFactor
=
quinticLowerLimitFactor
;
}
/**---------------------------------------------------------------------------------------
Get quinticUpperBornRadiusLimit
@return quinticUpperBornRadiusLimit
--------------------------------------------------------------------------------------- */
RealOpenMM
GBVIParameters
::
getQuinticUpperBornRadiusLimit
()
const
{
return
_quinticUpperBornRadiusLimit
;
}
/**---------------------------------------------------------------------------------------
Set quinticUpperBornRadiusLimit
@param quinticUpperBornRadiusLimit quinticUpperBornRadiusLimit
--------------------------------------------------------------------------------------- */
void
GBVIParameters
::
setQuinticUpperBornRadiusLimit
(
RealOpenMM
quinticUpperBornRadiusLimit
)
{
_quinticUpperBornRadiusLimit
=
quinticUpperBornRadiusLimit
;
}
platforms/reference/src/SimTKReference/ReferenceGBVI.cpp
deleted
100644 → 0
View file @
94823d84
/* Portions copyright (c) 2006-2009 Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject
* to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <string.h>
#include <math.h>
#include <sstream>
#include <stdio.h>
#include "ReferenceForce.h"
#include "ReferenceGBVI.h"
using
namespace
std
;
using
namespace
OpenMM
;
/**---------------------------------------------------------------------------------------
ReferenceGBVI constructor
gbviParameters gbviParameters object
--------------------------------------------------------------------------------------- */
ReferenceGBVI
::
ReferenceGBVI
(
GBVIParameters
*
gbviParameters
)
:
_gbviParameters
(
gbviParameters
)
{
_switchDeriviative
.
resize
(
gbviParameters
->
getNumberOfAtoms
());
}
/**---------------------------------------------------------------------------------------
ReferenceGBVI destructor
--------------------------------------------------------------------------------------- */
ReferenceGBVI
::~
ReferenceGBVI
()
{
}
/**---------------------------------------------------------------------------------------
Get GBVIParameters reference
@return GBVIParameters reference
--------------------------------------------------------------------------------------- */
GBVIParameters
*
ReferenceGBVI
::
getGBVIParameters
()
const
{
return
_gbviParameters
;
}
/**---------------------------------------------------------------------------------------
Set GBVIParameters reference
@param GBVIParameters reference
--------------------------------------------------------------------------------------- */
void
ReferenceGBVI
::
setGBVIParameters
(
GBVIParameters
*
gbviParameters
)
{
_gbviParameters
=
gbviParameters
;
}
/**---------------------------------------------------------------------------------------
Return OBC chain derivative: size = _obcParameters->getNumberOfAtoms()
@return array
--------------------------------------------------------------------------------------- */
vector
<
RealOpenMM
>&
ReferenceGBVI
::
getSwitchDeriviative
()
{
return
_switchDeriviative
;
}
/**---------------------------------------------------------------------------------------
Compute quintic spline value and associated derviative
@param x value to compute spline at
@param rl lower cutoff value
@param ru upper cutoff value
@param outValue value of spline at x
@param outDerivative value of derivative of spline at x
--------------------------------------------------------------------------------------- */
void
ReferenceGBVI
::
quinticSpline
(
RealOpenMM
x
,
RealOpenMM
rl
,
RealOpenMM
ru
,
RealOpenMM
*
outValue
,
RealOpenMM
*
outDerivative
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
minusSix
=
static_cast
<
RealOpenMM
>
(
-
6.0
);
static
const
RealOpenMM
minusTen
=
static_cast
<
RealOpenMM
>
(
-
10.0
);
static
const
RealOpenMM
minusThirty
=
static_cast
<
RealOpenMM
>
(
-
30.0
);
static
const
RealOpenMM
fifteen
=
static_cast
<
RealOpenMM
>
(
15.0
);
static
const
RealOpenMM
sixty
=
static_cast
<
RealOpenMM
>
(
60.0
);
// ---------------------------------------------------------------------------------------
RealOpenMM
numerator
=
x
-
rl
;
RealOpenMM
denominator
=
ru
-
rl
;
RealOpenMM
ratio
=
numerator
/
denominator
;
RealOpenMM
ratio2
=
ratio
*
ratio
;
RealOpenMM
ratio3
=
ratio2
*
ratio
;
*
outValue
=
one
+
ratio3
*
(
minusTen
+
fifteen
*
ratio
+
minusSix
*
ratio2
);
*
outDerivative
=
ratio2
*
(
minusThirty
+
sixty
*
ratio
+
minusThirty
*
ratio2
)
/
denominator
;
}
/**---------------------------------------------------------------------------------------
Compute Born radii based on Eq. 3 of Labute paper [JCC 29 p. 1693-1698 2008])
and quintic splice switching function
@param atomicRadius3 atomic radius cubed
@param bornSum Born sum (volume integral)
@param gbviParameters Gbvi parameters (parameters used in spline
QuinticLowerLimitFactor & QuinticUpperBornRadiusLimit)
@param bornRadius output Born radius
@param switchDeriviative output switching function deriviative
--------------------------------------------------------------------------------------- */
void
ReferenceGBVI
::
computeBornRadiiUsingQuinticSpline
(
RealOpenMM
atomicRadius3
,
RealOpenMM
bornSum
,
GBVIParameters
*
gbviParameters
,
RealOpenMM
*
bornRadius
,
RealOpenMM
*
switchDeriviative
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
minusOne
=
static_cast
<
RealOpenMM
>
(
-
1.0
);
static
const
RealOpenMM
minusThree
=
static_cast
<
RealOpenMM
>
(
-
3.0
);
static
const
RealOpenMM
oneEighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
static
const
RealOpenMM
minusOneThird
=
static_cast
<
RealOpenMM
>
((
-
1.0
/
3.0
));
static
const
RealOpenMM
three
=
static_cast
<
RealOpenMM
>
(
3.0
);
// ---------------------------------------------------------------------------------------
// R = [ S(V)*(A - V) ]**(-1/3)
// S(V) = 1 V < L
// S(V) = qSpline + U/(A-V) L < V < A
// S(V) = U/(A-V) U < V
// dR/dr = (-1/3)*[ S(V)*(A - V) ]**(-4/3)*[ d{ S(V)*(A-V) }/dr
// d{ S(V)*(A-V) }/dr = (dV/dr)*[ (A-V)*dS/dV - S(V) ]
// (A - V)*dS/dV - S(V) = 0 - 1 V < L
// (A - V)*dS/dV - S(V) = (A-V)*d(qSpline) + (A-V)*U/(A-V)**2 - qSpline - U/(A-V)
// = (A-V)*d(qSpline) - qSpline L < V < A**(-3)
// (A - V)*dS/dV - S(V) = (A-V)*U*/(A-V)**2 - U/(A-V) = 0 U < V
RealOpenMM
splineL
=
gbviParameters
->
getQuinticLowerLimitFactor
()
*
atomicRadius3
;
RealOpenMM
sum
;
if
(
bornSum
>
splineL
)
{
if
(
bornSum
<
atomicRadius3
)
{
RealOpenMM
splineValue
,
splineDerivative
;
quinticSpline
(
bornSum
,
splineL
,
atomicRadius3
,
&
splineValue
,
&
splineDerivative
);
sum
=
(
atomicRadius3
-
bornSum
)
*
splineValue
+
gbviParameters
->
getQuinticUpperBornRadiusLimit
();
*
switchDeriviative
=
splineValue
-
(
atomicRadius3
-
bornSum
)
*
splineDerivative
;
}
else
{
sum
=
gbviParameters
->
getQuinticUpperBornRadiusLimit
();
*
switchDeriviative
=
zero
;
}
}
else
{
sum
=
atomicRadius3
-
bornSum
;
*
switchDeriviative
=
one
;
}
*
bornRadius
=
POW
(
sum
,
minusOneThird
);
}
/**---------------------------------------------------------------------------------------
Get Born radii based on Eq. 3 of Labute paper [JCC 29 p. 1693-1698 2008])
@param atomCoordinates atomic coordinates
@param bornRadii output array of Born radii
@param chain not used here
--------------------------------------------------------------------------------------- */
void
ReferenceGBVI
::
computeBornRadii
(
const
vector
<
RealVec
>&
atomCoordinates
,
vector
<
RealOpenMM
>&
bornRadii
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
minusThree
=
static_cast
<
RealOpenMM
>
(
-
3.0
);
static
const
RealOpenMM
oneEighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
static
const
RealOpenMM
minusOneThird
=
static_cast
<
RealOpenMM
>
((
-
1.0
/
3.0
));
static
const
RealOpenMM
three
=
static_cast
<
RealOpenMM
>
(
3.0
);
// ---------------------------------------------------------------------------------------
GBVIParameters
*
gbviParameters
=
getGBVIParameters
();
int
numberOfAtoms
=
gbviParameters
->
getNumberOfAtoms
();
const
vector
<
RealOpenMM
>&
atomicRadii
=
gbviParameters
->
getAtomicRadii
();
const
vector
<
RealOpenMM
>&
scaledRadii
=
gbviParameters
->
getScaledRadii
();
vector
<
RealOpenMM
>&
switchDeriviatives
=
getSwitchDeriviative
();
// ---------------------------------------------------------------------------------------
// calculate Born radii
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
)
{
RealOpenMM
radiusI
=
atomicRadii
[
atomI
];
RealOpenMM
sum
=
zero
;
// sum over volumes
for
(
int
atomJ
=
0
;
atomJ
<
numberOfAtoms
;
atomJ
++
)
{
if
(
atomJ
!=
atomI
)
{
RealOpenMM
deltaR
[
ReferenceForce
::
LastDeltaRIndex
];
if
(
_gbviParameters
->
getPeriodic
())
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
_gbviParameters
->
getPeriodicBox
(),
deltaR
);
else
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
deltaR
);
RealOpenMM
r
=
deltaR
[
ReferenceForce
::
RIndex
];
if
(
_gbviParameters
->
getUseCutoff
()
&&
r
>
_gbviParameters
->
getCutoffDistance
())
continue
;
sum
+=
ReferenceGBVI
::
getVolume
(
r
,
radiusI
,
scaledRadii
[
atomJ
]);
}
}
RealOpenMM
atomicRadius3
=
POW
(
radiusI
,
minusThree
);
if
(
_gbviParameters
->
getBornRadiusScalingMethod
()
!=
GBVIParameters
::
QuinticSpline
)
{
sum
=
atomicRadius3
-
sum
;
bornRadii
[
atomI
]
=
POW
(
sum
,
minusOneThird
);
switchDeriviatives
[
atomI
]
=
one
;
}
else
{
RealOpenMM
bornRadius
,
switchDeriviative
;
computeBornRadiiUsingQuinticSpline
(
atomicRadius3
,
sum
,
gbviParameters
,
&
bornRadius
,
&
switchDeriviative
);
bornRadii
[
atomI
]
=
bornRadius
;
switchDeriviatives
[
atomI
]
=
switchDeriviative
;
}
}
}
/**---------------------------------------------------------------------------------------
Get volume Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return volume
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
getVolume
(
RealOpenMM
r
,
RealOpenMM
R
,
RealOpenMM
S
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
minusThree
=
static_cast
<
RealOpenMM
>
(
-
3.0
);
RealOpenMM
diff
=
(
S
-
R
);
if
(
FABS
(
diff
)
<
r
)
{
RealOpenMM
lowerBound
=
(
R
>
(
r
-
S
))
?
R
:
(
r
-
S
);
return
(
ReferenceGBVI
::
getL
(
r
,
(
r
+
S
),
S
)
-
ReferenceGBVI
::
getL
(
r
,
lowerBound
,
S
));
}
else
if
(
r
<=
diff
)
{
return
ReferenceGBVI
::
getL
(
r
,
(
r
+
S
),
S
)
-
ReferenceGBVI
::
getL
(
r
,
(
r
-
S
),
S
)
+
POW
(
R
,
minusThree
);
}
else
{
return
zero
;
}
}
/**---------------------------------------------------------------------------------------
Get L (used in analytical solution for volume integrals)
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return L value (Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
getL
(
RealOpenMM
r
,
RealOpenMM
x
,
RealOpenMM
S
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
threeHalves
=
static_cast
<
RealOpenMM
>
(
1.5
);
static
const
RealOpenMM
third
=
static_cast
<
RealOpenMM
>
((
1.0
/
3.0
));
static
const
RealOpenMM
fourth
=
static_cast
<
RealOpenMM
>
(
0.25
);
static
const
RealOpenMM
eighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
// ---------------------------------------------------------------------------------------
RealOpenMM
rInv
=
one
/
r
;
RealOpenMM
xInv
=
one
/
x
;
RealOpenMM
xInv2
=
xInv
*
xInv
;
RealOpenMM
xInv3
=
xInv2
*
xInv
;
RealOpenMM
diff2
=
(
r
+
S
)
*
(
r
-
S
);
return
(
threeHalves
*
xInv
)
*
((
xInv
*
fourth
*
rInv
)
-
(
xInv2
*
third
)
+
(
diff2
*
xInv3
*
eighth
*
rInv
));
}
/**---------------------------------------------------------------------------------------
Get partial derivative of L wrt r
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return partial derivative based on Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
dL_dr
(
RealOpenMM
r
,
RealOpenMM
x
,
RealOpenMM
S
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
threeHalves
=
static_cast
<
RealOpenMM
>
(
1.5
);
static
const
RealOpenMM
threeEights
=
static_cast
<
RealOpenMM
>
(
0.375
);
static
const
RealOpenMM
third
=
static_cast
<
RealOpenMM
>
((
1.0
/
3.0
));
static
const
RealOpenMM
fourth
=
static_cast
<
RealOpenMM
>
(
0.25
);
static
const
RealOpenMM
eighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
// ---------------------------------------------------------------------------------------
RealOpenMM
rInv
=
one
/
r
;
RealOpenMM
rInv2
=
rInv
*
rInv
;
RealOpenMM
xInv
=
one
/
x
;
RealOpenMM
xInv2
=
xInv
*
xInv
;
RealOpenMM
xInv3
=
xInv2
*
xInv
;
RealOpenMM
diff2
=
(
r
+
S
)
*
(
r
-
S
);
return
((
-
threeHalves
*
xInv2
*
rInv2
)
*
(
fourth
+
eighth
*
diff2
*
xInv2
)
+
threeEights
*
xInv3
*
xInv
);
}
/**---------------------------------------------------------------------------------------
Get partial derivative of L wrt x
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return partial derivative based on Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
dL_dx
(
RealOpenMM
r
,
RealOpenMM
x
,
RealOpenMM
S
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
half
=
static_cast
<
RealOpenMM
>
(
0.5
);
static
const
RealOpenMM
threeHalvesM
=
static_cast
<
RealOpenMM
>
(
-
1.5
);
static
const
RealOpenMM
third
=
static_cast
<
RealOpenMM
>
(
(
1.0
/
3.0
));
// ---------------------------------------------------------------------------------------
RealOpenMM
rInv
=
one
/
r
;
RealOpenMM
xInv
=
one
/
x
;
RealOpenMM
xInv2
=
xInv
*
xInv
;
RealOpenMM
xInv3
=
xInv2
*
xInv
;
RealOpenMM
diff
=
(
r
+
S
)
*
(
r
-
S
);
return
(
threeHalvesM
*
xInv3
)
*
((
half
*
rInv
)
-
xInv
+
(
half
*
diff
*
xInv2
*
rInv
));
}
/**---------------------------------------------------------------------------------------
Sgb function
@param t r*r*G_i*G_j
@return Sgb (top of p. 1694 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
Sgb
(
RealOpenMM
t
)
{
// ---------------------------------------------------------------------------------------
// static const char* methodName = "ReferenceGBVI::Sgb";
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
fourth
=
static_cast
<
RealOpenMM
>
(
0.25
);
// ---------------------------------------------------------------------------------------
return
((
t
!=
zero
)
?
one
/
SQRT
((
one
+
(
fourth
*
EXP
(
-
t
))
/
t
))
:
zero
);
}
/**---------------------------------------------------------------------------------------
Get GB/VI energy
@param atomCoordinates atomic coordinates
@param partialCharges partial charges
@return energy
--------------------------------------------------------------------------------------- */
RealOpenMM
ReferenceGBVI
::
computeBornEnergy
(
const
vector
<
RealVec
>&
atomCoordinates
,
const
vector
<
RealOpenMM
>&
partialCharges
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
two
=
static_cast
<
RealOpenMM
>
(
2.0
);
static
const
RealOpenMM
three
=
static_cast
<
RealOpenMM
>
(
3.0
);
static
const
RealOpenMM
four
=
static_cast
<
RealOpenMM
>
(
4.0
);
static
const
RealOpenMM
half
=
static_cast
<
RealOpenMM
>
(
0.5
);
static
const
RealOpenMM
fourth
=
static_cast
<
RealOpenMM
>
(
0.25
);
static
const
RealOpenMM
eighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
// ---------------------------------------------------------------------------------------
const
GBVIParameters
*
gbviParameters
=
getGBVIParameters
();
const
RealOpenMM
preFactor
=
gbviParameters
->
getElectricConstant
();
const
int
numberOfAtoms
=
gbviParameters
->
getNumberOfAtoms
();
const
vector
<
RealOpenMM
>&
atomicRadii
=
gbviParameters
->
getAtomicRadii
();
const
vector
<
RealOpenMM
>&
gammaParameters
=
gbviParameters
->
getGammaParameters
();
// compute Born radii
vector
<
RealOpenMM
>
bornRadii
(
numberOfAtoms
);
computeBornRadii
(
atomCoordinates
,
bornRadii
);
// ---------------------------------------------------------------------------------------
// Eq.2 of Labute paper [JCC 29 p. 1693-1698 2008]
// to minimze roundoff error sum cavityEnergy separately since in general much
// smaller than other contributions
RealOpenMM
energy
=
zero
;
RealOpenMM
cavityEnergy
=
zero
;
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
)
{
RealOpenMM
partialChargeI
=
partialCharges
[
atomI
];
// self-energy term
RealOpenMM
atomIEnergy
=
half
*
partialChargeI
/
bornRadii
[
atomI
];
// cavity term
RealOpenMM
ratio
=
(
atomicRadii
[
atomI
]
/
bornRadii
[
atomI
]);
cavityEnergy
+=
gammaParameters
[
atomI
]
*
ratio
*
ratio
*
ratio
;
for
(
int
atomJ
=
atomI
+
1
;
atomJ
<
numberOfAtoms
;
atomJ
++
)
{
RealOpenMM
deltaR
[
ReferenceForce
::
LastDeltaRIndex
];
if
(
_gbviParameters
->
getPeriodic
())
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
_gbviParameters
->
getPeriodicBox
(),
deltaR
);
else
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
deltaR
);
if
(
_gbviParameters
->
getUseCutoff
()
&&
deltaR
[
ReferenceForce
::
RIndex
]
>
_gbviParameters
->
getCutoffDistance
())
continue
;
RealOpenMM
r2
=
deltaR
[
ReferenceForce
::
R2Index
];
RealOpenMM
t
=
fourth
*
r2
/
(
bornRadii
[
atomI
]
*
bornRadii
[
atomJ
]);
atomIEnergy
+=
partialCharges
[
atomJ
]
*
Sgb
(
t
)
/
deltaR
[
ReferenceForce
::
RIndex
];
}
energy
+=
two
*
partialChargeI
*
atomIEnergy
;
}
energy
*=
preFactor
;
energy
-=
cavityEnergy
;
RealOpenMM
conversion
=
static_cast
<
RealOpenMM
>
(
gbviParameters
->
getTau
());
return
(
conversion
*
energy
);
}
/**---------------------------------------------------------------------------------------
Get GB/VI forces
@param atomCoordinates atomic coordinates
@param partialCharges partial charges
@param forces forces
--------------------------------------------------------------------------------------- */
void
ReferenceGBVI
::
computeBornForces
(
std
::
vector
<
RealVec
>&
atomCoordinates
,
const
vector
<
RealOpenMM
>&
partialCharges
,
std
::
vector
<
OpenMM
::
RealVec
>&
inputForces
)
{
// ---------------------------------------------------------------------------------------
static
const
RealOpenMM
zero
=
static_cast
<
RealOpenMM
>
(
0.0
);
static
const
RealOpenMM
one
=
static_cast
<
RealOpenMM
>
(
1.0
);
static
const
RealOpenMM
two
=
static_cast
<
RealOpenMM
>
(
2.0
);
static
const
RealOpenMM
three
=
static_cast
<
RealOpenMM
>
(
3.0
);
static
const
RealOpenMM
four
=
static_cast
<
RealOpenMM
>
(
4.0
);
static
const
RealOpenMM
half
=
static_cast
<
RealOpenMM
>
(
0.5
);
static
const
RealOpenMM
oneThird
=
static_cast
<
RealOpenMM
>
((
1.0
/
3.0
));
static
const
RealOpenMM
fourth
=
static_cast
<
RealOpenMM
>
(
0.25
);
static
const
RealOpenMM
eighth
=
static_cast
<
RealOpenMM
>
(
0.125
);
// ---------------------------------------------------------------------------------------
const
GBVIParameters
*
gbviParameters
=
getGBVIParameters
();
const
int
numberOfAtoms
=
gbviParameters
->
getNumberOfAtoms
();
const
vector
<
RealOpenMM
>&
atomicRadii
=
gbviParameters
->
getAtomicRadii
();
const
vector
<
RealOpenMM
>&
gammaParameters
=
gbviParameters
->
getGammaParameters
();
// ---------------------------------------------------------------------------------------
// constants
const
RealOpenMM
preFactor
=
two
*
gbviParameters
->
getElectricConstant
();
// ---------------------------------------------------------------------------------------
// compute Born radii
vector
<
RealOpenMM
>
bornRadii
(
numberOfAtoms
);
computeBornRadii
(
atomCoordinates
,
bornRadii
);
// set energy/forces to zero
std
::
vector
<
OpenMM
::
RealVec
>
forces
(
numberOfAtoms
);
for
(
int
ii
=
0
;
ii
<
numberOfAtoms
;
ii
++
)
{
forces
[
ii
][
0
]
=
zero
;
forces
[
ii
][
1
]
=
zero
;
forces
[
ii
][
2
]
=
zero
;
}
vector
<
RealOpenMM
>
bornForces
(
numberOfAtoms
,
0.0
);
// ---------------------------------------------------------------------------------------
// first main loop
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
)
{
// partial of polar term wrt Born radius
// and (dGpol/dr)(dr/dx)
RealOpenMM
partialChargeI
=
preFactor
*
partialCharges
[
atomI
];
for
(
int
atomJ
=
atomI
;
atomJ
<
numberOfAtoms
;
atomJ
++
)
{
RealOpenMM
deltaR
[
ReferenceForce
::
LastDeltaRIndex
];
if
(
_gbviParameters
->
getPeriodic
())
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
_gbviParameters
->
getPeriodicBox
(),
deltaR
);
else
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
deltaR
);
if
(
_gbviParameters
->
getUseCutoff
()
&&
deltaR
[
ReferenceForce
::
RIndex
]
>
_gbviParameters
->
getCutoffDistance
())
continue
;
RealOpenMM
r2
=
deltaR
[
ReferenceForce
::
R2Index
];
RealOpenMM
deltaX
=
deltaR
[
ReferenceForce
::
XIndex
];
RealOpenMM
deltaY
=
deltaR
[
ReferenceForce
::
YIndex
];
RealOpenMM
deltaZ
=
deltaR
[
ReferenceForce
::
ZIndex
];
RealOpenMM
alpha2_ij
=
bornRadii
[
atomI
]
*
bornRadii
[
atomJ
];
RealOpenMM
D_ij
=
r2
/
(
four
*
alpha2_ij
);
RealOpenMM
expTerm
=
EXP
(
-
D_ij
);
RealOpenMM
denominator2
=
r2
+
alpha2_ij
*
expTerm
;
RealOpenMM
denominator
=
SQRT
(
denominator2
);
RealOpenMM
Gpol
=
(
partialChargeI
*
partialCharges
[
atomJ
])
/
denominator
;
RealOpenMM
dGpol_dr
=
-
Gpol
*
(
one
-
fourth
*
expTerm
)
/
denominator2
;
RealOpenMM
dGpol_dalpha2_ij
=
-
half
*
Gpol
*
expTerm
*
(
one
+
D_ij
)
/
denominator2
;
if
(
atomI
!=
atomJ
)
{
bornForces
[
atomJ
]
+=
dGpol_dalpha2_ij
*
bornRadii
[
atomI
];
deltaX
*=
dGpol_dr
;
deltaY
*=
dGpol_dr
;
deltaZ
*=
dGpol_dr
;
forces
[
atomI
][
0
]
+=
deltaX
;
forces
[
atomI
][
1
]
+=
deltaY
;
forces
[
atomI
][
2
]
+=
deltaZ
;
forces
[
atomJ
][
0
]
-=
deltaX
;
forces
[
atomJ
][
1
]
-=
deltaY
;
forces
[
atomJ
][
2
]
-=
deltaZ
;
}
bornForces
[
atomI
]
+=
dGpol_dalpha2_ij
*
bornRadii
[
atomJ
];
}
}
// ---------------------------------------------------------------------------------------
// second main loop: (dGpol/dBornRadius)(dBornRadius/dr)(dr/dx)
// dGpol/dBornRadius) = bornForces[]
// dBornRadius/dr = (1/3)*(bR**4)*(dV/dr)
const
vector
<
RealOpenMM
>&
scaledRadii
=
gbviParameters
->
getScaledRadii
();
const
vector
<
RealOpenMM
>&
switchDeriviative
=
getSwitchDeriviative
();
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
)
{
RealOpenMM
R
=
atomicRadii
[
atomI
];
// partial of cavity term wrt Born radius
RealOpenMM
ratio
=
(
atomicRadii
[
atomI
]
/
bornRadii
[
atomI
]);
bornForces
[
atomI
]
+=
(
three
*
gammaParameters
[
atomI
]
*
ratio
*
ratio
*
ratio
)
/
bornRadii
[
atomI
];
RealOpenMM
b2
=
bornRadii
[
atomI
]
*
bornRadii
[
atomI
];
bornForces
[
atomI
]
*=
switchDeriviative
[
atomI
]
*
oneThird
*
b2
*
b2
;
for
(
int
atomJ
=
0
;
atomJ
<
numberOfAtoms
;
atomJ
++
)
{
if
(
atomJ
!=
atomI
)
{
RealOpenMM
deltaX
=
atomCoordinates
[
atomJ
][
0
]
-
atomCoordinates
[
atomI
][
0
];
RealOpenMM
deltaY
=
atomCoordinates
[
atomJ
][
1
]
-
atomCoordinates
[
atomI
][
1
];
RealOpenMM
deltaZ
=
atomCoordinates
[
atomJ
][
2
]
-
atomCoordinates
[
atomI
][
2
];
RealOpenMM
deltaR
[
ReferenceForce
::
LastDeltaRIndex
];
if
(
_gbviParameters
->
getPeriodic
())
ReferenceForce
::
getDeltaRPeriodic
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
_gbviParameters
->
getPeriodicBox
(),
deltaR
);
else
ReferenceForce
::
getDeltaR
(
atomCoordinates
[
atomI
],
atomCoordinates
[
atomJ
],
deltaR
);
if
(
_gbviParameters
->
getUseCutoff
()
&&
deltaR
[
ReferenceForce
::
RIndex
]
>
_gbviParameters
->
getCutoffDistance
())
continue
;
RealOpenMM
r2
=
deltaR
[
ReferenceForce
::
R2Index
];
deltaX
=
deltaR
[
ReferenceForce
::
XIndex
];
deltaY
=
deltaR
[
ReferenceForce
::
YIndex
];
deltaZ
=
deltaR
[
ReferenceForce
::
ZIndex
];
RealOpenMM
r
=
SQRT
(
r2
);
RealOpenMM
S
=
scaledRadii
[
atomJ
];
RealOpenMM
diff
=
(
S
-
R
);
RealOpenMM
de
=
zero
;
// find dRb/dr, where Rb is the Born radius
if
(
FABS
(
diff
)
<
r
)
{
de
=
ReferenceGBVI
::
dL_dr
(
r
,
r
+
S
,
S
)
+
ReferenceGBVI
::
dL_dx
(
r
,
r
+
S
,
S
);
if
(
R
>
(
r
-
S
))
{
de
-=
ReferenceGBVI
::
dL_dr
(
r
,
R
,
S
);
}
else
{
de
-=
(
ReferenceGBVI
::
dL_dr
(
r
,
(
r
-
S
),
S
)
+
ReferenceGBVI
::
dL_dx
(
r
,
(
r
-
S
),
S
));
}
}
else
if
(
r
<
(
S
-
R
))
{
de
=
ReferenceGBVI
::
dL_dr
(
r
,
r
+
S
,
S
)
+
ReferenceGBVI
::
dL_dx
(
r
,
r
+
S
,
S
);
de
-=
(
ReferenceGBVI
::
dL_dr
(
r
,
r
-
S
,
S
)
+
ReferenceGBVI
::
dL_dx
(
r
,
r
-
S
,
S
));
}
// de = (dG/dRb)(dRb/dr)
de
*=
bornForces
[
atomI
]
/
r
;
deltaX
*=
de
;
deltaY
*=
de
;
deltaZ
*=
de
;
forces
[
atomI
][
0
]
+=
deltaX
;
forces
[
atomI
][
1
]
+=
deltaY
;
forces
[
atomI
][
2
]
+=
deltaZ
;
forces
[
atomJ
][
0
]
-=
deltaX
;
forces
[
atomJ
][
1
]
-=
deltaY
;
forces
[
atomJ
][
2
]
-=
deltaZ
;
}
}
}
// convert from cal to Joule & apply prefactor tau = (1/diel_solute - 1/diel_solvent)
RealOpenMM
conversion
=
static_cast
<
RealOpenMM
>
(
gbviParameters
->
getTau
());
for
(
int
atomI
=
0
;
atomI
<
numberOfAtoms
;
atomI
++
)
{
inputForces
[
atomI
][
0
]
+=
conversion
*
forces
[
atomI
][
0
];
inputForces
[
atomI
][
1
]
+=
conversion
*
forces
[
atomI
][
1
];
inputForces
[
atomI
][
2
]
+=
conversion
*
forces
[
atomI
][
2
];
}
}
/**---------------------------------------------------------------------------------------
Use double precision
Get volume Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return volume
--------------------------------------------------------------------------------------- */
double
ReferenceGBVI
::
getVolumeD
(
double
r
,
double
R
,
double
S
)
{
// ---------------------------------------------------------------------------------------
static
const
double
zero
=
0.0
;
static
const
double
minusThree
=
-
3.0
;
double
diff
=
(
S
-
R
);
if
(
fabs
(
diff
)
<
r
)
{
double
lowerBound
=
(
R
>
(
r
-
S
))
?
R
:
(
r
-
S
);
return
(
ReferenceGBVI
::
getLD
(
r
,
(
r
+
S
),
S
)
-
ReferenceGBVI
::
getLD
(
r
,
lowerBound
,
S
));
}
else
if
(
r
<
diff
)
{
return
ReferenceGBVI
::
getLD
(
r
,
(
r
+
S
),
S
)
-
ReferenceGBVI
::
getLD
(
r
,
(
r
-
S
),
S
)
+
pow
(
R
,
minusThree
);
}
else
{
return
zero
;
}
}
/**---------------------------------------------------------------------------------------
Use double precision
Get L (used in analytical solution for volume integrals)
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return L value (Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
double
ReferenceGBVI
::
getLD
(
double
r
,
double
x
,
double
S
)
{
// ---------------------------------------------------------------------------------------
static
const
double
one
=
1.0
;
static
const
double
threeHalves
=
1.5
;
static
const
double
third
=
1.0
/
3.0
;
static
const
double
fourth
=
0.25
;
static
const
double
eighth
=
0.125
;
// ---------------------------------------------------------------------------------------
double
rInv
=
one
/
r
;
double
xInv
=
one
/
x
;
double
xInv2
=
xInv
*
xInv
;
double
xInv3
=
xInv2
*
xInv
;
double
diff2
=
(
r
+
S
)
*
(
r
-
S
);
return
(
threeHalves
*
xInv
)
*
((
xInv
*
fourth
*
rInv
)
-
(
xInv2
*
third
)
+
(
diff2
*
xInv3
*
eighth
*
rInv
));
}
/**---------------------------------------------------------------------------------------
Use double precision
Get partial derivative of L wrt r
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return partial derivative based on Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
double
ReferenceGBVI
::
dL_drD
(
double
r
,
double
x
,
double
S
)
{
// ---------------------------------------------------------------------------------------
static
const
double
one
=
1.0
;
static
const
double
threeHalves
=
1.5
;
static
const
double
threeEights
=
0.375
;
static
const
double
third
=
1.0
/
3.0
;
static
const
double
fourth
=
0.25
;
static
const
double
eighth
=
0.125
;
// ---------------------------------------------------------------------------------------
double
rInv
=
one
/
r
;
double
rInv2
=
rInv
*
rInv
;
double
xInv
=
one
/
x
;
double
xInv2
=
xInv
*
xInv
;
double
xInv3
=
xInv2
*
xInv
;
double
diff2
=
(
r
+
S
)
*
(
r
-
S
);
return
((
-
threeHalves
*
xInv2
*
rInv2
)
*
(
fourth
+
eighth
*
diff2
*
xInv2
)
+
threeEights
*
xInv3
*
xInv
);
}
/**---------------------------------------------------------------------------------------
Use double precision
Get partial derivative of L wrt x
@param r distance between atoms i & j
@param R atomic radius
@param S scaled atomic radius
@return partial derivative based on Eq. 4 of Labute paper [JCC 29 p. 1693-1698 2008])
--------------------------------------------------------------------------------------- */
double
ReferenceGBVI
::
dL_dxD
(
double
r
,
double
x
,
double
S
)
{
// ---------------------------------------------------------------------------------------
static
const
double
one
=
1.0
;
static
const
double
half
=
0.5
;
static
const
double
threeHalvesM
=
-
1.5
;
static
const
double
third
=
1.0
/
3.0
;
// ---------------------------------------------------------------------------------------
double
rInv
=
one
/
r
;
double
xInv
=
one
/
x
;
double
xInv2
=
xInv
*
xInv
;
double
xInv3
=
xInv2
*
xInv
;
double
diff
=
(
r
+
S
)
*
(
r
-
S
);
return
(
threeHalvesM
*
xInv3
)
*
((
half
*
rInv
)
-
xInv
+
(
half
*
diff
*
xInv2
*
rInv
));
}
platforms/reference/tests/TestReferenceCompoundIntegrator.cpp
0 → 100644
View file @
2d2f05ce
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "ReferenceTests.h"
#include "TestCompoundIntegrator.h"
void
runPlatformTests
()
{
}
plugins/amoeba/CMakeLists.txt
View file @
2d2f05ce
...
...
@@ -162,6 +162,6 @@ ELSE (EXECUTABLE_OUTPUT_PATH)
SET
(
TEST_PATH .
)
ENDIF
(
EXECUTABLE_OUTPUT_PATH
)
IF
(
BUILD_TESTING
)
IF
(
BUILD_TESTING
AND OPENMM_BUILD_SERIALIZATION_TESTS
)
ADD_SUBDIRECTORY
(
serialization/tests
)
ENDIF
(
BUILD_TESTING
)
ENDIF
(
BUILD_TESTING
AND OPENMM_BUILD_SERIALIZATION_TESTS
)
plugins/amoeba/openmmapi/include/openmm/AmoebaAngleForce.h
View file @
2d2f05ce
...
...
@@ -127,8 +127,8 @@ public:
* @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle
* @param length the angle measured in degrees
* @param quadratic
k
the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @param length the
equilibrium
angle
,
measured in degrees
* @param quadratic
K
the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @return the index of the angle that was added
*/
int
addAngle
(
int
particle1
,
int
particle2
,
int
particle3
,
double
length
,
double
quadraticK
);
...
...
@@ -137,11 +137,11 @@ public:
* Get the force field parameters for an angle term.
*
* @param index the index of the angle for which to get parameters
* @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle
* @param length the equilibrium angle, measured in degre
s
s
* @param quadratic
k
the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @param
[out]
particle1 the index of the first particle connected by the angle
* @param
[out]
particle2 the index of the second particle connected by the angle
* @param
[out]
particle3 the index of the third particle connected by the angle
* @param
[out]
length the equilibrium angle, measured in degre
e
s
* @param
[out]
quadratic
K
the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/
void
getAngleParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
double
&
length
,
double
&
quadraticK
)
const
;
...
...
@@ -153,7 +153,7 @@ public:
* @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle
* @param length the equilibrium angle, measured in degrees
* @param quadratic
k
the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @param quadratic
K
the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/
void
setAngleParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
double
length
,
double
quadraticK
);
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaBondForce.h
View file @
2d2f05ce
...
...
@@ -100,7 +100,7 @@ public:
* @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm
* @param
k
the quadratic force constant for the bond
* @param
quadraticK
the quadratic force constant for the bond
* @return the index of the bond that was added
*/
...
...
@@ -110,10 +110,10 @@ public:
* Get the force field parameters for a bond term.
*
* @param index the index of the bond for which to get parameters
* @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm
* @param quadratic
k
the quadratic force constant for the bond
* @param
[out]
particle1 the index of the first particle connected by the bond
* @param
[out]
particle2 the index of the second particle connected by the bond
* @param
[out]
length the equilibrium length of the bond, measured in nm
* @param
[out]
quadratic
K
the quadratic force constant for the bond
*/
void
getBondParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
double
&
length
,
double
&
quadraticK
)
const
;
...
...
@@ -125,7 +125,7 @@ public:
* @param particle1 the index of the first particle connected by the bond
* @param particle2 the index of the second particle connected by the bond
* @param length the equilibrium length of the bond, measured in nm
* @param
k
the quadratic force constant for the bond
* @param
quadraticK
the quadratic force constant for the bond
*/
void
setBondParameters
(
int
index
,
int
particle1
,
int
particle2
,
double
length
,
double
quadraticK
);
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaGeneralizedKirkwoodForce.h
View file @
2d2f05ce
...
...
@@ -80,9 +80,9 @@ public:
* Get the force field parameters for a particle.
*
* @param index the index of the particle for which to get parameters
* @param charge the charge of the particle, measured in units of the proton charge
* @param radius the atomic radius of the particle, measured in nm
* @param scalingFactor the scaling factor for the particle
* @param
[out]
charge the charge of the particle, measured in units of the proton charge
* @param
[out]
radius the atomic radius of the particle, measured in nm
* @param
[out]
scalingFactor the scaling factor for the particle
*/
void
getParticleParameters
(
int
index
,
double
&
charge
,
double
&
radius
,
double
&
scalingFactor
)
const
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaInPlaneAngleForce.h
View file @
2d2f05ce
...
...
@@ -129,7 +129,7 @@ public:
* @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians
* @param quadratic
k
the quadratic force constant for the angle measured in kJ/mol/radian^2
* @param quadratic
K
the quadratic force constant for the angle measured in kJ/mol/radian^2
* @return the index of the angle that was added
*/
int
addAngle
(
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
double
length
,
...
...
@@ -139,12 +139,12 @@ public:
* Get the force field parameters for an angle term.
*
* @param index the index of the angle for which to get parameters
* @param particle1 the index of the first particle connected by the angle
* @param particle2 the index of the second particle connected by the angle
* @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians
* @param quadratic
k
the quadratic force constant for the angle measured in kJ/mol/radian^2
* @param
[out]
particle1 the index of the first particle connected by the angle
* @param
[out]
particle2 the index of the second particle connected by the angle
* @param
[out]
particle3 the index of the third particle connected by the angle
* @param
[out]
particle4 the index of the fourth particle connected by the angle
* @param
[out]
length the equilibrium angle, measured in radians
* @param
[out]
quadratic
K
the quadratic force constant for the angle measured in kJ/mol/radian^2
*/
void
getAngleParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
int
&
particle4
,
double
&
length
,
double
&
quadraticK
)
const
;
...
...
@@ -158,7 +158,7 @@ public:
* @param particle3 the index of the third particle connected by the angle
* @param particle4 the index of the fourth particle connected by the angle
* @param length the equilibrium angle, measured in radians
* @param quadratic
k
the quadratic force constant for the angle, measured in kJ/mol/radian^2
* @param quadratic
K
the quadratic force constant for the angle, measured in kJ/mol/radian^2
*/
void
setAngleParameters
(
int
index
,
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
double
length
,
double
quadraticK
);
/**
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
View file @
2d2f05ce
...
...
@@ -154,7 +154,7 @@ public:
* Set the Ewald alpha parameter. If this is 0 (the default), a value is chosen automatically
* based on the Ewald error tolerance.
*
* @param
E
wald alpha parameter
* @param
ae
wald alpha parameter
*/
void
setAEwald
(
double
aewald
);
...
...
@@ -177,7 +177,7 @@ public:
* Set the PME grid dimensions. If Ewald alpha is 0 (the default), this is ignored and grid dimensions
* are chosen automatically based on the Ewald error tolerance.
*
* @param the PME grid dimensions
* @param
gridDimension
the PME grid dimensions
*/
void
setPmeGridDimensions
(
const
std
::
vector
<
int
>&
gridDimension
);
...
...
@@ -188,10 +188,10 @@ public:
* See the manual for details.
*
* @param context the Context for which to get the parameters
* @param alpha the separation parameter
* @param nx the number of grid points along the X axis
* @param ny the number of grid points along the Y axis
* @param nz the number of grid points along the Z axis
* @param
[out]
alpha the separation parameter
* @param
[out]
nx the number of grid points along the X axis
* @param
[out]
ny the number of grid points along the Y axis
* @param
[out]
nz the number of grid points along the Z axis
*/
void
getPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
...
...
@@ -218,16 +218,16 @@ public:
* Get the multipole parameters for a particle.
*
* @param index the index of the atom for which to get parameters
* @param charge the particle's charge
* @param molecularDipole the particle's molecular dipole (vector of size 3)
* @param molecularQuadrupole the particle's molecular quadrupole (vector of size 9)
* @param axisType the particle's axis type
* @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param multipoleAtomY index of second atom used in constructing lab<->molecular frames
* @param thole Thole parameter
* @param dampingFactor dampingFactor parameter
* @param polarity polarity parameter
* @param
[out]
charge the particle's charge
* @param
[out]
molecularDipole the particle's molecular dipole (vector of size 3)
* @param
[out]
molecularQuadrupole the particle's molecular quadrupole (vector of size 9)
* @param
[out]
axisType the particle's axis type
* @param
[out]
multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param
[out]
multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param
[out]
multipoleAtomY index of second atom used in constructing lab<->molecular frames
* @param
[out]
thole Thole parameter
* @param
[out]
dampingFactor dampingFactor parameter
* @param
[out]
polarity polarity parameter
*/
void
getMultipoleParameters
(
int
index
,
double
&
charge
,
std
::
vector
<
double
>&
molecularDipole
,
std
::
vector
<
double
>&
molecularQuadrupole
,
int
&
axisType
,
int
&
multipoleAtomZ
,
int
&
multipoleAtomX
,
int
&
multipoleAtomY
,
double
&
thole
,
double
&
dampingFactor
,
double
&
polarity
)
const
;
...
...
@@ -243,6 +243,8 @@ public:
* @param multipoleAtomZ index of first atom used in constructing lab<->molecular frames
* @param multipoleAtomX index of second atom used in constructing lab<->molecular frames
* @param multipoleAtomY index of second atom used in constructing lab<->molecular frames
* @param thole thole parameter
* @param dampingFactor damping factor parameter
* @param polarity polarity parameter
*/
void
setMultipoleParameters
(
int
index
,
double
charge
,
const
std
::
vector
<
double
>&
molecularDipole
,
const
std
::
vector
<
double
>&
molecularQuadrupole
,
...
...
@@ -262,7 +264,7 @@ public:
*
* @param index the index of the atom for which to set parameters
* @param typeId CovalentTypes type
* @param covalentAtoms
output vector of covalent atoms associated w/ the specfied CovalentType
* @param
[out]
covalentAtoms output vector of covalent atoms associated w/ the specfied CovalentType
*/
void
getCovalentMap
(
int
index
,
CovalentType
typeId
,
std
::
vector
<
int
>&
covalentAtoms
)
const
;
...
...
@@ -270,7 +272,7 @@ public:
* Get the CovalentMap for an atom
*
* @param index the index of the atom for which to set parameters
* @param covalentLists
output vector of covalent lists of atoms
* @param
[out]
covalentLists output vector of covalent lists of atoms
*/
void
getCovalentMaps
(
int
index
,
std
::
vector
<
std
::
vector
<
int
>
>&
covalentLists
)
const
;
...
...
@@ -284,7 +286,7 @@ public:
/**
* Set the max number of iterations to be used in calculating the mutual induced dipoles
*
* @param
max
number of iterations
* @param
inputMutualInducedMaxIterations
number of iterations
*/
void
setMutualInducedMaxIterations
(
int
inputMutualInducedMaxIterations
);
...
...
@@ -298,7 +300,7 @@ public:
/**
* Set the target epsilon to be used to test for convergence of iterative method used in calculating the mutual induced dipoles
*
* @param target epsilon
* @param
inputMutualInducedTargetEpsilon
target epsilon
*/
void
setMutualInducedTargetEpsilon
(
double
inputMutualInducedTargetEpsilon
);
...
...
@@ -343,7 +345,7 @@ public:
* Get the induced dipole moments of all particles.
*
* @param context the Context for which to get the induced dipoles
* @param dipoles the induced dipole moment of particle i is stored into the i'th element
* @param
[out]
dipoles the induced dipole moment of particle i is stored into the i'th element
*/
void
getInducedDipoles
(
Context
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
...
...
@@ -352,7 +354,7 @@ public:
*
* @param inputGrid input grid points over which the potential is to be evaluated
* @param context context
* @param outputElectrostaticPotential output potential
* @param
[out]
outputElectrostaticPotential output potential
*/
void
getElectrostaticPotential
(
const
std
::
vector
<
Vec3
>&
inputGrid
,
...
...
@@ -368,7 +370,7 @@ public:
* the quadrupole moment is still undefined and should be ignored.
*
* @param context context
* @param outputMultipoleMoments (charge,
* @param
[out]
outputMultipoleMoments (charge,
dipole_x, dipole_y, dipole_z,
quadrupole_xx, quadrupole_xy, quadrupole_xz,
quadrupole_yx, quadrupole_yy, quadrupole_yz,
...
...
@@ -441,8 +443,8 @@ public:
MultipoleInfo
(
double
charge
,
const
std
::
vector
<
double
>&
inputMolecularDipole
,
const
std
::
vector
<
double
>&
inputMolecularQuadrupole
,
int
axisType
,
int
multipoleAtomZ
,
int
multipoleAtomX
,
int
multipoleAtomY
,
double
thole
,
double
dampingFactor
,
double
polarity
)
:
charge
(
charge
),
axisType
(
axisType
),
multipoleAtomZ
(
multipoleAtomZ
),
multipoleAtomX
(
multipoleAtomX
),
multipoleAtomY
(
multipoleAtomY
),
thole
(
thole
),
dampingFactor
(
dampingFactor
),
polarity
(
polarity
)
{
axisType
(
axisType
),
multipoleAtomZ
(
multipoleAtomZ
),
multipoleAtomX
(
multipoleAtomX
),
multipoleAtomY
(
multipoleAtomY
),
charge
(
charge
),
thole
(
thole
),
dampingFactor
(
dampingFactor
),
polarity
(
polarity
)
{
covalentInfo
.
resize
(
CovalentEnd
);
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaOutOfPlaneBendForce.h
View file @
2d2f05ce
...
...
@@ -74,7 +74,7 @@ public:
*
* @return global cubicK term
*/
double
getAmoebaGlobalOutOfPlaneBendCubic
(
void
)
const
;
double
getAmoebaGlobalOutOfPlaneBendCubic
()
const
;
/**
* Set the global cubic term
...
...
@@ -88,7 +88,7 @@ public:
*
* @return global quartic term
*/
double
getAmoebaGlobalOutOfPlaneBendQuartic
(
void
)
const
;
double
getAmoebaGlobalOutOfPlaneBendQuartic
()
const
;
/**
* Set the global pentic term
...
...
@@ -102,7 +102,7 @@ public:
*
* @return global penticK term
*/
double
getAmoebaGlobalOutOfPlaneBendPentic
(
void
)
const
;
double
getAmoebaGlobalOutOfPlaneBendPentic
()
const
;
/**
* Set the global sextic term
...
...
@@ -116,7 +116,7 @@ public:
*
* @return global sexticK term
*/
double
getAmoebaGlobalOutOfPlaneBendSextic
(
void
)
const
;
double
getAmoebaGlobalOutOfPlaneBendSextic
()
const
;
/**
* Add an out-of-plane bend term to the force field.
...
...
@@ -134,11 +134,11 @@ public:
* Get the force field parameters for an out-of-plane bend term.
*
* @param index the index of the outOfPlaneBend for which to get parameters
* @param particle1 the index of the first particle connected by the outOfPlaneBend
* @param particle2 the index of the second particle connected by the outOfPlaneBend
* @param particle3 the index of the third particle connected by the outOfPlaneBend
* @param particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param k the force constant for the out-of-plane bend
* @param
[out]
particle1 the index of the first particle connected by the outOfPlaneBend
* @param
[out]
particle2 the index of the second particle connected by the outOfPlaneBend
* @param
[out]
particle3 the index of the third particle connected by the outOfPlaneBend
* @param
[out]
particle4 the index of the fourth particle connected by the outOfPlaneBend
* @param
[out]
k the force constant for the out-of-plane bend
*/
void
getOutOfPlaneBendParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
int
&
particle4
,
double
&
k
)
const
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaPiTorsionForce.h
View file @
2d2f05ce
...
...
@@ -80,13 +80,13 @@ public:
* Get the force field parameters for a torsion term.
*
* @param index the index of the torsion for which to get parameters
* @param particle1 the index of the first particle connected by the torsion
* @param particle2 the index of the second particle connected by the torsion
* @param particle3 the index of the third particle connected by the torsion
* @param particle4 the index of the fourth particle connected by the torsion
* @param particle5 the index of the fifth particle connected by the torsion
* @param particle6 the index of the sixth particle connected by the torsion
* @param k the force constant for the torsion
* @param
[out]
particle1 the index of the first particle connected by the torsion
* @param
[out]
particle2 the index of the second particle connected by the torsion
* @param
[out]
particle3 the index of the third particle connected by the torsion
* @param
[out]
particle4 the index of the fourth particle connected by the torsion
* @param
[out]
particle5 the index of the fifth particle connected by the torsion
* @param
[out]
particle6 the index of the sixth particle connected by the torsion
* @param
[out]
k the force constant for the torsion
*/
void
getPiTorsionParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
int
&
particle4
,
int
&
particle5
,
int
&
particle6
,
double
&
k
)
const
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaStretchBendForce.h
View file @
2d2f05ce
...
...
@@ -82,14 +82,14 @@ public:
* Get the force field parameters for a stretch-bend term.
*
* @param index the index of the stretch-bend for which to get parameters
* @param particle1 the index of the first particle connected by the stretch-bend
* @param particle2 the index of the second particle connected by the stretch-bend
* @param particle3 the index of the third particle connected by the stretch-bend
* @param lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param angle the equilibrium angle in radians
* @param k1 the force constant of the product of bond ab and angle a-b-c
* @param k2 the force constant of the product of bond bc and angle a-b-c
* @param
[out]
particle1 the index of the first particle connected by the stretch-bend
* @param
[out]
particle2 the index of the second particle connected by the stretch-bend
* @param
[out]
particle3 the index of the third particle connected by the stretch-bend
* @param
[out]
lengthAB the equilibrium length of the stretch-bend in bond ab [particle1, particle2], measured in nm
* @param
[out]
lengthCB the equilibrium length of the stretch-bend in bond cb [particle3, particle2], measured in nm
* @param
[out]
angle the equilibrium angle in radians
* @param
[out]
k1 the force constant of the product of bond ab and angle a-b-c
* @param
[out]
k2 the force constant of the product of bond bc and angle a-b-c
*/
void
getStretchBendParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
double
&
lengthAB
,
double
&
lengthCB
,
double
&
angle
,
double
&
k1
,
double
&
k2
)
const
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaTorsionTorsionForce.h
View file @
2d2f05ce
...
...
@@ -90,13 +90,13 @@ public:
* Get the force field parameters for a torsion-torsion term.
*
* @param index the index of the torsion-torsion for which to get parameters
* @param particle1 the index of the first particle connected by the torsion-torsion
* @param particle2 the index of the second particle connected by the torsion-torsion
* @param particle3 the index of the third particle connected by the torsion-torsion
* @param particle4 the index of the fourth particle connected by the torsion-torsion
* @param particle5 the index of the fifth particle connected by the torsion-torsion
* @param chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check
* @param gridIndex the grid index
* @param
[out]
particle1 the index of the first particle connected by the torsion-torsion
* @param
[out]
particle2 the index of the second particle connected by the torsion-torsion
* @param
[out]
particle3 the index of the third particle connected by the torsion-torsion
* @param
[out]
particle4 the index of the fourth particle connected by the torsion-torsion
* @param
[out]
particle5 the index of the fifth particle connected by the torsion-torsion
* @param
[out]
chiralCheckAtomIndex the index of the particle connected to particle3, but not particle2 or particle4 to be used in chirality check
* @param
[out]
gridIndex the grid index
*/
void
getTorsionTorsionParameters
(
int
index
,
int
&
particle1
,
int
&
particle2
,
int
&
particle3
,
int
&
particle4
,
int
&
particle5
,
int
&
chiralCheckAtomIndex
,
int
&
gridIndex
)
const
;
...
...
@@ -117,7 +117,7 @@ public:
/**
* Get the torsion-torsion grid at the specified index
*
* @param
gridI
ndex the grid index
* @param
i
ndex
the grid index
* @return grid return grid reference
*/
const
std
::
vector
<
std
::
vector
<
std
::
vector
<
double
>
>
>&
getTorsionTorsionGrid
(
int
index
)
const
;
...
...
@@ -172,7 +172,7 @@ public:
}
TorsionTorsionInfo
(
int
particle1
,
int
particle2
,
int
particle3
,
int
particle4
,
int
particle5
,
int
chiralCheckAtomIndex
,
int
gridIndex
)
:
particle1
(
particle1
),
particle2
(
particle2
),
particle3
(
particle3
),
particle4
(
particle4
),
particle5
(
particle5
),
gridIndex
(
gridIndex
),
chiralCheckAtomIndex
(
chiralCheckAtomIndex
)
{
particle4
(
particle4
),
particle5
(
particle5
),
chiralCheckAtomIndex
(
chiralCheckAtomIndex
)
,
gridIndex
(
gridIndex
)
{
}
};
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
View file @
2d2f05ce
...
...
@@ -98,10 +98,10 @@ public:
* Get the force field parameters for a vdw particle.
*
* @param particleIndex the particle index
* @param parentIndex the index of the parent particle
* @param sigma vdw sigma
* @param epsilon vdw epsilon
* @param reductionFactor the fraction of the distance along the line from the parent particle to this particle
* @param
[out]
parentIndex the index of the parent particle
* @param
[out]
sigma vdw sigma
* @param
[out]
epsilon vdw epsilon
* @param
[out]
reductionFactor the fraction of the distance along the line from the parent particle to this particle
* at which the interaction site should be placed
*/
void
getParticleParameters
(
int
particleIndex
,
int
&
parentIndex
,
double
&
sigma
,
double
&
epsilon
,
double
&
reductionFactor
)
const
;
...
...
@@ -179,7 +179,7 @@ public:
* Get exclusions for specified particle
*
* @param particleIndex particle index
* @param exclusions vector of exclusions
* @param
[out]
exclusions vector of exclusions
*/
void
getParticleExclusions
(
int
particleIndex
,
std
::
vector
<
int
>&
exclusions
)
const
;
...
...
@@ -253,7 +253,7 @@ public:
epsilon
=
0.0
;
}
VdwInfo
(
int
parentIndex
,
double
sigma
,
double
epsilon
,
double
reductionFactor
)
:
parentIndex
(
parentIndex
),
sigma
(
sigma
),
epsilon
(
epsilon
),
reductionFactor
(
reductionFactor
)
{
parentIndex
(
parentIndex
),
reductionFactor
(
reductionFactor
),
sigma
(
sigma
),
epsilon
(
epsilon
)
{
}
};
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaWcaDispersionForce.h
View file @
2d2f05ce
...
...
@@ -76,8 +76,8 @@ public:
* Get the force field parameters for a WCA dispersion particle.
*
* @param particleIndex the particle index
* @param radius radius
* @param epsilon epsilon
* @param
[out]
radius radius
* @param
[out]
epsilon epsilon
*/
void
getParticleParameters
(
int
particleIndex
,
double
&
radius
,
double
&
epsilon
)
const
;
...
...
plugins/amoeba/platforms/cuda/src/kernels/amoebaGk.cu
View file @
2d2f05ce
...
...
@@ -23,8 +23,8 @@ extern "C" __global__ void reduceBornSum(const long long* __restrict__ bornSum,
/**
* Apply the surface area term to the force and energy.
*/
extern
"C"
__global__
void
computeSurfaceAreaForce
(
long
long
*
__restrict__
bornForce
,
real
*
__restrict__
energyBuffer
,
const
float2
*
__restrict__
params
,
const
real
*
__restrict__
bornRadii
)
{
real
energy
=
0
;
extern
"C"
__global__
void
computeSurfaceAreaForce
(
long
long
*
__restrict__
bornForce
,
mixed
*
__restrict__
energyBuffer
,
const
float2
*
__restrict__
params
,
const
real
*
__restrict__
bornRadii
)
{
mixed
energy
=
0
;
for
(
unsigned
int
index
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
index
<
NUM_ATOMS
;
index
+=
blockDim
.
x
*
gridDim
.
x
)
{
real
bornRadius
=
bornRadii
[
index
];
float
radius
=
params
[
index
].
x
;
...
...
@@ -216,7 +216,7 @@ inline __device__ void zeroAtomData(AtomData2& data) {
* Compute electrostatic interactions.
*/
extern
"C"
__global__
void
computeGKForces
(
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
const
real
*
__restrict__
labFrameDipole
,
const
real
*
__restrict__
labFrameQuadrupole
,
const
real
*
__restrict__
inducedDipole
,
const
real
*
__restrict__
inducedDipolePolar
,
const
real
*
__restrict__
bornRadii
,
unsigned
long
long
*
__restrict__
bornForce
)
{
...
...
@@ -225,7 +225,7 @@ extern "C" __global__ void computeGKForces(
const
unsigned
int
numTiles
=
numTileIndices
;
unsigned
int
pos
=
(
unsigned
int
)
(
startTileIndex
+
warp
*
(
long
long
)
numTiles
/
totalWarps
);
unsigned
int
end
=
(
unsigned
int
)
(
startTileIndex
+
(
warp
+
1
)
*
(
long
long
)
numTiles
/
totalWarps
);
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
AtomData2
localData
[
GK_FORCE_THREAD_BLOCK_SIZE
];
do
{
...
...
@@ -605,7 +605,7 @@ __device__ float computePScaleFactor(uint2 covalent, unsigned int polarizationGr
* Compute electrostatic interactions.
*/
extern
"C"
__global__
void
computeEDiffForce
(
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
const
uint2
*
__restrict__
covalentFlags
,
const
unsigned
int
*
__restrict__
polarizationGroupFlags
,
const
ushort2
*
__restrict__
exclusionTiles
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
const
real
*
__restrict__
labFrameDipole
,
const
real
*
__restrict__
labFrameQuadrupole
,
const
real
*
__restrict__
inducedDipole
,
...
...
@@ -615,7 +615,7 @@ extern "C" __global__ void computeEDiffForce(
const
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
const
unsigned
int
tgx
=
threadIdx
.
x
&
(
TILE_SIZE
-
1
);
const
unsigned
int
tbx
=
threadIdx
.
x
-
tgx
;
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
AtomData4
localData
[
EDIFF_THREAD_BLOCK_SIZE
];
// First loop: process tiles that contain exclusions.
...
...
plugins/amoeba/platforms/cuda/src/kernels/amoebaWcaForce.cu
View file @
2d2f05ce
...
...
@@ -191,14 +191,14 @@ __device__ void computeOneInteraction(AtomData& atom1, AtomData& atom2, real rmi
/**
* Compute WCA interaction.
*/
extern
"C"
__global__
void
computeWCAForce
(
unsigned
long
long
*
__restrict__
forceBuffers
,
real
*
__restrict__
energyBuffer
,
extern
"C"
__global__
void
computeWCAForce
(
unsigned
long
long
*
__restrict__
forceBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
const
float2
*
__restrict__
radiusEpsilon
)
{
unsigned
int
totalWarps
=
(
blockDim
.
x
*
gridDim
.
x
)
/
TILE_SIZE
;
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
const
unsigned
int
numTiles
=
numTileIndices
;
unsigned
int
pos
=
(
unsigned
int
)
(
startTileIndex
+
warp
*
(
long
long
)
numTiles
/
totalWarps
);
unsigned
int
end
=
(
unsigned
int
)
(
startTileIndex
+
(
warp
+
1
)
*
(
long
long
)
numTiles
/
totalWarps
);
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
AtomData
localData
[
THREAD_BLOCK_SIZE
];
do
{
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
View file @
2d2f05ce
...
...
@@ -54,7 +54,7 @@ __device__ float computePScaleFactor(uint2 covalent, unsigned int polarizationGr
return
(
x
&&
y
?
0.0
f
:
(
x
&&
p
?
0.5
f
:
1.0
f
));
}
__device__
void
computeOneInteraction
(
AtomData
&
atom1
,
AtomData
&
atom2
,
bool
hasExclusions
,
float
dScale
,
float
pScale
,
float
mScale
,
float
forceFactor
,
real
&
energy
)
{
__device__
void
computeOneInteraction
(
AtomData
&
atom1
,
AtomData
&
atom2
,
bool
hasExclusions
,
float
dScale
,
float
pScale
,
float
mScale
,
float
forceFactor
,
mixed
&
energy
)
{
// Compute the displacement.
real3
delta
;
...
...
@@ -374,7 +374,7 @@ __device__ void computeOneInteraction(AtomData& atom1, AtomData& atom2, bool has
* Compute electrostatic interactions.
*/
extern
"C"
__global__
void
computeElectrostatics
(
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
const
uint2
*
__restrict__
covalentFlags
,
const
unsigned
int
*
__restrict__
polarizationGroupFlags
,
const
ushort2
*
__restrict__
exclusionTiles
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
#ifdef USE_CUTOFF
...
...
@@ -388,7 +388,7 @@ extern "C" __global__ void computeElectrostatics(
const
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
const
unsigned
int
tgx
=
threadIdx
.
x
&
(
TILE_SIZE
-
1
);
const
unsigned
int
tbx
=
threadIdx
.
x
-
tgx
;
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
AtomData
localData
[
THREAD_BLOCK_SIZE
];
// First loop: process tiles that contain exclusions.
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipolePme.cu
View file @
2d2f05ce
...
...
@@ -874,14 +874,14 @@ extern "C" __global__ void computeInducedPotentialFromGrid(const real2* __restri
}
extern
"C"
__global__
void
computeFixedMultipoleForceAndEnergy
(
real4
*
__restrict__
posq
,
unsigned
long
long
*
__restrict__
forceBuffers
,
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
const
real
*
__restrict__
labFrameDipole
,
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real
*
__restrict__
labFrameDipole
,
const
real
*
__restrict__
labFrameQuadrupole
,
const
real
*
__restrict__
fracDipole
,
const
real
*
__restrict__
fracQuadrupole
,
const
real
*
__restrict__
phi
,
const
real
*
__restrict__
cphi_global
,
real3
recipBoxVecX
,
real3
recipBoxVecY
,
real3
recipBoxVecZ
)
{
real
multipole
[
10
];
const
int
deriv1
[]
=
{
1
,
4
,
7
,
8
,
10
,
15
,
17
,
13
,
14
,
19
};
const
int
deriv2
[]
=
{
2
,
7
,
5
,
9
,
13
,
11
,
18
,
15
,
19
,
16
};
const
int
deriv3
[]
=
{
3
,
8
,
9
,
6
,
14
,
16
,
12
,
19
,
17
,
18
};
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
real
fracToCart
[
3
][
3
];
if
(
threadIdx
.
x
==
0
)
{
fracToCart
[
0
][
0
]
=
GRID_SIZE_X
*
recipBoxVecX
.
x
;
...
...
@@ -956,7 +956,7 @@ extern "C" __global__ void computeFixedMultipoleForceAndEnergy(real4* __restrict
}
extern
"C"
__global__
void
computeInducedDipoleForceAndEnergy
(
real4
*
__restrict__
posq
,
unsigned
long
long
*
__restrict__
forceBuffers
,
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
const
real
*
__restrict__
labFrameDipole
,
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real
*
__restrict__
labFrameDipole
,
const
real
*
__restrict__
labFrameQuadrupole
,
const
real
*
__restrict__
fracDipole
,
const
real
*
__restrict__
fracQuadrupole
,
const
real
*
__restrict__
inducedDipole_global
,
const
real
*
__restrict__
inducedDipolePolar_global
,
const
real
*
__restrict__
phi
,
const
real
*
__restrict__
phid
,
const
real
*
__restrict__
phip
,
...
...
@@ -967,7 +967,7 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
const
int
deriv1
[]
=
{
1
,
4
,
7
,
8
,
10
,
15
,
17
,
13
,
14
,
19
};
const
int
deriv2
[]
=
{
2
,
7
,
5
,
9
,
13
,
11
,
18
,
15
,
19
,
16
};
const
int
deriv3
[]
=
{
3
,
8
,
9
,
6
,
14
,
16
,
12
,
19
,
17
,
18
};
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
real
fracToCart
[
3
][
3
];
if
(
threadIdx
.
x
==
0
)
{
fracToCart
[
0
][
0
]
=
GRID_SIZE_X
*
recipBoxVecX
.
x
;
...
...
@@ -1040,9 +1040,9 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
inducedDipolePolar
[
2
]
=
cinducedDipolePolar
[
0
]
*
fracToCart
[
0
][
2
]
+
cinducedDipolePolar
[
1
]
*
fracToCart
[
1
][
2
]
+
cinducedDipolePolar
[
2
]
*
fracToCart
[
2
][
2
];
real4
f
=
make_real4
(
0
,
0
,
0
,
0
);
energy
+=
inducedDipole
[
0
]
*
phi
[
i
+
NUM_ATOMS
];
energy
+=
inducedDipole
[
1
]
*
phi
[
i
+
NUM_ATOMS
*
2
];
energy
+=
inducedDipole
[
2
]
*
phi
[
i
+
NUM_ATOMS
*
3
];
energy
+=
(
inducedDipole
[
0
]
+
inducedDipolePolar
[
0
])
*
phi
[
i
+
NUM_ATOMS
];
energy
+=
(
inducedDipole
[
1
]
+
inducedDipolePolar
[
1
])
*
phi
[
i
+
NUM_ATOMS
*
2
];
energy
+=
(
inducedDipole
[
2
]
+
inducedDipolePolar
[
2
])
*
phi
[
i
+
NUM_ATOMS
*
3
];
for
(
int
k
=
0
;
k
<
3
;
k
++
)
{
int
j1
=
deriv1
[
k
+
1
];
...
...
@@ -1070,7 +1070,7 @@ extern "C" __global__ void computeInducedDipoleForceAndEnergy(real4* __restrict_
forceBuffers
[
i
+
PADDED_NUM_ATOMS
]
-=
static_cast
<
unsigned
long
long
>
((
long
long
)
(
f
.
y
*
0x100000000
));
forceBuffers
[
i
+
PADDED_NUM_ATOMS
*
2
]
-=
static_cast
<
unsigned
long
long
>
((
long
long
)
(
f
.
z
*
0x100000000
));
}
energyBuffer
[
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
]
+=
0.5
f
*
EPSILON_FACTOR
*
energy
;
energyBuffer
[
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
]
+=
0.
2
5
f
*
EPSILON_FACTOR
*
energy
;
}
extern
"C"
__global__
void
recordInducedFieldDipoles
(
const
real
*
__restrict__
phid
,
real
*
const
__restrict__
phip
,
...
...
plugins/amoeba/platforms/cuda/src/kernels/pmeMultipoleElectrostatics.cu
View file @
2d2f05ce
...
...
@@ -56,7 +56,7 @@ __device__ float computePScaleFactor(uint2 covalent, unsigned int polarizationGr
}
__device__
void
computeOneInteraction
(
AtomData
&
atom1
,
AtomData
&
atom2
,
bool
hasExclusions
,
float
dScale
,
float
pScale
,
float
mScale
,
float
forceFactor
,
real
&
energy
,
real4
periodicBoxSize
,
real4
invPeriodicBoxSize
,
real4
periodicBoxVecX
,
real4
periodicBoxVecY
,
real4
periodicBoxVecZ
)
{
mixed
&
energy
,
real4
periodicBoxSize
,
real4
invPeriodicBoxSize
,
real4
periodicBoxVecX
,
real4
periodicBoxVecY
,
real4
periodicBoxVecZ
)
{
// Compute the displacement.
real3
delta
;
...
...
@@ -411,10 +411,10 @@ __device__ void computeOneInteraction(AtomData& atom1, AtomData& atom2, bool has
/**
* Compute the self energy and self torque.
*/
__device__
void
computeSelfEnergyAndTorque
(
AtomData
&
atom1
,
real
&
energy
)
{
__device__
void
computeSelfEnergyAndTorque
(
AtomData
&
atom1
,
mixed
&
energy
)
{
real
cii
=
atom1
.
q
*
atom1
.
q
;
real3
dipole
=
make_real3
(
atom1
.
sphericalDipole
.
y
,
atom1
.
sphericalDipole
.
z
,
atom1
.
sphericalDipole
.
x
);
real
dii
=
dot
(
dipole
,
dipole
+
atom1
.
inducedDipole
);
real
dii
=
dot
(
dipole
,
dipole
+
(
atom1
.
inducedDipole
+
atom1
.
inducedDipolePolar
)
*
0.5
f
);
#ifdef INCLUDE_QUADRUPOLES
real
qii
=
(
atom1
.
sphericalQuadrupole
[
0
]
*
atom1
.
sphericalQuadrupole
[
0
]
+
atom1
.
sphericalQuadrupole
[
1
]
*
atom1
.
sphericalQuadrupole
[
1
]
+
...
...
@@ -439,7 +439,7 @@ __device__ void computeSelfEnergyAndTorque(AtomData& atom1, real& energy) {
* Compute electrostatic interactions.
*/
extern
"C"
__global__
void
computeElectrostatics
(
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
real
*
__restrict__
energyBuffer
,
unsigned
long
long
*
__restrict__
forceBuffers
,
unsigned
long
long
*
__restrict__
torqueBuffers
,
mixed
*
__restrict__
energyBuffer
,
const
real4
*
__restrict__
posq
,
const
uint2
*
__restrict__
covalentFlags
,
const
unsigned
int
*
__restrict__
polarizationGroupFlags
,
const
ushort2
*
__restrict__
exclusionTiles
,
unsigned
int
startTileIndex
,
unsigned
int
numTileIndices
,
#ifdef USE_CUTOFF
...
...
@@ -453,7 +453,7 @@ extern "C" __global__ void computeElectrostatics(
const
unsigned
int
warp
=
(
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
)
/
TILE_SIZE
;
const
unsigned
int
tgx
=
threadIdx
.
x
&
(
TILE_SIZE
-
1
);
const
unsigned
int
tbx
=
threadIdx
.
x
-
tgx
;
real
energy
=
0
;
mixed
energy
=
0
;
__shared__
AtomData
localData
[
THREAD_BLOCK_SIZE
];
// First loop: process tiles that contain exclusions.
...
...
Prev
1
…
3
4
5
6
7
8
9
10
11
12
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