Commit ecc3bebc authored by Robert McGibbon's avatar Robert McGibbon
Browse files

Merge branch 'master' of github.com:pandegroup/openmm into sphinx

parents ec694ba8 cab0faf8
...@@ -131,16 +131,11 @@ script: ...@@ -131,16 +131,11 @@ script:
make PythonInstall; make PythonInstall;
fi; fi;
python -m simtk.testInstallation; python -m simtk.testInstallation;
(cd python/tests && py.test -v *); (cd python/tests && py.test -v);
fi fi
- # run all of the tests, making sure failures at this stage don't cause travis failures - # run all of the tests, making sure failures at this stage don't cause travis failures
- ctest -j2 --output-on-failure --schedule-random --stop-time $CTEST_STOP_TIME || true - python devtools/run-ctest.py -j2 --schedule-random --stop-time $CTEST_STOP_TIME
- # get a list of all of the failed tests into this stupid ctest format
- python -c "import os; fn = os.path.join('Testing', 'Temporary', 'LastTestsFailed.log'); os.path.exists(fn) or exit(0); failed = [line.split(':')[0] for line in open(fn)]; print(','.join(x+','+x for x in failed))" > FailedTests.log
- if [ -s Testing/Temporary/LastTestsFailed.log ]; then
ctest -I FailedTests.log;
fi
- if [[ ! -z "${DOCS_DEPLOY}" && "${DOCS_DEPLOY}" = "true" ]]; then - if [[ ! -z "${DOCS_DEPLOY}" && "${DOCS_DEPLOY}" = "true" ]]; then
pip install sphinx sphinxcontrib-lunrsearch sphinxcontrib-autodoc_doxygen; pip install sphinx sphinxcontrib-lunrsearch sphinxcontrib-autodoc_doxygen;
make C++ApiDocs PythonApiDocs; make C++ApiDocs PythonApiDocs;
......
...@@ -5,11 +5,10 @@ install: ...@@ -5,11 +5,10 @@ install:
# Setup shell for VS2010, x64, release mode # Setup shell for VS2010, x64, release mode
- > - >
"%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
# Set path to python, git-bash tools. # Set path to python, git-bash tools.
- "set PATH=C:\\Python34-x64;C:\\Python34-x64\\Scripts;%PATH%" - "set PATH=C:\\Python34-x64;C:\\Python34-x64\\Scripts;%PATH%"
- "set PATH=C:\\Program Files (x86)\\Git\\bin;%PATH%" - "set PATH=C:\\Program Files (x86)\\Git\\bin;%PATH%"
- pip install nose - pip install pytest
# Download FFTW3 for PME plugin # Download FFTW3 for PME plugin
- C:\MinGW\msys\1.0\bin\wget -q ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4-dll64.zip - C:\MinGW\msys\1.0\bin\wget -q ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4-dll64.zip
...@@ -22,26 +21,40 @@ install: ...@@ -22,26 +21,40 @@ install:
# Download and install some OpenMM build dependencies (doxygen, swig) # Download and install some OpenMM build dependencies (doxygen, swig)
- choco install -y doxygen.portable swig > null - choco install -y doxygen.portable swig > null
# Set CMake options # Download OpenCL Headers and build the ICD loader
- ps: $env:CMAKE_FLAGS='-DOPENMM_BUILD_PME_PLUGIN=ON -DFFTW_LIBRARY=C:/fftw/libfftw3f-3.lib -DFFTW_INCLUDES=C:/fftw -DCMAKE_BUILD_TYPE=Release -DOPENMM_BUILD_EXAMPLES=OFF -DCMAKE_CXX_FLAGS_RELEASE="/MD /Od /Ob0 /D NDEBUG"' - ps: $opencl_registry = "https://www.khronos.org/registry/cl"
- ps: mkdir C:/opencl > $null
- ps: cd C:/opencl
- ps: wget $opencl_registry/specs/opencl-icd-1.2.11.0.tgz -OutFile opencl-icd-1.2.11.0.tgz
- ps: 7z x opencl-icd-1.2.11.0.tgz > $null
- ps: 7z x opencl-icd-1.2.11.0.tar > $null
- ps: mv .\icd\* .
- ps: mkdir inc/CL > $null
- ps: wget $opencl_registry/api/1.2/ | select -ExpandProperty links | where {$_.href -like "*.h*"} | select -ExpandProperty outerText | foreach{ wget $opencl_registry/api/1.2/$_ -OutFile inc/CL/$_ }
- ps: mkdir lib > $null
- ps: cd lib
- cmake -G "NMake Makefiles" ..
- nmake
- cd %APPVEYOR_BUILD_FOLDER%
build_script:
- ps: $env:CMAKE_FLAGS =
"-DOPENMM_BUILD_PME_PLUGIN=ON
-DOPENCL_INCLUDE_DIR=C:/opencl/inc
-DOPENCL_LIBRARY=C:/opencl/lib/OpenCL.lib
-DFFTW_LIBRARY=C:/fftw/libfftw3f-3.lib
-DFFTW_INCLUDES=C:/fftw
-DOPENMM_BUILD_EXAMPLES=OFF
-DOPENMM_BUILD_OPENCL_TESTS=OFF
-DCMAKE_BUILD_TYPE=Release
-LA"
- mkdir build - mkdir build
- cd build - cd build
- cmake -G "NMake Makefiles" %CMAKE_FLAGS% -LA .. - cmake -G "NMake Makefiles" %CMAKE_FLAGS% -LA -DCMAKE_CXX_FLAGS_RELEASE="/MD /Od /Ob0 /D NDEBUG" ..
# Run the build
- cmake --build . --target install - cmake --build . --target install
- cmake --build . --target PythonInstall - cmake --build . --target PythonInstall
build: false
test_script: test_script:
- ctest || exit 0 - python %APPVEYOR_BUILD_FOLDER%\devtools\run-ctest.py
- python -c "import os; fn = os.path.join('Testing', 'Temporary', 'LastTestsFailed.log'); os.path.exists(fn) or exit(0); failed = [line.split(':')[0] for line in open(fn)]; print(','.join(x+','+x for x in failed))" > FailedTests.log
- ps: >
If (Test-Path "Testing\\Temporary\\LastTestsFailed.log") {
cat Testing\\Temporary\\LastTestsFailed.log
cat FailedTests.log
ctest -I FailedTests.log
}
- cd python\tests - cd python\tests
- nosetests -vv --processes=-1 --process-timeout=200 - py.test -v
- cd %APPVEYOR_BUILD_FOLDER%
from __future__ import print_function
import sys
from os.path import join, exists
from subprocess import call
def main():
# pass any extra arguments to the first ctest invocation
if call(['ctest', '--output-on-failure'] + sys.argv[1:], shell=True) == 0:
return 0
# load the log file containing the failed tests and reformat
# it in a way so that ctest can take it as input to rerun
# the failing tests
log = join('Testing', 'Temporary', 'LastTestsFailed.log')
assert exists(log)
failed = []
for line in open(log):
failed.append(line.split(':')[0])
with open('FailedTests.log', 'w') as f:
print(','.join(x + ',' + x for x in failed), file=f)
return call(['ctest', '--output-on-failure', '-I', 'FailedTests.log'])
if __name__ == '__main__':
sys.exit(main())
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
/** /**
* Create a Kernel that wraps a KernelImpl. * Create a Kernel that wraps a KernelImpl.
* *
* @param name the name of the kernel to create * @param KernelImpl the KernelImpl to wrap
*/ */
Kernel(KernelImpl* impl); Kernel(KernelImpl* impl);
~Kernel(); ~Kernel();
......
...@@ -53,7 +53,7 @@ class KernelFactory; ...@@ -53,7 +53,7 @@ class KernelFactory;
* To get a Platform object, call * To get a Platform object, call
* *
* <pre> * <pre>
* Platform& platform Platform::findPlatform(kernelNames); * Platform& platform = Platform::findPlatform(kernelNames);
* </pre> * </pre>
* *
* passing in the names of all kernels that will be required for the calculation you plan to perform. It * passing in the names of all kernels that will be required for the calculation you plan to perform. It
...@@ -78,6 +78,9 @@ public: ...@@ -78,6 +78,9 @@ public:
/** /**
* Get whether this Platform supports double precision arithmetic. If this returns false, the platform * Get whether this Platform supports double precision arithmetic. If this returns false, the platform
* is permitted to represent double precision values internally as single precision. * is permitted to represent double precision values internally as single precision.
*
* @deprecated This method is not well defined, and is too simplistic to describe the actual behavior of
* some Platforms, such as ones that offer multiple precision modes. It will be removed in a future release.
*/ */
virtual bool supportsDoublePrecision() const = 0; virtual bool supportsDoublePrecision() const = 0;
/** /**
......
...@@ -369,8 +369,8 @@ public: ...@@ -369,8 +369,8 @@ public:
* Get the donor and acceptor in a pair whose interaction should be excluded. * Get the donor and acceptor in a pair whose interaction should be excluded.
* *
* @param index the index of the exclusion for which to get donor and acceptor indices * @param index the index of the exclusion for which to get donor and acceptor indices
* @param[out] particle1 the index of the donor * @param[out] donor the index of the donor
* @param[out] particle2 the index of the acceptor * @param[out] acceptor the index of the acceptor
*/ */
void getExclusionParticles(int index, int& donor, int& acceptor) const; void getExclusionParticles(int index, int& donor, int& acceptor) const;
/** /**
......
...@@ -80,11 +80,11 @@ public: ...@@ -80,11 +80,11 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param values the tabulated values of the function f(x) at uniformly spaced values of x between min * @param[out] values the tabulated values of the function f(x) at uniformly spaced values of x between min
* and max. A natural cubic spline is used to interpolate between the tabulated values. * and max. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero for x &lt; min or x &gt; max. * The function is assumed to be zero for x &lt; min or x &gt; max.
* @param min the value of x corresponding to the first element of values * @param[out] min the value of x corresponding to the first element of values
* @param max the value of x corresponding to the last element of values * @param[out] max the value of x corresponding to the last element of values
*/ */
void getFunctionParameters(std::vector<double>& values, double& min, double& max) const; void getFunctionParameters(std::vector<double>& values, double& min, double& max) const;
/** /**
...@@ -129,16 +129,16 @@ public: ...@@ -129,16 +129,16 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin * @param[out] values the tabulated values of the function f(x,y) at xsize uniformly spaced values of x between xmin
* and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values. * and xmax, and ysize values of y between ymin and ymax. A natural cubic spline is used to interpolate between the tabulated values.
* The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that * The function is assumed to be zero when x or y is outside its specified range. The values should be ordered so that
* values[i+xsize*j] = f(x_i,y_j), where x_i is the i'th uniformly spaced value of x. This must be of length xsize*ysize. * values[i+xsize*j] = f(x_i,y_j), where x_i is the i'th uniformly spaced value of x. This must be of length xsize*ysize.
* @param xsize the number of table elements along the x direction * @param[out] xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction * @param[out] ysize the number of table elements along the y direction
* @param xmin the value of x corresponding to the first element of values * @param[out] xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values * @param[out] xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values * @param[out] ymin the value of y corresponding to the first element of values
* @param ymax the value of y corresponding to the last element of values * @param[out] ymax the value of y corresponding to the last element of values
*/ */
void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax) const; void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax) const;
/** /**
...@@ -194,21 +194,21 @@ public: ...@@ -194,21 +194,21 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin * @param[out] values the tabulated values of the function f(x,y,z) at xsize uniformly spaced values of x between xmin
* and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax. * and xmax, ysize values of y between ymin and ymax, and zsize values of z between zmin and zmax.
* A natural cubic spline is used to interpolate between the tabulated values. The function is * A natural cubic spline is used to interpolate between the tabulated values. The function is
* assumed to be zero when x, y, or z is outside its specified range. The values should be ordered so * assumed to be zero when x, y, or z is outside its specified range. The values should be ordered so
* that values[i+xsize*j+xsize*ysize*k] = f(x_i,y_j,z_k), where x_i is the i'th uniformly spaced value of x. * that values[i+xsize*j+xsize*ysize*k] = f(x_i,y_j,z_k), where x_i is the i'th uniformly spaced value of x.
* This must be of length xsize*ysize*zsize. * This must be of length xsize*ysize*zsize.
* @param xsize the number of table elements along the x direction * @param[out] xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction * @param[out] ysize the number of table elements along the y direction
* @param ysize the number of table elements along the z direction * @param[out] zsize the number of table elements along the z direction
* @param xmin the value of x corresponding to the first element of values * @param[out] xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values * @param[out] xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values * @param[out] ymin the value of y corresponding to the first element of values
* @param ymax the value of y corresponding to the last element of values * @param[out] ymax the value of y corresponding to the last element of values
* @param zmin the value of z corresponding to the first element of values * @param[out] zmin the value of z corresponding to the first element of values
* @param zmax the value of z corresponding to the last element of values * @param[out] zmax the value of z corresponding to the last element of values
*/ */
void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax) const; void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values, double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax) const;
/** /**
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
* This must be of length xsize*ysize*zsize. * This must be of length xsize*ysize*zsize.
* @param xsize the number of table elements along the x direction * @param xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction * @param ysize the number of table elements along the y direction
* @param ysize the number of table elements along the z direction * @param zsize the number of table elements along the z direction
* @param xmin the value of x corresponding to the first element of values * @param xmin the value of x corresponding to the first element of values
* @param xmax the value of x corresponding to the last element of values * @param xmax the value of x corresponding to the last element of values
* @param ymin the value of y corresponding to the first element of values * @param ymin the value of y corresponding to the first element of values
...@@ -257,7 +257,7 @@ public: ...@@ -257,7 +257,7 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param values the tabulated values of the function f(x) * @param[out] values the tabulated values of the function f(x)
*/ */
void getFunctionParameters(std::vector<double>& values) const; void getFunctionParameters(std::vector<double>& values) const;
/** /**
...@@ -293,9 +293,9 @@ public: ...@@ -293,9 +293,9 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param xsize the number of table elements along the x direction * @param[out] xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction * @param[out] ysize the number of table elements along the y direction
* @param values the tabulated values of the function f(x,y), ordered so that * @param[out] values the tabulated values of the function f(x,y), ordered so that
* values[i+xsize*j] = f(i,j). This must be of length xsize*ysize. * values[i+xsize*j] = f(i,j). This must be of length xsize*ysize.
*/ */
void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values) const; void getFunctionParameters(int& xsize, int& ysize, std::vector<double>& values) const;
...@@ -337,10 +337,10 @@ public: ...@@ -337,10 +337,10 @@ public:
/** /**
* Get the parameters for the tabulated function. * Get the parameters for the tabulated function.
* *
* @param xsize the number of table elements along the x direction * @param[out] xsize the number of table elements along the x direction
* @param ysize the number of table elements along the y direction * @param[out] ysize the number of table elements along the y direction
* @param zsize the number of table elements along the z direction * @param[out] zsize the number of table elements along the z direction
* @param values the tabulated values of the function f(x,y,z), ordered so that * @param[out] values the tabulated values of the function f(x,y,z), ordered so that
* values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize. * values[i+xsize*j+xsize*ysize*k] = f(i,j,k). This must be of length xsize*ysize*zsize.
*/ */
void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values) const; void getFunctionParameters(int& xsize, int& ysize, int& zsize, std::vector<double>& values) const;
......
...@@ -76,7 +76,7 @@ bool CudaContext::hasInitializedCuda = false; ...@@ -76,7 +76,7 @@ bool CudaContext::hasInitializedCuda = false;
CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlockingSync, const string& precision, const string& compiler, CudaContext::CudaContext(const System& system, int deviceIndex, bool useBlockingSync, const string& precision, const string& compiler,
const string& tempDir, const std::string& hostCompiler, CudaPlatform::PlatformData& platformData) : system(system), currentStream(0), const string& tempDir, const std::string& hostCompiler, CudaPlatform::PlatformData& platformData) : system(system), currentStream(0),
time(0.0), platformData(platformData), stepCount(0), computeForceCount(0), stepsSinceReorder(99999), contextIsValid(false), atomsWereReordered(false), hasCompilerKernel(false), time(0.0), platformData(platformData), stepCount(0), computeForceCount(0), stepsSinceReorder(99999), contextIsValid(false), atomsWereReordered(false), hasCompilerKernel(false),
pinnedBuffer(NULL), posq(NULL), posqCorrection(NULL), velm(NULL), force(NULL), energyBuffer(NULL), integration(NULL), expression(NULL), bonded(NULL), nonbonded(NULL), thread(NULL) { pinnedBuffer(NULL), posq(NULL), posqCorrection(NULL), velm(NULL), force(NULL), energyBuffer(NULL), atomIndexDevice(NULL), integration(NULL), expression(NULL), bonded(NULL), nonbonded(NULL), thread(NULL) {
this->compiler = "\""+compiler+"\""; this->compiler = "\""+compiler+"\"";
if (platformData.context != NULL) { if (platformData.context != NULL) {
try { try {
...@@ -339,6 +339,8 @@ CudaContext::~CudaContext() { ...@@ -339,6 +339,8 @@ CudaContext::~CudaContext() {
delete force; delete force;
if (energyBuffer != NULL) if (energyBuffer != NULL)
delete energyBuffer; delete energyBuffer;
if (atomIndexDevice != NULL)
delete atomIndexDevice;
if (integration != NULL) if (integration != NULL)
delete integration; delete integration;
if (expression != NULL) if (expression != NULL)
......
...@@ -1643,6 +1643,9 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon ...@@ -1643,6 +1643,9 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
defines["USE_EWALD"] = "1"; defines["USE_EWALD"] = "1";
if (cu.getContextIndex() == 0) { if (cu.getContextIndex() == 0) {
ewaldSelfEnergy = -ONE_4PI_EPS0*alpha*sumSquaredCharges/sqrt(M_PI); ewaldSelfEnergy = -ONE_4PI_EPS0*alpha*sumSquaredCharges/sqrt(M_PI);
char deviceName[100];
cuDeviceGetName(deviceName, 100, cu.getDevice());
usePmeStream = (string(deviceName) != "GeForce GTX 980"); // Using a separate stream is slower on GTX 980
pmeDefines["PME_ORDER"] = cu.intToString(PmeOrder); pmeDefines["PME_ORDER"] = cu.intToString(PmeOrder);
pmeDefines["NUM_ATOMS"] = cu.intToString(numParticles); pmeDefines["NUM_ATOMS"] = cu.intToString(numParticles);
pmeDefines["PADDED_NUM_ATOMS"] = cu.intToString(cu.getPaddedNumAtoms()); pmeDefines["PADDED_NUM_ATOMS"] = cu.intToString(cu.getPaddedNumAtoms());
...@@ -1654,6 +1657,8 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon ...@@ -1654,6 +1657,8 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
pmeDefines["M_PI"] = cu.doubleToString(M_PI); pmeDefines["M_PI"] = cu.doubleToString(M_PI);
if (cu.getUseDoublePrecision()) if (cu.getUseDoublePrecision())
pmeDefines["USE_DOUBLE_PRECISION"] = "1"; pmeDefines["USE_DOUBLE_PRECISION"] = "1";
if (usePmeStream)
pmeDefines["USE_PME_STREAM"] = "1";
CUmodule module = cu.createModule(CudaKernelSources::vectorOps+CudaKernelSources::pme, pmeDefines); CUmodule module = cu.createModule(CudaKernelSources::vectorOps+CudaKernelSources::pme, pmeDefines);
if (cu.getPlatformData().useCpuPme) { if (cu.getPlatformData().useCpuPme) {
// Create the CPU PME kernel. // Create the CPU PME kernel.
...@@ -1713,9 +1718,6 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon ...@@ -1713,9 +1718,6 @@ void CudaCalcNonbondedForceKernel::initialize(const System& system, const Nonbon
// Prepare for doing PME on its own stream. // Prepare for doing PME on its own stream.
char deviceName[100];
cuDeviceGetName(deviceName, 100, cu.getDevice());
usePmeStream = (string(deviceName) != "GeForce GTX 980"); // Using a separate stream is slower on GTX 980
if (usePmeStream) { if (usePmeStream) {
cuStreamCreate(&pmeStream, CU_STREAM_NON_BLOCKING); cuStreamCreate(&pmeStream, CU_STREAM_NON_BLOCKING);
if (useCudaFFT) { if (useCudaFFT) {
......
...@@ -188,7 +188,11 @@ gridEvaluateEnergy(real2* __restrict__ halfcomplex_pmeGrid, mixed* __restrict__ ...@@ -188,7 +188,11 @@ gridEvaluateEnergy(real2* __restrict__ halfcomplex_pmeGrid, mixed* __restrict__
energy += eterm*(grid.x*grid.x + grid.y*grid.y); energy += eterm*(grid.x*grid.x + grid.y*grid.y);
} }
} }
#ifdef USE_PME_STREAM
energyBuffer[blockIdx.x*blockDim.x+threadIdx.x] = 0.5f*energy; energyBuffer[blockIdx.x*blockDim.x+threadIdx.x] = 0.5f*energy;
#else
energyBuffer[blockIdx.x*blockDim.x+threadIdx.x] += 0.5f*energy;
#endif
} }
extern "C" __global__ extern "C" __global__
......
...@@ -1687,6 +1687,7 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb ...@@ -1687,6 +1687,7 @@ void OpenCLCalcNonbondedForceKernel::initialize(const System& system, const Nonb
pmeDefines["USE_ALTERNATE_MEMORY_ACCESS_PATTERN"] = "1"; pmeDefines["USE_ALTERNATE_MEMORY_ACCESS_PATTERN"] = "1";
usePmeQueue = isNvidia; usePmeQueue = isNvidia;
if (usePmeQueue) { if (usePmeQueue) {
pmeDefines["USE_PME_STREAM"] = "1";
pmeQueue = cl::CommandQueue(cl.getContext(), cl.getDevice()); pmeQueue = cl::CommandQueue(cl.getContext(), cl.getDevice());
int recipForceGroup = force.getReciprocalSpaceForceGroup(); int recipForceGroup = force.getReciprocalSpaceForceGroup();
if (recipForceGroup < 0) if (recipForceGroup < 0)
......
...@@ -84,7 +84,7 @@ __kernel void recordZIndex(__global int2* restrict pmeAtomGridIndex, __global co ...@@ -84,7 +84,7 @@ __kernel void recordZIndex(__global int2* restrict pmeAtomGridIndex, __global co
__kernel void gridSpreadCharge(__global const real4* restrict posq, __global const int2* restrict pmeAtomGridIndex, __global const int* restrict pmeAtomRange, __kernel void gridSpreadCharge(__global const real4* restrict posq, __global const int2* restrict pmeAtomGridIndex, __global const int* restrict pmeAtomRange,
__global long* restrict pmeGrid, __global const real4* restrict pmeBsplineTheta, real4 periodicBoxSize, real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ) { __global long* restrict pmeGrid, __global const real4* restrict pmeBsplineTheta, real4 periodicBoxSize, real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ) {
const real4 scale = 1/(real) (PME_ORDER-1); const real scale = 1/(real) (PME_ORDER-1);
real4 data[PME_ORDER]; real4 data[PME_ORDER];
// Process the atoms in spatially sorted order. This improves efficiency when writing // Process the atoms in spatially sorted order. This improves efficiency when writing
...@@ -118,7 +118,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con ...@@ -118,7 +118,7 @@ __kernel void gridSpreadCharge(__global const real4* restrict posq, __global con
data[j-1] = div*dr*data[j-2]; data[j-1] = div*dr*data[j-2];
for (int k = 1; k < (j-1); k++) for (int k = 1; k < (j-1); k++)
data[j-k-1] = div*((dr+(real4) k) *data[j-k-2] + (-dr+(real4) (j-k))*data[j-k-1]); data[j-k-1] = div*((dr+(real4) k) *data[j-k-2] + (-dr+(real4) (j-k))*data[j-k-1]);
data[0] = div*(- dr+1.0f)*data[0]; data[0] = div*(-dr+1.0f)*data[0];
} }
data[PME_ORDER-1] = scale*dr*data[PME_ORDER-2]; data[PME_ORDER-1] = scale*dr*data[PME_ORDER-2];
for (int j = 1; j < (PME_ORDER-1); j++) for (int j = 1; j < (PME_ORDER-1); j++)
...@@ -362,12 +362,16 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe ...@@ -362,12 +362,16 @@ __kernel void gridEvaluateEnergy(__global real2* restrict pmeGrid, __global mixe
energy += eterm*(grid.x*grid.x + grid.y*grid.y); energy += eterm*(grid.x*grid.x + grid.y*grid.y);
} }
} }
#ifdef USE_PME_STREAM
energyBuffer[get_global_id(0)] = 0.5f*energy; energyBuffer[get_global_id(0)] = 0.5f*energy;
#else
energyBuffer[get_global_id(0)] += 0.5f*energy;
#endif
} }
__kernel void gridInterpolateForce(__global const real4* restrict posq, __global real4* restrict forceBuffers, __global const real* restrict pmeGrid, __kernel void gridInterpolateForce(__global const real4* restrict posq, __global real4* restrict forceBuffers, __global const real* restrict pmeGrid,
real4 periodicBoxSize, real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ, __global int2* restrict pmeAtomGridIndex) { real4 periodicBoxSize, real4 recipBoxVecX, real4 recipBoxVecY, real4 recipBoxVecZ, __global int2* restrict pmeAtomGridIndex) {
const real4 scale = 1/(real) (PME_ORDER-1); const real scale = 1/(real) (PME_ORDER-1);
real4 data[PME_ORDER]; real4 data[PME_ORDER];
real4 ddata[PME_ORDER]; real4 ddata[PME_ORDER];
...@@ -403,7 +407,7 @@ __kernel void gridInterpolateForce(__global const real4* restrict posq, __global ...@@ -403,7 +407,7 @@ __kernel void gridInterpolateForce(__global const real4* restrict posq, __global
data[j-1] = div*dr*data[j-2]; data[j-1] = div*dr*data[j-2];
for (int k = 1; k < (j-1); k++) for (int k = 1; k < (j-1); k++)
data[j-k-1] = div*((dr+(real4) k) *data[j-k-2] + (-dr+(real4) (j-k))*data[j-k-1]); data[j-k-1] = div*((dr+(real4) k) *data[j-k-2] + (-dr+(real4) (j-k))*data[j-k-1]);
data[0] = div*(- dr+1.0f)*data[0]; data[0] = div*(-dr+1.0f)*data[0];
} }
ddata[0] = -data[0]; ddata[0] = -data[0];
for (int j = 1; j < PME_ORDER; j++) for (int j = 1; j < PME_ORDER; j++)
......
#ifndef OPENMM_CUSTOMCENTROIDBONDFORCE_PROXY_H_
#define OPENMM_CUSTOMCENTROIDBONDFORCE_PROXY_H_
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/windowsExport.h"
#include "openmm/serialization/SerializationProxy.h"
namespace OpenMM {
/**
* This is a proxy for serializing CustomCentroidBondForce objects.
*/
class OPENMM_EXPORT CustomCentroidBondForceProxy : public SerializationProxy {
public:
CustomCentroidBondForceProxy();
void serialize(const void* object, SerializationNode& node) const;
void* deserialize(const SerializationNode& node) const;
};
} // namespace OpenMM
#endif /*OPENMM_CUSTOMCENTROIDBONDFORCE_PROXY_H_*/
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/serialization/CustomCentroidBondForceProxy.h"
#include "openmm/serialization/SerializationNode.h"
#include "openmm/Force.h"
#include "openmm/CustomCentroidBondForce.h"
#include <sstream>
using namespace OpenMM;
using namespace std;
CustomCentroidBondForceProxy::CustomCentroidBondForceProxy() : SerializationProxy("CustomCentroidBondForce") {
}
void CustomCentroidBondForceProxy::serialize(const void* object, SerializationNode& node) const {
node.setIntProperty("version", 1);
const CustomCentroidBondForce& force = *reinterpret_cast<const CustomCentroidBondForce*>(object);
node.setIntProperty("forceGroup", force.getForceGroup());
node.setIntProperty("groups", force.getNumGroupsPerBond());
node.setStringProperty("energy", force.getEnergyFunction());
SerializationNode& perBondParams = node.createChildNode("PerBondParameters");
for (int i = 0; i < force.getNumPerBondParameters(); i++) {
perBondParams.createChildNode("Parameter").setStringProperty("name", force.getPerBondParameterName(i));
}
SerializationNode& globalParams = node.createChildNode("GlobalParameters");
for (int i = 0; i < force.getNumGlobalParameters(); i++) {
globalParams.createChildNode("Parameter").setStringProperty("name", force.getGlobalParameterName(i)).setDoubleProperty("default", force.getGlobalParameterDefaultValue(i));
}
SerializationNode& groups = node.createChildNode("Groups");
for (int i = 0; i < force.getNumGroups(); i++) {
vector<int> particles;
vector<double> weights;
force.getGroupParameters(i, particles, weights);
SerializationNode& group = groups.createChildNode("Group");
for (int j = 0; j < (int) particles.size(); j++) {
SerializationNode& node = group.createChildNode("Particle");
node.setIntProperty("p", particles[j]);
node.setDoubleProperty("weight", weights[j]);
}
}
SerializationNode& bonds = node.createChildNode("Bonds");
for (int i = 0; i < force.getNumBonds(); i++) {
vector<int> groups;
vector<double> params;
force.getBondParameters(i, groups, params);
SerializationNode& node = bonds.createChildNode("Bond");
for (int j = 0; j < (int) groups.size(); j++) {
stringstream key;
key << "g";
key << j+1;
node.setIntProperty(key.str(), groups[j]);
}
for (int j = 0; j < (int) params.size(); j++) {
stringstream key;
key << "param";
key << j+1;
node.setDoubleProperty(key.str(), params[j]);
}
}
SerializationNode& functions = node.createChildNode("Functions");
for (int i = 0; i < force.getNumTabulatedFunctions(); i++)
functions.createChildNode("Function", &force.getTabulatedFunction(i)).setStringProperty("name", force.getTabulatedFunctionName(i));
}
void* CustomCentroidBondForceProxy::deserialize(const SerializationNode& node) const {
if (node.getIntProperty("version") != 1)
throw OpenMMException("Unsupported version number");
CustomCentroidBondForce* force = NULL;
try {
CustomCentroidBondForce* force = new CustomCentroidBondForce(node.getIntProperty("groups"), node.getStringProperty("energy"));
force->setForceGroup(node.getIntProperty("forceGroup", 0));
const SerializationNode& perBondParams = node.getChildNode("PerBondParameters");
for (int i = 0; i < (int) perBondParams.getChildren().size(); i++) {
const SerializationNode& parameter = perBondParams.getChildren()[i];
force->addPerBondParameter(parameter.getStringProperty("name"));
}
const SerializationNode& globalParams = node.getChildNode("GlobalParameters");
for (int i = 0; i < (int) globalParams.getChildren().size(); i++) {
const SerializationNode& parameter = globalParams.getChildren()[i];
force->addGlobalParameter(parameter.getStringProperty("name"), parameter.getDoubleProperty("default"));
}
const SerializationNode& groups = node.getChildNode("Groups");
for (int i = 0; i < (int) groups.getChildren().size(); i++) {
const SerializationNode& group = groups.getChildren()[i];
vector<int> particles;
vector<double> weights;
for (int j = 0; j < (int) group.getChildren().size(); j++) {
particles.push_back(group.getChildren()[j].getIntProperty("p"));
weights.push_back(group.getChildren()[j].getDoubleProperty("weight"));
}
force->addGroup(particles, weights);
}
const SerializationNode& bonds = node.getChildNode("Bonds");
vector<int> bondGroups(force->getNumGroupsPerBond());
vector<double> params(force->getNumPerBondParameters());
for (int i = 0; i < (int) bonds.getChildren().size(); i++) {
const SerializationNode& bond = bonds.getChildren()[i];
for (int j = 0; j < (int) bondGroups.size(); j++) {
stringstream key;
key << "g";
key << j+1;
bondGroups[j] = bond.getIntProperty(key.str());
}
for (int j = 0; j < (int) params.size(); j++) {
stringstream key;
key << "param";
key << j+1;
params[j] = bond.getDoubleProperty(key.str());
}
force->addBond(bondGroups, params);
}
const SerializationNode& functions = node.getChildNode("Functions");
for (int i = 0; i < (int) functions.getChildren().size(); i++) {
const SerializationNode& function = functions.getChildren()[i];
if (function.hasProperty("type")) {
force->addTabulatedFunction(function.getStringProperty("name"), function.decodeObject<TabulatedFunction>());
}
else {
// This is an old file created before TabulatedFunction existed.
const SerializationNode& valuesNode = function.getChildNode("Values");
vector<double> values;
for (int j = 0; j < (int) valuesNode.getChildren().size(); j++)
values.push_back(valuesNode.getChildren()[j].getDoubleProperty("v"));
force->addTabulatedFunction(function.getStringProperty("name"), new Continuous1DFunction(values, function.getDoubleProperty("min"), function.getDoubleProperty("max")));
}
}
return force;
}
catch (...) {
if (force != NULL)
delete force;
throw;
}
}
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "openmm/CompoundIntegrator.h" #include "openmm/CompoundIntegrator.h"
#include "openmm/CustomAngleForce.h" #include "openmm/CustomAngleForce.h"
#include "openmm/CustomBondForce.h" #include "openmm/CustomBondForce.h"
#include "openmm/CustomCentroidBondForce.h"
#include "openmm/CustomCompoundBondForce.h" #include "openmm/CustomCompoundBondForce.h"
#include "openmm/CustomExternalForce.h" #include "openmm/CustomExternalForce.h"
#include "openmm/CustomGBForce.h" #include "openmm/CustomGBForce.h"
...@@ -68,6 +69,7 @@ ...@@ -68,6 +69,7 @@
#include "openmm/serialization/CompoundIntegratorProxy.h" #include "openmm/serialization/CompoundIntegratorProxy.h"
#include "openmm/serialization/CustomAngleForceProxy.h" #include "openmm/serialization/CustomAngleForceProxy.h"
#include "openmm/serialization/CustomBondForceProxy.h" #include "openmm/serialization/CustomBondForceProxy.h"
#include "openmm/serialization/CustomCentroidBondForceProxy.h"
#include "openmm/serialization/CustomCompoundBondForceProxy.h" #include "openmm/serialization/CustomCompoundBondForceProxy.h"
#include "openmm/serialization/CustomExternalForceProxy.h" #include "openmm/serialization/CustomExternalForceProxy.h"
#include "openmm/serialization/CustomGBForceProxy.h" #include "openmm/serialization/CustomGBForceProxy.h"
...@@ -118,6 +120,7 @@ extern "C" void registerSerializationProxies() { ...@@ -118,6 +120,7 @@ extern "C" void registerSerializationProxies() {
SerializationProxy::registerProxy(typeid(Continuous3DFunction), new Continuous3DFunctionProxy()); SerializationProxy::registerProxy(typeid(Continuous3DFunction), new Continuous3DFunctionProxy());
SerializationProxy::registerProxy(typeid(CustomAngleForce), new CustomAngleForceProxy()); SerializationProxy::registerProxy(typeid(CustomAngleForce), new CustomAngleForceProxy());
SerializationProxy::registerProxy(typeid(CustomBondForce), new CustomBondForceProxy()); SerializationProxy::registerProxy(typeid(CustomBondForce), new CustomBondForceProxy());
SerializationProxy::registerProxy(typeid(CustomCentroidBondForce), new CustomCentroidBondForceProxy());
SerializationProxy::registerProxy(typeid(CustomCompoundBondForce), new CustomCompoundBondForceProxy()); SerializationProxy::registerProxy(typeid(CustomCompoundBondForce), new CustomCompoundBondForceProxy());
SerializationProxy::registerProxy(typeid(CustomExternalForce), new CustomExternalForceProxy()); SerializationProxy::registerProxy(typeid(CustomExternalForce), new CustomExternalForceProxy());
SerializationProxy::registerProxy(typeid(CustomGBForce), new CustomGBForceProxy()); SerializationProxy::registerProxy(typeid(CustomGBForce), new CustomGBForceProxy());
......
/* -------------------------------------------------------------------------- *
* OpenMM *
* -------------------------------------------------------------------------- *
* This is part of the OpenMM molecular simulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. *
* *
* Portions copyright (c) 2010-2015 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
* THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
* USE OR OTHER DEALINGS IN THE SOFTWARE. *
* -------------------------------------------------------------------------- */
#include "openmm/internal/AssertionUtilities.h"
#include "openmm/CustomCentroidBondForce.h"
#include "openmm/serialization/XmlSerializer.h"
#include <iostream>
#include <sstream>
using namespace OpenMM;
using namespace std;
void testSerialization() {
// Create a Force.
CustomCentroidBondForce force(3, "5*sin(distance(g1,g2))^2+y*z");
force.setForceGroup(3);
force.addGlobalParameter("x", 1.3);
force.addGlobalParameter("y", 2.221);
force.addPerBondParameter("z");
for (int i = 0; i < 3; i++) {
vector<int> particles;
vector<double> weights;
for (int j = 0; j < i+1; j++) {
particles.push_back(i+j);
weights.push_back(1.0/(i+1));
}
force.addGroup(particles, weights);
}
vector<int> groups(3);
vector<double> params(1);
groups[0] = 0;
groups[1] = 1;
groups[2] = 2;
params[0] = 1.0;
force.addBond(groups, params);
groups[0] = 2;
groups[1] = 3;
groups[2] = 4;
params[0] = -3.3;
force.addBond(groups, params);
groups[0] = 3;
groups[1] = 5;
groups[2] = 1;
params[0] = 2.1;
force.addBond(groups, params);
vector<double> values(10);
for (int i = 0; i < 10; i++)
values[i] = sin((double) i);
force.addTabulatedFunction("f", new Continuous1DFunction(values, 0.5, 1.5));
// Serialize and then deserialize it.
stringstream buffer;
XmlSerializer::serialize<CustomCentroidBondForce>(&force, "Force", buffer);
CustomCentroidBondForce* copy = XmlSerializer::deserialize<CustomCentroidBondForce>(buffer);
// Compare the two forces to see if they are identical.
CustomCentroidBondForce& force2 = *copy;
ASSERT_EQUAL(force.getForceGroup(), force2.getForceGroup());
ASSERT_EQUAL(force.getNumGroupsPerBond(), force2.getNumGroupsPerBond());
ASSERT_EQUAL(force.getEnergyFunction(), force2.getEnergyFunction());
ASSERT_EQUAL(force.getNumPerBondParameters(), force2.getNumPerBondParameters());
for (int i = 0; i < force.getNumPerBondParameters(); i++)
ASSERT_EQUAL(force.getPerBondParameterName(i), force2.getPerBondParameterName(i));
ASSERT_EQUAL(force.getNumGlobalParameters(), force2.getNumGlobalParameters());
for (int i = 0; i < force.getNumGlobalParameters(); i++) {
ASSERT_EQUAL(force.getGlobalParameterName(i), force2.getGlobalParameterName(i));
ASSERT_EQUAL(force.getGlobalParameterDefaultValue(i), force2.getGlobalParameterDefaultValue(i));
}
ASSERT_EQUAL(force.getNumGroups(), force2.getNumGroups());
for (int i = 0; i < force.getNumGroups(); i++) {
vector<int> particles1, particles2;
vector<double> weights1, weights2;
force.getGroupParameters(i, particles1, weights1);
force2.getGroupParameters(i, particles2, weights2);
ASSERT_EQUAL(weights1.size(), weights2.size());
for (int j = 0; j < (int) weights1.size(); j++)
ASSERT_EQUAL(weights1[j], weights2[j]);
ASSERT_EQUAL(particles1.size(), particles2.size());
for (int j = 0; j < (int) particles1.size(); j++)
ASSERT_EQUAL(particles1[j], particles2[j]);
}
ASSERT_EQUAL(force.getNumBonds(), force2.getNumBonds());
for (int i = 0; i < force.getNumBonds(); i++) {
vector<int> groups1, groups2;
vector<double> params1, params2;
force.getBondParameters(i, groups1, params1);
force2.getBondParameters(i, groups2, params2);
ASSERT_EQUAL(params1.size(), params2.size());
for (int j = 0; j < (int) params1.size(); j++)
ASSERT_EQUAL(params1[j], params2[j]);
ASSERT_EQUAL(groups1.size(), groups2.size());
for (int j = 0; j < (int) groups1.size(); j++)
ASSERT_EQUAL(groups1[j], groups2[j]);
}
ASSERT_EQUAL(force.getNumTabulatedFunctions(), force2.getNumTabulatedFunctions());
for (int i = 0; i < force.getNumTabulatedFunctions(); i++) {
double min1, min2, max1, max2;
vector<double> val1, val2;
dynamic_cast<Continuous1DFunction&>(force.getTabulatedFunction(i)).getFunctionParameters(val1, min1, max1);
dynamic_cast<Continuous1DFunction&>(force2.getTabulatedFunction(i)).getFunctionParameters(val2, min2, max2);
ASSERT_EQUAL(force.getTabulatedFunctionName(i), force2.getTabulatedFunctionName(i));
ASSERT_EQUAL(min1, min2);
ASSERT_EQUAL(max1, max2);
ASSERT_EQUAL(val1.size(), val2.size());
for (int j = 0; j < (int) val1.size(); j++)
ASSERT_EQUAL(val1[j], val2[j]);
}
}
int main() {
try {
testSerialization();
}
catch(const exception& e) {
cout << "exception: " << e.what() << endl;
return 1;
}
cout << "Done" << endl;
return 0;
}
...@@ -50,6 +50,7 @@ foreach(SUBDIR ${SUBDIRS}) ...@@ -50,6 +50,7 @@ foreach(SUBDIR ${SUBDIRS})
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*README.txt" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*README.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.py" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.py"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.i" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.i"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.ini"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.sh" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.sh"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.xml" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.xml"
"${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.pdb" "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/*.pdb"
......
[pytest]
python_files=Test*.py
\ No newline at end of file
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