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
1a3caae0
Commit
1a3caae0
authored
Sep 16, 2010
by
Mark Friedrichs
Browse files
Continue PME
parent
e3196201
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
225 additions
and
45 deletions
+225
-45
plugins/amoeba/openmmapi/include/AmoebaMultipoleForce.h
plugins/amoeba/openmmapi/include/AmoebaMultipoleForce.h
+30
-0
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
+31
-1
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
+10
-1
plugins/amoeba/platforms/cuda/src/kernels/AmoebaGpu.cpp
plugins/amoeba/platforms/cuda/src/kernels/AmoebaGpu.cpp
+1
-0
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
...ms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
+118
-26
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
...amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
+35
-17
No files found.
plugins/amoeba/openmmapi/include/AmoebaMultipoleForce.h
View file @
1a3caae0
...
@@ -127,6 +127,34 @@ public:
...
@@ -127,6 +127,34 @@ public:
*/
*/
void
setAEwald
(
double
aewald
);
void
setAEwald
(
double
aewald
);
/**
* Get the B-spline order parameter
*
* @return the B-spline order parameter
*/
int
getPmeBSplineOrder
(
)
const
;
/**
* Set the B-spline order parameter
*
* @param the B-spline order parameter
*/
void
setPmeBSplineOrder
(
int
inputBSplineOrder
);
/**
* Get the PME grid dimensions
*
* @return the PME grid dimensions
*/
void
getPmeGridDimensions
(
std
::
vector
<
int
>&
gridDimension
)
const
;
/**
* Set the PME grid dimensions
*
* @param the PME grid dimensions
*/
void
setPmeGridDimensions
(
const
std
::
vector
<
int
>&
gridDimension
);
/**
/**
* Add multipole-related info for a particle
* Add multipole-related info for a particle
*
*
...
@@ -294,6 +322,8 @@ private:
...
@@ -294,6 +322,8 @@ private:
AmoebaNonbondedMethod
nonbondedMethod
;
AmoebaNonbondedMethod
nonbondedMethod
;
double
cutoffDistance
;
double
cutoffDistance
;
double
aewald
;
double
aewald
;
int
pmeBSplineOrder
;
std
::
vector
<
int
>
pmeGridDimension
;
MutualInducedIterationMethod
mutualInducedIterationMethod
;
MutualInducedIterationMethod
mutualInducedIterationMethod
;
int
mutualInducedMaxIterations
;
int
mutualInducedMaxIterations
;
double
mutualInducedTargetEpsilon
;
double
mutualInducedTargetEpsilon
;
...
...
plugins/amoeba/openmmapi/src/AmoebaMultipoleForce.cpp
View file @
1a3caae0
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
using
namespace
OpenMM
;
using
namespace
OpenMM
;
AmoebaMultipoleForce
::
AmoebaMultipoleForce
()
:
nonbondedMethod
(
NoCutoff
),
cutoffDistance
(
1.0
),
ewaldErrorTol
(
5e-4
),
mutualInducedIterationMethod
(
SOR
),
mutualInducedMaxIterations
(
60
),
AmoebaMultipoleForce
::
AmoebaMultipoleForce
()
:
nonbondedMethod
(
NoCutoff
),
pmeBSplineOrder
(
5
),
cutoffDistance
(
1.0
),
ewaldErrorTol
(
5e-4
),
mutualInducedIterationMethod
(
SOR
),
mutualInducedMaxIterations
(
60
),
mutualInducedTargetEpsilon
(
1.0e-05
),
scalingDistanceCutoff
(
100.0
),
electricConstant
(
138.9354558456
)
{
mutualInducedTargetEpsilon
(
1.0e-05
),
scalingDistanceCutoff
(
100.0
),
electricConstant
(
138.9354558456
)
{
}
}
...
@@ -64,6 +64,36 @@ void AmoebaMultipoleForce::setAEwald(double inputAewald ) {
...
@@ -64,6 +64,36 @@ void AmoebaMultipoleForce::setAEwald(double inputAewald ) {
aewald
=
inputAewald
;
aewald
=
inputAewald
;
}
}
int
AmoebaMultipoleForce
::
getPmeBSplineOrder
(
void
)
const
{
return
pmeBSplineOrder
;
}
void
AmoebaMultipoleForce
::
setPmeBSplineOrder
(
int
inputBSplineOrder
)
{
pmeBSplineOrder
=
inputBSplineOrder
;
}
void
AmoebaMultipoleForce
::
getPmeGridDimensions
(
std
::
vector
<
int
>&
gridDimension
)
const
{
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
;
}
void
AmoebaMultipoleForce
::
setPmeGridDimensions
(
const
std
::
vector
<
int
>&
gridDimension
)
{
pmeGridDimension
.
resize
(
3
);
pmeGridDimension
[
0
]
=
gridDimension
[
0
];
pmeGridDimension
[
1
]
=
gridDimension
[
1
];
pmeGridDimension
[
2
]
=
gridDimension
[
2
];
return
;
}
AmoebaMultipoleForce
::
MutualInducedIterationMethod
AmoebaMultipoleForce
::
getMutualInducedIterationMethod
(
void
)
const
{
AmoebaMultipoleForce
::
MutualInducedIterationMethod
AmoebaMultipoleForce
::
getMutualInducedIterationMethod
(
void
)
const
{
return
mutualInducedIterationMethod
;
return
mutualInducedIterationMethod
;
}
}
...
...
plugins/amoeba/platforms/cuda/src/AmoebaCudaKernels.cpp
View file @
1a3caae0
...
@@ -597,7 +597,16 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
...
@@ -597,7 +597,16 @@ void CudaCalcAmoebaMultipoleForceKernel::initialize(const System& system, const
NonbondedForce
nb
;
NonbondedForce
nb
;
nb
.
setEwaldErrorTolerance
(
force
.
getEwaldErrorTolerance
());
nb
.
setEwaldErrorTolerance
(
force
.
getEwaldErrorTolerance
());
nb
.
setCutoffDistance
(
force
.
getCutoffDistance
());
nb
.
setCutoffDistance
(
force
.
getCutoffDistance
());
NonbondedForceImpl
::
calcPMEParameters
(
system
,
nb
,
alpha
,
xsize
,
ysize
,
zsize
);
std
::
vector
<
int
>
pmeGridDimension
;
force
.
getPmeGridDimensions
(
pmeGridDimension
);
if
(
1
||
pmeGridDimension
[
0
]
==
0
){
NonbondedForceImpl
::
calcPMEParameters
(
system
,
nb
,
alpha
,
xsize
,
ysize
,
zsize
);
}
else
{
alpha
=
force
.
getAEwald
();
xsize
=
pmeGridDimension
[
0
];
ysize
=
pmeGridDimension
[
1
];
zsize
=
pmeGridDimension
[
2
];
}
gpuSetAmoebaPMEParameters
(
data
.
getAmoebaGpu
(),
(
float
)
alpha
,
xsize
,
ysize
,
zsize
);
gpuSetAmoebaPMEParameters
(
data
.
getAmoebaGpu
(),
(
float
)
alpha
,
xsize
,
ysize
,
zsize
);
}
}
...
...
plugins/amoeba/platforms/cuda/src/kernels/AmoebaGpu.cpp
View file @
1a3caae0
...
@@ -351,6 +351,7 @@ void gpuPrintCudaAmoebaGmxSimulation(amoebaGpuContext amoebaGpu, FILE* log )
...
@@ -351,6 +351,7 @@ void gpuPrintCudaAmoebaGmxSimulation(amoebaGpuContext amoebaGpu, FILE* log )
(
void
)
fprintf
(
log
,
" pM_ScaleIndices %p
\n
"
,
amoebaGpu
->
amoebaSim
.
pM_ScaleIndices
);
(
void
)
fprintf
(
log
,
" pM_ScaleIndices %p
\n
"
,
amoebaGpu
->
amoebaSim
.
pM_ScaleIndices
);
(
void
)
fprintf
(
log
,
" sqrtPi %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
sqrtPi
);
(
void
)
fprintf
(
log
,
" sqrtPi %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
sqrtPi
);
(
void
)
fprintf
(
log
,
" alpha Ewald %15.7e
\n
"
,
gpu
->
sim
.
alphaEwald
);
(
void
)
fprintf
(
log
,
" alpha Ewald %15.7e
\n
"
,
gpu
->
sim
.
alphaEwald
);
(
void
)
fprintf
(
log
,
" PME grid dimensions %6d %6d %6d
\n
"
,
gpu
->
sim
.
pmeGridSize
.
x
,
gpu
->
sim
.
pmeGridSize
.
y
,
gpu
->
sim
.
pmeGridSize
.
z
);
(
void
)
fprintf
(
log
,
" cutoffDistance2 %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
cutoffDistance2
);
(
void
)
fprintf
(
log
,
" cutoffDistance2 %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
cutoffDistance2
);
(
void
)
fprintf
(
log
,
" electric %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
electric
);
(
void
)
fprintf
(
log
,
" electric %15.7e
\n
"
,
amoebaGpu
->
amoebaSim
.
electric
);
(
void
)
fprintf
(
log
,
" box %15.7e %15.7e %15.7e
\n
"
,
gpu
->
sim
.
periodicBoxSizeX
,
gpu
->
sim
.
periodicBoxSizeY
,
gpu
->
sim
.
periodicBoxSizeZ
);
(
void
)
fprintf
(
log
,
" box %15.7e %15.7e %15.7e
\n
"
,
gpu
->
sim
.
periodicBoxSizeX
,
gpu
->
sim
.
periodicBoxSizeY
,
gpu
->
sim
.
periodicBoxSizeZ
);
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
View file @
1a3caae0
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include "amoebaCudaKernels.h"
#include "amoebaCudaKernels.h"
#include "kCalculateAmoebaCudaUtilities.h"
#include "kCalculateAmoebaCudaUtilities.h"
//
#define AMOEBA_DEBUG
#define AMOEBA_DEBUG
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaGmxSimulation
cSim
;
static
__constant__
cudaAmoebaGmxSimulation
cAmoebaSim
;
static
__constant__
cudaAmoebaGmxSimulation
cAmoebaSim
;
...
@@ -39,7 +39,7 @@ __launch_bounds__(GT2XX_THREADS_PER_BLOCK, 1)
...
@@ -39,7 +39,7 @@ __launch_bounds__(GT2XX_THREADS_PER_BLOCK, 1)
#else
#else
__launch_bounds__
(
G8X_THREADS_PER_BLOCK
,
1
)
__launch_bounds__
(
G8X_THREADS_PER_BLOCK
,
1
)
#endif
#endif
void
kReduce
DirectSelfFields
_kernel
(
unsigned
int
fieldComponents
,
unsigned
int
outputBuffers
,
float
*
fieldIn
,
float
*
fieldOut
)
static
void
kReduce
PmeEFieldPolar
_kernel
(
unsigned
int
fieldComponents
,
unsigned
int
outputBuffers
,
float
*
EFieldReciprocal
,
float
*
fieldIn
,
float
*
fieldOut
)
{
{
unsigned
int
pos
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
unsigned
int
pos
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
...
@@ -52,7 +52,7 @@ void kReduceDirectSelfFields_kernel( unsigned int fieldComponents, unsigned int
...
@@ -52,7 +52,7 @@ void kReduceDirectSelfFields_kernel( unsigned int fieldComponents, unsigned int
// self-term included here
// self-term included here
float
totalField
=
term
*
cAmoebaSim
.
pLabFrameDipole
[
pos
];
float
totalField
=
EFieldReciprocal
[
pos
]
+
term
*
cAmoebaSim
.
pLabFrameDipole
[
pos
];
float
*
pFt
=
fieldIn
+
pos
;
float
*
pFt
=
fieldIn
+
pos
;
unsigned
int
i
=
outputBuffers
;
unsigned
int
i
=
outputBuffers
;
...
@@ -80,19 +80,74 @@ void kReduceDirectSelfFields_kernel( unsigned int fieldComponents, unsigned int
...
@@ -80,19 +80,74 @@ void kReduceDirectSelfFields_kernel( unsigned int fieldComponents, unsigned int
}
}
}
}
__global__
#if (__CUDA_ARCH__ >= 200)
__launch_bounds__
(
GF1XX_THREADS_PER_BLOCK
,
1
)
#elif (__CUDA_ARCH__ >= 130)
__launch_bounds__
(
GT2XX_THREADS_PER_BLOCK
,
1
)
#else
__launch_bounds__
(
G8X_THREADS_PER_BLOCK
,
1
)
#endif
static
void
kReducePmeEField_kernel
(
unsigned
int
fieldComponents
,
unsigned
int
outputBuffers
,
float
*
fieldIn
,
float
*
fieldOut
)
{
unsigned
int
pos
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
// Reduce field
const
float
term
=
(
4.0
f
/
3.0
f
)
*
(
cSim
.
alphaEwald
*
cSim
.
alphaEwald
*
cSim
.
alphaEwald
)
/
cAmoebaSim
.
sqrtPi
;
//const float term = 0.0f;
while
(
pos
<
fieldComponents
)
{
// self-term included here
float
totalField
=
term
*
cAmoebaSim
.
pLabFrameDipole
[
pos
];
float
*
pFt
=
fieldIn
+
pos
;
unsigned
int
i
=
outputBuffers
;
while
(
i
>=
4
)
{
totalField
+=
pFt
[
0
]
+
pFt
[
fieldComponents
]
+
pFt
[
2
*
fieldComponents
]
+
pFt
[
3
*
fieldComponents
];
pFt
+=
fieldComponents
*
4
;
i
-=
4
;
}
if
(
i
>=
2
)
{
totalField
+=
pFt
[
0
]
+
pFt
[
fieldComponents
];
pFt
+=
fieldComponents
*
2
;
i
-=
2
;
}
if
(
i
>
0
)
{
totalField
+=
pFt
[
0
];
}
fieldOut
[
pos
]
+=
totalField
;
pos
+=
gridDim
.
x
*
blockDim
.
x
;
}
}
// reduce psWorkArray_3_1 -> EField
// reduce psWorkArray_3_1 -> EField
// reduce psWorkArray_3_2 -> EFieldPolar
// reduce psWorkArray_3_2 -> EFieldPolar
static
void
kReducePmeDirectE_Fields
(
amoebaGpuContext
amoebaGpu
)
static
void
kReducePmeDirectE_Fields
(
amoebaGpuContext
amoebaGpu
)
{
{
kReduceDirectSelfFields_kernel
<<<
amoebaGpu
->
nonbondBlocks
,
amoebaGpu
->
fieldReduceThreadsPerBlock
>>>
(
amoebaGpu
->
paddedNumberOfAtoms
*
3
,
amoebaGpu
->
outputBuffers
,
// E_FieldPolar = E_Field (reciprocal) + E_FieldPolar (direct) + self
amoebaGpu
->
psWorkArray_3_1
->
_pDevStream
[
0
],
amoebaGpu
->
psE_Field
->
_pDevStream
[
0
]
);
kReducePmeEFieldPolar_kernel
<<<
amoebaGpu
->
nonbondBlocks
,
amoebaGpu
->
fieldReduceThreadsPerBlock
>>>
(
amoebaGpu
->
paddedNumberOfAtoms
*
3
,
amoebaGpu
->
outputBuffers
,
amoebaGpu
->
psE_Field
->
_pDevStream
[
0
],
amoebaGpu
->
psWorkArray_3_2
->
_pDevStream
[
0
],
amoebaGpu
->
psE_FieldPolar
->
_pDevStream
[
0
]
);
LAUNCHERROR
(
"kReducePmeE_Fields1"
);
LAUNCHERROR
(
"kReducePmeE_Fields1"
);
kReduceDirectSelfFields_kernel
<<<
amoebaGpu
->
nonbondBlocks
,
amoebaGpu
->
fieldReduceThreadsPerBlock
>>>
(
// E_Field = E_Field (reciprocal) + E_Field (direct) + self
amoebaGpu
->
paddedNumberOfAtoms
*
3
,
amoebaGpu
->
outputBuffers
,
amoebaGpu
->
psWorkArray_3_2
->
_pDevStream
[
0
],
amoebaGpu
->
psE_FieldPolar
->
_pDevStream
[
0
]
);
kReducePmeEField_kernel
<<<
amoebaGpu
->
nonbondBlocks
,
amoebaGpu
->
fieldReduceThreadsPerBlock
>>>
(
amoebaGpu
->
paddedNumberOfAtoms
*
3
,
amoebaGpu
->
outputBuffers
,
amoebaGpu
->
psWorkArray_3_1
->
_pDevStream
[
0
],
amoebaGpu
->
psE_Field
->
_pDevStream
[
0
]
);
LAUNCHERROR
(
"kReducePmeE_Fields2"
);
LAUNCHERROR
(
"kReducePmeE_Fields2"
);
}
}
...
@@ -318,6 +373,20 @@ __device__ void calculateFixedFieldRealSpacePairIxn_kernel( FixedFieldParticle&
...
@@ -318,6 +373,20 @@ __device__ void calculateFixedFieldRealSpacePairIxn_kernel( FixedFieldParticle&
#define METHOD_NAME(a, b) a##N2ByWarp##b
#define METHOD_NAME(a, b) a##N2ByWarp##b
#include "kCalculateAmoebaCudaPmeFixedEField.h"
#include "kCalculateAmoebaCudaPmeFixedEField.h"
/**---------------------------------------------------------------------------------------
Report whether a number is a nan or infinity
@param number number to test
@return 1 if number is nan or infinity; else return 0
--------------------------------------------------------------------------------------- */
static
int
isNanOrInfinity
(
double
number
){
return
(
number
!=
number
||
number
==
std
::
numeric_limits
<
double
>::
infinity
()
||
number
==
-
std
::
numeric_limits
<
double
>::
infinity
())
?
1
:
0
;
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
Compute fixed electric field using PME
Compute fixed electric field using PME
...
@@ -335,6 +404,7 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -335,6 +404,7 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
gpuContext
gpu
=
amoebaGpu
->
gpuContext
;
gpuContext
gpu
=
amoebaGpu
->
gpuContext
;
#ifdef AMOEBA_DEBUG
#ifdef AMOEBA_DEBUG
static
const
char
*
methodName
=
"computeCudaAmoebaPmeFixedEField"
;
static
const
char
*
methodName
=
"computeCudaAmoebaPmeFixedEField"
;
if
(
amoebaGpu
->
log
){
if
(
amoebaGpu
->
log
){
(
void
)
fprintf
(
amoebaGpu
->
log
,
"
\n
%s
\n
"
,
methodName
);
(
void
)
fflush
(
amoebaGpu
->
log
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"
\n
%s
\n
"
,
methodName
);
(
void
)
fflush
(
amoebaGpu
->
log
);
...
@@ -347,21 +417,36 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -347,21 +417,36 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
memset
(
debugArray
->
_pSysStream
[
0
],
0
,
sizeof
(
float
)
*
4
*
paddedNumberOfAtoms
*
paddedNumberOfAtoms
);
memset
(
debugArray
->
_pSysStream
[
0
],
0
,
sizeof
(
float
)
*
4
*
paddedNumberOfAtoms
*
paddedNumberOfAtoms
);
debugArray
->
Upload
();
debugArray
->
Upload
();
(
*
gpu
->
psInteractionCount
)[
0
]
=
gpu
->
sim
.
workUnits
;
gpu
->
psInteractionCount
->
Upload
();
// print intermediate results for the targetAtom
// print intermediate results for the targetAtom
unsigned
int
targetAtom
=
0
;
unsigned
int
targetAtom
=
0
;
#endif
//#define SET_ALPHA_EWALD
int
maxPrint
=
3002
;
//#ifdef SET_ALPHA_EWALD
amoebaGpu
->
psE_Field
->
Download
();
// amoebaGpu->gpuContext->sim.alphaEwald = 5.4459052e+00f;
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields In
\n
"
);
// (void) fprintf( amoebaGpu->log, "computeCudaAmoebaPmeFixedEField: forceing alphaEwald=%15.7e\n", amoebaGpu->gpuContext->sim.alphaEwald );
for
(
int
ii
=
0
;
ii
<
gpu
->
natoms
;
ii
++
){
// SetCalculateAmoebaCudaPmeFixedEFieldSim(amoebaGpu);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"%5d "
,
ii
);
//#endif
int
indexOffset
=
ii
*
3
;
// E_Field
int
isNan
=
isNanOrInfinity
(
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
]
);
isNan
+=
isNanOrInfinity
(
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
+
1
]
);
isNan
+=
isNanOrInfinity
(
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
+
2
]
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"E[%16.9e %16.9e %16.9e] %s
\n
"
,
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
],
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
+
1
],
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
][
indexOffset
+
2
],
(
isNan
?
"XXX"
:
""
)
);
if
(
ii
==
maxPrint
&&
(
gpu
->
natoms
-
maxPrint
)
>
ii
){
ii
=
gpu
->
natoms
-
maxPrint
;
}
}
(
void
)
fflush
(
amoebaGpu
->
log
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields End
\n
"
);
#endif
kClearFields_3
(
amoebaGpu
,
2
);
kClearFields_3
(
amoebaGpu
,
2
);
...
@@ -413,12 +498,10 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -413,12 +498,10 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
sizeof
(
FixedFieldParticle
),
sizeof
(
FixedFieldParticle
)
*
amoebaGpu
->
nonbondThreadsPerBlock
,
amoebaGpu
->
energyOutputBuffers
,
sizeof
(
FixedFieldParticle
),
sizeof
(
FixedFieldParticle
)
*
amoebaGpu
->
nonbondThreadsPerBlock
,
amoebaGpu
->
energyOutputBuffers
,
(
*
gpu
->
psInteractionCount
)[
0
],
gpu
->
sim
.
workUnits
,
gpu
->
bOutputBufferPerWarp
);
(
*
gpu
->
psInteractionCount
)[
0
],
gpu
->
sim
.
workUnits
,
gpu
->
bOutputBufferPerWarp
);
(
void
)
fflush
(
amoebaGpu
->
log
);
(
void
)
fflush
(
amoebaGpu
->
log
);
/*
(void) fprintf( amoebaGpu->log, "Out WorkArray_3_[1,2] paddedNumberOfAtoms=%d\n", amoebaGpu->paddedNumberOfAtoms, amoebaGpu->outputBuffers );
amoebaGpu->psWorkArray_3_1->Download();
amoebaGpu->psWorkArray_3_1->Download();
amoebaGpu->psWorkArray_3_2->Download();
amoebaGpu->psWorkArray_3_2->Download();
amoebaGpu
->
psE_Field
->
Download
();
amoebaGpu
->
psE_FieldPolar
->
Download
();
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Out WorkArray_3_[1,2] paddedNumberOfAtoms=%d
\n
"
,
amoebaGpu
->
paddedNumberOfAtoms
,
amoebaGpu
->
outputBuffers
);
int
maxPrint
=
32
;
for( int ii = 0; ii < amoebaGpu->paddedNumberOfAtoms; ii++ ){
for( int ii = 0; ii < amoebaGpu->paddedNumberOfAtoms; ii++ ){
(void) fprintf( amoebaGpu->log, "%5d ", ii);
(void) fprintf( amoebaGpu->log, "%5d ", ii);
...
@@ -444,8 +527,9 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -444,8 +527,9 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
}
}
}
}
(void) fflush( amoebaGpu->log );
(void) fflush( amoebaGpu->log );
(
void
)
fprintf
(
amoebaGpu
->
log
,
"EFields End
\n
"
);
*/
amoebaGpu
->
psE_Field
->
Download
();
amoebaGpu
->
psE_FieldPolar
->
Download
();
for
(
int
ii
=
0
;
ii
<
gpu
->
natoms
;
ii
++
){
for
(
int
ii
=
0
;
ii
<
gpu
->
natoms
;
ii
++
){
(
void
)
fprintf
(
amoebaGpu
->
log
,
"%5d "
,
ii
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"%5d "
,
ii
);
...
@@ -520,6 +604,14 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -520,6 +604,14 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
void
cudaComputeAmoebaPmeFixedEField
(
amoebaGpuContext
amoebaGpu
)
void
cudaComputeAmoebaPmeFixedEField
(
amoebaGpuContext
amoebaGpu
)
{
{
cudaComputeAmoebaPmeDirectFixedEField
(
amoebaGpu
);
// zero field?
unsigned
int
offset
=
3
*
amoebaGpu
->
paddedNumberOfAtoms
*
sizeof
(
float
);
memset
(
amoebaGpu
->
psE_Field
->
_pSysStream
[
0
],
0
,
offset
);
amoebaGpu
->
psE_Field
->
Upload
();
kCalculateAmoebaPMEFixedMultipoleField
(
amoebaGpu
);
kCalculateAmoebaPMEFixedMultipoleField
(
amoebaGpu
);
cudaComputeAmoebaPmeDirectFixedEField
(
amoebaGpu
);
}
}
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
View file @
1a3caae0
...
@@ -1985,21 +1985,33 @@ static int readAmoebaMultipoleParameters( FILE* filePtr, int version, MapStringI
...
@@ -1985,21 +1985,33 @@ static int readAmoebaMultipoleParameters( FILE* filePtr, int version, MapStringI
// load in parameters
// load in parameters
int
numberOfMultipoles
=
atoi
(
tokens
[
1
].
c_str
()
);
unsigned
int
tokenIndex
=
1
;
int
numberOfMultipoles
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
int
usePme
=
0
;
int
usePme
=
0
;
int
bsOrder
=
0
;
std
::
vector
<
int
>
grid
(
3
,
0
);
double
aewald
=
0.0
;
double
aewald
=
0.0
;
double
cutoffDistance
=
0.0
;
double
cutoffDistance
=
0.0
;
double
box
[
3
]
=
{
10.0
,
10.0
,
10.0
}
;
std
::
vector
<
double
>
box
(
3
,
10.0
)
;
// usePme, aewald, cutoffDistance added w/ Version 1
// usePme, aewald, cutoffDistance added w/ Version 1
if
(
version
>
0
){
if
(
version
>
0
){
usePme
=
atoi
(
tokens
[
2
].
c_str
()
);
usePme
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
aewald
=
atof
(
tokens
[
3
].
c_str
()
);
aewald
=
atof
(
tokens
[
tokenIndex
++
].
c_str
()
);
cutoffDistance
=
atof
(
tokens
[
4
].
c_str
()
);
cutoffDistance
=
atof
(
tokens
[
tokenIndex
++
].
c_str
()
);
box
[
0
]
=
atof
(
tokens
[
5
].
c_str
()
);
box
[
1
]
=
atof
(
tokens
[
6
].
c_str
()
);
box
[
0
]
=
atof
(
tokens
[
tokenIndex
++
].
c_str
()
);
box
[
2
]
=
atof
(
tokens
[
7
].
c_str
()
);
box
[
1
]
=
atof
(
tokens
[
tokenIndex
++
].
c_str
()
);
box
[
2
]
=
atof
(
tokens
[
tokenIndex
++
].
c_str
()
);
//double electric = atof( tokens[tokenIndex++].c_str() );
tokenIndex
++
;
bsOrder
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
grid
[
0
]
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
grid
[
1
]
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
grid
[
2
]
=
atoi
(
tokens
[
tokenIndex
++
].
c_str
()
);
}
}
if
(
usePme
){
if
(
usePme
){
...
@@ -2009,6 +2021,8 @@ static int readAmoebaMultipoleParameters( FILE* filePtr, int version, MapStringI
...
@@ -2009,6 +2021,8 @@ static int readAmoebaMultipoleParameters( FILE* filePtr, int version, MapStringI
}
}
multipoleForce
->
setCutoffDistance
(
cutoffDistance
);
multipoleForce
->
setCutoffDistance
(
cutoffDistance
);
multipoleForce
->
setAEwald
(
aewald
);
multipoleForce
->
setAEwald
(
aewald
);
multipoleForce
->
setPmeBSplineOrder
(
bsOrder
);
multipoleForce
->
setPmeGridDimensions
(
grid
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
box
[
0
],
0.0
,
0.0
),
Vec3
(
0.0
,
box
[
1
],
0.0
),
Vec3
(
0.0
,
0.0
,
box
[
2
])
);
system
.
setDefaultPeriodicBoxVectors
(
Vec3
(
box
[
0
],
0.0
,
0.0
),
Vec3
(
0.0
,
box
[
1
],
0.0
),
Vec3
(
0.0
,
0.0
,
box
[
2
])
);
if
(
log
){
if
(
log
){
(
void
)
fprintf
(
log
,
"%s number of MultipoleParameter terms=%d usePme=%d aewald=%15.7e cutoffDistance=%12.4f
\n
"
,
(
void
)
fprintf
(
log
,
"%s number of MultipoleParameter terms=%d usePme=%d aewald=%15.7e cutoffDistance=%12.4f
\n
"
,
...
@@ -3605,15 +3619,19 @@ Integrator* readAmoebaParameterFile( const std::string& inputParameterFile, MapS
...
@@ -3605,15 +3619,19 @@ Integrator* readAmoebaParameterFile( const std::string& inputParameterFile, MapS
readVec3
(
filePtr
,
tokens
,
forces
[
AMOEBA_GK_FORCE
],
&
lineCount
,
field
,
log
);
readVec3
(
filePtr
,
tokens
,
forces
[
AMOEBA_GK_FORCE
],
&
lineCount
,
field
,
log
);
}
else
if
(
field
==
"AmoebaGkAndCavityForce"
){
}
else
if
(
field
==
"AmoebaGkAndCavityForce"
){
readVec3
(
filePtr
,
tokens
,
forces
[
AMOEBA_GK_CAVITY_FORCE
],
&
lineCount
,
field
,
log
);
readVec3
(
filePtr
,
tokens
,
forces
[
AMOEBA_GK_CAVITY_FORCE
],
&
lineCount
,
field
,
log
);
}
else
if
(
field
==
"AmoebaGk_A_ForceAndTorque"
||
}
else
if
(
field
==
"AmoebaGk_A_ForceAndTorque"
||
field
==
"AmoebaGk_A_Force"
||
field
==
"AmoebaGk_A_Force"
||
field
==
"AmoebaSurfaceParameters"
||
field
==
"AmoebaSurfaceParameters"
||
field
==
"AmoebaGk_A_DrB"
||
field
==
"AmoebaGk_A_DrB"
||
field
==
"AmoebaDBorn"
||
field
==
"AmoebaDBorn"
||
field
==
"AmoebaBorn1Force"
||
field
==
"AmoebaBorn1Force"
||
field
==
"AmoebaBornForce"
||
field
==
"AmoebaBornForce"
||
field
==
"AmoebaGkEdiffForceAndTorque"
||
field
==
"AmoebaGkEdiffForceAndTorque"
||
field
==
"AmoebaGkEdiffForce"
){
field
==
"AmoebaGkEdiffForce"
||
field
==
"PmeDirectForceAndTorqueOutLoop"
||
field
==
"PmeDirectForceIncludingMappedTorqueOutLoop"
||
field
==
"PmeDirectForceTorqueInLoop"
){
std
::
vector
<
std
::
vector
<
double
>
>
vectorOfDoubleVectors
;
std
::
vector
<
std
::
vector
<
double
>
>
vectorOfDoubleVectors
;
readVectorOfDoubleVectors
(
filePtr
,
tokens
,
vectorOfDoubleVectors
,
&
lineCount
,
field
,
log
);
readVectorOfDoubleVectors
(
filePtr
,
tokens
,
vectorOfDoubleVectors
,
&
lineCount
,
field
,
log
);
supplementary
[
field
]
=
vectorOfDoubleVectors
;
supplementary
[
field
]
=
vectorOfDoubleVectors
;
...
...
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