"plugins/vscode:/vscode.git/clone" did not exist on "c04bc13738fb6277fef4cb6d0eed13d85b78b6fd"
Commit d6132ea0 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods

parent ce8d2142
......@@ -1073,10 +1073,11 @@ int BrookBonded::_loadInvMaps( int nbondeds, int nparticles, int *particles, int
static const std::string methodName = "BrookBonded::_loadInvMaps";
static int printOn = 0;
double dangleValue = 0.0;
FILE* log = NULL;
// ---------------------------------------------------------------------------------------
printOn = (printOn && getLog()) ? 1 : 0;
printOn = (printOn && getLog()) ? printOn : 0;
// get particle stream size
......@@ -1121,10 +1122,11 @@ int BrookBonded::_loadInvMaps( int nbondeds, int nparticles, int *particles, int
}
if( printOn ){
(void) fprintf( getLog(), "%s force stream strms=%d nbondeds=%d max counts=[%d %d %d %d] strSz&Wd=%d %d\n", methodName.c_str(), getNumberOfForceStreams(),
log = getLog();
(void) fprintf( log, "%s force stream strms=%d nbondeds=%d max counts=[%d %d %d %d] strSz&Wd=%d %d\n", methodName.c_str(), getNumberOfForceStreams(),
nbondeds, getMaxInverseMapStreamCount(0), getMaxInverseMapStreamCount(1), getMaxInverseMapStreamCount(2), getMaxInverseMapStreamCount(3),
particleStreamSize, particleStreamWidth );
(void) fflush( getLog() );
(void) fflush( log );
}
// load data
......@@ -1134,18 +1136,17 @@ int BrookBonded::_loadInvMaps( int nbondeds, int nparticles, int *particles, int
block[jj] = -1.0f;
}
(void) fprintf( stderr, "%s _gpuCalcInvMap %d getInverseMapStreamCount=%d\n", methodName.c_str(), ii, getInverseMapStreamCount( ii ) ); (void) fflush( getLog() );
//(void) fprintf( stderr, "%s _gpuCalcInvMap %d getInverseMapStreamCount=%d\n", methodName.c_str(), ii, getInverseMapStreamCount( ii ) ); (void) fflush( log );
_gpuCalcInvMap( ii, 4, nbondeds, nparticles, particles, getMaxInverseMapStreamCount( ii ), counts, invmaps, &(_inverseMapStreamCount[ii]) );
_gpuPrintInvMaps( _inverseMapStreamCount[ii], nparticles, counts, invmaps, stderr );
//_gpuPrintInvMaps( _inverseMapStreamCount[ii], nparticles, counts, invmaps, stderr );
_validateInverseMapStreamCount( ii, _inverseMapStreamCount[ii] );
for( int jj = 0; jj < _inverseMapStreamCount[ii]; jj++ ){
_inverseStreamMaps[ii][jj]->loadFromArray( invmaps[jj] );
//if( printOn ){
if( 1 ){
if( printOn ){
FILE* log = stderr;
(void) fprintf( log, "%s inverseMap stream strms=%d count=%d index=%d %d InverseMapStreamCount[ii]=%d max=%d\n",
methodName.c_str(), getNumberOfForceStreams(), _inverseMapStreamCount[ii], ii, jj,
......@@ -1175,8 +1176,8 @@ _gpuPrintInvMaps( _inverseMapStreamCount[ii], nparticles, counts, invmaps, stder
// diagnostics
if( printOn ){
(void) fprintf( getLog(), "%s done\n", methodName.c_str() );
(void) fflush( getLog() );
(void) fprintf( log, "%s done\n", methodName.c_str() );
(void) fflush( log );
}
// free memory
......@@ -1587,13 +1588,20 @@ int BrookBonded::_gpuCalcInvMap( int posflag, int niparticles, int nints, int np
//char value[MAX_LINE_CHARS];
static const char* Set = "Set";
static const char* NotSet = "Not set";
static const int printOn = 0;
int printOn = 0;
FILE* log;
int particleRange[2] = { 90000000, -90000000 };
int mapnumRange[2] = { 90000000, -90000000 };
// ---------------------------------------------------------------------------------------
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
memset( counts, 0, sizeof( int )*nparticles );
for( i = 0; i < nmaps; i++ ){
......@@ -1608,9 +1616,9 @@ int BrookBonded::_gpuCalcInvMap( int posflag, int niparticles, int nints, int np
//Now note down the positions where each particle occurs
if( printOn && getLog() ){
(void) fprintf( getLog(), "%s: pos=%d ni=%d nints=%d nparticles=%d nmaps=<%d>\n", methodName.c_str(), posflag, niparticles, nints, nparticles, nmaps );
(void) fflush( getLog() );
if( printOn ){
(void) fprintf( log, "%s: pos=%d ni=%d nints=%d nparticles=%d nmaps=<%d>\n", methodName.c_str(), posflag, niparticles, nints, nparticles, nmaps );
(void) fflush( log );
}
for( i = 0; i < nints; i++ ){
......@@ -1622,18 +1630,19 @@ int BrookBonded::_gpuCalcInvMap( int posflag, int niparticles, int nints, int np
continue;
}
if( particle < particleRange[0] ){
if( particle < particleRange[0] ){
particleRange[0] = particle;
}
if( particle > particleRange[1] ){
}
if( particle > particleRange[1] ){
particleRange[1] = particle;
}
}
//Check to make sure we're inside the limits
if ( counts[particle] > nmaps * 4 ){
if( printOn && getLog() ){
(void) fprintf( getLog(), "%s Particle %d has too many proper torsions (%d, max %d)\n",
if( printOn ){
(void) fprintf( log, "%s Particle %d has too many proper torsions (%d, max %d)\n",
methodName.c_str(), particle, counts[particle], nmaps*4 );
(void) fflush( getLog() );
(void) fflush( log );
}
std::stringstream message;
message << methodName << " Particle " << particle << " has too many proper torsions; valid range:(" << counts[particle] << ", " << nmaps*4 << ")";
......@@ -1659,9 +1668,9 @@ if( particle > particleRange[1] ){
case 2: invmaps[mapnum][particle].z = (float) i; break;
case 3: invmaps[mapnum][particle].w = (float) i; break;
default:
if( printOn && getLog() ){
(void) fprintf( getLog(), "mapcomp %d invalid -- impossible!\n", mapcomp );
(void) fflush( getLog() );
if( printOn ){
(void) fprintf( log, "mapcomp %d invalid -- impossible!\n", mapcomp );
(void) fflush( log );
}
std::stringstream message;
message << methodName << " mapcomp " << mapcomp << " invalid -- actually impossible!";
......@@ -1671,12 +1680,12 @@ if( particle > particleRange[1] ){
counts[particle]++;
if( mapnum < mapnumRange[0] ){
if( mapnum < mapnumRange[0] ){
mapnumRange[0] = mapnum;
}
if( mapnum > mapnumRange[1] ){
}
if( mapnum > mapnumRange[1] ){
mapnumRange[1] = mapnum;
}
}
//fprintf( gpu->log, "%d particle=%d mapcomp=%d counts[]=%d mapnum=%d\n", i, particle, mapcomp, counts[particle], mapnum );
......@@ -1684,11 +1693,11 @@ if( mapnum > mapnumRange[1] ){
(*nimaps)++;
if( printOn && getLog() ){
(void) fprintf( getLog(), "%s mnmaps=%d Ranges: particle [%d %d] mapnum [%d %d]\n",
if( printOn ){
(void) fprintf( log, "%s mnmaps=%d Ranges: particle [%d %d] mapnum [%d %d]\n",
methodName.c_str(), *nimaps, particleRange[0], particleRange[1], mapnumRange[0], mapnumRange[1] );
(void) fflush( getLog() );
}
(void) fflush( log );
}
return DefaultReturnValue;
}
......@@ -1830,6 +1839,7 @@ void BrookBonded::computeForces( BrookStreamImpl& positionStream, BrookStreamImp
static const std::string methodName = "BrookBonded::computeForces";
static int printOn = 0;
FILE* log;
static const int I_Stream = 0;
static const int J_Stream = 1;
......@@ -1878,7 +1888,7 @@ void BrookBonded::computeForces( BrookStreamImpl& positionStream, BrookStreamImp
// diagnostics
if( printOn ){
FILE* log = getLog();
log = getLog();
//FILE* log = stderr;
int countPrintInvMap[4] = { 3, 5, 2, 4 };
......@@ -2025,12 +2035,9 @@ void BrookBonded::computeForces( BrookStreamImpl& positionStream, BrookStreamImp
// diagnostics
if( printOn ){
FILE* log = getLog() ? getLog() : stderr;
(void) fprintf( log, "\nPost 3_4/3_5 && NB forces" );
(void) fprintf( log, "%s Post 3_4/3_5 forces\n", methodName.c_str() );
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
brookStreamInternalF->printToFile( log );
}
if( getInverseMapStreamCount( J_Stream ) == 1 && getInverseMapStreamCount( L_Stream ) == 1 ){
......@@ -2095,20 +2102,9 @@ void BrookBonded::computeForces( BrookStreamImpl& positionStream, BrookStreamImp
// diagnostics
if( printOn ){
FILE* log = getLog() ? getLog() : stderr;
(void) fprintf( log, "\nFinal NB & bonded forces" );
(void) fprintf( log, "%s Final forces", methodName.c_str() );
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
brookStreamInternalF->printToFile( log );
/*
void* dataV = brookStreamInternalF->getData(1);
float* data = (float*) dataV;
(void) fprintf( getLog(), "\nFinal NB & bonded forces RAW\n" );
for( int ii = 0; ii < _brookNonBonded->getNumberOfParticles()*3; ii += 3 ){
(void) fprintf( getLog(), "%d [%.6e %.6e %.6e]\n", ii, data[ii], data[ii+1], data[ii+2] );
}
*/
}
// ---------------------------------------------------------------------------------------
......
......@@ -128,11 +128,16 @@ void BrookCalcGBSAOBCForceKernel::initialize( const System& system, const GBSAOB
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcGBSAOBCForceKernel::initialize";
const int PrintOn = 0;
int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
FILE* log = getLog();
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
// ---------------------------------------------------------------------------------------
......@@ -159,7 +164,7 @@ void BrookCalcGBSAOBCForceKernel::initialize( const System& system, const GBSAOB
_openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this );
if( log && PrintOn ){
if( printOn ){
std::string contents = brookGbsa.getContentsString( );
(void) fprintf( log, "%s brookGbsa::contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log );
......
......@@ -126,11 +126,16 @@ void BrookCalcHarmonicBondForceKernel::initialize( const System& system, const H
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookCalcHarmonicBondForceKernel::initialize";
static const int PrintOn = 0;
int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
FILE* log = getLog();
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
// ---------------------------------------------------------------------------------------
......@@ -164,7 +169,7 @@ void BrookCalcHarmonicBondForceKernel::initialize( const System& system, const H
_openMMBrookInterface.setTriggerForceKernel( this );
_openMMBrookInterface.setTriggerEnergyKernel( this );
if( PrintOn && log ){
if( printOn ){
std::string contents = _brookBondParameters->getContentsString( );
(void) fprintf( log, "%s contents\n%s", methodName.c_str(), contents.c_str() );
(void) fflush( log );
......
......@@ -446,7 +446,7 @@ int BrookGbsa::calculateBornRadii( const Stream& positions ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookGbsa::calculateBornRadii";
static const int PrintOn = 0;
static const int printOn = 0;
// ---------------------------------------------------------------------------------------
......@@ -490,7 +490,7 @@ int BrookGbsa::calculateBornRadii( const Stream& positions ){
// diagnostics
if( PrintOn && getLog() ){
if( printOn && getLog() ){
(void) fprintf( getLog(), "\n%s: atms=%d\n", methodName.c_str(), numberOfParticles );
for( int ii = 0; ii < numberOfParticles; ii++ ){
......@@ -925,12 +925,20 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookGbsa::executeForces";
static const int PrintOn = 0;
int printOn = 0;
FILE* log;
float mergeNonObcForces = 1.0f;
float kcalMolTokJNM = -0.4184f;
// ---------------------------------------------------------------------------------------
//setLog( stderr );
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
float includeAceTerm = (float) (includeAce());
BrookFloatStreamInternal** gbsaForceStreams = getForceStreams();
......@@ -949,9 +957,8 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "\n%s Post kCalculateBornRadii: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
if( printOn ){
(void) fprintf( log, "\n%s Post kCalculateBornRadii: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
methodName.c_str(), getNumberOfParticles(),
getParticleSizeCeiling(),
getDuplicationFactor(),
......@@ -959,14 +966,14 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getPartialForceStreamWidth( ) );
BrookStreamInternal* brookStreamInternalF = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalF->printToFile( getLog() );
(void) fprintf( log, "\nPositionStream\n" );
brookStreamInternalF->printToFile( log );
(void) fprintf( getLog(), "\nRadii\n" );
getObcParticleRadii()->printToFile( getLog() );
(void) fprintf( log, "\nRadii\n" );
getObcParticleRadii()->printToFile( log );
(void) fprintf( getLog(), "\nObcScaledParticleRadii\n" );
getObcScaledParticleRadii()->printToFile( getLog() );
(void) fprintf( log, "\nObcScaledParticleRadii\n" );
getObcScaledParticleRadii()->printToFile( log );
}
......@@ -990,9 +997,9 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( 0 && PrintOn && getLog() ){
if( 0 && printOn ){
(void) fprintf( getLog(), "\n%s Post kPostCalculateBornRadii_nobranch: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
(void) fprintf( log, "\n%s Post kPostCalculateBornRadii_nobranch: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
methodName.c_str(), getNumberOfParticles(),
getParticleSizeCeiling(),
getDuplicationFactor(),
......@@ -1000,20 +1007,20 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getPartialForceStreamWidth( ) );
BrookStreamInternal* brookStreamInternalF = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPositionStream\n" );
brookStreamInternalF->printToFile( getLog() );
(void) fprintf( log, "\nPositionStream\n" );
brookStreamInternalF->printToFile( log );
(void) fprintf( getLog(), "\nInput\n" );
gbsaForceStreams[0]->printToFile( getLog() );
(void) fprintf( log, "\nInput\n" );
gbsaForceStreams[0]->printToFile( log );
(void) fprintf( getLog(), "\nObcParticleRadii\n" );
getObcParticleRadii()->printToFile( getLog() );
(void) fprintf( log, "\nObcParticleRadii\n" );
getObcParticleRadii()->printToFile( log );
(void) fprintf( getLog(), "\nBornR\n" );
getObcBornRadii()->printToFile( getLog() );
(void) fprintf( log, "\nBornR\n" );
getObcBornRadii()->printToFile( log );
(void) fprintf( getLog(), "\nObcChain\n" );
getObcChain()->printToFile( getLog() );
(void) fprintf( log, "\nObcChain\n" );
getObcChain()->printToFile( log );
}
......@@ -1042,9 +1049,9 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( PrintOn && getLog() ){
if( printOn ){
(void) fprintf( getLog(), "\nPost kObcLoop1: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
(void) fprintf( log, "\nPost kObcLoop1: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
getNumberOfParticles(),
getParticleSizeCeiling(),
getDuplicationFactor(),
......@@ -1054,19 +1061,19 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getSolventDielectric(), includeAceTerm );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPost kObcLoop1 PositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop1 PositionStream\n" );
brookStreamInternalPos->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop1 BornR\n" );
getObcBornRadii()->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop1 BornR\n" );
getObcBornRadii()->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop1 ParticleR\n" );
getObcParticleRadii()->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop1 ParticleR\n" );
getObcParticleRadii()->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop1 ForceStreams output\n" );
(void) fprintf( log, "\nPost kObcLoop1 ForceStreams output\n" );
for( int ii = 0; ii < 4; ii++ ){
(void) fprintf( getLog(), "\nPost kObcLoop1 ForceStream %d output\n", ii );
gbsaForceStreams[ii]->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop1 ForceStream %d output\n", ii );
gbsaForceStreams[ii]->printToFile( log );
}
}
......@@ -1095,9 +1102,9 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( PrintOn && getLog()){
if( printOn ){
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: dup=%d aStrW=%d pStrW=%d no.atms=%3d ceil=%3d Unroll=%1d\n",
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: dup=%d aStrW=%d pStrW=%d no.atms=%3d ceil=%3d Unroll=%1d\n",
getDuplicationFactor(),
getParticleStreamWidth( ),
getPartialForceStreamWidth( ),
......@@ -1105,27 +1112,27 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getParticleSizeCeiling(),
getInnerLoopUnroll() );
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: ForceStreams\n" );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: ForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: %d ForceStreams\n", ii );
gbsaForceStreams[ii]->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: %d ForceStreams\n", ii );
gbsaForceStreams[ii]->printToFile( log );
}
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: ObcChain\n" );
getObcChain()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: ObcChain\n" );
getObcChain()->printToFile( log );
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: BornR\n" );
getObcBornRadii()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: BornR\n" );
getObcBornRadii()->printToFile( log );
// output
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: ObcIntermediateForce output\n" );
getObcIntermediateForce()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: ObcIntermediateForce output\n" );
getObcIntermediateForce()->printToFile( log );
// output
(void) fprintf( getLog(), "\nPost kPostObcLoop1_nobranch: ObcBornRadii2 output\n" );
getObcBornRadii2()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop1_nobranch: ObcBornRadii2 output\n" );
getObcBornRadii2()->printToFile( log );
}
......@@ -1151,9 +1158,9 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( PrintOn && getLog() ){
if( printOn ){
(void) fprintf( getLog(), "\nPost kObcLoop2: no.atms=%5d ceil=%3d dup=%3d strW=%3d pStrW=%3d\n",
(void) fprintf( log, "\nPost kObcLoop2: no.atms=%5d ceil=%3d dup=%3d strW=%3d pStrW=%3d\n",
getNumberOfParticles(),
getParticleSizeCeiling(),
getDuplicationFactor(),
......@@ -1161,18 +1168,18 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getPartialForceStreamWidth( ) );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPost kObcLoop2: PositionStream\n" );
brookStreamInternalPos->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop2: PositionStream\n" );
brookStreamInternalPos->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop2: ObcScaledParticleRadii\n" );
getObcScaledParticleRadii()->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop2: ObcScaledParticleRadii\n" );
getObcScaledParticleRadii()->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop2: ObcBornRadii2\n" );
getObcBornRadii2()->printToFile( getLog() );
(void) fprintf( log, "\nPost kObcLoop2: ObcBornRadii2\n" );
getObcBornRadii2()->printToFile( log );
(void) fprintf( getLog(), "\nPost kObcLoop2: ForceStreams\n" );
(void) fprintf( log, "\nPost kObcLoop2: ForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
gbsaForceStreams[ii]->printToFile( getLog() );
gbsaForceStreams[ii]->printToFile( log );
}
}
......@@ -1206,9 +1213,9 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
// diagnostics
if( PrintOn && getLog() ){
if( printOn ){
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: atms=%d ceil=%d dup=%d particleStrW=%3d prtlF=%3d diel=%.3f %.3f ACE=%.1f\n",
getNumberOfParticles(),
getParticleSizeCeiling(),
getDuplicationFactor(),
......@@ -1217,21 +1224,21 @@ void BrookGbsa::computeForces( BrookStreamImpl& positionStream, BrookStreamImpl&
getSoluteDielectric(),
getSolventDielectric(), includeAceTerm );
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: PartialForceStreams\n" );
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: PartialForceStreams\n" );
for( int ii = 0; ii < 4; ii++ ){
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: PartialForceStreams %d\n", ii );
gbsaForceStreams[ii]->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: PartialForceStreams %d\n", ii );
gbsaForceStreams[ii]->printToFile( log );
}
BrookStreamInternal* brookStreamInternalF = forceStream.getBrookStreamImpl();
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: ForceStream\n" );
brookStreamInternalF->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: ForceStream\n" );
brookStreamInternalF->printToFile( log );
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: Chain\n" );
getObcChain()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: Chain\n" );
getObcChain()->printToFile( log );
(void) fprintf( getLog(), "\nPost kPostObcLoop2_nobranch: BornR\n" );
getObcBornRadii()->printToFile( getLog() );
(void) fprintf( log, "\nPost kPostObcLoop2_nobranch: BornR\n" );
getObcBornRadii()->printToFile( log );
}
......
......@@ -123,13 +123,13 @@ void BrookIntegrateLangevinStepKernel::initialize( const System& system, const L
// ---------------------------------------------------------------------------------------
int printOn = 1;
int printOn = 0;
static const std::string methodName = "BrookIntegrateLangevinStepKernel::initialize";
FILE* log = NULL;
// ---------------------------------------------------------------------------------------
setLog( stderr );
//setLog( stderr );
printOn = (printOn && getLog()) ? printOn : 0;
if( printOn ){
......
......@@ -950,19 +950,19 @@ int BrookLangevinDynamics::update( BrookStreamImpl& positionStream, BrookStreamI
// ---------------------------------------------------------------------------------------
static const std::string methodName = "\nBrookLangevinDynamics::update";
int printOn = 1;
int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
_internalStepCount++;
setLog( stderr );
//setLog( stderr );
printOn = (printOn && getLog()) ? printOn : 0;
const BrookOpenMMFloat* derivedParameters = getDerivedParameters();
if( (0 || printOn) ){
if( printOn ){
log = getLog();
static int showAux = 1;
......@@ -1031,8 +1031,6 @@ setLog( stderr );
}
//StreamImpl& positionStreamImpl = positionStream.getImpl();
//const BrookStreamImpl brookPositions = dynamic_cast<BrookStreamImpl&> (positionStreamImpl);
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
(void) fprintf( log, "\nPositionStream %d\n", _internalStepCount );
brookStreamInternalPos->printToFile( log );
......@@ -1082,7 +1080,7 @@ setLog( stderr );
// first Shake gather
kshakeh_update1_fix1(
(float) getLangevinDynamicsParticleStreamWidth(),
(float) brookShakeAlgorithm.getShakeConstraintStreamWidth(),
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
getXPrimeStream()->getBrookStream(),
brookShakeAlgorithm.getShakeXCons0Stream()->getBrookStream(),
......@@ -1093,8 +1091,8 @@ setLog( stderr );
if( 0 && printOn ){
(void) fprintf( log, "\n%s Post kshakeh_update2_fix1: particleStrW=%3d",
methodName.c_str(), getLangevinDynamicsParticleStreamWidth() );
(void) fprintf( log, "\n%s Post kshakeh_update2_fix1: ShakeConstraintStreamWidth=%3d",
methodName.c_str(), brookShakeAlgorithm.getShakeConstraintStreamWidth() );
if( _internalStepCount == 1 ){
(void) fprintf( log, "\nShakeInverseMapStream %d\n" );
......@@ -1204,7 +1202,7 @@ setLog( stderr );
// second Shake gather
kshakeh_update2_fix1(
(float) getLangevinDynamicsParticleStreamWidth(),
(float) brookShakeAlgorithm.getShakeConstraintStreamWidth(),
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
positionStream.getBrookStream(),
getXPrimeStream()->getBrookStream(),
......@@ -1217,9 +1215,9 @@ setLog( stderr );
// diagnostics
if( printOn ){
(void) fprintf( log, "\n%s step=%d Post kshakeh_update2_fix1: particleStrW=%3d rngStrW=%3d rngOff=%5d "
(void) fprintf( log, "\n%s step=%d Post kshakeh_update2_fix1: ShakeConstraintStreamWidth=%3d rngStrW=%3d rngOff=%5d "
"Sd2pc[]=[%12.5e %12.5e]\n", methodName.c_str(), _internalStepCount,
getLangevinDynamicsParticleStreamWidth(),
brookShakeAlgorithm.getShakeConstraintStreamWidth(),
brookRandomNumberGenerator.getRandomNumberStreamWidth(),
brookRandomNumberGenerator.getRvStreamOffset(),
derivedParameters[Sd2pc1], derivedParameters[Sd2pc2] );
......
......@@ -1285,8 +1285,6 @@ void BrookNonBonded::computeForces( BrookStreamImpl& positionStream, BrookStream
FILE* log;
// static const int debug = 1;
// ---------------------------------------------------------------------------------------
printOn = (printOn && getLog()) ? printOn : 0;
......@@ -1327,9 +1325,9 @@ nonbondedForceStreams[3]->fillWithValue( &zerof );
// diagnostics
//if( 1 && printOn ){
static int step = 0;
if( step++ < 1 ){
if( printOn ){
//static int step = 0;
//if( step++ < 1 ){
//FILE* log = getLog();
FILE* log = stderr;
(void) fprintf( log, "%s\n", methodName.c_str() ); (void) fflush( log );
......
......@@ -362,13 +362,20 @@ int BrookRandomNumberGenerator::_loadRandomNumberStreamsKiss( void ){
static unsigned int state[4];
static int stateInitialized = 0;
static int PrintOn = 0;
int printOn = 0;
FILE* log;
static const int reseed = 10000;
static std::string methodName = "\nBrookRandomNumberGenerator::_loadRandomNumberStreamsKiss";
// ---------------------------------------------------------------------------------------
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
// periodically reset seeds
if( !stateInitialized || !(stateInitialized % reseed) ){
......@@ -378,10 +385,10 @@ int BrookRandomNumberGenerator::_loadRandomNumberStreamsKiss( void ){
state[2] = rand();
state[3] = rand();
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "%s reset state seeds stateInitialized=%d reseed=%d [%u %u %u %u]\n",
if( printOn ){
(void) fprintf( log, "%s reset state seeds stateInitialized=%d reseed=%d [%u %u %u %u]\n",
methodName.c_str(), stateInitialized, reseed, state[0], state[1], state[2], state[3] );
(void) fflush( getLog() );
(void) fflush( log );
}
/*
......@@ -398,13 +405,13 @@ state[3] = 27587;
float* loadBuffer = _getLoadBuffer();
if( PrintOn && getLog() ){
if( printOn ){
static float count = 0.0f;
float block = (float) (3*getRandomNumberStreamSize() );
count += 1.0f;
(void) fprintf( getLog(), "%s: count=%.1f ttl=%.3e no./count=%.1f %d %d\n", methodName.c_str(),
(void) fprintf( log, "%s: count=%.1f ttl=%.3e no./count=%.1f %d %d\n", methodName.c_str(),
count, block*count, block, getRandomNumberStreamSize(), getNumberOfRandomNumberStreams() );
(void) fflush( getLog() );
(void) fflush( log );
}
for( int jj = 0; jj < getNumberOfRandomNumberStreams(); jj++ ){
......@@ -418,9 +425,9 @@ state[3] = 27587;
getRandomNumberStream( jj )->loadFromArray( loadBuffer );
}
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "%s: stats\n%s\n", methodName.c_str(), getStatisticsString().c_str() );
(void) fflush( getLog() );
if( printOn ){
(void) fprintf( log, "%s: stats\n%s\n", methodName.c_str(), getStatisticsString().c_str() );
(void) fflush( log );
}
return DefaultReturnValue;
......@@ -439,7 +446,8 @@ int BrookRandomNumberGenerator::_loadRandomNumberStreamsMersenne( void ){
// ---------------------------------------------------------------------------------------
static const std::string methodName = "\nBrookRandomNumberGenerator::_loadRandomNumberStreamsMersenne";
static int PrintOn = 0;
int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
......@@ -456,9 +464,9 @@ int BrookRandomNumberGenerator::_loadRandomNumberStreamsMersenne( void ){
getRandomNumberStream( jj )->loadFromArray( loadBuffer );
}
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "%s: stats\n%s\n", methodName.c_str(), getStatisticsString().c_str() );
(void) fflush( getLog() );
if( printOn ){
(void) fprintf( log, "%s: stats\n%s\n", methodName.c_str(), getStatisticsString().c_str() );
(void) fflush( log );
}
return DefaultReturnValue;
......@@ -676,10 +684,17 @@ int BrookRandomNumberGenerator::advanceGVCursor( int numberOfRandomValuesConsume
// ---------------------------------------------------------------------------------------
static const std::string methodName = "BrookRandomNumberGenerator::advanceGVCursor";
static const int PrintOn = 0;
int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
if( printOn && getLog() ){
log = getLog();
} else {
printOn = 0;
}
int rvStreamSize = getRandomNumberStreamSize();
// use 2 random values per sd
......@@ -726,9 +741,9 @@ int BrookRandomNumberGenerator::advanceGVCursor( int numberOfRandomValuesConsume
_rvStreamIndex = 0;
}
if( PrintOn && getLog() ){
(void) fprintf( getLog(), "%s StrmIdx=%d action=%s\n", methodName, _rvStreamIndex, action );
(void) fflush( getLog() );
if( printOn ){
(void) fprintf( log, "%s StrmIdx=%d action=%s\n", methodName, _rvStreamIndex, action );
(void) fflush( log );
}
}
......
......@@ -560,7 +560,7 @@ int BrookShakeAlgorithm::_setShakeStreams( const std::vector<double>& masses, co
BrookOpenMMFloat* inverseMap = new BrookOpenMMFloat[2*shakeParticleStreamSize];
for( int ii = 0; ii < shakeParticleStreamSize*2; ii++ ){
inverseMap[ii] = -1;
inverseMap[ii] = static_cast<BrookOpenMMFloat>(-1.0);
}
// build inverse map
......@@ -568,7 +568,7 @@ int BrookShakeAlgorithm::_setShakeStreams( const std::vector<double>& masses, co
for( int ii = 0; ii < shakeConstraintStreamSize; ii++ ){
int ii4 = ii << 2;
for( int jj = 0; jj < 4; jj++ ){
if( particleIndices[ii4+jj] != -1 ){
if( particleIndices[ii4+jj] > -1.0f ){
int particleIndex = (int) (particleIndices[ii4+jj] + 0.001);
inverseMap[particleIndex*2] = (float) ii;
inverseMap[particleIndex*2+1] = (float) jj;
......
......@@ -467,19 +467,19 @@ int BrookVerletDynamics::update( BrookStreamImpl& positionStream, BrookStreamImp
// ---------------------------------------------------------------------------------------
static std::string methodName = "\nBrookVerletDynamics::update";
static int printOn = 1;
static int printOn = 0;
FILE* log;
// ---------------------------------------------------------------------------------------
_internalStepCount++;
setLog( stderr );
//setLog( stderr );
printOn = (printOn && getLog()) ? printOn : 0;
BrookStreamImpl& forceStream = const_cast<BrookStreamImpl&> (forceStreamC);
if( (1 || printOn) ){
if( printOn ){
static int showAux = 1;
log = getLog();
......@@ -598,7 +598,7 @@ setLog( stderr );
// Shake gather
kshakeh_update1_fix1(
(float) getVerletDynamicsParticleStreamWidth(),
(float) brookShakeAlgorithm.getShakeConstraintStreamWidth(),
brookShakeAlgorithm.getShakeInverseMapStream()->getBrookStream(),
getXPrimeStream()->getBrookStream(),
brookShakeAlgorithm.getShakeXCons0Stream()->getBrookStream(),
......@@ -608,10 +608,10 @@ setLog( stderr );
getXPrimeStream()->getBrookStream() );
//positionStream.getBrookStream() );
if( 0 && printOn ){
if( printOn ){
(void) fprintf( log, "\n%s Post kshakeh_update2_fix1: particleStrW=%3d",
methodName.c_str(), getVerletDynamicsParticleStreamWidth() );
(void) fprintf( log, "\n%s Post kshakeh_update1_fix1: step=%d ShakeConstraintStreamWidth=%3d",
methodName.c_str(), _internalStepCount, brookShakeAlgorithm.getShakeConstraintStreamWidth() );
(void) fprintf( log, "\nShakeInverseMapStream %d\n", _internalStepCount );
brookShakeAlgorithm.getShakeInverseMapStream()->printToFile( log );
......@@ -652,6 +652,7 @@ setLog( stderr );
methodName.c_str(), _internalStepCount, inverseStepSize );
BrookStreamInternal* brookStreamInternalPos = positionStream.getBrookStreamImpl();
brookShakeAlgorithm.checkConstraints( brookStreamInternalPos, log, 0.0001f );
(void) fprintf( log, "\nPositionStream %d\n", _internalStepCount );
brookStreamInternalPos->printToFile( log );
......
......@@ -538,11 +538,7 @@ void OpenMMBrookInterface::computeForces( OpenMMContextImpl& context ){
// ---------------------------------------------------------------------------------------
(void) fprintf( stderr, "%s done nonbonded & bonded=%d completed=%d\n", methodName.c_str(),
_brookBonded.isActive(), _brookBonded.isSetupCompleted() );
(void) fflush( stderr );
setLog( stderr );
//setLog( stderr );
printOn = (printOn && getLog()) ? printOn : 0;
BrookStreamImpl* positions = getParticlePositions();
......@@ -550,15 +546,10 @@ setLog( stderr );
// info
//if( printOn > 1 ){
if( 0 ){
if( printOn > 1 ){
printForcesToFile( context );
}
(void) fprintf( stderr, "%s x1 done nonbonded & bonded=%d completed=%d\n", methodName.c_str(),
_brookBonded.isActive(), _brookBonded.isSetupCompleted() );
(void) fflush( stderr );
// nonbonded forces
if( _brookNonBonded.isActive() ){
......@@ -587,16 +578,11 @@ setLog( stderr );
getParticleStreamWidth(), getParticleStreamSize() );
}
(void) fprintf( stderr, "%s done nonbonded & bonded=%d completed=%d\n", methodName.c_str(),
_brookBonded.isActive(), _brookBonded.isSetupCompleted() );
(void) fflush( stderr );
_brookBonded.computeForces( *positions, *forces );
// diagnostics
if( printOn ){
FILE* log = stderr;
static int step = 0;
static const int stopStep = 10;
(void) fprintf( log, "%s done bonded computeForces\n", methodName.c_str() );
......@@ -621,16 +607,12 @@ setLog( stderr );
}
// GBSA OBC forces
if( _brookGbsa.isActive() ){
_brookGbsa.computeForces( *positions, *forces );
}
(void) fprintf( stderr, "%s done computeForces\n", methodName.c_str() );
(void) fflush( stderr );
// ---------------------------------------------------------------------------------------
}
......
......@@ -203,22 +203,23 @@ kernel void kshakeh_update1_fix1(
float3 cposq3[][], //ditto for h3
out float3 oposq<> //updated deltas
){
float2 atom;
atom.y = round( (invmap.x - fmod( invmap.x, strwidth ))/strwidth );
atom.x = invmap.x - atom.y * strwidth;
// oposq = posq;
if ( invmap.y < 0 ){
if( invmap.y < 0 ){
oposq = posqp;
} else if ( invmap.y < 0.5f ){
oposq += cposq0[ atom ];
} else if ( invmap.y < 1.5f ){
oposq += cposq1[ atom ];
} else if ( invmap.y < 2.5f ){
oposq += cposq2[ atom ];
} else if ( invmap.y < 3.5f ){
oposq += cposq3[ atom ];
} else if( invmap.y < 0.5f ){
oposq = cposq0[ atom ];
} else if( invmap.y < 1.5f ){
oposq = cposq1[ atom ];
} else if( invmap.y < 2.5f ){
oposq = cposq2[ atom ];
} else if( invmap.y < 3.5f ){
oposq = cposq3[ atom ];
}
}
......
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