Commit 2507ee7f authored by Charlles Abreu's avatar Charlles Abreu
Browse files

Replaced not_equal macro by notEqual function

parent 6bf99439
......@@ -30,6 +30,7 @@
* -------------------------------------------------------------------------- */
#include <vector>
#include <math.h>
#include "openmm/internal/SplineFitter.h"
#include "openmm/OpenMMException.h"
......@@ -37,7 +38,9 @@
using namespace OpenMM;
using namespace std;
#define not_equal(a, b) (abs((a)-(b)) > 1e-15 + 1e-15*abs(b)) // same as scipy.interpolate()
static bool notEqual(double a, double b) {
return (fabs(a-b) > 1e-15 + 1e-15*fabs(b));
}
void SplineFitter::createSpline(const vector<double>& x, const vector<double>& y, bool periodic, vector<double>& deriv) {
if (periodic)
......@@ -89,7 +92,7 @@ void SplineFitter::createPeriodicSpline(const vector<double>& x, const vector<do
throw OpenMMException("createPeriodicSpline: x and y vectors must have same length");
if (n < 3)
throw OpenMMException("createPeriodicSpline: the length of the input array must be at least 3");
if (not_equal(y[0], y[n-1]))
if (notEqual(y[0], y[n-1]))
throw OpenMMException("createPeriodicSpline: the first and last points must have the same value");
deriv.resize(n);
......
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