Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
51828eaa
Commit
51828eaa
authored
May 05, 2014
by
Peter Eastman
Browse files
Merge branch 'master' into qc
parents
cf8a03e8
5ed9dd65
Changes
229
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
123 additions
and
306 deletions
+123
-306
plugins/cpupme/tests/CMakeLists.txt
plugins/cpupme/tests/CMakeLists.txt
+0
-4
plugins/drude/CMakeLists.txt
plugins/drude/CMakeLists.txt
+6
-18
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
+2
-1
plugins/drude/platforms/cuda/CMakeLists.txt
plugins/drude/platforms/cuda/CMakeLists.txt
+8
-32
plugins/drude/platforms/opencl/CMakeLists.txt
plugins/drude/platforms/opencl/CMakeLists.txt
+8
-32
plugins/drude/platforms/reference/CMakeLists.txt
plugins/drude/platforms/reference/CMakeLists.txt
+5
-25
plugins/drude/platforms/reference/tests/CMakeLists.txt
plugins/drude/platforms/reference/tests/CMakeLists.txt
+0
-5
plugins/rpmd/CMakeLists.txt
plugins/rpmd/CMakeLists.txt
+6
-21
plugins/rpmd/openmmapi/include/openmm/RPMDIntegrator.h
plugins/rpmd/openmmapi/include/openmm/RPMDIntegrator.h
+6
-1
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
+26
-1
plugins/rpmd/platforms/cuda/CMakeLists.txt
plugins/rpmd/platforms/cuda/CMakeLists.txt
+8
-32
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
+2
-23
plugins/rpmd/platforms/opencl/CMakeLists.txt
plugins/rpmd/platforms/opencl/CMakeLists.txt
+8
-32
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
+2
-23
plugins/rpmd/platforms/reference/CMakeLists.txt
plugins/rpmd/platforms/reference/CMakeLists.txt
+6
-26
plugins/rpmd/platforms/reference/tests/CMakeLists.txt
plugins/rpmd/platforms/reference/tests/CMakeLists.txt
+0
-5
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
+2
-23
serialization/include/openmm/serialization/SerializationNode.h
...lization/include/openmm/serialization/SerializationNode.h
+22
-0
serialization/src/AndersenThermostatProxy.cpp
serialization/src/AndersenThermostatProxy.cpp
+3
-1
serialization/src/CMAPTorsionForceProxy.cpp
serialization/src/CMAPTorsionForceProxy.cpp
+3
-1
No files found.
plugins/cpupme/tests/CMakeLists.txt
View file @
51828eaa
...
...
@@ -5,10 +5,6 @@ ENABLE_TESTING()
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
# Automatically create tests using files named "Test*.cpp"
...
...
plugins/drude/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM Drude Plugin
#
# Creates OpenMM Drude plugin library, base name=OpenMMDrude.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
# Creates OpenMMDrude plugin library.
#
# Windows:
# OpenMMDrude
[_d]
.dll
# OpenMMDrude
[_d]
.lib
# OpenMMDrude_static
[_d]
.lib
# OpenMMDrude.dll
# OpenMMDrude.lib
# OpenMMDrude_static.lib
# Unix:
# libOpenMMDrude
[_d]
.so
# libOpenMMDrude_static
[_d]
.a
# libOpenMMDrude.so
# libOpenMMDrude_static.a
#----------------------------------------------------
#INCLUDE(Dart)
...
...
@@ -24,12 +22,6 @@ SET(OPENMM_DRUDE_LIBRARY_NAME OpenMMDrude)
SET
(
SHARED_DRUDE_TARGET
${
OPENMM_DRUDE_LIBRARY_NAME
}
)
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
# to be part of the API.
SET
(
API_DRUDE_INCLUDE_DIRS
)
# start empty
...
...
@@ -100,10 +92,6 @@ IF(DL_LIBRARY)
ENDIF
(
DL_LIBRARY
)
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
}
)
IF
(
OPENMM_BUILD_STATIC_LIB
)
...
...
plugins/drude/openmmapi/src/DrudeForceImpl.cpp
View file @
51828eaa
...
...
@@ -141,7 +141,8 @@ void DrudeForceImpl::initialize(ContextImpl& context) {
}
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
()
{
...
...
plugins/drude/platforms/cuda/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM CUDA Drude Integrator
#
# Creates OpenMM library, base name=OpenMMDrudeCUDA.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMDrudeCUDA library.
#
# Windows:
# OpenMMDrudeCUDA
[_d]
.dll
# OpenMMDrudeCUDA
[_d]
.lib
# OpenMMDrudeCUDA.dll
# OpenMMDrudeCUDA.lib
# Unix:
# libOpenMMDrudeCUDA
[_d]
.so
# libOpenMMDrudeCUDA.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMDRUDECUDA_LIBRARY_NAME OpenMMDrudeCUDA)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -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
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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
}
${
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
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
CUDA_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
CUDA
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_DRUDE_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_SHARED_LIBRARY"
)
IF
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-F/Library/Frameworks -framework CUDA"
)
...
...
@@ -119,11 +99,7 @@ ENDIF (APPLE)
INSTALL
(
TARGETS
${
SHARED_TARGET
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/lib/plugins
)
# Ensure that links to the main CUDA library will be resolved.
IF
(
APPLE
)
IF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA_d.dylib
)
ELSE
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA.dylib
)
ENDIF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA.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
)
if
(
OPENMM_BUILD_CUDA_TESTS
)
...
...
plugins/drude/platforms/opencl/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM OpenCL Drude Integrator
#
# Creates OpenMM library, base name=OpenMMDrudeOpenCL.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMDrudeOpenCL library.
#
# Windows:
# OpenMMDrudeOpenCL
[_d]
.dll
# OpenMMDrudeOpenCL
[_d]
.lib
# OpenMMDrudeOpenCL.dll
# OpenMMDrudeOpenCL.lib
# Unix:
# libOpenMMDrudeOpenCL
[_d]
.so
# libOpenMMDrudeOpenCL.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMDRUDEOPENCL_LIBRARY_NAME OpenMMDrudeOpenCL)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -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
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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
}
${
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
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
OpenCL
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_DRUDE_TARGET
}
)
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
)
# Ensure that links to the main OpenCL library will be resolved.
IF
(
APPLE
)
IF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL_d.dylib
)
ELSE
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL.dylib
)
ENDIF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL.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
)
if
(
OPENMM_BUILD_OPENCL_TESTS
)
...
...
plugins/drude/platforms/reference/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM Reference Drude Integrator
#
# Creates OpenMM library, base name=OpenMMDrudeReference.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMDrudeReference library.
#
# Windows:
# OpenMMDrudeReference
[_d]
.dll
# OpenMMDrudeReference
[_d]
.lib
# OpenMMDrudeReference.dll
# OpenMMDrudeReference.lib
# Unix:
# libOpenMMDrudeReference
[_d]
.so
# libOpenMMDrudeReference.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMDRUDEREFERENCE_LIBRARY_NAME OpenMMDrudeReference)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -84,12 +69,7 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR})
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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
}
${
OPENMM_LIBRARY_NAME
}
)
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"
)
...
...
plugins/drude/platforms/reference/tests/CMakeLists.txt
View file @
51828eaa
...
...
@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src)
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
# Automatically create tests using files named "Test*.cpp"
...
...
plugins/rpmd/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM RPMD Plugin
#
# Creates OpenMM RPMD plugin library, base name=OpenMMRPMD.
# Default libraries are shared & optimized. Variants
# are created for static (_static) and debug (_d).
# Creates OpenMMRPMD plugin library.
#
# Windows:
# OpenMMRPMD
[_d]
.dll
# OpenMMRPMD
[_d]
.lib
# OpenMMRPMD_static
[_d]
.lib
# OpenMMRPMD.dll
# OpenMMRPMD.lib
# OpenMMRPMD_static.lib
# Unix:
# libOpenMMRPMD
[_d]
.so
# libOpenMMRPMD_static
[_d]
.a
# libOpenMMRPMD.so
# libOpenMMRPMD_static.a
#----------------------------------------------------
#INCLUDE(Dart)
...
...
@@ -31,15 +29,6 @@ IF( CREATE_SERIALIZABLE_OPENMM_RPMD )
SET
(
SHARED_RPMD_SERIALIZABLE_TARGET
${
OPENMM_RPMD_LIBRARY_NAME
}
_serializable
)
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
# to be part of the API.
SET
(
API_RPMD_INCLUDE_DIRS
)
# start empty
...
...
@@ -107,10 +96,6 @@ IF(DL_LIBRARY)
ENDIF
(
DL_LIBRARY
)
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
}
)
IF
(
CREATE_SERIALIZABLE_OPENMM_RPMD
)
...
...
plugins/rpmd/openmmapi/include/openmm/RPMDIntegrator.h
View file @
51828eaa
...
...
@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -195,6 +195,11 @@ public:
* 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
);
/**
* 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.
*
...
...
plugins/rpmd/openmmapi/src/RPMDIntegrator.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2008-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2008-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -34,6 +34,7 @@
#include "openmm/OpenMMException.h"
#include "openmm/internal/ContextImpl.h"
#include "openmm/RpmdKernels.h"
#include "SimTKOpenMMRealType.h"
#include <cmath>
#include <ctime>
#include <string>
...
...
@@ -195,3 +196,27 @@ void RPMDIntegrator::step(int steps) {
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
;
}
plugins/rpmd/platforms/cuda/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM CUDA RPMD Integrator
#
# Creates OpenMM library, base name=OpenMMRPMDCUDA.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMRPMDCUDA library,.
#
# Windows:
# OpenMMRPMDCUDA
[_d]
.dll
# OpenMMRPMDCUDA
[_d]
.lib
# OpenMMRPMDCUDA.dll
# OpenMMRPMDCUDA.lib
# Unix:
# libOpenMMRPMDCUDA
[_d]
.so
# libOpenMMRPMDCUDA.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMRPMDCUDA_LIBRARY_NAME OpenMMRPMDCUDA)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -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
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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
}
${
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
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
CUDA_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
CUDA
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_RPMD_TARGET
}
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES COMPILE_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-DOPENMM_BUILDING_SHARED_LIBRARY"
)
IF
(
APPLE
)
SET_TARGET_PROPERTIES
(
${
SHARED_TARGET
}
PROPERTIES LINK_FLAGS
"
${
EXTRA_COMPILE_FLAGS
}
-F/Library/Frameworks -framework CUDA"
)
...
...
@@ -119,11 +99,7 @@ ENDIF (APPLE)
INSTALL
(
TARGETS
${
SHARED_TARGET
}
DESTINATION
${
CMAKE_INSTALL_PREFIX
}
/lib/plugins
)
# Ensure that links to the main CUDA library will be resolved.
IF
(
APPLE
)
IF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA_d.dylib
)
ELSE
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA.dylib
)
ENDIF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
CUDA_LIBRARY libOpenMMCUDA.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
)
if
(
OPENMM_BUILD_CUDA_TESTS
)
...
...
plugins/rpmd/platforms/cuda/tests/TestCudaRpmd.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2011-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2011-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -466,30 +466,9 @@ void testWithoutThermostat() {
double
initialEnergy
;
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
++
)
{
integ
.
step
(
1
);
// 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
);
}
}
double
energy
=
integ
.
getTotalEnergy
();
if
(
i
==
0
)
initialEnergy
=
energy
;
else
...
...
plugins/rpmd/platforms/opencl/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM OpenCL RPMD Integrator
#
# Creates OpenMM library, base name=OpenMMRPMDOpenCL.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMRPMDOpenCL library.
#
# Windows:
# OpenMMRPMDOpenCL
[_d]
.dll
# OpenMMRPMDOpenCL
[_d]
.lib
# OpenMMRPMDOpenCL.dll
# OpenMMRPMDOpenCL.lib
# Unix:
# libOpenMMRPMDOpenCL
[_d]
.so
# libOpenMMRPMDOpenCL.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMRPMDOPENCL_LIBRARY_NAME OpenMMRPMDOpenCL)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -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
)
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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
}
${
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
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
${
OPENCL_LIBRARIES
}
${
PTHREADS_LIB
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
OpenCL
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_RPMD_TARGET
}
)
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
)
# Ensure that links to the main OpenCL library will be resolved.
IF
(
APPLE
)
IF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL_d.dylib
)
ELSE
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL.dylib
)
ENDIF
(
CMAKE_BUILD_TYPE MATCHES Debug
)
SET
(
OPENCL_LIBRARY libOpenMMOpenCL.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
)
if
(
OPENMM_BUILD_OPENCL_TESTS
)
...
...
plugins/rpmd/platforms/opencl/tests/TestOpenCLRpmd.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2011-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2011-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -467,30 +467,9 @@ void testWithoutThermostat() {
double
initialEnergy
;
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
++
)
{
integ
.
step
(
1
);
// 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
);
}
}
double
energy
=
integ
.
getTotalEnergy
();
if
(
i
==
0
)
initialEnergy
=
energy
;
else
...
...
plugins/rpmd/platforms/reference/CMakeLists.txt
View file @
51828eaa
#---------------------------------------------------
# OpenMM Reference RPMD Integrator
#
# Creates OpenMM library, base name=OpenMMRPMDReference.
# Default libraries are shared & optimized. Variants
# are created for debug (_d).
# Creates OpenMMRPMDReference library.
#
# Windows:
# OpenMMRPMDReference
[_d]
.dll
# OpenMMRPMDReference
[_d]
.lib
# OpenMMRPMDReference.dll
# OpenMMRPMDReference.lib
# Unix:
# libOpenMMRPMDReference
[_d]
.so
# libOpenMMRPMDReference.so
#----------------------------------------------------
# The source is organized into subdirectories, but we handle them all from
...
...
@@ -24,19 +22,6 @@ SET(OPENMMRPMDREFERENCE_LIBRARY_NAME OpenMMRPMDReference)
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
# to be part of the API.
SET
(
API_INCLUDE_DIRS
)
# start empty
...
...
@@ -84,13 +69,8 @@ INCLUDE_DIRECTORIES(${REFERENCE_INCLUDE_DIR})
ADD_LIBRARY
(
${
SHARED_TARGET
}
SHARED
${
SOURCE_FILES
}
${
SOURCE_INCLUDE_FILES
}
${
API_ABS_INCLUDE_FILES
}
)
IF
(
UNIX AND CMAKE_BUILD_TYPE MATCHES Debug
)
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_RPMD_TARGET
}
optimized
${
SHARED_RPMD_TARGET
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
OPENMM_LIBRARY_NAME
}
)
TARGET_LINK_LIBRARIES
(
${
SHARED_TARGET
}
${
SHARED_RPMD_TARGET
}
)
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
)
...
...
plugins/rpmd/platforms/reference/tests/CMakeLists.txt
View file @
51828eaa
...
...
@@ -8,11 +8,6 @@ INCLUDE_DIRECTORIES(${OPENMM_DIR}/platforms/reference/src)
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
# Automatically create tests using files named "Test*.cpp"
...
...
plugins/rpmd/platforms/reference/tests/TestReferenceRpmd.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2011-201
3
Stanford University and the Authors. *
* Portions copyright (c) 2011-201
4
Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
...
...
@@ -350,30 +350,9 @@ void testWithoutThermostat() {
double
initialEnergy
;
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
++
)
{
integ
.
step
(
1
);
// 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
);
}
}
double
energy
=
integ
.
getTotalEnergy
();
if
(
i
==
0
)
initialEnergy
=
energy
;
else
...
...
serialization/include/openmm/serialization/SerializationNode.h
View file @
51828eaa
...
...
@@ -152,6 +152,28 @@ public:
* @param value the value to set for the property
*/
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
* the specified name, an exception is thrown.
...
...
serialization/src/AndersenThermostatProxy.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* 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 *
* Contributors: *
* *
...
...
@@ -47,6 +47,7 @@ void AndersenThermostatProxy::serialize(const void* object, SerializationNode& n
node
.
setDoubleProperty
(
"temperature"
,
force
.
getDefaultTemperature
());
node
.
setDoubleProperty
(
"frequency"
,
force
.
getDefaultCollisionFrequency
());
node
.
setIntProperty
(
"randomSeed"
,
force
.
getRandomNumberSeed
());
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
}
void
*
AndersenThermostatProxy
::
deserialize
(
const
SerializationNode
&
node
)
const
{
...
...
@@ -55,6 +56,7 @@ void* AndersenThermostatProxy::deserialize(const SerializationNode& node) const
AndersenThermostat
*
force
=
NULL
;
try
{
AndersenThermostat
*
force
=
new
AndersenThermostat
(
node
.
getDoubleProperty
(
"temperature"
),
node
.
getDoubleProperty
(
"frequency"
));
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
force
->
setRandomNumberSeed
(
node
.
getIntProperty
(
"randomSeed"
));
return
force
;
}
...
...
serialization/src/CMAPTorsionForceProxy.cpp
View file @
51828eaa
...
...
@@ -6,7 +6,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* 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 *
* Contributors: *
* *
...
...
@@ -44,6 +44,7 @@ CMAPTorsionForceProxy::CMAPTorsionForceProxy() : SerializationProxy("CMAPTorsion
void
CMAPTorsionForceProxy
::
serialize
(
const
void
*
object
,
SerializationNode
&
node
)
const
{
node
.
setIntProperty
(
"version"
,
1
);
const
CMAPTorsionForce
&
force
=
*
reinterpret_cast
<
const
CMAPTorsionForce
*>
(
object
);
node
.
setIntProperty
(
"forceGroup"
,
force
.
getForceGroup
());
SerializationNode
&
maps
=
node
.
createChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
force
.
getNumMaps
();
i
++
)
{
int
size
;
...
...
@@ -66,6 +67,7 @@ void* CMAPTorsionForceProxy::deserialize(const SerializationNode& node) const {
throw
OpenMMException
(
"Unsupported version number"
);
CMAPTorsionForce
*
force
=
new
CMAPTorsionForce
();
try
{
force
->
setForceGroup
(
node
.
getIntProperty
(
"forceGroup"
,
0
));
const
SerializationNode
&
maps
=
node
.
getChildNode
(
"Maps"
);
for
(
int
i
=
0
;
i
<
(
int
)
maps
.
getChildren
().
size
();
i
++
)
{
const
SerializationNode
&
map
=
maps
.
getChildren
()[
i
];
...
...
Prev
1
…
4
5
6
7
8
9
10
11
12
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment