Commit 0a930401 authored by Mark Friedrichs's avatar Mark Friedrichs
Browse files

Mods required for Windows

parent 8f0e6d3c
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
* *
*/ */
#include <vector>
#include "../../../tests/AssertionUtilities.h" #include "../../../tests/AssertionUtilities.h"
#include "CudaPlatform.h" #include "CudaPlatform.h"
...@@ -61,6 +60,10 @@ ...@@ -61,6 +60,10 @@
#include "openmm/BrownianIntegrator.h" #include "openmm/BrownianIntegrator.h"
#include "../src/sfmt/SFMT.h" #include "../src/sfmt/SFMT.h"
#include <ctime>
#include <vector>
#include <cfloat>
// force enums // force enums
#define MAX_PRINT 5 #define MAX_PRINT 5
...@@ -2262,7 +2265,7 @@ static int checkEnergyForceConsistent( Context& context, double delta, double to ...@@ -2262,7 +2265,7 @@ static int checkEnergyForceConsistent( Context& context, double delta, double to
double step = delta/forceNorm; double step = delta/forceNorm;
std::vector<Vec3> perturbedPositions; std::vector<Vec3> perturbedPositions;
perturbedPositions.resize( forces.size() ); perturbedPositions.resize( forces.size() );
for( int ii = 0; ii < forces.size(); ii++ ){ for( unsigned int ii = 0; ii < forces.size(); ii++ ){
perturbedPositions[ii] = Vec3( coordinates[ii][0] - step*forces[ii][0], coordinates[ii][1] - step*forces[ii][1], coordinates[ii][2] - step*forces[ii][2] ); perturbedPositions[ii] = Vec3( coordinates[ii][0] - step*forces[ii][0], coordinates[ii][1] - step*forces[ii][1], coordinates[ii][2] - step*forces[ii][2] );
} }
...@@ -2339,7 +2342,8 @@ Integrator* _getIntegrator( std::string& integratorName, double timeStep, ...@@ -2339,7 +2342,8 @@ Integrator* _getIntegrator( std::string& integratorName, double timeStep,
integrator = new LangevinIntegrator( temperature, friction, timeStep ); integrator = new LangevinIntegrator( temperature, friction, timeStep );
LangevinIntegrator* langevinIntegrator = dynamic_cast<LangevinIntegrator*>(integrator); LangevinIntegrator* langevinIntegrator = dynamic_cast<LangevinIntegrator*>(integrator);
if( randomNumberSeed <= 0 ){ if( randomNumberSeed <= 0 ){
langevinIntegrator->setRandomNumberSeed(time(NULL)); time_t zero = time(NULL);
langevinIntegrator->setRandomNumberSeed(static_cast<int>(zero));
} else { } else {
langevinIntegrator->setRandomNumberSeed( randomNumberSeed ); langevinIntegrator->setRandomNumberSeed( randomNumberSeed );
} }
...@@ -2347,7 +2351,8 @@ Integrator* _getIntegrator( std::string& integratorName, double timeStep, ...@@ -2347,7 +2351,8 @@ Integrator* _getIntegrator( std::string& integratorName, double timeStep,
integrator = new VariableLangevinIntegrator( temperature, friction, errorTolerance ); integrator = new VariableLangevinIntegrator( temperature, friction, errorTolerance );
VariableLangevinIntegrator* langevinIntegrator = dynamic_cast<VariableLangevinIntegrator*>(integrator); VariableLangevinIntegrator* langevinIntegrator = dynamic_cast<VariableLangevinIntegrator*>(integrator);
if( randomNumberSeed <= 0 ){ if( randomNumberSeed <= 0 ){
langevinIntegrator->setRandomNumberSeed(time(NULL)); time_t zero = time(NULL);
langevinIntegrator->setRandomNumberSeed(static_cast<int>(zero));
} else { } else {
langevinIntegrator->setRandomNumberSeed( randomNumberSeed ); langevinIntegrator->setRandomNumberSeed( randomNumberSeed );
} }
...@@ -3500,18 +3505,18 @@ void testEnergyForcesConsistent( std::string parameterFileName, int forceFlag, d ...@@ -3500,18 +3505,18 @@ void testEnergyForcesConsistent( std::string parameterFileName, int forceFlag, d
#endif #endif
if( log ){ if( log ){
(void) fprintf( log, "%s Testing reference platform\n", methodName.c_str() ); (void) fprintf( log, "%s Testing cuda platform\n", methodName.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
checkEnergyForceConsistent( *referenceOpenMMContext, delta, tolerance, log ); checkEnergyForceConsistent( *cudaOpenMMContext, delta, tolerance, log );
if( log ){ if( log ){
(void) fprintf( log, "%s Testing cuda platform\n", methodName.c_str() ); (void) fprintf( log, "%s Testing reference platform\n", methodName.c_str() );
(void) fflush( log ); (void) fflush( log );
} }
checkEnergyForceConsistent( *cudaOpenMMContext, delta, tolerance, log ); checkEnergyForceConsistent( *referenceOpenMMContext, delta, tolerance, log );
} }
void testEnergyConservation( std::string parameterFileName, int forceFlag, int totalSimulationSteps, FILE* inputLog ){ void testEnergyConservation( std::string parameterFileName, int forceFlag, int totalSimulationSteps, FILE* inputLog ){
......
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