Commit 51828eaa authored by Peter Eastman's avatar Peter Eastman
Browse files

Merge branch 'master' into qc

parents cf8a03e8 5ed9dd65
...@@ -5,10 +5,6 @@ ENABLE_TESTING() ...@@ -5,10 +5,6 @@ ENABLE_TESTING()
SET(SHARED_OPENMM_PME_TARGET OpenMMPME) SET(SHARED_OPENMM_PME_TARGET OpenMMPME)
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_OPENMM_PME_TARGET ${SHARED_OPENMM_PME_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
#LINK_DIRECTORIES #LINK_DIRECTORIES
# Automatically create tests using files named "Test*.cpp" # Automatically create tests using files named "Test*.cpp"
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM Drude Plugin # OpenMM Drude Plugin
# #
# Creates OpenMM Drude plugin library, base name=OpenMMDrude. # Creates OpenMMDrude plugin library.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
# #
# Windows: # Windows:
# OpenMMDrude[_d].dll # OpenMMDrude.dll
# OpenMMDrude[_d].lib # OpenMMDrude.lib
# OpenMMDrude_static[_d].lib # OpenMMDrude_static.lib
# Unix: # Unix:
# libOpenMMDrude[_d].so # libOpenMMDrude.so
# libOpenMMDrude_static[_d].a # libOpenMMDrude_static.a
#---------------------------------------------------- #----------------------------------------------------
#INCLUDE(Dart) #INCLUDE(Dart)
...@@ -24,12 +22,6 @@ SET(OPENMM_DRUDE_LIBRARY_NAME OpenMMDrude) ...@@ -24,12 +22,6 @@ SET(OPENMM_DRUDE_LIBRARY_NAME OpenMMDrude)
SET(SHARED_DRUDE_TARGET ${OPENMM_DRUDE_LIBRARY_NAME}) SET(SHARED_DRUDE_TARGET ${OPENMM_DRUDE_LIBRARY_NAME})
SET(STATIC_DRUDE_TARGET ${OPENMM_DRUDE_LIBRARY_NAME}_static) SET(STATIC_DRUDE_TARGET ${OPENMM_DRUDE_LIBRARY_NAME}_static)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_DRUDE_TARGET ${SHARED_DRUDE_TARGET}_d)
SET(STATIC_DRUDE_TARGET ${STATIC_DRUDE_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_DRUDE_INCLUDE_DIRS) # start empty SET(API_DRUDE_INCLUDE_DIRS) # start empty
...@@ -100,10 +92,6 @@ IF(DL_LIBRARY) ...@@ -100,10 +92,6 @@ IF(DL_LIBRARY)
ENDIF(DL_LIBRARY) ENDIF(DL_LIBRARY)
SET( OpenMMLib OpenMM ) SET( OpenMMLib OpenMM )
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(OpenMMLib ${OpenMMLib}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES( ${SHARED_DRUDE_TARGET} ${SHARED_TARGET} ) TARGET_LINK_LIBRARIES( ${SHARED_DRUDE_TARGET} ${SHARED_TARGET} )
IF(OPENMM_BUILD_STATIC_LIB) IF(OPENMM_BUILD_STATIC_LIB)
......
...@@ -141,7 +141,8 @@ void DrudeForceImpl::initialize(ContextImpl& context) { ...@@ -141,7 +141,8 @@ void DrudeForceImpl::initialize(ContextImpl& context) {
} }
double DrudeForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) { double DrudeForceImpl::calcForcesAndEnergy(ContextImpl& context, bool includeForces, bool includeEnergy, int groups) {
return kernel.getAs<CalcDrudeForceKernel>().execute(context, includeForces, includeEnergy); if ((groups&(1<<owner.getForceGroup())) != 0)
return kernel.getAs<CalcDrudeForceKernel>().execute(context, includeForces, includeEnergy);
} }
std::vector<std::string> DrudeForceImpl::getKernelNames() { std::vector<std::string> DrudeForceImpl::getKernelNames() {
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM CUDA Drude Integrator # OpenMM CUDA Drude Integrator
# #
# Creates OpenMM library, base name=OpenMMDrudeCUDA. # Creates OpenMMDrudeCUDA library.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMDrudeCUDA[_d].dll # OpenMMDrudeCUDA.dll
# OpenMMDrudeCUDA[_d].lib # OpenMMDrudeCUDA.lib
# Unix: # Unix:
# libOpenMMDrudeCUDA[_d].so # libOpenMMDrudeCUDA.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMDRUDECUDA_LIBRARY_NAME OpenMMDrudeCUDA) ...@@ -24,19 +22,6 @@ SET(OPENMMDRUDECUDA_LIBRARY_NAME OpenMMDrudeCUDA)
SET(SHARED_TARGET ${OPENMMDRUDECUDA_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMDRUDECUDA_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -101,14 +86,9 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} ...@@ -101,14 +86,9 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H}
SET_SOURCE_FILES_PROPERTIES(${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} PROPERTIES GENERATED TRUE) SET_SOURCE_FILES_PROPERTIES(${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} PROPERTIES GENERATED TRUE)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${CUDA_LIBRARIES} ${PTHREADS_LIB})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA)
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB} ${CUDA_LIBRARIES} ${PTHREADS_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}CUDA_d optimized ${OPENMM_LIBRARY_NAME}CUDA)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_DRUDE_TARGET} optimized ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
IF (APPLE) IF (APPLE)
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS} -F/Library/Frameworks -framework CUDA") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS} -F/Library/Frameworks -framework CUDA")
...@@ -119,11 +99,7 @@ ENDIF (APPLE) ...@@ -119,11 +99,7 @@ ENDIF (APPLE)
INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins) INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins)
# Ensure that links to the main CUDA library will be resolved. # Ensure that links to the main CUDA library will be resolved.
IF (APPLE) IF (APPLE)
IF (CMAKE_BUILD_TYPE MATCHES Debug) SET(CUDA_LIBRARY libOpenMMCUDA.dylib)
SET(CUDA_LIBRARY libOpenMMCUDA_d.dylib)
ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
SET(CUDA_LIBRARY libOpenMMCUDA.dylib)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${CUDA_LIBRARY} @loader_path/${CUDA_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${CUDA_LIBRARY} @loader_path/${CUDA_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)")
ENDIF (APPLE) ENDIF (APPLE)
if(OPENMM_BUILD_CUDA_TESTS) if(OPENMM_BUILD_CUDA_TESTS)
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM OpenCL Drude Integrator # OpenMM OpenCL Drude Integrator
# #
# Creates OpenMM library, base name=OpenMMDrudeOpenCL. # Creates OpenMMDrudeOpenCL library.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMDrudeOpenCL[_d].dll # OpenMMDrudeOpenCL.dll
# OpenMMDrudeOpenCL[_d].lib # OpenMMDrudeOpenCL.lib
# Unix: # Unix:
# libOpenMMDrudeOpenCL[_d].so # libOpenMMDrudeOpenCL.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMDRUDEOPENCL_LIBRARY_NAME OpenMMDrudeOpenCL) ...@@ -24,19 +22,6 @@ SET(OPENMMDRUDEOPENCL_LIBRARY_NAME OpenMMDrudeOpenCL)
SET(SHARED_TARGET ${OPENMMDRUDEOPENCL_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMDRUDEOPENCL_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -101,24 +86,15 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CL_KERNELS_CPP} ${CL_KERNELS_H} ...@@ -101,24 +86,15 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CL_KERNELS_CPP} ${CL_KERNELS_H}
SET_SOURCE_FILES_PROPERTIES(${CL_KERNELS_CPP} ${CL_KERNELS_H} PROPERTIES GENERATED TRUE) SET_SOURCE_FILES_PROPERTIES(${CL_KERNELS_CPP} ${CL_KERNELS_H} PROPERTIES GENERATED TRUE)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES} ${PTHREADS_LIB})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_DRUDE_TARGET})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB} ${OPENCL_LIBRARIES} ${PTHREADS_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}OpenCL_d optimized ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_DRUDE_TARGET} optimized ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins) INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins)
# Ensure that links to the main OpenCL library will be resolved. # Ensure that links to the main OpenCL library will be resolved.
IF (APPLE) IF (APPLE)
IF (CMAKE_BUILD_TYPE MATCHES Debug) SET(OPENCL_LIBRARY libOpenMMOpenCL.dylib)
SET(OPENCL_LIBRARY libOpenMMOpenCL_d.dylib)
ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
SET(OPENCL_LIBRARY libOpenMMOpenCL.dylib)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${OPENCL_LIBRARY} @loader_path/${OPENCL_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${OPENCL_LIBRARY} @loader_path/${OPENCL_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)")
ENDIF (APPLE) ENDIF (APPLE)
if(OPENMM_BUILD_OPENCL_TESTS) if(OPENMM_BUILD_OPENCL_TESTS)
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM Reference Drude Integrator # OpenMM Reference Drude Integrator
# #
# Creates OpenMM library, base name=OpenMMDrudeReference. # Creates OpenMMDrudeReference library.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMDrudeReference[_d].dll # OpenMMDrudeReference.dll
# OpenMMDrudeReference[_d].lib # OpenMMDrudeReference.lib
# Unix: # Unix:
# libOpenMMDrudeReference[_d].so # libOpenMMDrudeReference.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMDRUDEREFERENCE_LIBRARY_NAME OpenMMDrudeReference) ...@@ -24,19 +22,6 @@ SET(OPENMMDRUDEREFERENCE_LIBRARY_NAME OpenMMDrudeReference)
SET(SHARED_TARGET ${OPENMMDRUDEREFERENCE_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMDRUDEREFERENCE_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -84,12 +69,7 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR}) ...@@ -84,12 +69,7 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR})
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d)
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_DRUDE_TARGET} optimized ${SHARED_DRUDE_TARGET}) TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_DRUDE_TARGET} optimized ${SHARED_DRUDE_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
......
...@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src) ...@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src)
SET(SHARED_OPENMM_DRUDE_TARGET OpenMMDrude) SET(SHARED_OPENMM_DRUDE_TARGET OpenMMDrude)
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_CUDA_TARGET ${SHARED_CUDA_TARGET}_d)
SET(SHARED_OPENMM_DRUDE_TARGET ${SHARED_OPENMM_DRUDE_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
#LINK_DIRECTORIES #LINK_DIRECTORIES
# Automatically create tests using files named "Test*.cpp" # Automatically create tests using files named "Test*.cpp"
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM RPMD Plugin # OpenMM RPMD Plugin
# #
# Creates OpenMM RPMD plugin library, base name=OpenMMRPMD. # Creates OpenMMRPMD plugin library.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
# #
# Windows: # Windows:
# OpenMMRPMD[_d].dll # OpenMMRPMD.dll
# OpenMMRPMD[_d].lib # OpenMMRPMD.lib
# OpenMMRPMD_static[_d].lib # OpenMMRPMD_static.lib
# Unix: # Unix:
# libOpenMMRPMD[_d].so # libOpenMMRPMD.so
# libOpenMMRPMD_static[_d].a # libOpenMMRPMD_static.a
#---------------------------------------------------- #----------------------------------------------------
#INCLUDE(Dart) #INCLUDE(Dart)
...@@ -31,15 +29,6 @@ IF( CREATE_SERIALIZABLE_OPENMM_RPMD ) ...@@ -31,15 +29,6 @@ IF( CREATE_SERIALIZABLE_OPENMM_RPMD )
SET(SHARED_RPMD_SERIALIZABLE_TARGET ${OPENMM_RPMD_LIBRARY_NAME}_serializable) SET(SHARED_RPMD_SERIALIZABLE_TARGET ${OPENMM_RPMD_LIBRARY_NAME}_serializable)
ENDIF( CREATE_SERIALIZABLE_OPENMM_RPMD ) ENDIF( CREATE_SERIALIZABLE_OPENMM_RPMD )
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_RPMD_TARGET ${SHARED_RPMD_TARGET}_d)
SET(STATIC_RPMD_TARGET ${STATIC_RPMD_TARGET}_d)
IF( CREATE_SERIALIZABLE_OPENMM_RPMD )
SET(SHARED_RPMD_SERIALIZABLE_TARGET ${SHARED_RPMD_SERIALIZABLE_TARGET}_d)
ENDIF( CREATE_SERIALIZABLE_OPENMM_RPMD )
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_RPMD_INCLUDE_DIRS) # start empty SET(API_RPMD_INCLUDE_DIRS) # start empty
...@@ -107,10 +96,6 @@ IF(DL_LIBRARY) ...@@ -107,10 +96,6 @@ IF(DL_LIBRARY)
ENDIF(DL_LIBRARY) ENDIF(DL_LIBRARY)
SET( OpenMMLib OpenMM ) SET( OpenMMLib OpenMM )
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(OpenMMLib ${OpenMMLib}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES( ${SHARED_RPMD_TARGET} ${SHARED_TARGET} ) TARGET_LINK_LIBRARIES( ${SHARED_RPMD_TARGET} ${SHARED_TARGET} )
IF( CREATE_SERIALIZABLE_OPENMM_RPMD ) IF( CREATE_SERIALIZABLE_OPENMM_RPMD )
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2013 Stanford University and the Authors. * * Portions copyright (c) 2008-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -195,6 +195,11 @@ public: ...@@ -195,6 +195,11 @@ public:
* and energies. Group i will be included if (groups&(1<<i)) != 0. The default value includes all groups. * and energies. Group i will be included if (groups&(1<<i)) != 0. The default value includes all groups.
*/ */
State getState(int copy, int types, bool enforcePeriodicBox=false, int groups=0xFFFFFFFF); State getState(int copy, int types, bool enforcePeriodicBox=false, int groups=0xFFFFFFFF);
/**
* Get the total energy of the ring polymer. This includes the potential and kinetic energies of all copies,
* plus the potential energy of the harmonic springs that link copies together.
*/
double getTotalEnergy();
/** /**
* Advance a simulation through time by taking a series of time steps. * Advance a simulation through time by taking a series of time steps.
* *
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2008-2013 Stanford University and the Authors. * * Portions copyright (c) 2008-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "openmm/OpenMMException.h" #include "openmm/OpenMMException.h"
#include "openmm/internal/ContextImpl.h" #include "openmm/internal/ContextImpl.h"
#include "openmm/RpmdKernels.h" #include "openmm/RpmdKernels.h"
#include "SimTKOpenMMRealType.h"
#include <cmath> #include <cmath>
#include <ctime> #include <ctime>
#include <string> #include <string>
...@@ -195,3 +196,27 @@ void RPMDIntegrator::step(int steps) { ...@@ -195,3 +196,27 @@ void RPMDIntegrator::step(int steps) {
forcesAreValid = true; forcesAreValid = true;
} }
} }
double RPMDIntegrator::getTotalEnergy() {
const System& system = owner->getSystem();
int numParticles = system.getNumParticles();
double energy = 0.0;
const double hbar = 1.054571628e-34*AVOGADRO/(1000*1e-12);
const double wn = numCopies*BOLTZ*temperature/hbar;
State prevState = getState(numCopies-1, State::Positions);
for (int i = 0; i < numCopies; i++) {
// Add the energy of this copy.
State state = getState(i, State::Positions | State::Energy);
energy += state.getKineticEnergy()+state.getPotentialEnergy();
// Add the energy from the springs connecting it to the previous copy.
for (int j = 0; j < numParticles; j++) {
Vec3 delta = state.getPositions()[j]-prevState.getPositions()[j];
energy += 0.5*wn*wn*system.getParticleMass(j)*delta.dot(delta);
}
prevState = state;
}
return energy;
}
#--------------------------------------------------- #---------------------------------------------------
# OpenMM CUDA RPMD Integrator # OpenMM CUDA RPMD Integrator
# #
# Creates OpenMM library, base name=OpenMMRPMDCUDA. # Creates OpenMMRPMDCUDA library,.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMRPMDCUDA[_d].dll # OpenMMRPMDCUDA.dll
# OpenMMRPMDCUDA[_d].lib # OpenMMRPMDCUDA.lib
# Unix: # Unix:
# libOpenMMRPMDCUDA[_d].so # libOpenMMRPMDCUDA.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMRPMDCUDA_LIBRARY_NAME OpenMMRPMDCUDA) ...@@ -24,19 +22,6 @@ SET(OPENMMRPMDCUDA_LIBRARY_NAME OpenMMRPMDCUDA)
SET(SHARED_TARGET ${OPENMMRPMDCUDA_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMRPMDCUDA_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -101,14 +86,9 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} ...@@ -101,14 +86,9 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H}
SET_SOURCE_FILES_PROPERTIES(${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} PROPERTIES GENERATED TRUE) SET_SOURCE_FILES_PROPERTIES(${CUDA_KERNELS_CPP} ${CUDA_KERNELS_H} PROPERTIES GENERATED TRUE)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${CUDA_LIBRARIES} ${PTHREADS_LIB})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}CUDA)
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB} ${CUDA_LIBRARIES} ${PTHREADS_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}CUDA_d optimized ${OPENMM_LIBRARY_NAME}CUDA)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_RPMD_TARGET} optimized ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
IF (APPLE) IF (APPLE)
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS} -F/Library/Frameworks -framework CUDA") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS} -F/Library/Frameworks -framework CUDA")
...@@ -119,11 +99,7 @@ ENDIF (APPLE) ...@@ -119,11 +99,7 @@ ENDIF (APPLE)
INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins) INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins)
# Ensure that links to the main CUDA library will be resolved. # Ensure that links to the main CUDA library will be resolved.
IF (APPLE) IF (APPLE)
IF (CMAKE_BUILD_TYPE MATCHES Debug) SET(CUDA_LIBRARY libOpenMMCUDA.dylib)
SET(CUDA_LIBRARY libOpenMMCUDA_d.dylib)
ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
SET(CUDA_LIBRARY libOpenMMCUDA.dylib)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${CUDA_LIBRARY} @loader_path/${CUDA_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${CUDA_LIBRARY} @loader_path/${CUDA_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)")
ENDIF (APPLE) ENDIF (APPLE)
if(OPENMM_BUILD_CUDA_TESTS) if(OPENMM_BUILD_CUDA_TESTS)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2013 Stanford University and the Authors. * * Portions copyright (c) 2011-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -466,30 +466,9 @@ void testWithoutThermostat() { ...@@ -466,30 +466,9 @@ void testWithoutThermostat() {
double initialEnergy; double initialEnergy;
int numSteps = 100; int numSteps = 100;
const double hbar = 1.054571628e-34*AVOGADRO/(1000*1e-12);
const double wn = numCopies*BOLTZ*temperature/hbar;
const double springConstant = mass*wn*wn;
for (int i = 0; i < numSteps; i++) { for (int i = 0; i < numSteps; i++) {
integ.step(1); integ.step(1);
double energy = integ.getTotalEnergy();
// Sum the energies of all the copies.
double energy = 0.0;
for (int j = 0; j < numCopies; j++) {
State state = integ.getState(j, State::Positions | State::Energy);
positions[j] = state.getPositions();
energy += state.getPotentialEnergy()+state.getKineticEnergy();
}
// Add the energy from the springs connecting copies.
for (int j = 0; j < numCopies; j++) {
int previous = (j == 0 ? numCopies-1 : j-1);
for (int k = 0; k < numParticles; k++) {
Vec3 delta = positions[j][k]-positions[previous][k];
energy += 0.5*springConstant*delta.dot(delta);
}
}
if (i == 0) if (i == 0)
initialEnergy = energy; initialEnergy = energy;
else else
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM OpenCL RPMD Integrator # OpenMM OpenCL RPMD Integrator
# #
# Creates OpenMM library, base name=OpenMMRPMDOpenCL. # Creates OpenMMRPMDOpenCL library.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMRPMDOpenCL[_d].dll # OpenMMRPMDOpenCL.dll
# OpenMMRPMDOpenCL[_d].lib # OpenMMRPMDOpenCL.lib
# Unix: # Unix:
# libOpenMMRPMDOpenCL[_d].so # libOpenMMRPMDOpenCL.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMRPMDOPENCL_LIBRARY_NAME OpenMMRPMDOpenCL) ...@@ -24,19 +22,6 @@ SET(OPENMMRPMDOPENCL_LIBRARY_NAME OpenMMRPMDOpenCL)
SET(SHARED_TARGET ${OPENMMRPMDOPENCL_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMRPMDOPENCL_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -100,24 +85,15 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CL_KERNELS_CPP} ${CL_KERNELS_H} ...@@ -100,24 +85,15 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CL_KERNELS_CPP} ${CL_KERNELS_H}
SET_SOURCE_FILES_PROPERTIES(${CL_KERNELS_CPP} ${CL_KERNELS_H} PROPERTIES GENERATED TRUE) SET_SOURCE_FILES_PROPERTIES(${CL_KERNELS_CPP} ${CL_KERNELS_H} PROPERTIES GENERATED TRUE)
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME} ${OPENCL_LIBRARIES} ${PTHREADS_LIB})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME}OpenCL)
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB} ${OPENCL_LIBRARIES} ${PTHREADS_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${OPENMM_LIBRARY_NAME}OpenCL_d optimized ${OPENMM_LIBRARY_NAME}OpenCL)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_RPMD_TARGET} optimized ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins) INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins)
# Ensure that links to the main OpenCL library will be resolved. # Ensure that links to the main OpenCL library will be resolved.
IF (APPLE) IF (APPLE)
IF (CMAKE_BUILD_TYPE MATCHES Debug) SET(OPENCL_LIBRARY libOpenMMOpenCL.dylib)
SET(OPENCL_LIBRARY libOpenMMOpenCL_d.dylib)
ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
SET(OPENCL_LIBRARY libOpenMMOpenCL.dylib)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${OPENCL_LIBRARY} @loader_path/${OPENCL_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)") INSTALL(CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${OPENCL_LIBRARY} @loader_path/${OPENCL_LIBRARY} ${CMAKE_INSTALL_PREFIX}/lib/plugins/lib${SHARED_TARGET}.dylib)")
ENDIF (APPLE) ENDIF (APPLE)
if(OPENMM_BUILD_OPENCL_TESTS) if(OPENMM_BUILD_OPENCL_TESTS)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2013 Stanford University and the Authors. * * Portions copyright (c) 2011-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -467,30 +467,9 @@ void testWithoutThermostat() { ...@@ -467,30 +467,9 @@ void testWithoutThermostat() {
double initialEnergy; double initialEnergy;
int numSteps = 100; int numSteps = 100;
const double hbar = 1.054571628e-34*AVOGADRO/(1000*1e-12);
const double wn = numCopies*BOLTZ*temperature/hbar;
const double springConstant = mass*wn*wn;
for (int i = 0; i < numSteps; i++) { for (int i = 0; i < numSteps; i++) {
integ.step(1); integ.step(1);
double energy = integ.getTotalEnergy();
// Sum the energies of all the copies.
double energy = 0.0;
for (int j = 0; j < numCopies; j++) {
State state = integ.getState(j, State::Positions | State::Energy);
positions[j] = state.getPositions();
energy += state.getPotentialEnergy()+state.getKineticEnergy();
}
// Add the energy from the springs connecting copies.
for (int j = 0; j < numCopies; j++) {
int previous = (j == 0 ? numCopies-1 : j-1);
for (int k = 0; k < numParticles; k++) {
Vec3 delta = positions[j][k]-positions[previous][k];
energy += 0.5*springConstant*delta.dot(delta);
}
}
if (i == 0) if (i == 0)
initialEnergy = energy; initialEnergy = energy;
else else
......
#--------------------------------------------------- #---------------------------------------------------
# OpenMM Reference RPMD Integrator # OpenMM Reference RPMD Integrator
# #
# Creates OpenMM library, base name=OpenMMRPMDReference. # Creates OpenMMRPMDReference library.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# #
# Windows: # Windows:
# OpenMMRPMDReference[_d].dll # OpenMMRPMDReference.dll
# OpenMMRPMDReference[_d].lib # OpenMMRPMDReference.lib
# Unix: # Unix:
# libOpenMMRPMDReference[_d].so # libOpenMMRPMDReference.so
#---------------------------------------------------- #----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from # The source is organized into subdirectories, but we handle them all from
...@@ -24,19 +22,6 @@ SET(OPENMMRPMDREFERENCE_LIBRARY_NAME OpenMMRPMDReference) ...@@ -24,19 +22,6 @@ SET(OPENMMRPMDREFERENCE_LIBRARY_NAME OpenMMRPMDReference)
SET(SHARED_TARGET ${OPENMMRPMDREFERENCE_LIBRARY_NAME}) SET(SHARED_TARGET ${OPENMMRPMDREFERENCE_LIBRARY_NAME})
# Ensure that debug libraries have "_d" appended to their names.
# CMake gets this right on Windows automatically with this definition.
IF (MSVC)
SET(CMAKE_DEBUG_POSTFIX "_d" CACHE INTERNAL "" FORCE)
ENDIF (MSVC)
# But on Unix or Cygwin we have to add the suffix manually
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_TARGET ${SHARED_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
# These are all the places to search for header files which are # These are all the places to search for header files which are
# to be part of the API. # to be part of the API.
SET(API_INCLUDE_DIRS) # start empty SET(API_INCLUDE_DIRS) # start empty
...@@ -84,13 +69,8 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR}) ...@@ -84,13 +69,8 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR})
ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES}) ADD_LIBRARY(${SHARED_TARGET} SHARED ${SOURCE_FILES} ${SOURCE_INCLUDE_FILES} ${API_ABS_INCLUDE_FILES})
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${OPENMM_LIBRARY_NAME})
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME}_d) TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${SHARED_RPMD_TARGET})
ELSE (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(MAIN_OPENMM_LIB ${OPENMM_LIBRARY_NAME})
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
TARGET_LINK_LIBRARIES(${SHARED_TARGET} ${MAIN_OPENMM_LIB})
TARGET_LINK_LIBRARIES(${SHARED_TARGET} debug ${SHARED_RPMD_TARGET} optimized ${SHARED_RPMD_TARGET})
SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY") SET_TARGET_PROPERTIES(${SHARED_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_COMPILE_FLAGS}" COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -DOPENMM_BUILDING_SHARED_LIBRARY")
INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins) INSTALL(TARGETS ${SHARED_TARGET} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/plugins)
......
...@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src) ...@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src)
SET(SHARED_OPENMM_RPMD_TARGET OpenMMRPMD) SET(SHARED_OPENMM_RPMD_TARGET OpenMMRPMD)
IF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
SET(SHARED_CUDA_TARGET ${SHARED_CUDA_TARGET}_d)
SET(SHARED_OPENMM_RPMD_TARGET ${SHARED_OPENMM_RPMD_TARGET}_d)
ENDIF (UNIX AND CMAKE_BUILD_TYPE MATCHES Debug)
#LINK_DIRECTORIES #LINK_DIRECTORIES
# Automatically create tests using files named "Test*.cpp" # Automatically create tests using files named "Test*.cpp"
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2011-2013 Stanford University and the Authors. * * Portions copyright (c) 2011-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -350,30 +350,9 @@ void testWithoutThermostat() { ...@@ -350,30 +350,9 @@ void testWithoutThermostat() {
double initialEnergy; double initialEnergy;
int numSteps = 100; int numSteps = 100;
const double hbar = 1.054571628e-34*AVOGADRO/(1000*1e-12);
const double wn = numCopies*BOLTZ*temperature/hbar;
const double springConstant = mass*wn*wn;
for (int i = 0; i < numSteps; i++) { for (int i = 0; i < numSteps; i++) {
integ.step(1); integ.step(1);
double energy = integ.getTotalEnergy();
// Sum the energies of all the copies.
double energy = 0.0;
for (int j = 0; j < numCopies; j++) {
State state = integ.getState(j, State::Positions | State::Energy);
positions[j] = state.getPositions();
energy += state.getPotentialEnergy()+state.getKineticEnergy();
}
// Add the energy from the springs connecting copies.
for (int j = 0; j < numCopies; j++) {
int previous = (j == 0 ? numCopies-1 : j-1);
for (int k = 0; k < numParticles; k++) {
Vec3 delta = positions[j][k]-positions[previous][k];
energy += 0.5*springConstant*delta.dot(delta);
}
}
if (i == 0) if (i == 0)
initialEnergy = energy; initialEnergy = energy;
else else
......
...@@ -152,6 +152,28 @@ public: ...@@ -152,6 +152,28 @@ public:
* @param value the value to set for the property * @param value the value to set for the property
*/ */
SerializationNode& setIntProperty(const std::string& name, int value); SerializationNode& setIntProperty(const std::string& name, int value);
/**
* Get the property with a particular name, specified as an bool. If there is no property with
* the specified name, an exception is thrown.
*
* @param name the name of the property to get
*/
bool getBoolProperty(const std::string& name) const;
/**
* Get the property with a particular name, specified as a bool. If there is no property with
* the specified name, a default value is returned instead.
*
* @param name the name of the property to get
* @param defaultValue the value to return if the specified property does not exist
*/
bool getBoolProperty(const std::string& name, bool defaultValue) const;
/**
* Set the value of a property, specified as a bool.
*
* @param name the name of the property to set
* @param value the value to set for the property
*/
SerializationNode& setBoolProperty(const std::string& name, bool value);
/** /**
* Get the property with a particular name, specified as a double. If there is no property with * Get the property with a particular name, specified as a double. If there is no property with
* the specified name, an exception is thrown. * the specified name, an exception is thrown.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -47,6 +47,7 @@ void AndersenThermostatProxy::serialize(const void* object, SerializationNode& n ...@@ -47,6 +47,7 @@ void AndersenThermostatProxy::serialize(const void* object, SerializationNode& n
node.setDoubleProperty("temperature", force.getDefaultTemperature()); node.setDoubleProperty("temperature", force.getDefaultTemperature());
node.setDoubleProperty("frequency", force.getDefaultCollisionFrequency()); node.setDoubleProperty("frequency", force.getDefaultCollisionFrequency());
node.setIntProperty("randomSeed", force.getRandomNumberSeed()); node.setIntProperty("randomSeed", force.getRandomNumberSeed());
node.setIntProperty("forceGroup", force.getForceGroup());
} }
void* AndersenThermostatProxy::deserialize(const SerializationNode& node) const { void* AndersenThermostatProxy::deserialize(const SerializationNode& node) const {
...@@ -55,6 +56,7 @@ void* AndersenThermostatProxy::deserialize(const SerializationNode& node) const ...@@ -55,6 +56,7 @@ void* AndersenThermostatProxy::deserialize(const SerializationNode& node) const
AndersenThermostat* force = NULL; AndersenThermostat* force = NULL;
try { try {
AndersenThermostat* force = new AndersenThermostat(node.getDoubleProperty("temperature"), node.getDoubleProperty("frequency")); AndersenThermostat* force = new AndersenThermostat(node.getDoubleProperty("temperature"), node.getDoubleProperty("frequency"));
force->setForceGroup(node.getIntProperty("forceGroup", 0));
force->setRandomNumberSeed(node.getIntProperty("randomSeed")); force->setRandomNumberSeed(node.getIntProperty("randomSeed"));
return force; return force;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2010 Stanford University and the Authors. * * Portions copyright (c) 2010-2014 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -44,6 +44,7 @@ CMAPTorsionForceProxy::CMAPTorsionForceProxy() : SerializationProxy("CMAPTorsion ...@@ -44,6 +44,7 @@ CMAPTorsionForceProxy::CMAPTorsionForceProxy() : SerializationProxy("CMAPTorsion
void CMAPTorsionForceProxy::serialize(const void* object, SerializationNode& node) const { void CMAPTorsionForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1); node.setIntProperty("version", 1);
const CMAPTorsionForce& force = *reinterpret_cast<const CMAPTorsionForce*>(object); const CMAPTorsionForce& force = *reinterpret_cast<const CMAPTorsionForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
SerializationNode& maps = node.createChildNode("Maps"); SerializationNode& maps = node.createChildNode("Maps");
for (int i = 0; i < force.getNumMaps(); i++) { for (int i = 0; i < force.getNumMaps(); i++) {
int size; int size;
...@@ -66,6 +67,7 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const { ...@@ -66,6 +67,7 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
throw OpenMMException("Unsupported version number"); throw OpenMMException("Unsupported version number");
CMAPTorsionForce* force = new CMAPTorsionForce(); CMAPTorsionForce* force = new CMAPTorsionForce();
try { try {
force->setForceGroup(node.getIntProperty("forceGroup", 0));
const SerializationNode& maps = node.getChildNode("Maps"); const SerializationNode& maps = node.getChildNode("Maps");
for (int i = 0; i < (int) maps.getChildren().size(); i++) { for (int i = 0; i < (int) maps.getChildren().size(); i++) {
const SerializationNode& map = maps.getChildren()[i]; const SerializationNode& map = maps.getChildren()[i];
......
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