Commit adb4ec5a authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods

parent 0e675a19
......@@ -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;
......
......@@ -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 com[3] = { 0.0, 0.0, 0.0 };
float localEnergy = 0.0f;
int localIndex = 0;
float massSum = 0.0f;
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.0f/massSum;
com[0] *= inverseTotalMass;
com[1] *= inverseTotalMass;
com[2] *= inverseTotalMass;
printf( "KE raw=%.5e Com [%12.5e %12.5e %12.5e]\n", 0.5f*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]);
}
......
......@@ -118,7 +118,7 @@ int BrookIntegrateVerletStepKernel::setLog( FILE* log ){
*
*/
void BrookIntegrateVerletStepKernel::initialize( const System& system, const VerletIntegrator& integrator ){
void BrookIntegrateVerletStepKernel::initialize( const System& system, const VerletIntegrator& integrator ){
// ---------------------------------------------------------------------------------------
......@@ -166,9 +166,9 @@ void BrookIntegrateVerletStepKernel::initialize( const System& system, const Ve
_brookShakeAlgorithm->setLog( log );
_brookShakeAlgorithm->setup( masses, constraintIndicesVector, constraintLengths, getPlatform() );
BrookOpenMMFloat tolerance = static_cast<BrookOpenMMFloat>( integrator.getConstraintTolerance() );
BrookOpenMMFloat tolerance = static_cast<BrookOpenMMFloat>( integrator.getConstraintTolerance() );
_brookShakeAlgorithm->setShakeTolerance( tolerance );
_brookShakeAlgorithm->setMaxIterations( 30 );
_brookShakeAlgorithm->setMaxIterations( 40 );
if( printOn && log ){
(void) fprintf( log, "%s done w/ setup: particles=%d const=%d\n", methodName.c_str(), numberOfParticles, numberOfConstraints );
......
......@@ -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";
// ---------------------------------------------------------------------------------------
......
......@@ -140,7 +140,7 @@ int BrookVerletDynamics::updateParameters( double stepSize ){
static int showUpdate = 1;
static int maxShowUpdate = 3;
static const std::string methodName = "\nBrookVerletDynamics::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 = "\nBrookVerletDynamics::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(), "\nInverseMassStream\n" );
getInverseMassStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nForceStream\n" );
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
brookStreamInternalF->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalV = velocityStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nVelocityStream\n" );
brookStreamInternalV->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\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(), "\nShakeParticleIndicesStream\n" );
brookShakeAlgorithm.getShakeParticleIndicesStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeParticleParameterStream\n" );
brookShakeAlgorithm.getShakeParticleParameterStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons0\n" );
brookShakeAlgorithm.getShakeXCons0Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons1\n" );
brookShakeAlgorithm.getShakeXCons1Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons2\n" );
brookShakeAlgorithm.getShakeXCons2Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons3\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(), "\nShakeInverseMapStream\n" );
brookShakeAlgorithm.getShakeInverseMapStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons0\n" );
brookShakeAlgorithm.getShakeXCons0Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons1\n" );
brookShakeAlgorithm.getShakeXCons1Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons2\n" );
brookShakeAlgorithm.getShakeXCons2Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons3\n" );
brookShakeAlgorithm.getShakeXCons3Stream()->printToFile( getLog() );
}
// second integration step
float inverseStepSize = 1.0f/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(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
brookStreamInternalPos = velocityStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nVelocityStream\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 = "\nBrookVerletDynamics::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(), "\nInverseMassStream\n" );
getInverseMassStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nForceStream\n" );
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
brookStreamInternalF->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalV = velocityStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nVelocityStream\n" );
brookStreamInternalV->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\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(), "\nShakeParticleIndicesStream\n" );
brookShakeAlgorithm.getShakeParticleIndicesStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeParticleParameterStream\n" );
brookShakeAlgorithm.getShakeParticleParameterStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons0\n" );
brookShakeAlgorithm.getShakeXCons0Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons1\n" );
brookShakeAlgorithm.getShakeXCons1Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons2\n" );
brookShakeAlgorithm.getShakeXCons2Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons3\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(), "\nShakeInverseMapStream\n" );
brookShakeAlgorithm.getShakeInverseMapStream()->printToFile( getLog() );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons0\n" );
brookShakeAlgorithm.getShakeXCons0Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons1\n" );
brookShakeAlgorithm.getShakeXCons1Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons2\n" );
brookShakeAlgorithm.getShakeXCons2Stream()->printToFile( getLog() );
(void) fprintf( getLog(), "\nShakeXCons3\n" );
brookShakeAlgorithm.getShakeXCons3Stream()->printToFile( getLog() );
}
// second integration step
float inverseStepSize = 1.0f/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(), "\nPositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( getLog(), "\nXPrimeStream\n" );
getXPrimeStream()->printToFile( getLog() );
brookStreamInternalPos = velocityStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nVelocityStream\n" );
brookStreamInternalPos->printToFile( getLog() );
}
} else {
kupdateMdNoShake( getStepSize(),
positionStream.getBrookStream(),
velocityStream.getBrookStream(),
forceStream.getBrookStream(),
getInverseMassStream()->getBrookStream(),
velocityStream.getBrookStream(),
positionStream.getBrookStream() );
}
//_brookVelocityCenterOfMassRemoval->removeVelocityCenterOfMass( velocities );
return DefaultReturnValue;
}
......@@ -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<> ) {
outstr = instr;
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;
}
......@@ -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 instr1, ::brook::stream instr2, ::brook::stream outstr );
void ksetStr3( ::brook::stream instr, ::brook::stream outstr );
#endif // __KCOMMON_H__
......@@ -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
......
......@@ -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,
......
......@@ -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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment