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
a381a3ab
"platforms/opencl/vscode:/vscode.git/clone" did not exist on "5353984365299e9c3a7d421786dd31e05ee624fc"
Commit
a381a3ab
authored
Aug 01, 2016
by
peastman
Browse files
Merge branch 'master' into gayberne
parents
5ecc8e00
1f7866ad
Changes
199
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
336 additions
and
169 deletions
+336
-169
platforms/reference/src/SimTKReference/ReferenceCustomTorsionIxn.cpp
...eference/src/SimTKReference/ReferenceCustomTorsionIxn.cpp
+21
-26
platforms/reference/src/SimTKReference/ReferenceHarmonicBondIxn.cpp
...reference/src/SimTKReference/ReferenceHarmonicBondIxn.cpp
+1
-1
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
...rms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
+2
-2
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
...ms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
+9
-5
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
...erence/src/SimTKReference/ReferenceProperDihedralBond.cpp
+1
-1
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
.../reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
+1
-1
platforms/reference/src/SimTKReference/SimTKOpenMMUtilities.cpp
...rms/reference/src/SimTKReference/SimTKOpenMMUtilities.cpp
+3
-0
plugins/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
...ns/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
+43
-4
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
+22
-1
plugins/amoeba/openmmapi/include/openmm/amoebaKernels.h
plugins/amoeba/openmmapi/include/openmm/amoebaKernels.h
+14
-12
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
...nmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
+5
-4
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
+36
-24
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
+11
-3
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
+11
-3
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
+3
-3
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+73
-10
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
+14
-0
plugins/amoeba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
...eba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
+22
-23
plugins/amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
.../amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
+22
-23
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
...moeba/platforms/cuda/src/kernels/multipoleInducedField.cu
+22
-23
No files found.
platforms/reference/src/SimTKReference/ReferenceCustomTorsionIxn.cpp
View file @
a381a3ab
...
...
@@ -38,20 +38,19 @@ using namespace OpenMM;
--------------------------------------------------------------------------------------- */
ReferenceCustomTorsionIxn
::
ReferenceCustomTorsionIxn
(
const
Lepton
::
CompiledExpression
&
energyExpression
,
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
)
:
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
),
usePeriodic
(
false
)
{
energyTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
"theta"
);
forceTheta
=
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
"theta"
);
const
Lepton
::
CompiledExpression
&
forceExpression
,
const
vector
<
string
>&
parameterNames
,
map
<
string
,
double
>
globalParameters
,
const
vector
<
Lepton
::
CompiledExpression
>
energyParamDerivExpressions
)
:
energyExpression
(
energyExpression
),
forceExpression
(
forceExpression
),
usePeriodic
(
false
),
energyParamDerivExpressions
(
energyParamDerivExpressions
)
{
expressionSet
.
registerExpression
(
this
->
energyExpression
);
expressionSet
.
registerExpression
(
this
->
forceExpression
);
for
(
int
i
=
0
;
i
<
this
->
energyParamDerivExpressions
.
size
();
i
++
)
expressionSet
.
registerExpression
(
this
->
energyParamDerivExpressions
[
i
]);
thetaIndex
=
expressionSet
.
getVariableIndex
(
"theta"
);
numParameters
=
parameterNames
.
size
();
for
(
int
i
=
0
;
i
<
(
int
)
numParameters
;
i
++
)
{
energyParams
.
push_back
(
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
parameterNames
[
i
]));
forceParams
.
push_back
(
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
parameterNames
[
i
]));
}
for
(
map
<
string
,
double
>::
const_iterator
iter
=
globalParameters
.
begin
();
iter
!=
globalParameters
.
end
();
++
iter
)
{
ReferenceForce
::
setVariable
(
ReferenceForce
::
getVariablePointer
(
this
->
energyExpression
,
iter
->
first
),
iter
->
second
);
ReferenceForce
::
setVariable
(
ReferenceForce
::
getVariablePointer
(
this
->
forceExpression
,
iter
->
first
),
iter
->
second
);
}
for
(
int
i
=
0
;
i
<
(
int
)
numParameters
;
i
++
)
torsionParamIndex
.
push_back
(
expressionSet
.
getVariableIndex
(
parameterNames
[
i
]));
for
(
map
<
string
,
double
>::
const_iterator
iter
=
globalParameters
.
begin
();
iter
!=
globalParameters
.
end
();
++
iter
)
expressionSet
.
setVariable
(
expressionSet
.
getVariableIndex
(
iter
->
first
),
iter
->
second
);
}
/**---------------------------------------------------------------------------------------
...
...
@@ -86,18 +85,10 @@ void ReferenceCustomTorsionIxn::calculateBondIxn(int* atomIndices,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
static
const
std
::
string
methodName
=
"
\n
ReferenceCustomTorsionIxn::calculateTorsionIxn"
;
static
const
RealOpenMM
zero
=
0.0
;
static
const
RealOpenMM
one
=
1.0
;
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
)
{
RealOpenMM
deltaR
[
3
][
ReferenceForce
::
LastDeltaRIndex
];
for
(
int
i
=
0
;
i
<
numParameters
;
i
++
)
{
ReferenceForce
::
setVariable
(
energyParams
[
i
],
parameters
[
i
]);
ReferenceForce
::
setVariable
(
forceParams
[
i
],
parameters
[
i
]);
}
for
(
int
i
=
0
;
i
<
numParameters
;
i
++
)
expressionSet
.
setVariable
(
torsionParamIndex
[
i
],
parameters
[
i
]);
// ---------------------------------------------------------------------------------------
...
...
@@ -130,8 +121,7 @@ void ReferenceCustomTorsionIxn::calculateBondIxn(int* atomIndices,
RealOpenMM
dotDihedral
;
RealOpenMM
signOfAngle
;
RealOpenMM
angle
=
getDihedralAngleBetweenThreeVectors
(
deltaR
[
0
],
deltaR
[
1
],
deltaR
[
2
],
crossProduct
,
&
dotDihedral
,
deltaR
[
0
],
&
signOfAngle
,
1
);
ReferenceForce
::
setVariable
(
energyTheta
,
angle
);
ReferenceForce
::
setVariable
(
forceTheta
,
angle
);
expressionSet
.
setVariable
(
thetaIndex
,
angle
);
// evaluate delta angle, dE/d(angle)
...
...
@@ -174,6 +164,11 @@ void ReferenceCustomTorsionIxn::calculateBondIxn(int* atomIndices,
forces
[
atomDIndex
][
ii
]
+=
internalF
[
3
][
ii
];
}
// Record parameter derivatives.
for
(
int
i
=
0
;
i
<
energyParamDerivExpressions
.
size
();
i
++
)
energyParamDerivs
[
i
]
+=
energyParamDerivExpressions
[
i
].
evaluate
();
// accumulate energies
if
(
totalEnergy
!=
NULL
)
...
...
platforms/reference/src/SimTKReference/ReferenceHarmonicBondIxn.cpp
View file @
a381a3ab
...
...
@@ -74,7 +74,7 @@ void ReferenceHarmonicBondIxn::calculateBondIxn(int* atomIndices,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
)
{
static
const
std
::
string
methodName
=
"
\n
ReferenceHarmonicBondIxn::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulomb14.cpp
View file @
a381a3ab
/* Portions copyright (c) 2006 Stanford University and Simbios.
/* Portions copyright (c) 2006
-2016
Stanford University and Simbios.
* Contributors: Pande Group
*
* Permission is hereby granted, free of charge, to any person obtaining
...
...
@@ -81,7 +81,7 @@ ReferenceLJCoulomb14::~ReferenceLJCoulomb14() {
void
ReferenceLJCoulomb14
::
calculateBondIxn
(
int
*
atomIndices
,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
)
{
static
const
std
::
string
methodName
=
"
\n
ReferenceLJCoulomb14::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceLJCoulombIxn.cpp
View file @
a381a3ab
...
...
@@ -420,6 +420,7 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
// Now subtract off the exclusions, since they were implicitly included in the reciprocal space sum.
RealOpenMM
totalExclusionEnergy
=
0.0
f
;
const
double
TWO_OVER_SQRT_PI
=
2
/
sqrt
(
PI_M
);
for
(
int
i
=
0
;
i
<
numberOfAtoms
;
i
++
)
for
(
set
<
int
>::
const_iterator
iter
=
exclusions
[
i
].
begin
();
iter
!=
exclusions
[
i
].
end
();
++
iter
)
{
if
(
*
iter
>
i
)
{
...
...
@@ -446,6 +447,10 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
// accumulate energies
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]
*
inverseR
*
erf
(
alphaR
));
}
else
{
realSpaceEwaldEnergy
=
(
RealOpenMM
)
(
alphaEwald
*
TWO_OVER_SQRT_PI
*
ONE_4PI_EPS0
*
atomParameters
[
ii
][
QIndex
]
*
atomParameters
[
jj
][
QIndex
]);
}
totalExclusionEnergy
+=
realSpaceEwaldEnergy
;
if
(
energyByAtom
)
{
...
...
@@ -454,7 +459,6 @@ void ReferenceLJCoulombIxn::calculateEwaldIxn(int numberOfAtoms, vector<RealVec>
}
}
}
}
if
(
totalEnergy
)
*
totalEnergy
-=
totalExclusionEnergy
;
...
...
platforms/reference/src/SimTKReference/ReferenceProperDihedralBond.cpp
View file @
a381a3ab
...
...
@@ -75,7 +75,7 @@ void ReferenceProperDihedralBond::calculateBondIxn(int* atomIndices,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
)
{
static
const
std
::
string
methodName
=
"
\n
ReferenceProperDihedralBond::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/ReferenceRbDihedralBond.cpp
View file @
a381a3ab
...
...
@@ -73,7 +73,7 @@ void ReferenceRbDihedralBond::calculateBondIxn(int* atomIndices,
vector
<
RealVec
>&
atomCoordinates
,
RealOpenMM
*
parameters
,
vector
<
RealVec
>&
forces
,
RealOpenMM
*
totalEnergy
)
const
{
RealOpenMM
*
totalEnergy
,
double
*
energyParamDerivs
)
{
static
const
std
::
string
methodName
=
"
\n
ReferenceRbDihedralBond::calculateBondIxn"
;
...
...
platforms/reference/src/SimTKReference/SimTKOpenMMUtilities.cpp
View file @
a381a3ab
...
...
@@ -383,8 +383,11 @@ void SimTKOpenMMUtilities::createCheckpoint(std::ostream& stream) {
void
SimTKOpenMMUtilities
::
loadCheckpoint
(
std
::
istream
&
stream
)
{
stream
.
read
((
char
*
)
&
_randomNumberSeed
,
sizeof
(
uint32_t
));
bool
prevInitialized
=
_randomInitialized
;
stream
.
read
((
char
*
)
&
_randomInitialized
,
sizeof
(
bool
));
if
(
_randomInitialized
)
{
if
(
!
prevInitialized
)
init_gen_rand
(
0
,
sfmt
);
stream
.
read
((
char
*
)
&
nextGaussianIsValid
,
sizeof
(
bool
));
stream
.
read
((
char
*
)
&
nextGaussian
,
sizeof
(
RealOpenMM
));
sfmt
.
loadCheckpoint
(
stream
);
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaMultipoleForce.h
View file @
a381a3ab
...
...
@@ -147,11 +147,34 @@ public:
*/
void
setCutoffDistance
(
double
distance
);
/**
* Get the parameters to use for PME calculations. If alpha is 0 (the default), these parameters are
* ignored and instead their values are chosen based on the Ewald error tolerance.
*
* @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
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
;
/**
* Set the parameters to use for PME calculations. If alpha is 0 (the default), these parameters are
* ignored and instead their values are chosen based on the Ewald error tolerance.
*
* @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
*/
void
setPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
);
/**
* Get the Ewald alpha parameter. If this is 0 (the default), a value is chosen automatically
* based on the Ewald error tolerance.
*
* @return the Ewald alpha parameter
* @deprecated This method exists only for backward compatibility. Use getPMEParameters() instead.
*/
double
getAEwald
()
const
;
...
...
@@ -160,6 +183,7 @@ public:
* based on the Ewald error tolerance.
*
* @param aewald alpha parameter
* @deprecated This method exists only for backward compatibility. Use setPMEParameters() instead.
*/
void
setAEwald
(
double
aewald
);
...
...
@@ -175,6 +199,7 @@ public:
* are chosen automatically based on the Ewald error tolerance.
*
* @return the PME grid dimensions
* @deprecated This method exists only for backward compatibility. Use getPMEParameters() instead.
*/
void
getPmeGridDimensions
(
std
::
vector
<
int
>&
gridDimension
)
const
;
...
...
@@ -183,6 +208,7 @@ public:
* are chosen automatically based on the Ewald error tolerance.
*
* @param gridDimension the PME grid dimensions
* @deprecated This method exists only for backward compatibility. Use setPMEParameters() instead.
*/
void
setPmeGridDimensions
(
const
std
::
vector
<
int
>&
gridDimension
);
...
...
@@ -344,7 +370,13 @@ public:
* This can be overridden by explicitly setting an alpha parameter and grid dimensions to use.
*/
void
setEwaldErrorTolerance
(
double
tol
);
/**
* Get the fixed dipole moments of all particles in the global reference frame.
*
* @param context the Context for which to get the fixed dipoles
* @param[out] dipoles the fixed dipole moment of particle i is stored into the i'th element
*/
void
getLabFramePermanentDipoles
(
Context
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Get the induced dipole moments of all particles.
*
...
...
@@ -353,6 +385,14 @@ public:
*/
void
getInducedDipoles
(
Context
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Get the total dipole moments (fixed plus induced) of all particles.
*
* @param context the Context for which to get the total dipoles
* @param[out] dipoles the total dipole moment of particle i is stored into the i'th element
*/
void
getTotalDipoles
(
Context
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Get the electrostatic potential.
*
...
...
@@ -408,9 +448,8 @@ private:
NonbondedMethod
nonbondedMethod
;
PolarizationType
polarizationType
;
double
cutoffDistance
;
double
aewald
;
int
pmeBSplineOrder
;
std
::
vector
<
int
>
pmeGridDimension
;
double
alpha
;
int
pmeBSplineOrder
,
nx
,
ny
,
nz
;
int
mutualInducedMaxIterations
;
std
::
vector
<
double
>
extrapolationCoefficients
;
...
...
plugins/amoeba/openmmapi/include/openmm/AmoebaVdwForce.h
View file @
a381a3ab
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
2
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
6
Stanford University and the Authors. *
* Authors: Mark Friedrichs, Peter Eastman *
* Contributors: *
* *
...
...
@@ -183,13 +183,34 @@ public:
*/
void
getParticleExclusions
(
int
particleIndex
,
std
::
vector
<
int
>&
exclusions
)
const
;
/**
* Get the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
* is NoCutoff, this value will have no effect.
*
* @return the cutoff distance, measured in nm
*/
double
getCutoffDistance
()
const
;
/**
* Set the cutoff distance (in nm) being used for nonbonded interactions. If the NonbondedMethod in use
* is NoCutoff, this value will have no effect.
*
* @param distance the cutoff distance, measured in nm
*/
void
setCutoffDistance
(
double
distance
);
/**
* Set the cutoff distance.
*
* @deprecated This method exists only for backward compatibility. Use setCutoffDistance() instead.
*/
void
setCutoff
(
double
cutoff
);
/**
* Get the cutoff distance.
*
* @deprecated This method exists only for backward compatibility. Use getCutoffDistance() instead.
*/
double
getCutoff
()
const
;
...
...
plugins/amoeba/openmmapi/include/openmm/amoebaKernels.h
View file @
a381a3ab
...
...
@@ -348,7 +348,9 @@ public:
*/
virtual
double
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
)
=
0
;
virtual
void
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
)
=
0
;
virtual
void
getInducedDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
)
=
0
;
virtual
void
getTotalDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
)
=
0
;
virtual
void
getElectrostaticPotential
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
inputGrid
,
std
::
vector
<
double
>&
outputElectrostaticPotential
)
=
0
;
...
...
plugins/amoeba/openmmapi/include/openmm/internal/AmoebaMultipoleForceImpl.h
View file @
a381a3ab
...
...
@@ -81,8 +81,9 @@ public:
* @param covalentDegree covalent degrees for the CovalentEnd lists
*/
static
void
getCovalentDegree
(
const
AmoebaMultipoleForce
&
force
,
std
::
vector
<
int
>&
covalentDegree
);
void
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
void
getInducedDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
void
getTotalDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
void
getElectrostaticPotential
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
inputGrid
,
std
::
vector
<
double
>&
outputElectrostaticPotential
);
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
View file @
a381a3ab
...
...
@@ -40,9 +40,7 @@ using std::string;
using
std
::
vector
;
AmoebaMultipoleForce
::
AmoebaMultipoleForce
()
:
nonbondedMethod
(
NoCutoff
),
polarizationType
(
Mutual
),
pmeBSplineOrder
(
5
),
cutoffDistance
(
1.0
),
ewaldErrorTol
(
1e-4
),
mutualInducedMaxIterations
(
60
),
mutualInducedTargetEpsilon
(
1.0e-02
),
scalingDistanceCutoff
(
100.0
),
electricConstant
(
138.9354558456
),
aewald
(
0.0
)
{
pmeGridDimension
.
resize
(
3
);
pmeGridDimension
[
0
]
=
pmeGridDimension
[
1
]
=
pmeGridDimension
[
2
];
mutualInducedTargetEpsilon
(
1.0e-02
),
scalingDistanceCutoff
(
100.0
),
electricConstant
(
138.9354558456
),
alpha
(
0.0
),
nx
(
0
),
ny
(
0
),
nz
(
0
)
{
extrapolationCoefficients
.
push_back
(
-
0.154
);
extrapolationCoefficients
.
push_back
(
0.017
);
extrapolationCoefficients
.
push_back
(
0.658
);
...
...
@@ -81,12 +79,26 @@ void AmoebaMultipoleForce::setCutoffDistance(double distance) {
cutoffDistance
=
distance
;
}
void
AmoebaMultipoleForce
::
getPMEParameters
(
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
alpha
=
this
->
alpha
;
nx
=
this
->
nx
;
ny
=
this
->
ny
;
nz
=
this
->
nz
;
}
void
AmoebaMultipoleForce
::
setPMEParameters
(
double
alpha
,
int
nx
,
int
ny
,
int
nz
)
{
this
->
alpha
=
alpha
;
this
->
nx
=
nx
;
this
->
ny
=
ny
;
this
->
nz
=
nz
;
}
double
AmoebaMultipoleForce
::
getAEwald
()
const
{
return
a
ewald
;
return
a
lpha
;
}
void
AmoebaMultipoleForce
::
setAEwald
(
double
inputAewald
)
{
a
ewald
=
inputAewald
;
a
lpha
=
inputAewald
;
}
int
AmoebaMultipoleForce
::
getPmeBSplineOrder
()
const
{
...
...
@@ -94,25 +106,17 @@ int AmoebaMultipoleForce::getPmeBSplineOrder() const {
}
void
AmoebaMultipoleForce
::
getPmeGridDimensions
(
std
::
vector
<
int
>&
gridDimension
)
const
{
if
(
gridDimension
.
size
()
<
3
)
{
if
(
gridDimension
.
size
()
<
3
)
gridDimension
.
resize
(
3
);
}
if
(
pmeGridDimension
.
size
()
>
2
)
{
gridDimension
[
0
]
=
pmeGridDimension
[
0
];
gridDimension
[
1
]
=
pmeGridDimension
[
1
];
gridDimension
[
2
]
=
pmeGridDimension
[
2
];
}
else
{
gridDimension
[
0
]
=
gridDimension
[
1
]
=
gridDimension
[
2
]
=
0
;
}
return
;
gridDimension
[
0
]
=
nx
;
gridDimension
[
1
]
=
ny
;
gridDimension
[
2
]
=
nz
;
}
void
AmoebaMultipoleForce
::
setPmeGridDimensions
(
const
std
::
vector
<
int
>&
gridDimension
)
{
pmeGridDimension
.
resize
(
3
);
pmeGridDimension
[
0
]
=
gridDimension
[
0
];
pmeGridDimension
[
1
]
=
gridDimension
[
1
];
pmeGridDimension
[
2
]
=
gridDimension
[
2
];
return
;
nx
=
gridDimension
[
0
];
ny
=
gridDimension
[
1
];
nz
=
gridDimension
[
2
];
}
void
AmoebaMultipoleForce
::
getPMEParametersInContext
(
const
Context
&
context
,
double
&
alpha
,
int
&
nx
,
int
&
ny
,
int
&
nz
)
const
{
...
...
@@ -246,6 +250,14 @@ void AmoebaMultipoleForce::getInducedDipoles(Context& context, vector<Vec3>& dip
dynamic_cast
<
AmoebaMultipoleForceImpl
&>
(
getImplInContext
(
context
)).
getInducedDipoles
(
getContextImpl
(
context
),
dipoles
);
}
void
AmoebaMultipoleForce
::
getLabFramePermanentDipoles
(
Context
&
context
,
vector
<
Vec3
>&
dipoles
)
{
dynamic_cast
<
AmoebaMultipoleForceImpl
&>
(
getImplInContext
(
context
)).
getLabFramePermanentDipoles
(
getContextImpl
(
context
),
dipoles
);
}
void
AmoebaMultipoleForce
::
getTotalDipoles
(
Context
&
context
,
vector
<
Vec3
>&
dipoles
)
{
dynamic_cast
<
AmoebaMultipoleForceImpl
&>
(
getImplInContext
(
context
)).
getTotalDipoles
(
getContextImpl
(
context
),
dipoles
);
}
void
AmoebaMultipoleForce
::
getElectrostaticPotential
(
const
std
::
vector
<
Vec3
>&
inputGrid
,
Context
&
context
,
std
::
vector
<
double
>&
outputElectrostaticPotential
)
{
dynamic_cast
<
AmoebaMultipoleForceImpl
&>
(
getImplInContext
(
context
)).
getElectrostaticPotential
(
getContextImpl
(
context
),
inputGrid
,
outputElectrostaticPotential
);
}
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForceImpl.cpp
View file @
a381a3ab
...
...
@@ -183,10 +183,18 @@ void AmoebaMultipoleForceImpl::getCovalentDegree(const AmoebaMultipoleForce& for
return
;
}
void
AmoebaMultipoleForceImpl
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
getLabFramePermanentDipoles
(
context
,
dipoles
);
}
void
AmoebaMultipoleForceImpl
::
getInducedDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
getInducedDipoles
(
context
,
dipoles
);
}
void
AmoebaMultipoleForceImpl
::
getTotalDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
getTotalDipoles
(
context
,
dipoles
);
}
void
AmoebaMultipoleForceImpl
::
getElectrostaticPotential
(
ContextImpl
&
context
,
const
std
::
vector
<
Vec3
>&
inputGrid
,
std
::
vector
<
double
>&
outputElectrostaticPotential
)
{
kernel
.
getAs
<
CalcAmoebaMultipoleForceKernel
>
().
getElectrostaticPotential
(
context
,
inputGrid
,
outputElectrostaticPotential
);
...
...
plugins/amoeba/openmmapi/src/AmoebaVdwForce.cpp
View file @
a381a3ab
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-20
09
Stanford University and the Authors. *
* Portions copyright (c) 2008-20
16
Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
...
...
@@ -102,12 +102,20 @@ void AmoebaVdwForce::getParticleExclusions(int particleIndex, std::vector< int >
}
void
AmoebaVdwForce
::
setCutoff
(
double
inputCutoff
)
{
double
AmoebaVdwForce
::
getCutoffDistance
()
const
{
return
cutoff
;
}
void
AmoebaVdwForce
::
setCutoffDistance
(
double
inputCutoff
)
{
cutoff
=
inputCutoff
;
}
void
AmoebaVdwForce
::
setCutoff
(
double
inputCutoff
)
{
setCutoffDistance
(
inputCutoff
);
}
double
AmoebaVdwForce
::
getCutoff
()
const
{
return
c
utoff
;
return
getC
utoff
Distance
()
;
}
AmoebaVdwForce
::
NonbondedMethod
AmoebaVdwForce
::
getNonbondedMethod
()
const
{
...
...
plugins/amoeba/openmmapi/src/AmoebaVdwForceImpl.cpp
View file @
a381a3ab
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008 Stanford University and the Authors.
*
* Portions copyright (c) 2008
-2016
Stanford University and the Authors. *
* Authors: *
* Contributors: *
* *
...
...
@@ -62,7 +62,7 @@ void AmoebaVdwForceImpl::initialize(ContextImpl& context) {
if
(
owner
.
getNonbondedMethod
()
==
AmoebaVdwForce
::
CutoffPeriodic
)
{
Vec3
boxVectors
[
3
];
system
.
getDefaultPeriodicBoxVectors
(
boxVectors
[
0
],
boxVectors
[
1
],
boxVectors
[
2
]);
double
cutoff
=
owner
.
getCutoff
();
double
cutoff
=
owner
.
getCutoff
Distance
();
if
(
cutoff
>
0.5
*
boxVectors
[
0
][
0
]
||
cutoff
>
0.5
*
boxVectors
[
1
][
1
]
||
cutoff
>
0.5
*
boxVectors
[
2
][
2
])
throw
OpenMMException
(
"AmoebaVdwForce: The cutoff distance cannot be greater than half the periodic box size."
);
}
...
...
@@ -103,7 +103,7 @@ double AmoebaVdwForceImpl::calcDispersionCorrection(const System& system, const
}
// Compute the VdW tapering coefficients. Mostly copied from amoebaCudaGpu.cpp.
double
cutoff
=
force
.
getCutoff
();
double
cutoff
=
force
.
getCutoff
Distance
();
double
vdwTaper
=
0.90
;
// vdwTaper is a scaling factor, it is not a distance.
double
c0
=
0.0
;
double
c1
=
0.0
;
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
a381a3ab
...
...
@@ -1146,11 +1146,10 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
coefficients
<<
cu
.
doubleToString
(
sum
);
}
defines
[
"EXTRAPOLATION_COEFFICIENTS_SUM"
]
=
coefficients
.
str
();
alpha
=
force
.
getAEwald
();
if
(
usePME
)
{
vector
<
int
>
pmeGridDimension
;
force
.
getP
meGridDimensions
(
pmeGridDimension
);
if
(
pmeGridDimension
[
0
]
==
0
||
alpha
==
0.0
)
{
int
nx
,
ny
,
nz
;
force
.
getP
MEParameters
(
alpha
,
nx
,
ny
,
nz
);
if
(
nx
==
0
||
alpha
==
0.0
)
{
NonbondedForce
nb
;
nb
.
setEwaldErrorTolerance
(
force
.
getEwaldErrorTolerance
());
nb
.
setCutoffDistance
(
force
.
getCutoffDistance
());
...
...
@@ -1159,9 +1158,9 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
gridSizeY
=
CudaFFT3D
::
findLegalDimension
(
gridSizeY
);
gridSizeZ
=
CudaFFT3D
::
findLegalDimension
(
gridSizeZ
);
}
else
{
gridSizeX
=
CudaFFT3D
::
findLegalDimension
(
pmeGridDimension
[
0
]
);
gridSizeY
=
CudaFFT3D
::
findLegalDimension
(
pmeGridDimension
[
1
]
);
gridSizeZ
=
CudaFFT3D
::
findLegalDimension
(
pmeGridDimension
[
2
]
);
gridSizeX
=
CudaFFT3D
::
findLegalDimension
(
nx
);
gridSizeY
=
CudaFFT3D
::
findLegalDimension
(
ny
);
gridSizeZ
=
CudaFFT3D
::
findLegalDimension
(
nz
);
}
defines
[
"EWALD_ALPHA"
]
=
cu
.
doubleToString
(
alpha
);
defines
[
"SQRT_PI"
]
=
cu
.
doubleToString
(
sqrt
(
M_PI
));
...
...
@@ -1993,6 +1992,27 @@ void CudaCalcAmoebaMultipoleForceKernel::ensureMultipolesValid(ContextImpl& cont
context
.
calcForcesAndEnergy
(
false
,
false
,
-
1
);
}
void
CudaCalcAmoebaMultipoleForceKernel
::
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
ensureMultipolesValid
(
context
);
int
numParticles
=
cu
.
getNumAtoms
();
dipoles
.
resize
(
numParticles
);
const
vector
<
int
>&
order
=
cu
.
getAtomIndex
();
if
(
cu
.
getUseDoublePrecision
())
{
vector
<
double
>
labDipoleVec
;
labFrameDipoles
->
download
(
labDipoleVec
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
dipoles
[
order
[
i
]]
=
Vec3
(
labDipoleVec
[
3
*
i
],
labDipoleVec
[
3
*
i
+
1
],
labDipoleVec
[
3
*
i
+
2
]);
}
else
{
vector
<
float
>
labDipoleVec
;
labFrameDipoles
->
download
(
labDipoleVec
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
dipoles
[
order
[
i
]]
=
Vec3
(
labDipoleVec
[
3
*
i
],
labDipoleVec
[
3
*
i
+
1
],
labDipoleVec
[
3
*
i
+
2
]);
}
}
void
CudaCalcAmoebaMultipoleForceKernel
::
getInducedDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
ensureMultipolesValid
(
context
);
int
numParticles
=
cu
.
getNumAtoms
();
...
...
@@ -2012,6 +2032,48 @@ void CudaCalcAmoebaMultipoleForceKernel::getInducedDipoles(ContextImpl& context,
}
}
void
CudaCalcAmoebaMultipoleForceKernel
::
getTotalDipoles
(
ContextImpl
&
context
,
vector
<
Vec3
>&
dipoles
)
{
ensureMultipolesValid
(
context
);
int
numParticles
=
cu
.
getNumAtoms
();
dipoles
.
resize
(
numParticles
);
const
vector
<
int
>&
order
=
cu
.
getAtomIndex
();
if
(
cu
.
getUseDoublePrecision
())
{
vector
<
double4
>
posqVec
;
vector
<
double
>
labDipoleVec
;
vector
<
double
>
inducedDipoleVec
;
double
totalDipoleVecX
;
double
totalDipoleVecY
;
double
totalDipoleVecZ
;
inducedDipole
->
download
(
inducedDipoleVec
);
labFrameDipoles
->
download
(
labDipoleVec
);
cu
.
getPosq
().
download
(
posqVec
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
totalDipoleVecX
=
labDipoleVec
[
3
*
i
]
+
inducedDipoleVec
[
3
*
i
];
totalDipoleVecY
=
labDipoleVec
[
3
*
i
+
1
]
+
inducedDipoleVec
[
3
*
i
+
1
];
totalDipoleVecZ
=
labDipoleVec
[
3
*
i
+
2
]
+
inducedDipoleVec
[
3
*
i
+
2
];
dipoles
[
order
[
i
]]
=
Vec3
(
totalDipoleVecX
,
totalDipoleVecY
,
totalDipoleVecZ
);
}
}
else
{
vector
<
float4
>
posqVec
;
vector
<
float
>
labDipoleVec
;
vector
<
float
>
inducedDipoleVec
;
float
totalDipoleVecX
;
float
totalDipoleVecY
;
float
totalDipoleVecZ
;
inducedDipole
->
download
(
inducedDipoleVec
);
labFrameDipoles
->
download
(
labDipoleVec
);
cu
.
getPosq
().
download
(
posqVec
);
for
(
int
i
=
0
;
i
<
numParticles
;
i
++
)
{
totalDipoleVecX
=
labDipoleVec
[
3
*
i
]
+
inducedDipoleVec
[
3
*
i
];
totalDipoleVecY
=
labDipoleVec
[
3
*
i
+
1
]
+
inducedDipoleVec
[
3
*
i
+
1
];
totalDipoleVecZ
=
labDipoleVec
[
3
*
i
+
2
]
+
inducedDipoleVec
[
3
*
i
+
2
];
dipoles
[
order
[
i
]]
=
Vec3
(
totalDipoleVecX
,
totalDipoleVecY
,
totalDipoleVecZ
);
}
}
}
void
CudaCalcAmoebaMultipoleForceKernel
::
getElectrostaticPotential
(
ContextImpl
&
context
,
const
vector
<
Vec3
>&
inputGrid
,
vector
<
double
>&
outputElectrostaticPotential
)
{
ensureMultipolesValid
(
context
);
int
numPoints
=
inputGrid
.
size
();
...
...
@@ -2165,6 +2227,7 @@ void CudaCalcAmoebaMultipoleForceKernel::computeSystemMultipoleMoments(ContextIm
outputMultipoleMoments
[
12
]
=
100.0
*
zzqdp
*
debye
;
}
void
CudaCalcAmoebaMultipoleForceKernel
::
getSystemMultipoleMoments
(
ContextImpl
&
context
,
vector
<
double
>&
outputMultipoleMoments
)
{
ensureMultipolesValid
(
context
);
if
(
cu
.
getUseDoublePrecision
())
...
...
@@ -2601,15 +2664,15 @@ void CudaCalcAmoebaVdwForceKernel::initialize(const System& system, const Amoeba
replacements
[
"EPSILON_COMBINING_RULE"
]
=
"4"
;
else
throw
OpenMMException
(
"Illegal combining rule for sigma: "
+
sigmaCombiningRule
);
double
cutoff
=
force
.
getCutoff
();
double
cutoff
=
force
.
getCutoff
Distance
();
double
taperCutoff
=
cutoff
*
0.9
;
replacements
[
"CUTOFF_DISTANCE"
]
=
cu
.
doubleToString
(
force
.
getCutoff
());
replacements
[
"CUTOFF_DISTANCE"
]
=
cu
.
doubleToString
(
force
.
getCutoff
Distance
());
replacements
[
"TAPER_CUTOFF"
]
=
cu
.
doubleToString
(
taperCutoff
);
replacements
[
"TAPER_C3"
]
=
cu
.
doubleToString
(
10
/
pow
(
taperCutoff
-
cutoff
,
3.0
));
replacements
[
"TAPER_C4"
]
=
cu
.
doubleToString
(
15
/
pow
(
taperCutoff
-
cutoff
,
4.0
));
replacements
[
"TAPER_C5"
]
=
cu
.
doubleToString
(
6
/
pow
(
taperCutoff
-
cutoff
,
5.0
));
bool
useCutoff
=
(
force
.
getNonbondedMethod
()
!=
AmoebaVdwForce
::
NoCutoff
);
nonbonded
->
addInteraction
(
useCutoff
,
useCutoff
,
true
,
force
.
getCutoff
(),
exclusions
,
nonbonded
->
addInteraction
(
useCutoff
,
useCutoff
,
true
,
force
.
getCutoff
Distance
(),
exclusions
,
cu
.
replaceStrings
(
CudaAmoebaKernelSources
::
amoebaVdwForce2
,
replacements
),
0
);
// Create the other kernels.
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.h
View file @
a381a3ab
...
...
@@ -328,6 +328,13 @@ public:
* @return the potential energy due to the force
*/
double
execute
(
ContextImpl
&
context
,
bool
includeForces
,
bool
includeEnergy
);
/**
* Get the LabFrame 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
*/
void
getLabFramePermanentDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Get the induced dipole moments of all particles.
*
...
...
@@ -335,6 +342,13 @@ public:
* @param dipoles the induced dipole moment of particle i is stored into the i'th element
*/
void
getInducedDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Get the total 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
*/
void
getTotalDipoles
(
ContextImpl
&
context
,
std
::
vector
<
Vec3
>&
dipoles
);
/**
* Execute the kernel to calculate the electrostatic potential
*
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleElectrostatics.cu
View file @
a381a3ab
...
...
@@ -488,6 +488,8 @@ extern "C" __global__ void computeElectrostatics(
#ifdef USE_CUTOFF
const
unsigned
int
numTiles
=
interactionCount
[
0
];
if
(
numTiles
>
maxTiles
)
return
;
// There wasn't enough memory for the neighbor list.
int
pos
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
warp
*
(
long
long
)
numTileIndices
/
totalWarps
:
warp
*
(
long
long
)
numTiles
/
totalWarps
);
int
end
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
(
warp
+
1
)
*
(
long
long
)
numTileIndices
/
totalWarps
:
(
warp
+
1
)
*
(
long
long
)
numTiles
/
totalWarps
);
#else
...
...
@@ -508,11 +510,8 @@ extern "C" __global__ void computeElectrostatics(
int
x
,
y
;
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
else
#endif
{
#else
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
...
...
@@ -535,7 +534,7 @@ extern "C" __global__ void computeElectrostatics(
while
(
skipTiles
[
currentSkipIndex
]
<
pos
)
currentSkipIndex
++
;
includeTile
=
(
skipTiles
[
currentSkipIndex
]
!=
pos
);
}
#endif
if
(
includeTile
)
{
unsigned
int
atom1
=
x
*
TILE_SIZE
+
tgx
;
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleFixedField.cu
View file @
a381a3ab
...
...
@@ -592,6 +592,8 @@ extern "C" __global__ void computeFixedField(
#ifdef USE_CUTOFF
const
unsigned
int
numTiles
=
interactionCount
[
0
];
if
(
numTiles
>
maxTiles
)
return
;
// There wasn't enough memory for the neighbor list.
int
pos
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
warp
*
(
long
long
)
numTileIndices
/
totalWarps
:
warp
*
(
long
long
)
numTiles
/
totalWarps
);
int
end
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
(
warp
+
1
)
*
(
long
long
)
numTileIndices
/
totalWarps
:
(
warp
+
1
)
*
(
long
long
)
numTiles
/
totalWarps
);
#else
...
...
@@ -612,11 +614,8 @@ extern "C" __global__ void computeFixedField(
int
x
,
y
;
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
else
#endif
{
#else
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
...
...
@@ -639,7 +638,7 @@ extern "C" __global__ void computeFixedField(
while
(
skipTiles
[
currentSkipIndex
]
<
pos
)
currentSkipIndex
++
;
includeTile
=
(
skipTiles
[
currentSkipIndex
]
!=
pos
);
}
#endif
if
(
includeTile
)
{
unsigned
int
atom1
=
x
*
TILE_SIZE
+
tgx
;
...
...
plugins/amoeba/platforms/cuda/src/kernels/multipoleInducedField.cu
View file @
a381a3ab
...
...
@@ -454,6 +454,8 @@ extern "C" __global__ void computeInducedField(
#ifdef USE_CUTOFF
const
unsigned
int
numTiles
=
interactionCount
[
0
];
if
(
numTiles
>
maxTiles
)
return
;
// There wasn't enough memory for the neighbor list.
int
pos
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
warp
*
(
long
long
)
numTileIndices
/
totalWarps
:
warp
*
(
long
long
)
numTiles
/
totalWarps
);
int
end
=
(
int
)
(
numTiles
>
maxTiles
?
startTileIndex
+
(
warp
+
1
)
*
(
long
long
)
numTileIndices
/
totalWarps
:
(
warp
+
1
)
*
(
long
long
)
numTiles
/
totalWarps
);
#else
...
...
@@ -474,11 +476,8 @@ extern "C" __global__ void computeInducedField(
int
x
,
y
;
#ifdef USE_CUTOFF
if
(
numTiles
<=
maxTiles
)
x
=
tiles
[
pos
];
else
#endif
{
#else
y
=
(
int
)
floor
(
NUM_BLOCKS
+
0.5
f
-
SQRT
((
NUM_BLOCKS
+
0.5
f
)
*
(
NUM_BLOCKS
+
0.5
f
)
-
2
*
pos
));
x
=
(
pos
-
y
*
NUM_BLOCKS
+
y
*
(
y
+
1
)
/
2
);
if
(
x
<
y
||
x
>=
NUM_BLOCKS
)
{
// Occasionally happens due to roundoff error.
...
...
@@ -501,7 +500,7 @@ extern "C" __global__ void computeInducedField(
while
(
skipTiles
[
currentSkipIndex
]
<
pos
)
currentSkipIndex
++
;
includeTile
=
(
skipTiles
[
currentSkipIndex
]
!=
pos
);
}
#endif
if
(
includeTile
)
{
unsigned
int
atom1
=
x
*
TILE_SIZE
+
tgx
;
...
...
Prev
1
…
3
4
5
6
7
8
9
10
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