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
6b0ad778
Commit
6b0ad778
authored
Oct 01, 2010
by
Mark Friedrichs
Browse files
PME mods
parent
f21e5169
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
53 deletions
+36
-53
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.cu
...src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.cu
+18
-20
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.h
.../src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.h
+10
-12
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
...ms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
+4
-8
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
.../src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
+0
-4
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaRotateFrame.cu
...platforms/cuda/src/kernels/kCalculateAmoebaRotateFrame.cu
+2
-9
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
...amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
+2
-0
No files found.
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.cu
View file @
6b0ad778
...
@@ -98,7 +98,7 @@ __device__ static void debugSetup( unsigned int atomI, unsigned int atomJ,
...
@@ -98,7 +98,7 @@ __device__ static void debugSetup( unsigned int atomI, unsigned int atomJ,
*/
*/
// self-energy for PME
// self-energy for PME
/*
__device__
static
void
calculatePmeSelfEnergyElectrostaticPairIxn_kernel
(
PmeDirectElectrostaticParticle
&
atomI
,
float
*
energy
)
__device__
static
void
calculatePmeSelfEnergyElectrostaticPairIxn_kernel
(
PmeDirectElectrostaticParticle
&
atomI
,
float
*
energy
)
{
{
float
term
=
2.0
f
*
cSim
.
alphaEwald
*
cSim
.
alphaEwald
;
float
term
=
2.0
f
*
cSim
.
alphaEwald
*
cSim
.
alphaEwald
;
...
@@ -122,7 +122,7 @@ __device__ static void calculatePmeSelfEnergyElectrostaticPairIxn_kernel( PmeDir
...
@@ -122,7 +122,7 @@ __device__ static void calculatePmeSelfEnergyElectrostaticPairIxn_kernel( PmeDir
*
energy
=
(
cii
+
term
*
(
dii
/
3.0
f
+
2.0
f
*
term
*
qii
/
5.0
f
));
*
energy
=
(
cii
+
term
*
(
dii
/
3.0
f
+
2.0
f
*
term
*
qii
/
5.0
f
));
*
energy
+=
term
*
uii
/
3.0
f
;
*
energy
+=
term
*
uii
/
3.0
f
;
*
energy
*=
fterm
;
*
energy
*=
fterm
;
}
*/
}
// self-torque for PME
// self-torque for PME
...
@@ -134,14 +134,13 @@ __device__ static void calculatePmeSelfTorqueElectrostaticPairIxn_kernel( PmeDir
...
@@ -134,14 +134,13 @@ __device__ static void calculatePmeSelfTorqueElectrostaticPairIxn_kernel( PmeDir
float
uiy
=
0.5
f
*
(
atomI
.
inducedDipole
[
1
]
+
atomI
.
inducedDipoleP
[
1
]);
float
uiy
=
0.5
f
*
(
atomI
.
inducedDipole
[
1
]
+
atomI
.
inducedDipoleP
[
1
]);
float
uiz
=
0.5
f
*
(
atomI
.
inducedDipole
[
2
]
+
atomI
.
inducedDipoleP
[
2
]);
float
uiz
=
0.5
f
*
(
atomI
.
inducedDipole
[
2
]
+
atomI
.
inducedDipoleP
[
2
]);
atomI
.
torque
[
0
]
+
=
term
*
(
atomI
.
labFrameDipole
[
1
]
*
uiz
-
atomI
.
labFrameDipole
[
2
]
*
uiy
);
atomI
.
torque
[
0
]
-
=
term
*
(
atomI
.
labFrameDipole
[
1
]
*
uiz
-
atomI
.
labFrameDipole
[
2
]
*
uiy
);
atomI
.
torque
[
1
]
+
=
term
*
(
atomI
.
labFrameDipole
[
2
]
*
uix
-
atomI
.
labFrameDipole
[
0
]
*
uiz
);
atomI
.
torque
[
1
]
-
=
term
*
(
atomI
.
labFrameDipole
[
2
]
*
uix
-
atomI
.
labFrameDipole
[
0
]
*
uiz
);
atomI
.
torque
[
2
]
+
=
term
*
(
atomI
.
labFrameDipole
[
0
]
*
uiy
-
atomI
.
labFrameDipole
[
1
]
*
uix
);
atomI
.
torque
[
2
]
-
=
term
*
(
atomI
.
labFrameDipole
[
0
]
*
uiy
-
atomI
.
labFrameDipole
[
1
]
*
uix
);
}
}
__device__
void
calculatePmeDirectElectrostaticPairIxn_kernel
(
PmeDirectElectrostaticParticle
&
atomI
,
PmeDirectElectrostaticParticle
&
atomJ
,
__device__
void
calculatePmeDirectElectrostaticPairIxn_kernel
(
PmeDirectElectrostaticParticle
&
atomI
,
PmeDirectElectrostaticParticle
&
atomJ
,
float
*
scalingFactors
,
float
*
outputForce
,
float
outputTorque
[
2
][
3
],
float
*
scalingFactors
,
float
*
outputForce
,
float
outputTorque
[
2
][
3
],
float
*
energy
float
*
energy
#ifdef AMOEBA_DEBUG
#ifdef AMOEBA_DEBUG
,
float4
*
debugArray
,
float4
*
debugArray
#endif
#endif
...
@@ -870,10 +869,11 @@ __device__ void calculatePmeDirectElectrostaticPairIxn_kernel( PmeDirectElectros
...
@@ -870,10 +869,11 @@ __device__ void calculatePmeDirectElectrostaticPairIxn_kernel( PmeDirectElectros
// increment gradient due to force and torque on first site;
// increment gradient due to force and torque on first site;
outputForce
[
0
]
=
-
conversionFactor
*
(
ftm2
[
1
]
+
ftm2i
[
1
]);
outputForce
[
0
]
=
conversionFactor
*
(
ftm2
[
1
]
+
ftm2i
[
1
]);
outputForce
[
1
]
=
-
conversionFactor
*
(
ftm2
[
2
]
+
ftm2i
[
2
]);
outputForce
[
1
]
=
conversionFactor
*
(
ftm2
[
2
]
+
ftm2i
[
2
]);
outputForce
[
2
]
=
-
conversionFactor
*
(
ftm2
[
3
]
+
ftm2i
[
3
]);
outputForce
[
2
]
=
conversionFactor
*
(
ftm2
[
3
]
+
ftm2i
[
3
]);
conversionFactor
*=
-
1.0
;
outputTorque
[
0
][
0
]
=
conversionFactor
*
(
ttm2
[
1
]
+
ttm2i
[
1
]);
outputTorque
[
0
][
0
]
=
conversionFactor
*
(
ttm2
[
1
]
+
ttm2i
[
1
]);
outputTorque
[
0
][
1
]
=
conversionFactor
*
(
ttm2
[
2
]
+
ttm2i
[
2
]);
outputTorque
[
0
][
1
]
=
conversionFactor
*
(
ttm2
[
2
]
+
ttm2i
[
2
]);
outputTorque
[
0
][
2
]
=
conversionFactor
*
(
ttm2
[
3
]
+
ttm2i
[
3
]);
outputTorque
[
0
][
2
]
=
conversionFactor
*
(
ttm2
[
3
]
+
ttm2i
[
3
]);
...
@@ -881,7 +881,6 @@ __device__ void calculatePmeDirectElectrostaticPairIxn_kernel( PmeDirectElectros
...
@@ -881,7 +881,6 @@ __device__ void calculatePmeDirectElectrostaticPairIxn_kernel( PmeDirectElectros
outputTorque
[
1
][
0
]
=
conversionFactor
*
(
ttm3
[
1
]
+
ttm3i
[
1
]);
outputTorque
[
1
][
0
]
=
conversionFactor
*
(
ttm3
[
1
]
+
ttm3i
[
1
]);
outputTorque
[
1
][
1
]
=
conversionFactor
*
(
ttm3
[
2
]
+
ttm3i
[
2
]);
outputTorque
[
1
][
1
]
=
conversionFactor
*
(
ttm3
[
2
]
+
ttm3i
[
2
]);
outputTorque
[
1
][
2
]
=
conversionFactor
*
(
ttm3
[
3
]
+
ttm3i
[
3
]);
outputTorque
[
1
][
2
]
=
conversionFactor
*
(
ttm3
[
3
]
+
ttm3i
[
3
]);
//outputTorque[1][2] = conversionFactor*(ttm3_2 + ttm3i_2);
#ifdef AMOEBA_DEBUG
#ifdef AMOEBA_DEBUG
int
debugIndex
=
0
;
int
debugIndex
=
0
;
...
@@ -1299,10 +1298,10 @@ void cudaComputeAmoebaPmeDirectElectrostatic( amoebaGpuContext amoebaGpu )
...
@@ -1299,10 +1298,10 @@ void cudaComputeAmoebaPmeDirectElectrostatic( amoebaGpuContext amoebaGpu )
}
}
delete
debugArray
;
delete
debugArray
;
#endif
#endif
// ---------------------------------------------------------------------------------------
cudaComputeAmoebaMapTorquesAndAddTotalForce
(
amoebaGpu
,
amoebaGpu
->
psTorque
,
amoebaGpu
->
psForce
,
gpu
->
psForce4
);
}
}
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -1315,7 +1314,6 @@ void cudaComputeAmoebaPmeDirectElectrostatic( amoebaGpuContext amoebaGpu )
...
@@ -1315,7 +1314,6 @@ void cudaComputeAmoebaPmeDirectElectrostatic( amoebaGpuContext amoebaGpu )
void
cudaComputeAmoebaPmeElectrostatic
(
amoebaGpuContext
amoebaGpu
)
void
cudaComputeAmoebaPmeElectrostatic
(
amoebaGpuContext
amoebaGpu
)
{
{
cudaComputeAmoebaPmeDirectElectrostatic
(
amoebaGpu
);
cudaComputeAmoebaPmeDirectElectrostatic
(
amoebaGpu
);
kCalculateAmoebaPME
(
amoebaGpu
);
kCalculateAmoebaPME
(
amoebaGpu
);
}
}
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeDirectElectrostatic.h
View file @
6b0ad778
...
@@ -236,9 +236,9 @@ if( atomI == targetAtom ){
...
@@ -236,9 +236,9 @@ if( atomI == targetAtom ){
if
(
atomI
<
cAmoebaSim
.
numberOfAtoms
){
if
(
atomI
<
cAmoebaSim
.
numberOfAtoms
){
calculatePmeSelfTorqueElectrostaticPairIxn_kernel
(
localParticle
);
calculatePmeSelfTorqueElectrostaticPairIxn_kernel
(
localParticle
);
//
float energy;
float
energy
;
//
calculatePmeSelfEnergyElectrostaticPairIxn_kernel( localParticle, &energy );
calculatePmeSelfEnergyElectrostaticPairIxn_kernel
(
localParticle
,
&
energy
);
//
totalEnergy += energy;
totalEnergy
+=
energy
;
}
}
// Write results
// Write results
...
@@ -282,10 +282,8 @@ if( atomI == targetAtom ){
...
@@ -282,10 +282,8 @@ if( atomI == targetAtom ){
#endif
#endif
}
}
else
// 100% utilization
else
{
{
// Read fixed atom data into registers and GRF
if
(
lasty
!=
y
)
if
(
lasty
!=
y
)
{
{
// load shared data
// load shared data
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeFixedEField.cu
View file @
6b0ad778
...
@@ -382,10 +382,11 @@ __device__ void calculateFixedFieldRealSpacePairIxn_kernel( FixedFieldParticle&
...
@@ -382,10 +382,11 @@ __device__ void calculateFixedFieldRealSpacePairIxn_kernel( FixedFieldParticle&
--------------------------------------------------------------------------------------- */
--------------------------------------------------------------------------------------- */
#ifdef AMOEBA_DEBUG
static
int
isNanOrInfinity
(
double
number
){
static
int
isNanOrInfinity
(
double
number
){
return
(
number
!=
number
||
number
==
std
::
numeric_limits
<
double
>::
infinity
()
||
number
==
-
std
::
numeric_limits
<
double
>::
infinity
())
?
1
:
0
;
return
(
number
!=
number
||
number
==
std
::
numeric_limits
<
double
>::
infinity
()
||
number
==
-
std
::
numeric_limits
<
double
>::
infinity
())
?
1
:
0
;
}
}
#endif
/**---------------------------------------------------------------------------------------
/**---------------------------------------------------------------------------------------
...
@@ -398,13 +399,9 @@ static int isNanOrInfinity( double number ){
...
@@ -398,13 +399,9 @@ static int isNanOrInfinity( double number ){
static
void
cudaComputeAmoebaPmeDirectFixedEField
(
amoebaGpuContext
amoebaGpu
)
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
);
...
@@ -421,8 +418,6 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -421,8 +418,6 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
unsigned
int
targetAtom
=
0
;
unsigned
int
targetAtom
=
0
;
#endif
int
maxPrint
=
3002
;
int
maxPrint
=
3002
;
amoebaGpu
->
psE_Field
->
Download
();
amoebaGpu
->
psE_Field
->
Download
();
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields In
\n
"
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields In
\n
"
);
...
@@ -448,6 +443,7 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
...
@@ -448,6 +443,7 @@ static void cudaComputeAmoebaPmeDirectFixedEField( amoebaGpuContext amoebaGpu )
}
}
(
void
)
fflush
(
amoebaGpu
->
log
);
(
void
)
fflush
(
amoebaGpu
->
log
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields End
\n
"
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Recip EFields End
\n
"
);
#endif
kClearFields_3
(
amoebaGpu
,
2
);
kClearFields_3
(
amoebaGpu
,
2
);
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaCudaPmeMutualInducedField.cu
View file @
6b0ad778
...
@@ -725,8 +725,6 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
...
@@ -725,8 +725,6 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
amoebaGpu
->
mutualInducedDone
=
done
;
amoebaGpu
->
mutualInducedDone
=
done
;
amoebaGpu
->
mutualInducedConverged
=
(
!
done
||
iteration
>
amoebaGpu
->
mutualInducedMaxIterations
)
?
0
:
1
;
amoebaGpu
->
mutualInducedConverged
=
(
!
done
||
iteration
>
amoebaGpu
->
mutualInducedMaxIterations
)
?
0
:
1
;
#ifdef AMOEBA_DEBUG
/*
if
(
0
){
if
(
0
){
std
::
vector
<
int
>
fileId
;
std
::
vector
<
int
>
fileId
;
//fileId.push_back( 0 );
//fileId.push_back( 0 );
...
@@ -736,8 +734,6 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
...
@@ -736,8 +734,6 @@ static void cudaComputeAmoebaPmeMutualInducedFieldBySOR( amoebaGpuContext amoeba
cudaLoadCudaFloatArray
(
gpu
->
natoms
,
3
,
amoebaGpu
->
psInducedDipolePolar
,
outputVector
);
cudaLoadCudaFloatArray
(
gpu
->
natoms
,
3
,
amoebaGpu
->
psInducedDipolePolar
,
outputVector
);
cudaWriteVectorOfDoubleVectorsToFile
(
"CudaPmeMI"
,
fileId
,
outputVector
);
cudaWriteVectorOfDoubleVectorsToFile
(
"CudaPmeMI"
,
fileId
,
outputVector
);
}
}
*/
#endif
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
}
}
...
...
plugins/amoeba/platforms/cuda/src/kernels/kCalculateAmoebaRotateFrame.cu
View file @
6b0ad778
...
@@ -389,17 +389,10 @@ void kCalculateAmoebaMultipoleForces(amoebaGpuContext amoebaGpu, bool hasAmoebaG
...
@@ -389,17 +389,10 @@ void kCalculateAmoebaMultipoleForces(amoebaGpuContext amoebaGpu, bool hasAmoebaG
if
(
amoebaGpu
->
multipoleNonbondedMethod
==
AMOEBA_NO_CUTOFF
){
if
(
amoebaGpu
->
multipoleNonbondedMethod
==
AMOEBA_NO_CUTOFF
){
cudaComputeAmoebaElectrostatic
(
amoebaGpu
);
cudaComputeAmoebaElectrostatic
(
amoebaGpu
);
}
else
{
cudaComputeAmoebaPmeElectrostatic
(
amoebaGpu
);
}
// map torques to forces
// map torques to forces
cudaComputeAmoebaMapTorquesAndAddTotalForce
(
amoebaGpu
,
amoebaGpu
->
psTorque
,
amoebaGpu
->
psForce
,
amoebaGpu
->
gpuContext
->
psForce4
);
cudaComputeAmoebaMapTorquesAndAddTotalForce
(
amoebaGpu
,
amoebaGpu
->
psTorque
,
amoebaGpu
->
psForce
,
amoebaGpu
->
gpuContext
->
psForce4
);
}
else
{
if
(
0
&&
amoebaGpu
->
log
){
cudaComputeAmoebaPmeElectrostatic
(
amoebaGpu
);
(
void
)
fprintf
(
amoebaGpu
->
log
,
"Done mapping torques -> forces%s
\n
"
,
methodName
.
c_str
()
);
fflush
(
NULL
);
(
void
)
fflush
(
NULL
);
}
}
}
}
...
...
plugins/amoeba/platforms/cuda/tests/AmoebaTinkerParameterFile.cpp
View file @
6b0ad778
...
@@ -3608,12 +3608,14 @@ Integrator* readAmoebaParameterFile( const std::string& inputParameterFile, MapS
...
@@ -3608,12 +3608,14 @@ Integrator* readAmoebaParameterFile( const std::string& inputParameterFile, MapS
}
}
}
else
if
(
field
==
"AmoebaRealPmeForce"
||
}
else
if
(
field
==
"AmoebaRealPmeForce"
||
field
==
"AmoebaKSpacePmeForce"
||
field
==
"AmoebaKSpacePmeForce"
||
field
==
"AmoebaDirAndSForce"
||
field
==
"AmoebaSelfPmeForce"
){
field
==
"AmoebaSelfPmeForce"
){
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
;
}
else
if
(
field
==
"AmoebaRealPmeEnergy"
||
}
else
if
(
field
==
"AmoebaRealPmeEnergy"
||
field
==
"AmoebaKSpacePmeEnergy"
||
field
==
"AmoebaKSpacePmeEnergy"
||
field
==
"AmoebaDirAndSEnergy"
||
field
==
"AmoebaSelfPmeEnergy"
){
field
==
"AmoebaSelfPmeEnergy"
){
double
value
=
atof
(
tokens
[
1
].
c_str
()
);
double
value
=
atof
(
tokens
[
1
].
c_str
()
);
std
::
vector
<
std
::
vector
<
double
>
>
vectorOfDoubleVectors
;
std
::
vector
<
std
::
vector
<
double
>
>
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