Commit f755a61a authored by John Chodera (MSKCC)'s avatar John Chodera (MSKCC)
Browse files

Undo changes.

parent ab41f844
This diff is collapsed.
#ifndef OPENMM_ASSERTIONUTILITIES_H_
#define OPENMM_ASSERTIONUTILITIES_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) 2008-2013 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. *
* -------------------------------------------------------------------------- */
/**
* This file provides a variety of macros useful in test cases.
*/
#include "windowsExport.h"
#include <cmath>
#include <sstream>
namespace OpenMM {
void OPENMM_EXPORT throwException(const char* file, int line, const std::string& details);
} // namespace OpenMM
#define ASSERT(cond) {if (!(cond)) throwException(__FILE__, __LINE__, "");};
#define ASSERT_EQUAL(expected, found) {if (!((expected) == (found))) {std::stringstream details; details << "Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_CONTAINERS(expected, found) {if (!((expected) == (found))) {std::stringstream details; details << "Containers not equal"; throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_TOL(expected, found, tol) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << "Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_EQUAL_VEC(expected, found, tol) {double _norm_ = std::sqrt((expected).dot(expected)); double _scale_ = _norm_ > 1.0 ? _norm_ : 1.0; if ((std::abs(((expected)[0])-((found)[0]))/_scale_ > (tol)) || (std::abs(((expected)[1])-((found)[1]))/_scale_ > (tol)) || (std::abs(((expected)[2])-((found)[2]))/_scale_ > (tol))) {std::stringstream details; details << " Expected "<<(expected)<<", found "<<(found); throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_USUALLY_TRUE(cond) {if (!(cond)) throwException(__FILE__, __LINE__, "(This test is stochastic and may occasionally fail)");};
#define ASSERT_USUALLY_EQUAL_TOL(expected, found, tol) {double _scale_ = std::abs(expected) > 1.0 ? std::abs(expected) : 1.0; if (!(std::abs((expected)-(found))/_scale_ <= (tol))) {std::stringstream details; details << "Expected "<<(expected)<<", found "<<(found)<<" (This test is stochastic and may occasionally fail)"; throwException(__FILE__, __LINE__, details.str());}};
#define ASSERT_VALID_INDEX(index, vector) {if (index < 0 || index >= (int) vector.size()) throwException(__FILE__, __LINE__, "Index out of range");};
#endif /*OPENMM_ASSERTIONUTILITIES_H_*/
...@@ -103,9 +103,9 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons ...@@ -103,9 +103,9 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
CustomNonbondedForce* force = new CustomNonbondedForce(node.getStringProperty("energy")); CustomNonbondedForce* force = new CustomNonbondedForce(node.getStringProperty("energy"));
force->setNonbondedMethod((CustomNonbondedForce::NonbondedMethod) node.getIntProperty("method")); force->setNonbondedMethod((CustomNonbondedForce::NonbondedMethod) node.getIntProperty("method"));
force->setCutoffDistance(node.getDoubleProperty("cutoff")); force->setCutoffDistance(node.getDoubleProperty("cutoff"));
force->setUseSwitchingFunction(node.getBoolProperty("useSwitchingFunction", false)); force->setUseSwitchingFunction(node.getBoolProperty("useSwitchingFunction"));
force->setSwitchingDistance(node.getDoubleProperty("switchingDistance", -1.0)); force->setSwitchingDistance(node.getDoubleProperty("switchingDistance"));
force->setUseLongRangeCorrection(node.getBoolProperty("useLongRangeCorrection", false)); force->setUseLongRangeCorrection(node.getBoolProperty("useLongRangeCorrection"));
const SerializationNode& perParticleParams = node.getChildNode("PerParticleParameters"); const SerializationNode& perParticleParams = node.getChildNode("PerParticleParameters");
for (int i = 0; i < (int) perParticleParams.getChildren().size(); i++) { for (int i = 0; i < (int) perParticleParams.getChildren().size(); i++) {
const SerializationNode& parameter = perParticleParams.getChildren()[i]; const SerializationNode& parameter = perParticleParams.getChildren()[i];
...@@ -149,8 +149,6 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons ...@@ -149,8 +149,6 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
force->addTabulatedFunction(function.getStringProperty("name"), new Continuous1DFunction(values, function.getDoubleProperty("min"), function.getDoubleProperty("max"))); force->addTabulatedFunction(function.getStringProperty("name"), new Continuous1DFunction(values, function.getDoubleProperty("min"), function.getDoubleProperty("max")));
} }
} }
// Look for interaction group definitions in a backward-compatible way.
try {
const SerializationNode& interactionGroups = node.getChildNode("InteractionGroups"); const SerializationNode& interactionGroups = node.getChildNode("InteractionGroups");
for (int i = 0; i < (int) interactionGroups.getChildren().size(); i++) { for (int i = 0; i < (int) interactionGroups.getChildren().size(); i++) {
const SerializationNode& interactionGroup = interactionGroups.getChildren()[i]; const SerializationNode& interactionGroup = interactionGroups.getChildren()[i];
...@@ -166,9 +164,6 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons ...@@ -166,9 +164,6 @@ void* CustomNonbondedForceProxy::deserialize(const SerializationNode& node) cons
set2.insert(set2node.getChildren()[j].getIntProperty("index")); set2.insert(set2node.getChildren()[j].getIntProperty("index"));
force->addInteractionGroup(set1, set2); force->addInteractionGroup(set1, set2);
} }
} catch (exception &e) {
// Do nothing, since we have to assume that InteractionGroups is not present and allow for this possibility.
}
return force; return force;
} }
catch (...) { catch (...) {
......
...@@ -80,20 +80,20 @@ void* NonbondedForceProxy::deserialize(const SerializationNode& node) const { ...@@ -80,20 +80,20 @@ void* NonbondedForceProxy::deserialize(const SerializationNode& node) const {
NonbondedForce* force = new NonbondedForce(); NonbondedForce* force = new NonbondedForce();
try { try {
force->setNonbondedMethod((NonbondedForce::NonbondedMethod) node.getIntProperty("method")); force->setNonbondedMethod((NonbondedForce::NonbondedMethod) node.getIntProperty("method"));
force->setCutoffDistance(node.getDoubleProperty("cutoff", 1.0)); force->setCutoffDistance(node.getDoubleProperty("cutoff"));
force->setUseSwitchingFunction(node.getDoubleProperty("useSwitchingFunction", false)); force->setUseSwitchingFunction(node.getDoubleProperty("useSwitchingFunction"));
force->setSwitchingDistance(node.getDoubleProperty("switchingDistance", -1.0)); force->setSwitchingDistance(node.getDoubleProperty("switchingDistance"));
force->setEwaldErrorTolerance(node.getDoubleProperty("ewaldTolerance", 5e-4)); force->setEwaldErrorTolerance(node.getDoubleProperty("ewaldTolerance"));
force->setReactionFieldDielectric(node.getDoubleProperty("rfDielectric", 78.3)); force->setReactionFieldDielectric(node.getDoubleProperty("rfDielectric"));
force->setUseDispersionCorrection(node.getIntProperty("dispersionCorrection",true)); force->setUseDispersionCorrection(node.getIntProperty("dispersionCorrection"));
double alpha; double alpha;
int nx, ny, nz; int nx, ny, nz;
alpha = node.getDoubleProperty("alpha", 0.0); alpha = node.getDoubleProperty("alpha");
nx = node.getIntProperty("nx", 0); nx = node.getIntProperty("nx");
ny = node.getIntProperty("ny", 0); ny = node.getIntProperty("ny");
nz = node.getIntProperty("nz", 0); nz = node.getIntProperty("nz");
force->setPMEParameters(alpha, nx, ny, nz); force->setPMEParameters(alpha, nx, ny, nz);
force->setReciprocalSpaceForceGroup(node.getIntProperty("recipForceGroup", -1)); force->setReciprocalSpaceForceGroup(node.getIntProperty("recipForceGroup"));
const SerializationNode& particles = node.getChildNode("Particles"); const SerializationNode& particles = node.getChildNode("Particles");
for (int i = 0; i < (int) particles.getChildren().size(); i++) { for (int i = 0; i < (int) particles.getChildren().size(); i++) {
const SerializationNode& particle = particles.getChildren()[i]; const SerializationNode& particle = particles.getChildren()[i];
......
...@@ -517,7 +517,7 @@ QUIET = NO ...@@ -517,7 +517,7 @@ QUIET = NO
# generated by doxygen. Possible values are YES and NO. If left blank # generated by doxygen. Possible values are YES and NO. If left blank
# NO is used. # NO is used.
WARNINGS = NO WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will # for undocumented members. If EXTRACT_ALL is set to YES then this flag will
...@@ -530,7 +530,7 @@ WARN_IF_UNDOCUMENTED = NO ...@@ -530,7 +530,7 @@ WARN_IF_UNDOCUMENTED = NO
# parameters in a documented function, or documenting parameters that # parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly. # don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = NO WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be abled to get warnings for # This WARN_NO_PARAMDOC option can be abled to get warnings for
# functions that are documented, but have no documentation for their parameters # functions that are documented, but have no documentation for their parameters
...@@ -564,14 +564,8 @@ WARN_LOGFILE = ...@@ -564,14 +564,8 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories # directories like "/usr/src/myproject". Separate the files or directories
# with spaces. # with spaces.
INPUT = "/Users/choderaj/code/openmm/openmm.jchodera/openmmapi" \ INPUT = "$(OPENMM_INCLUDE_PATH)/OpenMM.h" \
"/Users/choderaj/code/openmm/openmm.jchodera/olla/include/openmm/Platform.h" \ "$(OPENMM_INCLUDE_PATH)/openmm"
"/Users/choderaj/code/openmm/openmm.jchodera/serialization/include/openmm/serialization/SerializationNode.h" \
"/Users/choderaj/code/openmm/openmm.jchodera/serialization/include/openmm/serialization/SerializationProxy.h" \
"/Users/choderaj/code/openmm/openmm.jchodera/serialization/include/openmm/serialization/XmlSerializer.h" \
"/Users/choderaj/code/openmm/openmm.jchodera/plugins/amoeba/openmmapi" \
"/Users/choderaj/code/openmm/openmm.jchodera/plugins/rpmd/openmmapi" \
"/Users/choderaj/code/openmm/openmm.jchodera/plugins/drude/openmmapi"
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
...@@ -600,7 +594,7 @@ RECURSIVE = YES ...@@ -600,7 +594,7 @@ RECURSIVE = YES
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag. # subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = *Impl.h EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or # The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded # directories that are symbolic links (a Unix filesystem feature) are excluded
...@@ -614,15 +608,11 @@ EXCLUDE_SYMLINKS = NO ...@@ -614,15 +608,11 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories # against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/* # for example use the pattern */test/*
#EXCLUDE_PATTERNS = */tests/* \
# */src/* \
# */.svn/*
EXCLUDE_PATTERNS = */tests/* \ EXCLUDE_PATTERNS = */tests/* \
*/openmmapi/src/* \ */.svn/*
*/internal/* \
*/.svn/* \
*amoebaKernels.h \
*DrudeKernels.h \
*RpmdKernels.h \
*OpenMMFortranModule.f90 \
*OpenMMCWrapper.h
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the # (namespaces, classes, functions, etc.) that should be excluded from the
......
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