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
adb4ec5a
"wrappers/vscode:/vscode.git/clone" did not exist on "b788fdd643a80292aab6f9f31827fe3552bae237"
Commit
adb4ec5a
authored
Jan 05, 2009
by
Mark Friedrichs
Browse files
Mods
parent
0e675a19
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
938 additions
and
881 deletions
+938
-881
platforms/brook/src/BrookBonded.cpp
platforms/brook/src/BrookBonded.cpp
+2
-2
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
+34
-20
platforms/brook/src/BrookIntegrateVerletStepKernel.cpp
platforms/brook/src/BrookIntegrateVerletStepKernel.cpp
+3
-3
platforms/brook/src/BrookLangevinDynamics.cpp
platforms/brook/src/BrookLangevinDynamics.cpp
+660
-619
platforms/brook/src/BrookRemoveCMMotionKernel.cpp
platforms/brook/src/BrookRemoveCMMotionKernel.cpp
+9
-2
platforms/brook/src/BrookVerletDynamics.cpp
platforms/brook/src/BrookVerletDynamics.cpp
+212
-211
platforms/brook/src/gpu/kcommon.br
platforms/brook/src/gpu/kcommon.br
+8
-10
platforms/brook/src/gpu/kcommon.h
platforms/brook/src/gpu/kcommon.h
+6
-7
platforms/brook/src/gpu/kshakeh.br
platforms/brook/src/gpu/kshakeh.br
+3
-4
platforms/brook/src/gpu/kshakeh.h
platforms/brook/src/gpu/kshakeh.h
+0
-1
platforms/brook/src/gpu/kupdatemd.br
platforms/brook/src/gpu/kupdatemd.br
+1
-2
No files found.
platforms/brook/src/BrookBonded.cpp
View file @
adb4ec5a
...
...
@@ -1805,13 +1805,13 @@ void BrookBonded::computeForces( BrookStreamImpl& positionStream, BrookStreamImp
static
const
std
::
string
methodName
=
"BrookBonded::computeForces"
;
static
const
int
PrintOn
=
0
;
static
const
int
I_Stream
=
0
;
static
const
int
J_Stream
=
1
;
static
const
int
K_Stream
=
2
;
static
const
int
L_Stream
=
3
;
static
const
int
PrintOn
=
0
;
static
const
int
MaxErrorMessages
=
2
;
static
int
ErrorMessages
=
0
;
...
...
platforms/brook/src/BrookCalcKineticEnergyKernel.cpp
View file @
adb4ec5a
...
...
@@ -141,34 +141,48 @@ double BrookCalcKineticEnergyKernel::execute( OpenMMContextImpl& context ){
void
*
dataV
=
_openMMBrookInterface
.
getParticleVelocities
()
->
getData
(
1
);
float
*
velocity
=
(
float
*
)
dataV
;
double
energy
=
0.0
;
int
index
=
0
;
/*
if
(
0
&&
_numberOfParticles
){
printf
(
"BrookCalcKineticEnergyKernel:
\n
"
);
float
com
[
3
]
=
{
0.0
,
0.0
,
0.0
};
for ( int ii = 0; ii < _numberOfParticles; ii++, index += 3 ){
com[0] += velocity[index];
com[1] += velocity[index+1];
com[2] += velocity[index+2];
printf( " %d %.3f [%12.5e %12.5e %12.5e]\n", ii, _masses[ii], velocity[index], velocity[index+1], velocity[index+2] );
float
localEnergy
=
0.0
f
;
int
localIndex
=
0
;
float
massSum
=
0.0
f
;
for
(
int
ii
=
0
;
ii
<
_numberOfParticles
;
ii
++
,
localIndex
+=
3
){
com
[
0
]
+=
_masses
[
ii
]
*
velocity
[
localIndex
];
com
[
1
]
+=
_masses
[
ii
]
*
velocity
[
localIndex
+
1
];
com
[
2
]
+=
_masses
[
ii
]
*
velocity
[
localIndex
+
2
];
localEnergy
+=
_masses
[
ii
]
*
(
velocity
[
localIndex
]
*
velocity
[
localIndex
]
+
velocity
[
localIndex
+
1
]
*
velocity
[
localIndex
+
1
]
+
velocity
[
localIndex
+
2
]
*
velocity
[
localIndex
+
2
]);
massSum
+=
_masses
[
ii
];
printf
(
" %d %.3f [%12.5e %12.5e %12.5e]
\n
"
,
ii
,
_masses
[
ii
],
velocity
[
localIndex
],
velocity
[
localIndex
+
1
],
velocity
[
localIndex
+
2
]
);
}
printf( "Com [%12.5e %12.5e %12.5e]\n", com[0], com[1], com[2] );
index = 0;
float
inverseTotalMass
=
1.0
f
/
massSum
;
com
[
0
]
*=
inverseTotalMass
;
com
[
1
]
*=
inverseTotalMass
;
com
[
2
]
*=
inverseTotalMass
;
printf
(
"KE raw=%.5e Com [%12.5e %12.5e %12.5e]
\n
"
,
0.5
f
*
localEnergy
,
com
[
0
],
com
[
1
],
com
[
2
]
);
float
newcom
[
3
]
=
{
0.0
,
0.0
,
0.0
};
for ( int ii = 0; ii < _numberOfParticles; ii++, index += 3 ){
velocity[index] -= com[0];
velocity[index+1] -= com[1];
velocity[index+2] -= com[2];
newcom[0] += velocity[index];
newcom[1] += velocity[index+1];
newcom[2] += velocity[index+2];
localIndex
=
0
;
for
(
int
ii
=
0
;
ii
<
_numberOfParticles
;
ii
++
,
localIndex
+=
3
){
velocity
[
localIndex
]
-=
com
[
0
];
velocity
[
localIndex
+
1
]
-=
com
[
1
];
velocity
[
localIndex
+
2
]
-=
com
[
2
];
newcom
[
0
]
+=
velocity
[
localIndex
];
newcom
[
1
]
+=
velocity
[
localIndex
+
1
];
newcom
[
2
]
+=
velocity
[
localIndex
+
2
];
printf
(
" %d %.3f [%12.5e %12.5e %12.5e]
\n
"
,
ii
,
_masses
[
ii
],
velocity
[
localIndex
],
velocity
[
localIndex
+
1
],
velocity
[
localIndex
+
2
]
);
}
printf
(
"NewCom [%12.5e %12.5e %12.5e]
\n
"
,
newcom
[
0
],
newcom
[
1
],
newcom
[
2
]
);
index = 0;
*/
}
int
index
=
0
;
double
energy
=
0.0
;
for
(
int
ii
=
0
;
ii
<
_numberOfParticles
;
ii
++
,
index
+=
3
){
energy
+=
_masses
[
ii
]
*
(
velocity
[
index
]
*
velocity
[
index
]
+
velocity
[
index
+
1
]
*
velocity
[
index
+
1
]
+
velocity
[
index
+
2
]
*
velocity
[
index
+
2
]);
}
...
...
platforms/brook/src/BrookIntegrateVerletStepKernel.cpp
View file @
adb4ec5a
...
...
@@ -168,7 +168,7 @@ void BrookIntegrateVerletStepKernel::initialize( const System& system, const Ve
BrookOpenMMFloat
tolerance
=
static_cast
<
BrookOpenMMFloat
>
(
integrator
.
getConstraintTolerance
()
);
_brookShakeAlgorithm
->
setShakeTolerance
(
tolerance
);
_brookShakeAlgorithm
->
setMaxIterations
(
3
0
);
_brookShakeAlgorithm
->
setMaxIterations
(
4
0
);
if
(
printOn
&&
log
){
(
void
)
fprintf
(
log
,
"%s done w/ setup: particles=%d const=%d
\n
"
,
methodName
.
c_str
(),
numberOfParticles
,
numberOfConstraints
);
...
...
platforms/brook/src/BrookLangevinDynamics.cpp
View file @
adb4ec5a
This diff is collapsed.
Click to expand it.
platforms/brook/src/BrookRemoveCMMotionKernel.cpp
View file @
adb4ec5a
...
...
@@ -96,7 +96,9 @@ void BrookRemoveCMMotionKernel::initialize( const System& system, const CMMotion
// ---------------------------------------------------------------------------------------
// static const std::string methodName = "BrookRemoveCMMotionKernel::initialize";
static
const
std
::
string
methodName
=
"BrookRemoveCMMotionKernel::initialize"
;
static
const
int
PrintOn
=
0
;
FILE
*
log
=
getLog
();
// ---------------------------------------------------------------------------------------
...
...
@@ -110,6 +112,11 @@ void BrookRemoveCMMotionKernel::initialize( const System& system, const CMMotion
_brookVelocityCenterOfMassRemoval
=
new
BrookVelocityCenterOfMassRemoval
();
_brookVelocityCenterOfMassRemoval
->
setup
(
masses
,
getPlatform
()
);
if
(
PrintOn
&&
log
){
(
void
)
fprintf
(
log
,
"%s
\n
"
,
methodName
.
c_str
()
);
(
void
)
fflush
(
log
);
}
return
;
}
...
...
@@ -162,7 +169,7 @@ void BrookRemoveCMMotionKernel::execute( OpenMMContextImpl& context ){
// ---------------------------------------------------------------------------------------
//
static const std::string methodName = "BrookRemoveCMMotionKernel::execute";
static
const
std
::
string
methodName
=
"BrookRemoveCMMotionKernel::execute"
;
// ---------------------------------------------------------------------------------------
...
...
platforms/brook/src/BrookVerletDynamics.cpp
View file @
adb4ec5a
...
...
@@ -140,7 +140,7 @@ int BrookVerletDynamics::updateParameters( double stepSize ){
static
int
showUpdate
=
1
;
static
int
maxShowUpdate
=
3
;
static
const
std
::
string
methodName
=
"
\n
BrookVerletDynamics::updateParameters"
;
static
const
std
::
string
methodName
=
"BrookVerletDynamics::updateParameters"
;
// ---------------------------------------------------------------------------------------
...
...
@@ -151,7 +151,7 @@ int BrookVerletDynamics::updateParameters( double stepSize ){
if
(
showUpdate
&&
getLog
()
&&
(
showUpdate
++
<
maxShowUpdate
)
){
std
::
string
contents
=
getContentsString
(
);
(
void
)
fprintf
(
getLog
(),
"%s contents
\n
%s"
,
methodName
,
contents
.
c_str
()
);
(
void
)
fprintf
(
getLog
(),
"%s contents
\n
%s"
,
methodName
.
c_str
()
,
contents
.
c_str
()
);
(
void
)
fflush
(
getLog
()
);
}
...
...
@@ -160,215 +160,6 @@ int BrookVerletDynamics::updateParameters( double stepSize ){
}
/**
* Update
*
* @param positions particle positions
* @param velocities particle velocities
* @param forces particle forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
*
* @return DefaultReturnValue
*
*/
int
BrookVerletDynamics
::
update
(
BrookStreamImpl
&
positionStream
,
BrookStreamImpl
&
velocityStream
,
const
BrookStreamImpl
&
forceStreamC
,
BrookShakeAlgorithm
&
brookShakeAlgorithm
){
// ---------------------------------------------------------------------------------------
static
std
::
string
methodName
=
"
\n
BrookVerletDynamics::update"
;
static
const
int
PrintOn
=
0
;
// ---------------------------------------------------------------------------------------
BrookStreamImpl
&
forceStream
=
const_cast
<
BrookStreamImpl
&>
(
forceStreamC
);
if
(
(
1
||
PrintOn
)
&&
getLog
()
){
static
int
showAux
=
1
;
if
(
showAux
){
showAux
=
0
;
/*
std::string contents = _brookVelocityCenterOfMassRemoval->getContentsString( );
(void) fprintf( getLog(), "%s VelocityCenterOfMassRemoval contents\n%s", methodName, contents.c_str() );
*/
(
void
)
fprintf
(
getLog
(),
"%s Shake contents
\n
%s"
,
methodName
,
brookShakeAlgorithm
.
getContentsString
().
c_str
()
);
(
void
)
fflush
(
getLog
()
);
}
}
// To Shake or not to Shake
if
(
brookShakeAlgorithm
.
getNumberOfConstraints
()
>
0
){
// integration step
kupdate_md1
(
(
float
)
getStepSize
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
forceStream
.
getBrookStream
(),
getInverseMassStream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
()
);
// diagnostics
if
(
PrintOn
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kupdate_md_verlet: particleStrW=%3d step=%.5f"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
(),
getStepSize
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
InverseMassStream
\n
"
);
getInverseMassStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStream
\n
"
);
BrookStreamInternal
*
brookStreamInternalF
=
forceStream
.
getBrookStreamImpl
();
brookStreamInternalF
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalV
=
velocityStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
VelocityStream
\n
"
);
brookStreamInternalV
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
}
kshakeh_fix1
(
(
float
)
brookShakeAlgorithm
.
getMaxIterations
(),
(
float
)
getVerletDynamicsParticleStreamWidth
(),
brookShakeAlgorithm
.
getShakeTolerance
(),
brookShakeAlgorithm
.
getShakeParticleIndicesStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeParticleParameterStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
getBrookStream
()
);
if
(
(
1
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kshakeh_fix1: particleStrW=%3d"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeParticleIndicesStream
\n
"
);
brookShakeAlgorithm
.
getShakeParticleIndicesStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeParticleParameterStream
\n
"
);
brookShakeAlgorithm
.
getShakeParticleParameterStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons0
\n
"
);
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons1
\n
"
);
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons2
\n
"
);
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons3
\n
"
);
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
printToFile
(
getLog
()
);
}
// second Shake gather
kshakeh_update2_fix1
(
(
float
)
getVerletDynamicsParticleStreamWidth
(),
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
()
);
if
(
(
1
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kshakeh_update2_fix1: particleStrW=%3d"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeInverseMapStream
\n
"
);
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons0
\n
"
);
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons1
\n
"
);
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons2
\n
"
);
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons3
\n
"
);
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
printToFile
(
getLog
()
);
}
// second integration step
float
inverseStepSize
=
1.0
f
/
getStepSize
();
kupdate_md2
(
inverseStepSize
,
getXPrimeStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
positionStream
.
getBrookStream
()
);
if
(
(
1
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kupdate_md2: inverseStepSize=%3e"
,
methodName
.
c_str
(),
inverseStepSize
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
brookStreamInternalPos
=
velocityStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
VelocityStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
}
}
else
{
kupdateMdNoShake
(
getStepSize
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
forceStream
.
getBrookStream
(),
getInverseMassStream
()
->
getBrookStream
(),
velocityStream
.
getBrookStream
(),
positionStream
.
getBrookStream
()
);
}
//_brookVelocityCenterOfMassRemoval->removeVelocityCenterOfMass( velocities );
return
DefaultReturnValue
;
};
/**
* Get Particle stream size
*
...
...
@@ -656,3 +447,213 @@ std::string BrookVerletDynamics::getContentsString( int level ) const {
return
message
.
str
();
}
/**
* Update
*
* @param positions particle positions
* @param velocities particle velocities
* @param forces particle forces
* @param brookShakeAlgorithm BrookShakeAlgorithm reference
*
* @return DefaultReturnValue
*
*/
int
BrookVerletDynamics
::
update
(
BrookStreamImpl
&
positionStream
,
BrookStreamImpl
&
velocityStream
,
const
BrookStreamImpl
&
forceStreamC
,
BrookShakeAlgorithm
&
brookShakeAlgorithm
){
// ---------------------------------------------------------------------------------------
static
std
::
string
methodName
=
"
\n
BrookVerletDynamics::update"
;
static
const
int
PrintOn
=
0
;
// ---------------------------------------------------------------------------------------
BrookStreamImpl
&
forceStream
=
const_cast
<
BrookStreamImpl
&>
(
forceStreamC
);
if
(
(
1
||
PrintOn
)
&&
getLog
()
){
static
int
showAux
=
1
;
if
(
showAux
){
showAux
=
0
;
/*
std::string contents = _brookVelocityCenterOfMassRemoval->getContentsString( );
(void) fprintf( getLog(), "%s VelocityCenterOfMassRemoval contents\n%s", methodName, contents.c_str() );
*/
(
void
)
fprintf
(
getLog
(),
"%s Shake contents
\n
%s"
,
methodName
.
c_str
(),
brookShakeAlgorithm
.
getContentsString
().
c_str
()
);
(
void
)
fflush
(
getLog
()
);
}
}
// To Shake or not to Shake
if
(
brookShakeAlgorithm
.
getNumberOfConstraints
()
>
0
){
// integration step
kupdate_md1
(
(
float
)
getStepSize
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
forceStream
.
getBrookStream
(),
getInverseMassStream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
()
);
// diagnostics
if
(
PrintOn
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kupdate_md1: particleStrW=%3d step=%.5f"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
(),
getStepSize
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
InverseMassStream
\n
"
);
getInverseMassStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ForceStream
\n
"
);
BrookStreamInternal
*
brookStreamInternalF
=
forceStream
.
getBrookStreamImpl
();
brookStreamInternalF
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalV
=
velocityStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
VelocityStream
\n
"
);
brookStreamInternalV
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
}
// Shake
kshakeh_fix1
(
(
float
)
brookShakeAlgorithm
.
getMaxIterations
(),
(
float
)
getVerletDynamicsParticleStreamWidth
(),
brookShakeAlgorithm
.
getShakeTolerance
(),
brookShakeAlgorithm
.
getShakeParticleIndicesStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeParticleParameterStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
getBrookStream
()
);
if
(
(
0
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kshakeh_fix1: particleStrW=%3d"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeParticleIndicesStream
\n
"
);
brookShakeAlgorithm
.
getShakeParticleIndicesStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeParticleParameterStream
\n
"
);
brookShakeAlgorithm
.
getShakeParticleParameterStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons0
\n
"
);
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons1
\n
"
);
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons2
\n
"
);
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons3
\n
"
);
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
printToFile
(
getLog
()
);
}
// Shake gather
kshakeh_update1_fix1
(
(
float
)
getVerletDynamicsParticleStreamWidth
(),
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
getBrookStream
(),
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
getBrookStream
(),
getXPrimeStream
()
->
getBrookStream
()
);
//positionStream.getBrookStream() );
if
(
(
0
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kshakeh_update2_fix1: particleStrW=%3d"
,
methodName
.
c_str
(),
getVerletDynamicsParticleStreamWidth
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeInverseMapStream
\n
"
);
brookShakeAlgorithm
.
getShakeInverseMapStream
()
->
printToFile
(
getLog
()
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons0
\n
"
);
brookShakeAlgorithm
.
getShakeXCons0Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons1
\n
"
);
brookShakeAlgorithm
.
getShakeXCons1Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons2
\n
"
);
brookShakeAlgorithm
.
getShakeXCons2Stream
()
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
ShakeXCons3
\n
"
);
brookShakeAlgorithm
.
getShakeXCons3Stream
()
->
printToFile
(
getLog
()
);
}
// second integration step
float
inverseStepSize
=
1.0
f
/
getStepSize
();
kupdate_md2
(
inverseStepSize
,
getXPrimeStream
()
->
getBrookStream
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
positionStream
.
getBrookStream
()
);
if
(
(
0
||
PrintOn
)
&&
getLog
()
){
(
void
)
fprintf
(
getLog
(),
"
\n
%s Post kupdate_md2: inverseStepSize=%3e"
,
methodName
.
c_str
(),
inverseStepSize
);
BrookStreamInternal
*
brookStreamInternalPos
=
positionStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
PositionStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
(
void
)
fprintf
(
getLog
(),
"
\n
XPrimeStream
\n
"
);
getXPrimeStream
()
->
printToFile
(
getLog
()
);
brookStreamInternalPos
=
velocityStream
.
getBrookStreamImpl
();
(
void
)
fprintf
(
getLog
(),
"
\n
VelocityStream
\n
"
);
brookStreamInternalPos
->
printToFile
(
getLog
()
);
}
}
else
{
kupdateMdNoShake
(
getStepSize
(),
positionStream
.
getBrookStream
(),
velocityStream
.
getBrookStream
(),
forceStream
.
getBrookStream
(),
getInverseMassStream
()
->
getBrookStream
(),
velocityStream
.
getBrookStream
(),
positionStream
.
getBrookStream
()
);
}
//_brookVelocityCenterOfMassRemoval->removeVelocityCenterOfMass( velocities );
return
DefaultReturnValue
;
}
platforms/brook/src/gpu/kcommon.br
View file @
adb4ec5a
...
...
@@ -30,31 +30,29 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
//Inverse of above
kernel void kgetxyz( float4 instr<>, out float3 outstr<> ) {
kernel void kgetxyz( float4 instr<>, out float3 outstr<> ){
outstr = instr.xyz;
}
//Zeroes out a stream
kernel void kzerof3( out float3 outstr<> )
{
kernel void kzerof3( out float3 outstr<> ){
outstr = float3( 0.0f, 0.0f, 0.0f );
}
//Zeros out a stream
kernel void kzerof4( out float4 outstr<> )
{
kernel void kzerof4( out float4 outstr<> ){
outstr = float4( 0.0f, 0.0f, 0.0f, 0.0f );
}
kernel void ksetf4( float4 val, out float4 outstr<> )
{
kernel void ksetf4( float4 val, out float4 outstr<> ){
outstr = val;
}
kernel void ksetStr3( float3 instr<>, out float3 outstr<> )
{
kernel void ksetStr3( float3 instr<>, out float3 outstr<> ){
outstr = instr;
}
kernel void kadd3( float3
val
<>, out float3 outstr<> )
{
outstr
+
=
val
;
kernel void kadd3( float3
in1<>, float3 in2
<>, out float3 outstr<> ){
outstr
=
in1 + in2
;
}
platforms/brook/src/gpu/kcommon.h
View file @
adb4ec5a
...
...
@@ -33,15 +33,14 @@
* -------------------------------------------------------------------------- */
void
kgetxyz
(
::
brook
::
stream
instr
,
::
brook
::
stream
outstr
);
void
kgetxyz
(
::
brook
::
stream
instr
,
::
brook
::
stream
outstr
);
void
kzerof3
(
::
brook
::
stream
outstr
);
void
kzerof4
(
::
brook
::
stream
outstr
);
void
kzerof4
(
::
brook
::
stream
outstr
);
void
kzerof3
(
::
brook
::
stream
outstr
);
void
kzerof4
(
::
brook
::
stream
outstr
);
void
kzerof4
(
::
brook
::
stream
outstr
);
void
ksetf4
(
const
float4
val
,
::
brook
::
stream
outstr
);
void
kadd3
(
::
brook
::
stream
instr
,
::
brook
::
stream
outstr
);
void
ksetf4
(
const
float4
val
,
::
brook
::
stream
outstr
);
void
kadd3
(
::
brook
::
stream
instr
1
,
::
brook
::
stream
instr2
,
::
brook
::
stream
outstr
);
void
ksetStr3
(
::
brook
::
stream
instr
,
::
brook
::
stream
outstr
);
#endif // __KCOMMON_H__
platforms/brook/src/gpu/kshakeh.br
View file @
adb4ec5a
...
...
@@ -145,7 +145,7 @@ kshakeh_fix1(
acor = ( ld1 - 2 * rrpr - rpsqij ) * params.y / ( rrpr + rij1sq ) ;
diff = abs( ld1 - 2 * rrpr - rpsqij ) / (params.z * tolerance );
acor = (diff < 1.0f) ? 0.0f : acor;
converged = acor;
converged =
abs(
acor
)
;
dr = rij1 * acor;
xpi += dr * params.x;
...
...
@@ -160,7 +160,7 @@ kshakeh_fix1(
diff = abs( ld2 - 2.0f * rrpr - rpsqij ) / (params.z * tolerance );
acor = mask2 * ( ld2 - 2.0f * rrpr - rpsqij ) * params.y / ( rrpr + rij2sq ) ;
acor = (diff < 1.0f) ? 0.0f : acor;
converged += acor;
converged +=
abs(
acor
)
;
dr = rij2 * acor;
xpi += dr * params.x;
...
...
@@ -174,7 +174,7 @@ kshakeh_fix1(
diff = abs( ld3 - 2.0f * rrpr - rpsqij ) / (params.z * tolerance );
acor = mask3 * ( ld3 - 2.0f * rrpr - rpsqij ) * params.y / ( rrpr + rij3sq ) ;
acor = (diff < 1.0f) ? 0.0f : acor;
converged += acor;
converged +=
abs(
acor
)
;
dr = rij3 * acor;
xpi += dr * params.x;
...
...
@@ -195,7 +195,6 @@ kshakeh_fix1(
kernel void kshakeh_update1_fix1(
float strwidth, //width of cposq streams
float2 invmap<>, //shakeh inverse map
float3 posq<>, //old positions
float3 posqp<>, //deltas from sd2
float3 cposq0[][], //constrained delta for heavy atom
float3 cposq1[][], //ditto for h1
...
...
platforms/brook/src/gpu/kshakeh.h
View file @
adb4ec5a
...
...
@@ -45,7 +45,6 @@ void kshakeh_fix1 (
void
kshakeh_update1_fix1
(
const
float
strwidth
,
::
brook
::
stream
invmap
,
::
brook
::
stream
posq
,
::
brook
::
stream
posqp
,
::
brook
::
stream
cposq0
,
::
brook
::
stream
cposq1
,
...
...
platforms/brook/src/gpu/kupdatemd.br
View file @
adb4ec5a
...
...
@@ -48,8 +48,8 @@ kernel void kupdate_md2(
out float3 vnew<>, //Corrected velocities
out float3 posqnew<> //equal to posqp, avoids an extra call to copy
){
posqnew = posq + posqp;
vnew = posqp * dtinv;
posqnew = posq + posqp;
}
kernel void kupdateMdNoShake(
...
...
@@ -64,4 +64,3 @@ kernel void kupdateMdNoShake(
outv = v + dt*invmass*f;
posqp += dt*outv;
}
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