Commit 15986eaa authored by Vedran Miletić's avatar Vedran Miletić

Replace deprecated headers with cheader equivalents

parent 5a778be1
......@@ -108,7 +108,7 @@ public:
void SetArg(int i, RbtReturnType f) { Arg[i] = f; }
void SetNameArg(int i, std::string &n) { NameArg[i] = n; }
RbtReturnType Execute() {
if (fabs(Arg[1]) < 0.000001)
if (std::fabs(Arg[1]) < 0.000001)
return Arg[0];
return Arg[0] / Arg[1];
}
......@@ -153,9 +153,9 @@ public:
void SetArg(int i, RbtReturnType f) { Arg[i] = f; }
void SetNameArg(int i, std::string &n) { NameArg[i] = n; }
RbtReturnType Execute() {
if (fabs(Arg[0]) < 0.000001)
if (std::fabs(Arg[0]) < 0.000001)
return 0;
return (log(fabs(Arg[0])));
return (std::log(std::fabs(Arg[0])));
}
private:
......@@ -172,10 +172,10 @@ public:
void SetNameArg(int i, std::string &n) { NameArg[i] = n; }
RbtReturnType Execute() {
if (Arg[0] > 200)
return exp(200);
return std::exp(200);
if (Arg[0] < -200)
return 0;
return exp(Arg[0]);
return std::exp(Arg[0]);
}
private:
......
......@@ -740,7 +740,7 @@ class isAtomIonic : public std::unary_function<RbtAtom *, bool> {
public:
explicit isAtomIonic() {}
bool operator()(const RbtAtom *pAtom) const {
return (fabs(pAtom->GetGroupCharge()) > 0.001);
return (std::fabs(pAtom->GetGroupCharge()) > 0.001);
}
};
......
......@@ -18,7 +18,7 @@
#define _RBTCOORD_H_
#include <algorithm> //for min,max
#include <math.h> //for sqrt
#include <cmath> //for sqrt
#include <numeric> //for accumulate
#include "RbtConfig.h"
......@@ -296,7 +296,7 @@ public:
inline double Length2() const { return x * x + y * y + z * z; }
// Returns magnitude of vector (or distance from origin)
inline double Length() const { return sqrt(Length2()); }
inline double Length() const { return std::sqrt(Length2()); }
// Returns unit vector in same direction
// Member function (V2 = V1.Unit())
......@@ -385,7 +385,7 @@ inline double Angle(const RbtVector &v1, const RbtVector &v2) {
double sin_theta = (v1.Cross(v2)).Length() / d1d2;
// Get theta and convert to degrees
double theta = atan2(sin_theta, cos_theta);
double theta = std::atan2(sin_theta, cos_theta);
return theta * 180.0 / M_PI;
}
......@@ -412,7 +412,7 @@ inline double Dihedral(const RbtVector &v1, const RbtVector &v2,
double cos_phi = A.Dot(B) / (rA * rB);
double sin_phi = C.Dot(B) / (rC * rB);
// Get phi and convert to degrees
double phi = -atan2(sin_phi, cos_phi);
double phi = -std::atan2(sin_phi, cos_phi);
return phi * 180.0 / M_PI;
}
......
......@@ -18,7 +18,7 @@
#ifdef _RBTOBJECTCOUNTER
#include <iostream.h>
#include <iostream>
#include <map>
// Object counter class for debugging no. of object constructions and
......
......@@ -42,7 +42,7 @@ public:
class prms {
public:
prms(double ss = 3.0, double kk = 0.2, double o = 0.0)
: s(fabs(ss)), k(kk), sign((ss > 0.0) ? +1.0 : -1.0), offset(o) {}
: s(std::fabs(ss)), k(kk), sign((ss > 0.0) ? +1.0 : -1.0), offset(o) {}
double s; // rotational degeneracy
double k; // barrier height
double sign; //+1 or -1, to invert potential
......
......@@ -105,7 +105,7 @@ namespace Rbt {
// by the magnitude of the normal vector
// DM 31 Mar 1999 - returned signed distance (not absolute value)
inline double DistanceFromPointToPlane(const RbtCoord &c0, const RbtPlane &p) {
// return fabs( c0.Dot(p.VNorm()) + p.D() );
// return std::fabs( c0.Dot(p.VNorm()) + p.D() );
return c0.Dot(p.VNorm()) + p.D();
}
......
......@@ -15,7 +15,7 @@
#ifndef _RBTQUAT_H_
#define _RBTQUAT_H_
#include <math.h> //for sqrt
#include <cmath> //for sqrt
#include "RbtCoord.h"
......@@ -48,8 +48,8 @@ public:
// CAUTION: Argument types are the reverse of above
inline RbtQuat(const RbtVector &axis, double phi) {
double halfPhi(0.5 * phi);
s = cos(halfPhi);
v = sin(halfPhi) * axis.Unit();
s = std::cos(halfPhi);
v = std::sin(halfPhi) * axis.Unit();
}
// Destructor
......@@ -161,7 +161,7 @@ public:
// Returns magnitude of quat
// Member function (L = Q1.Length())
inline double Length() const {
return sqrt(s * s + v.x * v.x + v.y * v.y + v.z * v.z);
return std::sqrt(s * s + v.x * v.x + v.y * v.y + v.z * v.z);
}
// Returns unit quat
......
......@@ -104,7 +104,7 @@ public:
void operator+=(const RbtVariant &v) {
std::copy(v.m_sl.begin(), v.m_sl.end(), std::back_inserter(m_sl));
m_d = atof(String().c_str());
m_d = std::atof(String().c_str());
}
// Conversion operators to convert back to basic types
......@@ -165,12 +165,12 @@ private:
m_sl.clear();
if (!s.empty())
m_sl.push_back(s);
m_d = atof(String().c_str());
m_d = std::atof(String().c_str());
}
void SetStringList(const RbtStringList &sl) {
m_sl = sl;
m_d = atof(String().c_str());
m_d = std::atof(String().c_str());
}
void SetBool(bool b) {
......
......@@ -177,7 +177,7 @@ void RbtGPFFCHK1::CreateRandomCtes(int nctes) {
for (int i = 0; i < (nctes - 2); i++) {
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
c = (a / 10.0) * pow(10, b);
c = (a / 10.0) * std::pow(10, b);
std::cout << "c" << i + 2 << " \t" << c << std::endl;
ctes.push_back(c);
}
......
......@@ -71,7 +71,7 @@ double RbtGPFFCrossDock::CalculateFitness(RbtGPGenomePtr g,
bool function) {
if (function) {
std::cout << "Error, no function possible with Cross Docking\n";
exit(1);
std::exit(1);
}
RbtGPParser p(g->GetNIP(), g->GetNIF(), g->GetNN(), g->GetNO());
RbtReturnTypeList o;
......@@ -203,7 +203,7 @@ void RbtGPFFCrossDock::CreateRandomCtes(int nctes) {
for (int i = 0; i < (nctes - 2); i++) {
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
c = (a / 10.0) * pow(10, b);
c = (a / 10.0) * std::pow(10, b);
std::cout << "c" << i + 2 << " \t" << c << std::endl;
ctes.push_back(c);
}
......
......@@ -71,8 +71,8 @@ double RbtGPFFGold::CalculateFitness(RbtGPGenomePtr g, RbtReturnTypeArray &it,
for (int j = 0; j < RbtGPGenome::GetNO(); j++)
if (function) {
double d = 2.5 * rmsd + scoreM - *(o[j]);
tot += d * d; // abs(d); // * d;
// if (abs(2.5 * rmsd + scoreM - *(o[j])) < range)
tot += d * d; // std::abs(d); // * d;
// if (std::abs(2.5 * rmsd + scoreM - *(o[j])) < range)
// tot++;
} else if (*(o[j]) < 0.0) {
if (rmsd < hitlimit)
......
......@@ -119,7 +119,7 @@ double RbtGPFFHSP90::CalculateFitness(
{
RbtDouble t1 = *sft[i][0]; // - meanReal;
RbtDouble t2 = *o[i][0]; // - meanPred;
sumDiff += abs(t1 - t2);
sumDiff += std::abs(t1 - t2);
// std::cout << sumDiff << "\t" << sumSqrReal << "\t" << sumSqrPred <<
std::endl;
}
......@@ -197,7 +197,7 @@ void RbtGPFFHSP90::CreateRandomCtes(int nctes) {
for (int i = 0; i < (nctes - 2); i++) {
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
c = (a / 10.0) * pow(10, b);
c = (a / 10.0) * std::pow(10, b);
std::cout << "c" << i + 2 << " \t" << c << std::endl;
ctes.push_back(c);
}
......
......@@ -104,7 +104,7 @@ double RbtGPFFSpike::CalculateFitness(RbtGPGenomePtr g, RbtReturnTypeArray &it,
for (int j = 0; j < RbtGPGenome::GetNO(); j++)
if (function) {
std::cout << "Error, no function possible with spike\n";
exit(1);
std::exit(1);
} else if (*(o[j]) < 0.0) {
if (hit < hitlimit)
good++; // += 1.2;
......@@ -197,7 +197,7 @@ void RbtGPFFSpike::CreateRandomCtes(int nctes) {
for (int i = 0; i < (nctes - 2); i++) {
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
c = (a / 10.0) * pow(10, b);
c = (a / 10.0) * std::pow(10, b);
std::cout << "c" << i + 2 << " \t" << c << std::endl;
ctes.push_back(c);
}
......
......@@ -112,7 +112,8 @@ void RbtGPGenome::Initialise() {
int a, b;
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
double r = (a / 10.0) * pow(10.0, b); // m_rand.GetRandom01() * 20 - 10;
double r =
(a / 10.0) * std::pow(10.0, b); // m_rand.GetRandom01() * 20 - 10;
chrom->SetConstant(r, g);
}
(*chrom)[g++] = f;
......@@ -148,7 +149,8 @@ void RbtGPGenome::MutateGene(int i) {
int a, b;
a = m_rand.GetRandomInt(200) - 100;
b = m_rand.GetRandomInt(10) - 5;
double r = (a / 10.0) * pow(10.0, b); // m_rand.GetRandom01() * 20 - 10;
double r =
(a / 10.0) * std::pow(10.0, b); // m_rand.GetRandom01() * 20 - 10;
chrom->SetConstant(r, i);
} else if ((*chrom)[i] == nf) {
chrom->ResetConstant(i);
......
......@@ -13,7 +13,7 @@
#include "RbtGPPopulation.h"
#include "RbtDebug.h"
#include <algorithm>
#include <float.h>
#include <cfloat>
// Static data members for RbtGPPopulation
std::string RbtGPPopulation::_CT("RbtGPPopulation");
......@@ -210,7 +210,7 @@ void RbtGPPopulation::ScaleFitness() {
ss += (pop[i]->GetFitness() - ave) * (pop[i]->GetFitness() - ave);
}
// standard deviation
stdev = sqrt(ss / (popsize - 1));
stdev = std::sqrt(ss / (popsize - 1));
// calculate scaled values using sigma truncation
// Goldberg page 124
for (int i = 0; i < popsize; i++) {
......@@ -256,14 +256,15 @@ RbtGPGenomePtr RbtGPPopulation::RkSelect() const {
double index;
int max = popsize; // index will be between 0 and popsize - 1
index = max *
(bias - sqrt(bias * bias - 4.0 * (bias - 1) * m_rand.GetRandom01())) /
(bias -
std::sqrt(bias * bias - 4.0 * (bias - 1) * m_rand.GetRandom01())) /
2.0 / (bias - 1);
if (index < 0) {
std::cout << index << " " << max << std::endl;
index = 0.0;
}
// DM 25/04/05 - avoid compiler warning by explicitly converting double to int
int intIndex = (int)floor(index);
int intIndex = (int)std::floor(index);
return (pop[intIndex]);
}
......
......@@ -13,9 +13,9 @@
#include "../inc/RbtGPGenome.h"
#include "../inc/RbtGPPopulation.h"
#include "../inc/RbtParser.h"
#include <cstdio>
#include <fstream>
#include <sstream>
#include <stdio.h>
int main(int argc, char *argv[]) {
/*std::cout << "Genome file: \n";
......
......@@ -16,14 +16,14 @@
#include "RbtGPGenome.h"
#include "RbtGPPopulation.h"
#include "RbtParser.h"
#include <cstdio>
#include <fstream>
#include <stdio.h>
int main(int argc, char *argv[]) {
try {
RbtRand &theRand = Rbt::GetRbtRand(); // ref to random number generator
if (argc > 1)
theRand.Seed(atoi(argv[2]));
theRand.Seed(std::atoi(argv[2]));
else
theRand.SeedFromClock();
std::cout << "Seed: " << theRand.GetSeed() << std::endl;
......
......@@ -16,14 +16,14 @@
#include "RbtGPGenome.h"
#include "RbtGPPopulation.h"
#include "RbtParser.h"
#include <cstdio>
#include <fstream>
#include <stdio.h>
int main(int argc, char *argv[]) {
try {
RbtRand &theRand = Rbt::GetRbtRand(); // ref to random number generator
if (argc > 1)
theRand.Seed(atoi(argv[1]));
theRand.Seed(std::atoi(argv[1]));
else
theRand.SeedFromClock();
std::cout << "Seed: " << theRand.GetSeed() << std::endl;
......
......@@ -142,10 +142,10 @@ int main(int argc, char *argv[]) {
strSFFile = strArg.substr(2);
else if (strArg.find("-g") == 0) {
std::string strGridStep = strArg.substr(2);
gs = atof(strGridStep.c_str());
gs = std::atof(strGridStep.c_str());
} else if (strArg.find("-b") == 0) {
std::string strBorder = strArg.substr(2);
border = atof(strBorder.c_str());
border = std::atof(strBorder.c_str());
} else {
std::cout << " ** INVALID ARGUMENT" << std::endl;
return 1;
......
......@@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
strReceptorPrmFile = optarg;
case 'b':
bBorderArg = true;
border = atof(optarg);
border = std::atof(optarg);
break;
case 'R': // also for -ras
bReadAS = true;
......@@ -133,7 +133,7 @@ int main(int argc, char *argv[]) {
break;
case 'l':
bList = true;
dist = atof(optarg);
dist = std::atof(optarg);
break;
case 'm':
bMOEgrid = true;
......@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
}*/
if (strReceptorPrmFile.empty()) {
std::cout << "Missing receptor parameter file name" << std::endl;
exit(1);
std::exit(1);
}
// writing command line arguments
std::cout << "Command line arguments:" << std::endl;
......
......@@ -59,7 +59,7 @@ int main(int argc, char *argv[]) {
strOutputFile = strArg.substr(2);
else if (strArg.find("-n") == 0) {
std::string strGridNum = strArg.substr(2);
iGrid = atoi(strGridNum.c_str());
iGrid = std::atoi(strGridNum.c_str());
} else {
std::cout << " ** INVALID ARGUMENT" << std::endl;
return 1;
......
......@@ -13,7 +13,7 @@
// Main docking application
#include <iomanip>
#include <errno.h>
#include <cerrno>
#include <unistd.h>
#include "RbtBiMolWorkSpace.h"
......@@ -155,7 +155,7 @@ int main(int argc, char *argv[]) {
strParamFile = optarg;
break;
case 'n':
nDockingRuns = atoi(optarg);
nDockingRuns = std::atoi(optarg);
break;
case 'P': // protonate
bPosIonise = true;
......@@ -174,7 +174,7 @@ int main(int argc, char *argv[]) {
// threshold. Otherwise, I assume is the filter file name
char *error;
errno = 0;
val = strtod(optarg, &error);
val = std::strtod(optarg, &error);
if (!errno && !*error) // Is it a number?
{
dTargetScore = val;
......@@ -187,11 +187,11 @@ int main(int argc, char *argv[]) {
break;
case 's':
bSeed = true;
nSeed = atoi(optarg);
nSeed = std::atoi(optarg);
break;
case 'T':
bTrace = true;
iTrace = atoi(optarg);
iTrace = std::atoi(optarg);
break;
default:
break;
......@@ -205,7 +205,7 @@ int main(int argc, char *argv[]) {
if (strLigandMdlFile.empty() || strReceptorPrmFile.empty() ||
strParamFile.empty()) { // if any of them is missing
std::cout << "Missing required parameter(s)" << std::endl;
exit(1);
std::exit(1);
}
std::cout << " -i " << strLigandMdlFile << std::endl;
std::cout << " -r " << strReceptorPrmFile << std::endl;
......
......@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
// Brief help message
if (argc == 1) {
PrintUsage();
exit(1);
std::exit(1);
}
// parsing command-line options
opterr = 0;
......@@ -129,12 +129,12 @@ int main(int argc, char *argv[]) {
case 'g':
std::cout << "\t -g " << optarg << std::endl;
strGridStep = optarg;
gs = atof(strGridStep.c_str());
gs = std::atof(strGridStep.c_str());
break;
case 'b':
std::cout << "\t -b " << optarg << std::endl;
strBorder = optarg;
border = atof(strBorder.c_str());
border = std::atof(strBorder.c_str());
break;
case 't':
std::cout << "\t -t " << optarg << std::endl;
......@@ -150,7 +150,7 @@ int main(int argc, char *argv[]) {
return 1;
default:
PrintUsage();
exit(1);
std::exit(1);
}
}
std::cout << std::endl;
......
......@@ -152,7 +152,7 @@ double rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
for (int i = 0; i < nCoords; i++) {
rms += Rbt::Length2(rc[i], c[i]);
}
rms = sqrt(rms / float(nCoords));
rms = std::sqrt(rms / float(nCoords));
return rms;
}
}
......@@ -189,7 +189,7 @@ int main(int argc, char *argv[]) {
bool bRemoveDups(false);
double threshold(1.0);
if (argc > 4) {
threshold = atof(argv[4]);
threshold = std::atof(argv[4]);
bRemoveDups = true;
}
......@@ -304,7 +304,7 @@ int main(int argc, char *argv[]) {
for (; (sIter != scoreVec.end()) && (rIter != rmsVec.end());
sIter++, rIter++) {
double de = (*sIter) - minScore;
double z = exp(-de / (8.314e-3 * 298.0));
double z = std::exp(-de / (8.314e-3 * 298.0));
zTot += z;
zMean += (*rIter) * z;
zMean2 += (*rIter) * (*rIter) * z;
......@@ -314,8 +314,8 @@ int main(int argc, char *argv[]) {
}
zMean /= zTot;
double zVar = zMean2 / zTot - (zMean * zMean);
// std::cout << "zRMSD," << zTot << "," << zMean << "," << sqrt(zVar) <<
// std::endl;
// std::cout << "zRMSD," << zTot << "," << zMean << "," << std::sqrt(zVar)
// << std::endl;
} catch (RbtError &e) {
std::cout << e << std::endl;
} catch (...) {
......
......@@ -153,7 +153,7 @@ int main(int argc, char *argv[]) {
if ((argc == 2) && !strReferenceSDFile.empty()) {
// smile expression found for the reference file. Nothing
// else to be done
exit(0);
std::exit(0);
}
if (tetherAtoms.empty()) {
throw RbtError(_WHERE_, "SMARTS query should have at least one match in "
......
......@@ -38,7 +38,7 @@ double rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
for (int i = 0; i < nCoords; i++) {
rms += Rbt::Length2(rc[i], c[i]);
}
rms = sqrt(rms / float(nCoords));
rms = std::sqrt(rms / float(nCoords));
return rms;
}
}
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
std::cout << "Reference SMILES: " << strSmiles << std::endl;
std::cout << "Paths found = " << pathset.size() << std::endl;
if (pathset.empty()) {
exit(0);
std::exit(0);
}
// Use the SMILES string for the reference to query each record in the SD
// file This has the useful side effect that the numbering scheme in the SD
......@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) {
for (; (sIter != scoreVec.end()) && (rIter != rmsVec.end());
sIter++, rIter++) {
double de = (*sIter) - minScore;
double z = exp(-de / (8.314e-3 * 298.0));
double z = std::exp(-de / (8.314e-3 * 298.0));
double r = (*rIter);
if (r < 2.05)
zGood += z;
......
......@@ -13,11 +13,11 @@
// Misc non-member functions in Rbt namespace
#include <algorithm> //For sort
#include <climits> //For PATH_MAX
#include <cstdlib> //For getenv
#include <ctime> //For time functions
#include <dirent.h> //For directory handling
#include <fstream> //For ifstream
#include <limits.h> //For PATH_MAX
#include <stdlib.h> //For getenv
#include <time.h> //For time functions
#include <unistd.h> //For POSIX getcwd
//#include <ios>
#include "Rbt.h"
......@@ -26,7 +26,7 @@
// GetRbtRoot - returns value of RBT_ROOT env variable
std::string Rbt::GetRbtRoot() {
char *szRbtRoot = getenv("RBT_ROOT");
char *szRbtRoot = std::getenv("RBT_ROOT");
if (szRbtRoot != (char *)nullptr) {
return std::string(szRbtRoot);
} else {
......@@ -39,11 +39,11 @@ std::string Rbt::GetRbtRoot() {
// or HOME if RBT_HOME is not defined
// If HOME is undefined, returns current working directory
std::string Rbt::GetRbtHome() {
char *szRbtHome = getenv("RBT_HOME");
char *szRbtHome = std::getenv("RBT_HOME");
if (szRbtHome != (char *)nullptr) {
return std::string(szRbtHome);
} else {
szRbtHome = getenv("HOME");
szRbtHome = std::getenv("HOME");
if (szRbtHome != (char *)nullptr) {
return std::string(szRbtHome);
} else {
......@@ -62,9 +62,9 @@ std::string Rbt::GetBuild() { return IDS_BUILDNUM; }
std::string Rbt::GetProduct() { return IDS_PRODUCT; }
// GetTime - returns current time as an RbtString
std::string Rbt::GetTime() {
time_t t = ::time(nullptr); // Get time in seconds since 1970
tm *pLocalTime = ::localtime(&t); // Convert to local time struct
return std::string(::asctime(pLocalTime)); // Convert to ascii string
time_t t = std::time(nullptr); // Get time in seconds since 1970
tm *pLocalTime = std::localtime(&t); // Convert to local time struct
return std::string(std::asctime(pLocalTime)); // Convert to ascii string
}
// GetCurrentDirectory - returns current working directory
std::string Rbt::GetCurrentDirectory() {
......
......@@ -354,15 +354,15 @@ double RbtAromIdxSF::AromScore(const RbtInteractionCenter *pIC1,
// Calculate average perp. distance from each pi center to the other ring
// plane
double R = (fabs(Rbt::DistanceFromPointToPlane(cAtom1_1, pl2)) +
fabs(Rbt::DistanceFromPointToPlane(cAtom2_1, pl1))) /
double R = (std::fabs(Rbt::DistanceFromPointToPlane(cAtom1_1, pl2)) +
std::fabs(Rbt::DistanceFromPointToPlane(cAtom2_1, pl1))) /
2.0;
double f = f1(R - Rprms.R0, Rprms);
// Only calculate average slip angle if f > 0
if (f > 0.0) {
RbtVector v = cAtom2_1 - cAtom1_1;
double sa = (acos(fabs(Rbt::Dot(v.Unit(), pl1.VNorm()))) +
acos(fabs(Rbt::Dot(v.Unit(), pl2.VNorm())))) *
double sa = (std::acos(std::fabs(Rbt::Dot(v.Unit(), pl1.VNorm()))) +
std::acos(std::fabs(Rbt::Dot(v.Unit(), pl2.VNorm())))) *
90.0 / M_PI;
f *= f1(sa, Aprms);
if (f > 0.0) {
......
......@@ -93,9 +93,9 @@ void RbtBaseGrid::Read(std::istream &istr) { OwnRead(istr); }
void RbtBaseGrid::SetGridMin(const RbtCoord &gridMin) {
// Determine the integral min and max grid point coords (in multiples of grid
// step from origin)
m_nXMin = floor(gridMin.x / m_step.x + 0.5);
m_nYMin = floor(gridMin.y / m_step.y + 0.5);
m_nZMin = floor(gridMin.z / m_step.z + 0.5);
m_nXMin = std::floor(gridMin.x / m_step.x + 0.5);
m_nYMin = std::floor(gridMin.y / m_step.y + 0.5);
m_nZMin = std::floor(gridMin.z / m_step.z + 0.5);
// Max integral coords are just min+N-1
m_nXMax = m_nXMin + m_NX - 1;
......
......@@ -105,7 +105,7 @@ double RbtBaseIdxSF::GetMaxError() const {
// the ligand atom. However the actual ligand atom - receptor atom distance
// may be maxError Angstroms closer than the grid point - receptor atom
// distance used in the indexing.
return 0.5 * sqrt(3.0) * m_gridStep;
return 0.5 * std::sqrt(3.0) * m_gridStep;
}
// DM 12 Apr 2002
......
......@@ -96,7 +96,7 @@ void RbtBiMolWorkSpace::UpdateModelCoordsFromChromRecords(
for (RbtStringListConstIter iter = chromValues.begin();
iter != chromValues.end(); ++iter) {
std::string chromValue(*iter);
chromVec.push_back(atof(chromValue.c_str()));
chromVec.push_back(std::atof(chromValue.c_str()));
}
spChrom->SetVector(chromVec);
spChrom->SyncToModel();
......
......@@ -137,7 +137,7 @@ double RbtChromDihedralElement::CompareVector(const RbtDoubleList &v,
double otherAngle = v[i++];
double stepSize = m_spRefData->GetStepSize();
if (stepSize > 0.0) {
double absDiff = fabs(StandardisedValue(m_value - otherAngle));
double absDiff = std::fabs(StandardisedValue(m_value - otherAngle));
retVal = absDiff / stepSize;
}
}
......
......@@ -38,7 +38,7 @@ double RbtChromDihedralRefData::GetModelValue() const {
void RbtChromDihedralRefData::SetModelValue(double dihedralAngle) {
double delta = dihedralAngle - GetModelValue();
// Only rotate if delta is non-zero
if (fabs(delta) > 0.001) {
if (std::fabs(delta) > 0.001) {
// Coords of atom 1
RbtCoord coord1(m_atom2->GetCoords());
// Vector along the bond between atom 1 and atom 2 (rotation axis)
......
......@@ -82,7 +82,7 @@ bool RbtChromElement::VectorOK(const RbtXOverList &v, int i) const {
void RbtChromElement::CauchyMutate(double mean, double variance) {
// Need to convert the Cauchy random variable to a positive number
// and use this as the relative step size for mutation
double relStepSize = fabs(m_rand.GetCauchyRandom(mean, variance));
double relStepSize = std::fabs(m_rand.GetCauchyRandom(mean, variance));
Mutate(relStepSize);
}
......
......@@ -110,7 +110,7 @@ double RbtChromOccupancyElement::CompareVector(const RbtDoubleList &v,
double otherOccupancy = v[i++];
double stepSize = m_spRefData->GetStepSize();
if (stepSize > 0.0) {
double absDiff = fabs(m_value - otherOccupancy);
double absDiff = std::fabs(m_value - otherOccupancy);
retVal = absDiff / stepSize;
}
}
......
......@@ -314,7 +314,7 @@ double RbtChromPositionElement::CompareVector(const RbtDoubleList &v,
if (rotStepSize > 0.0) {
// Determine the difference between the two orientations
// in terms of the axis/angle needed to align them
// q.s = cos(phi / 2)