Commit e702e8bb authored by Michael Sherman's avatar Michael Sherman
Browse files

(1) Minor changes to get rid of warnings from VC++.

(2) I disabled the block of code in the main CMakeLists file that tries to second guess VC++'s choices for runtime libraries. This was required for me to get CUDA to work in VC 2005 where the compiler always chooses multithreaded libraries. I verified that Brook will still build this way, but I haven't tested it.
parent 7629ea48
...@@ -272,6 +272,8 @@ INSTALL_FILES(/include FILES ${CORE_HEADERS}) ...@@ -272,6 +272,8 @@ INSTALL_FILES(/include FILES ${CORE_HEADERS})
INSTALL_FILES(/include/openmm FILES ${TOP_HEADERS}) INSTALL_FILES(/include/openmm FILES ${TOP_HEADERS})
INSTALL_FILES(/include/openmm/internal FILES ${INTERNAL_HEADERS}) INSTALL_FILES(/include/openmm/internal FILES ${INTERNAL_HEADERS})
IF(HELL_IS_FROZEN_OVER)
# Set the build flags to link statically to the microsoft runtime library, unless # Set the build flags to link statically to the microsoft runtime library, unless
# the user tells us otherwise, via the variable "USE_MSVC_RUNTIME_DLL" # the user tells us otherwise, via the variable "USE_MSVC_RUNTIME_DLL"
# It is a sore defect of cmake that makes these gymnastics necessary # It is a sore defect of cmake that makes these gymnastics necessary
...@@ -340,6 +342,8 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio") ...@@ -340,6 +342,8 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS_MINSIZEREL ${CMAKE_CXX_FLAGS_MINSIZEREL} CACHE STRING "" FORCE)
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
ENDIF(HELL_IS_FROZEN_OVER)
# #
# Allow automated build and dashboard. # Allow automated build and dashboard.
# #
......
...@@ -23,11 +23,15 @@ ...@@ -23,11 +23,15 @@
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#if defined(OPENMM_BUILDING_SHARED_LIBRARY) // We don't want to hear about how sprintf is "unsafe".
#define OPENMM_EXPORT __declspec(dllexport) #pragma warning(disable:4996)
#elif defined(OPENMM_BUILDING_STATIC_LIBRARY) || defined(OPENMM_USE_STATIC_LIBRARIES) #if defined(OPENMM_BUILDING_SHARED_LIBRARY)
#define OPENMM_EXPORT __declspec(dllexport)
// Keep MS VC++ quiet about lack of dll export of private members.
#pragma warning(disable:4251)
#elif defined(OPENMM_BUILDING_STATIC_LIBRARY) || defined(OPENMM_USE_STATIC_LIBRARIES)
#define OPENMM_EXPORT #define OPENMM_EXPORT
#else #else
#define OPENMM_EXPORT __declspec(dllimport) // i.e., a client of a shared library #define OPENMM_EXPORT __declspec(dllimport) // i.e., a client of a shared library
#endif #endif
#else #else
......
...@@ -77,7 +77,7 @@ void testGaussian() { ...@@ -77,7 +77,7 @@ void testGaussian() {
double c2 = var-mean*mean; double c2 = var-mean*mean;
double c3 = skew-3*var*mean+2*mean*mean*mean; double c3 = skew-3*var*mean+2*mean*mean*mean;
double c4 = kurtosis-4*skew*mean-3*var*var+12*var*mean*mean-6*mean*mean*mean*mean; double c4 = kurtosis-4*skew*mean-3*var*var+12*var*mean*mean-6*mean*mean*mean*mean;
ASSERT_EQUAL_TOL(0.0, mean, 1.0/sqrt(numValues)); ASSERT_EQUAL_TOL(0.0, mean, 1.0/sqrt((double)numValues));
ASSERT_EQUAL_TOL(1.0, c2, 1.0/pow(numValues, 1.0/3.0)); ASSERT_EQUAL_TOL(1.0, c2, 1.0/pow(numValues, 1.0/3.0));
ASSERT_EQUAL_TOL(0.0, c3, 1.0/pow(numValues, 1.0/4.0)); ASSERT_EQUAL_TOL(0.0, c3, 1.0/pow(numValues, 1.0/4.0));
ASSERT_EQUAL_TOL(0.0, c4, 1.0/pow(numValues, 1.0/4.0)); ASSERT_EQUAL_TOL(0.0, c4, 1.0/pow(numValues, 1.0/4.0));
......
...@@ -608,7 +608,7 @@ void ReferenceIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, con ...@@ -608,7 +608,7 @@ void ReferenceIntegrateVerletStepKernel::execute(OpenMMContextImpl& context, con
delete constraints; delete constraints;
} }
dynamics = new ReferenceVerletDynamics(context.getSystem().getNumParticles(), static_cast<RealOpenMM>(stepSize) ); dynamics = new ReferenceVerletDynamics(context.getSystem().getNumParticles(), static_cast<RealOpenMM>(stepSize) );
constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, integrator.getConstraintTolerance()); constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, (RealOpenMM)integrator.getConstraintTolerance());
dynamics->setReferenceConstraintAlgorithm(constraints); dynamics->setReferenceConstraintAlgorithm(constraints);
prevStepSize = stepSize; prevStepSize = stepSize;
} }
...@@ -667,7 +667,7 @@ void ReferenceIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, c ...@@ -667,7 +667,7 @@ void ReferenceIntegrateLangevinStepKernel::execute(OpenMMContextImpl& context, c
static_cast<RealOpenMM>(stepSize), static_cast<RealOpenMM>(stepSize),
static_cast<RealOpenMM>(tau), static_cast<RealOpenMM>(tau),
static_cast<RealOpenMM>(temperature) ); static_cast<RealOpenMM>(temperature) );
constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, integrator.getConstraintTolerance()); constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, (RealOpenMM)integrator.getConstraintTolerance());
dynamics->setReferenceConstraintAlgorithm(constraints); dynamics->setReferenceConstraintAlgorithm(constraints);
prevTemp = temperature; prevTemp = temperature;
prevFriction = friction; prevFriction = friction;
...@@ -727,7 +727,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, c ...@@ -727,7 +727,7 @@ void ReferenceIntegrateBrownianStepKernel::execute(OpenMMContextImpl& context, c
static_cast<RealOpenMM>(stepSize), static_cast<RealOpenMM>(stepSize),
static_cast<RealOpenMM>(friction), static_cast<RealOpenMM>(friction),
static_cast<RealOpenMM>(temperature) ); static_cast<RealOpenMM>(temperature) );
constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, integrator.getConstraintTolerance()); constraints = new ReferenceShakeAlgorithm(numConstraints, constraintIndices, constraintDistances, (RealOpenMM)integrator.getConstraintTolerance());
dynamics->setReferenceConstraintAlgorithm(constraints); dynamics->setReferenceConstraintAlgorithm(constraints);
prevTemp = temperature; prevTemp = temperature;
prevFriction = friction; prevFriction = friction;
......
...@@ -136,7 +136,7 @@ void ReferenceLincsAlgorithm::initialize(int numberOfAtoms, RealOpenMM* inverseM ...@@ -136,7 +136,7 @@ void ReferenceLincsAlgorithm::initialize(int numberOfAtoms, RealOpenMM* inverseM
} }
_linkedConstraints.resize(_numberOfConstraints); _linkedConstraints.resize(_numberOfConstraints);
for (int atom = 0; atom < numberOfAtoms; atom++) { for (int atom = 0; atom < numberOfAtoms; atom++) {
for (int i = 0; i < atomConstraints[atom].size(); i++) for (int i = 0; i < (int)atomConstraints[atom].size(); i++)
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
int c1 = atomConstraints[atom][i]; int c1 = atomConstraints[atom][i];
int c2 = atomConstraints[atom][j]; int c2 = atomConstraints[atom][j];
...@@ -169,7 +169,7 @@ void ReferenceLincsAlgorithm::solveMatrix() { ...@@ -169,7 +169,7 @@ void ReferenceLincsAlgorithm::solveMatrix() {
vector<RealOpenMM>& rhs2 = (iteration%2 == 0 ? _rhs2 : _rhs1); vector<RealOpenMM>& rhs2 = (iteration%2 == 0 ? _rhs2 : _rhs1);
for (int c1 = 0; c1 < _numberOfConstraints; c1++) { for (int c1 = 0; c1 < _numberOfConstraints; c1++) {
rhs2[c1] = zero; rhs2[c1] = zero;
for (int j = 0; j < _linkedConstraints[c1].size(); j++) { for (int j = 0; j < (int)_linkedConstraints[c1].size(); j++) {
int c2 = _linkedConstraints[c1][j]; int c2 = _linkedConstraints[c1][j];
rhs2[c1] += _couplingMatrix[c1][j]*rhs1[c2]; rhs2[c1] += _couplingMatrix[c1][j]*rhs1[c2];
} }
...@@ -195,12 +195,12 @@ void ReferenceLincsAlgorithm::updateAtomPositions(int numberOfAtoms, RealOpenMM* ...@@ -195,12 +195,12 @@ void ReferenceLincsAlgorithm::updateAtomPositions(int numberOfAtoms, RealOpenMM*
_sMatrix[i]*_solution[i]*_constraintDir[i][2]); _sMatrix[i]*_solution[i]*_constraintDir[i][2]);
int atom1 = _atomIndices[i][0]; int atom1 = _atomIndices[i][0];
int atom2 = _atomIndices[i][1]; int atom2 = _atomIndices[i][1];
atomCoordinates[atom1][0] -= inverseMasses[atom1]*delta[0]; atomCoordinates[atom1][0] -= (RealOpenMM)(inverseMasses[atom1]*delta[0]);
atomCoordinates[atom1][1] -= inverseMasses[atom1]*delta[1]; atomCoordinates[atom1][1] -= (RealOpenMM)(inverseMasses[atom1]*delta[1]);
atomCoordinates[atom1][2] -= inverseMasses[atom1]*delta[2]; atomCoordinates[atom1][2] -= (RealOpenMM)(inverseMasses[atom1]*delta[2]);
atomCoordinates[atom2][0] += inverseMasses[atom2]*delta[0]; atomCoordinates[atom2][0] += (RealOpenMM)(inverseMasses[atom2]*delta[0]);
atomCoordinates[atom2][1] += inverseMasses[atom2]*delta[1]; atomCoordinates[atom2][1] += (RealOpenMM)(inverseMasses[atom2]*delta[1]);
atomCoordinates[atom2][2] += inverseMasses[atom2]*delta[2]; atomCoordinates[atom2][2] += (RealOpenMM)(inverseMasses[atom2]*delta[2]);
} }
} }
...@@ -246,7 +246,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina ...@@ -246,7 +246,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
_constraintDir[i] = Vec3(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0], _constraintDir[i] = Vec3(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0],
atomCoordinatesP[atom1][1]-atomCoordinatesP[atom2][1], atomCoordinatesP[atom1][1]-atomCoordinatesP[atom2][1],
atomCoordinatesP[atom1][2]-atomCoordinatesP[atom2][2]); atomCoordinatesP[atom1][2]-atomCoordinatesP[atom2][2]);
RealOpenMM invLength = one/SQRT(_constraintDir[i].dot(_constraintDir[i])); RealOpenMM invLength = (RealOpenMM)(1/SQRT((RealOpenMM)_constraintDir[i].dot(_constraintDir[i])));
_constraintDir[i][0] *= invLength; _constraintDir[i][0] *= invLength;
_constraintDir[i][1] *= invLength; _constraintDir[i][1] *= invLength;
_constraintDir[i][2] *= invLength; _constraintDir[i][2] *= invLength;
...@@ -255,15 +255,15 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina ...@@ -255,15 +255,15 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
// Build the coupling matrix. // Build the coupling matrix.
for (int c1 = 0; c1 < _couplingMatrix.size(); c1++) { for (int c1 = 0; c1 < (int)_couplingMatrix.size(); c1++) {
Vec3& dir1 = _constraintDir[c1]; Vec3& dir1 = _constraintDir[c1];
for (int j = 0; j < _couplingMatrix[c1].size(); j++) { for (int j = 0; j < (int)_couplingMatrix[c1].size(); j++) {
int c2 = _linkedConstraints[c1][j]; int c2 = _linkedConstraints[c1][j];
Vec3& dir2 = _constraintDir[c2]; Vec3& dir2 = _constraintDir[c2];
if (_atomIndices[c1][0] == _atomIndices[c2][0] || _atomIndices[c1][1] == _atomIndices[c2][1]) if (_atomIndices[c1][0] == _atomIndices[c2][0] || _atomIndices[c1][1] == _atomIndices[c2][1])
_couplingMatrix[c1][j] = -inverseMasses[_atomIndices[c1][0]]*_sMatrix[c1]*dir1.dot(dir2)*_sMatrix[c2]; _couplingMatrix[c1][j] = (RealOpenMM)(-inverseMasses[_atomIndices[c1][0]]*_sMatrix[c1]*dir1.dot(dir2)*_sMatrix[c2]);
else else
_couplingMatrix[c1][j] = inverseMasses[_atomIndices[c1][1]]*_sMatrix[c1]*dir1.dot(dir2)*_sMatrix[c2]; _couplingMatrix[c1][j] = (RealOpenMM)(inverseMasses[_atomIndices[c1][1]]*_sMatrix[c1]*dir1.dot(dir2)*_sMatrix[c2]);
} }
} }
...@@ -280,7 +280,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina ...@@ -280,7 +280,7 @@ int ReferenceLincsAlgorithm::apply( int numberOfAtoms, RealOpenMM** atomCoordina
Vec3 delta(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0], Vec3 delta(atomCoordinatesP[atom1][0]-atomCoordinatesP[atom2][0],
atomCoordinatesP[atom1][1]-atomCoordinatesP[atom2][1], atomCoordinatesP[atom1][1]-atomCoordinatesP[atom2][1],
atomCoordinatesP[atom1][2]-atomCoordinatesP[atom2][2]); atomCoordinatesP[atom1][2]-atomCoordinatesP[atom2][2]);
RealOpenMM p2 = two*_distance[i]*_distance[i]-delta.dot(delta); RealOpenMM p2 = (RealOpenMM)(two*_distance[i]*_distance[i]-delta.dot(delta));
if (p2 < zero) if (p2 < zero)
p2 = zero; p2 = zero;
_rhs1[i] = _solution[i] = _sMatrix[i]*(_distance[i]-SQRT(p2)); _rhs1[i] = _solution[i] = _sMatrix[i]*(_distance[i]-SQRT(p2));
......
...@@ -501,7 +501,7 @@ RealOpenMM e3 = -partialChargeI2*partialCharges[atomJ]*Sgb( t )/deltaR[Reference ...@@ -501,7 +501,7 @@ RealOpenMM e3 = -partialChargeI2*partialCharges[atomJ]*Sgb( t )/deltaR[Reference
(void) fflush( logFile ); (void) fflush( logFile );
#endif #endif
RealOpenMM conversion = CAL_TO_JOULE*gbviParameters->getTau(); RealOpenMM conversion = (RealOpenMM)(CAL_TO_JOULE*gbviParameters->getTau());
return (conversion*energy); return (conversion*energy);
} }
...@@ -776,7 +776,7 @@ if( 0 ){ ...@@ -776,7 +776,7 @@ if( 0 ){
// convert from cal to Joule & apply prefactor tau = (1/diel_solute - 1/diel_solvent) // convert from cal to Joule & apply prefactor tau = (1/diel_solute - 1/diel_solvent)
RealOpenMM conversion = CAL_TO_JOULE*gbviParameters->getTau(); RealOpenMM conversion = (RealOpenMM)(CAL_TO_JOULE*gbviParameters->getTau());
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
inputForces[atomI][0] = conversion*forces[atomI][0]; inputForces[atomI][0] = conversion*forces[atomI][0];
inputForces[atomI][1] = conversion*forces[atomI][1]; inputForces[atomI][1] = conversion*forces[atomI][1];
......
...@@ -603,7 +603,7 @@ int CpuObc::computeBornEnergyForces( RealOpenMM* bornRadii, RealOpenMM** atomCoo ...@@ -603,7 +603,7 @@ int CpuObc::computeBornEnergyForces( RealOpenMM* bornRadii, RealOpenMM** atomCoo
// cal to Joule conversion // cal to Joule conversion
RealOpenMM conversion = 0.4184; RealOpenMM conversion = (RealOpenMM)0.4184;
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
inputForces[atomI][0] += conversion*forces[atomI][0]; inputForces[atomI][0] += conversion*forces[atomI][0];
inputForces[atomI][1] += conversion*forces[atomI][1]; inputForces[atomI][1] += conversion*forces[atomI][1];
...@@ -1221,7 +1221,7 @@ if( logFile && atomI >= 0 ){ ...@@ -1221,7 +1221,7 @@ if( logFile && atomI >= 0 ){
} }
RealOpenMM conversion = 0.4184; RealOpenMM conversion = (RealOpenMM)0.4184;
for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){ for( int atomI = 0; atomI < numberOfAtoms; atomI++ ){
forces[atomI][0] *= conversion; forces[atomI][0] *= conversion;
forces[atomI][1] *= conversion; forces[atomI][1] *= conversion;
......
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