"olla/vscode:/vscode.git/clone" did not exist on "baa4dcfd37b1ccb7d1d4b8d46e6bb632ded4478e"
Commit 4112ece5 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods to get validation code to compile on windows

parent e8a4c506
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <typeinfo> #include <typeinfo>
#ifdef _MSC_VER #ifdef _MSC_VER
#include <limits>
#define isinf !_finite #define isinf !_finite
#define isnan _isnan #define isnan _isnan
#endif #endif
......
...@@ -77,6 +77,7 @@ ValidateOpenMM::ValidateOpenMM( void ) { ...@@ -77,6 +77,7 @@ ValidateOpenMM::ValidateOpenMM( void ) {
ValidateOpenMM::~ValidateOpenMM() { ValidateOpenMM::~ValidateOpenMM() {
} }
int ValidateOpenMM::isNan( double number ){ int ValidateOpenMM::isNan( double number ){
return isinf( number ) || isnan( number ) ? 1 : 0; return isinf( number ) || isnan( number ) ? 1 : 0;
} }
...@@ -843,7 +844,7 @@ void ValidateOpenMM::copyConstraints( const System& systemToCopy, System* system ...@@ -843,7 +844,7 @@ void ValidateOpenMM::copyConstraints( const System& systemToCopy, System* system
// --------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------
for( unsigned int ii = 0; ii < systemToCopy.getNumConstraints(); ii++ ){ for( int ii = 0; ii < systemToCopy.getNumConstraints(); ii++ ){
int particle1, particle2; int particle1, particle2;
double distance; double distance;
systemToCopy.getConstraintParameters( ii, particle1, particle2, distance ); systemToCopy.getConstraintParameters( ii, particle1, particle2, distance );
......
...@@ -505,7 +505,7 @@ void ValidateOpenMMForces::compareOpenMMForces( Context& context, Platform& plat ...@@ -505,7 +505,7 @@ void ValidateOpenMMForces::compareOpenMMForces( Context& context, Platform& plat
const System& system = context.getSystem(); const System& system = context.getSystem();
std::vector<int> compareAllForces; std::vector<int> compareAllForces;
for( unsigned int ii = 0; ii < system.getNumForces(); ii++ ){ for( int ii = 0; ii < system.getNumForces(); ii++ ){
std::vector<int> compareForces; std::vector<int> compareForces;
std::string forceName = getForceName( system.getForce( ii ) ); std::string forceName = getForceName( system.getForce( ii ) );
if( isExcludedForce( forceName ) == 0 ){ if( isExcludedForce( forceName ) == 0 ){
...@@ -772,7 +772,7 @@ std::string ValidateOpenMMForces::getSummary( std::vector<ForceValidationResult* ...@@ -772,7 +772,7 @@ std::string ValidateOpenMMForces::getSummary( std::vector<ForceValidationResult*
#define LOCAL_SPRINTF12(a,b,c,d,e,f,g,h,i,j,k,l) sprintf( (a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), (l) ); #define LOCAL_SPRINTF12(a,b,c,d,e,f,g,h,i,j,k,l) sprintf( (a), (b), (c), (d), (e), (f), (g), (h), (i), (j), (k), (l) );
#endif #endif
int maxMissesToPrint = getMaxErrorsToPrint(); unsigned int maxMissesToPrint = static_cast<unsigned int>(getMaxErrorsToPrint());
std::stringstream summary; std::stringstream summary;
std::string tab = " "; std::string tab = " ";
int useForces = 1; int useForces = 1;
...@@ -829,8 +829,7 @@ std::string ValidateOpenMMForces::getSummary( std::vector<ForceValidationResult* ...@@ -829,8 +829,7 @@ std::string ValidateOpenMMForces::getSummary( std::vector<ForceValidationResult*
std::vector<double> forceNorms2 = forceValidationResults[ii]->getForceNorms( 1 ); std::vector<double> forceNorms2 = forceValidationResults[ii]->getForceNorms( 1 );
for( unsigned int kk = 0; kk < inconsistentIndices.size() && kk < maxMissesToPrint; kk++ ){ for( unsigned int kk = 0; kk < inconsistentIndices.size() && kk < maxMissesToPrint; kk++ ){
int jj = inconsistentIndices[kk]; int jj = inconsistentIndices[kk];
if( isinf( forceNorms1[jj] ) || isnan( forceNorms1[jj] ) || if( isNan( forceNorms1[jj] ) || isNan( forceNorms2[jj] ) ){
isinf( forceNorms2[jj] ) || isnan( forceNorms2[jj] ) ){
(void) LOCAL_SPRINTF5( value, " nan at index %6d norms: [%12.5e %12.5e]", jj, forceNorms1[jj], forceNorms2[jj] ); (void) LOCAL_SPRINTF5( value, " nan at index %6d norms: [%12.5e %12.5e]", jj, forceNorms1[jj], forceNorms2[jj] );
summary << _getLine( tab, "Error", value ); summary << _getLine( tab, "Error", value );
} else { } else {
......
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