diff --git a/CMakeLists.txt b/CMakeLists.txt index 072011efd..ebecaffab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ option(RDK_BUILD_SLN_SUPPORT "include support for the SLN format" ON ) option(RDK_TEST_MULTITHREADED "run some tests of multithreading" OFF ) option(RDK_BUILD_SWIG_JAVA_WRAPPER "build the SWIG JAVA wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" ON ) option(RDK_BUILD_SWIG_CSHARP_WRAPPER "build the experimental SWIG C# wrappers (does nothing if RDK_BUILD_SWIG_WRAPPERS is not set)" OFF ) -option(RDK_TEST_MMFF_COMPLIANCE "run MMFF compliance tests (requires boost iostreams and libbz2)" ON ) if(RDK_BUILD_SWIG_WRAPPERS!=ON) set(RDK_BUILD_SWIG_JAVA_WRAPPER OFF) diff --git a/Code/ForceField/MMFF/CMakeLists.txt b/Code/ForceField/MMFF/CMakeLists.txt index 07d33929f..99245bc0e 100644 --- a/Code/ForceField/MMFF/CMakeLists.txt +++ b/Code/ForceField/MMFF/CMakeLists.txt @@ -1,20 +1,13 @@ +if((NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test_data/MMFF94_reference.log) + OR (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test_data/MMFF94s_reference.log)) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${CMAKE_CURRENT_SOURCE_DIR}/test_data/MMFF_reference_logs.tgz + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test_data + ) +endif() -if(RDK_TEST_MMFF_COMPLIANCE) - set(T_LIBS ${Boost_LIBRARIES}) - find_package(Boost 1.39.0 COMPONENTS iostreams REQUIRED) - set(Boost_LIBRARIES ${T_LIBS} ${Boost_LIBRARIES}) - if(MSVC) - ADD_DEFINITIONS("/D YY_NO_UNISTD_H") - # as of cmake 2.8.0 and boost 1.43 we need to do this to avoid - # forcing the user to build both static and dynamic versions - # of the regex library: - ADD_DEFINITIONS("/D BOOST_ALL_DYN_LINK") - endif(MSVC) - - rdkit_test(testMMFFForceField testMMFFForceField.cpp - LINK_LIBRARIES - DistGeomHelpers DistGeometry ForceFieldHelpers ForceField - FileParsers MolTransforms SmilesParse SubstructMatch MolAlign Optimizer EigenSolvers Alignment GraphMol RDGeometryLib RDGeneral - ${Boost_IOSTREAMS_LIBRARY}) -endif(RDK_TEST_MMFF_COMPLIANCE) -#add_subdirectory(Wrap) +rdkit_test(testMMFFForceField testMMFFForceField.cpp + LINK_LIBRARIES + DistGeomHelpers DistGeometry ForceFieldHelpers ForceField + FileParsers MolTransforms SmilesParse SubstructMatch MolAlign + Optimizer EigenSolvers Alignment GraphMol RDGeometryLib RDGeneral) diff --git a/Code/ForceField/MMFF/Params.cpp b/Code/ForceField/MMFF/Params.cpp index 9a4d59b1d..7b2a849b7 100644 --- a/Code/ForceField/MMFF/Params.cpp +++ b/Code/ForceField/MMFF/Params.cpp @@ -2006,11 +2006,11 @@ namespace ForceFields { MMFFAngleCollection::MMFFAngleCollection(std::string mmffAngle) { if (mmffAngle == "") { - unsigned int i=0; - while(defaultMMFFAngleData[i]!="EOS"){ - mmffAngle += defaultMMFFAngleData[i]; - i++; - } + unsigned int i = 0; + while (defaultMMFFAngleData[i] != "EOS") { + mmffAngle += defaultMMFFAngleData[i]; + ++i; + } } std::istringstream inStream(mmffAngle); @@ -2063,7 +2063,7 @@ namespace ForceFields { // another joy of VC++ "compiler limit: string exceeds 65535 bytes in length" compels us to // break this into pieces - const std::string defaultMMFFAngleData[] ={ + const std::string defaultMMFFAngleData[] = { "*\n" "* Copyright (c) Merck and Co., Inc., 1994, 1995, 1996\n" "* All Rights Reserved\n" @@ -4417,7 +4417,8 @@ namespace ForceFields { "0 32 82 65 1.238 129.293 E94\n" "0 59 82 64 1.563 105.660 E94\n" "0 64 82 65 1.281 112.955 E94\n", - "EOS"}; + "EOS" + }; class MMFFStbnCollection * MMFFStbnCollection::ds_instance = NULL; diff --git a/Code/ForceField/MMFF/Params.h b/Code/ForceField/MMFF/Params.h index 62fa13884..ea9623868 100644 --- a/Code/ForceField/MMFF/Params.h +++ b/Code/ForceField/MMFF/Params.h @@ -21,6 +21,9 @@ #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif // binary searches are slightly faster than std::map; // however when I moved to binary searches I had already @@ -32,9 +35,6 @@ namespace ForceFields { namespace MMFF { -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif const double DEG2RAD = M_PI / 180.0; const double RAD2DEG = 180.0 / M_PI; inline const bool isDoubleZero(const double x) { diff --git a/Code/ForceField/MMFF/testMMFFForceField.cpp b/Code/ForceField/MMFF/testMMFFForceField.cpp index 8120ebef9..a0705a3dc 100644 --- a/Code/ForceField/MMFF/testMMFFForceField.cpp +++ b/Code/ForceField/MMFF/testMMFFForceField.cpp @@ -26,11 +26,6 @@ #include #include #include -#ifndef RDK_NOGZIP -#include -#include -#include -#endif #include "testMMFFForceField.h" @@ -72,20 +67,6 @@ bool fgrep(std::fstream &rdkFStream, std::string key) } -#ifndef RDK_NOGZIP -void fgunzip(std::string filename) -{ - std::string gzipFilename = filename + ".gz"; - std::ifstream ifStream(gzipFilename.c_str(), std::ios_base::in | std::ios_base::binary); - std::ofstream ofStream(filename.c_str(), std::ios_base::out); - boost::iostreams::filtering_streambuf ifStreamFilter; - ifStreamFilter.push(boost::iostreams::gzip_decompressor()); - ifStreamFilter.push(ifStream); - boost::iostreams::copy(ifStreamFilter, ofStream); -} -#endif - - bool getLineByNum(std::istream& stream, std::streampos startPos, unsigned int n, std::string& line) { @@ -389,14 +370,6 @@ int main(int argc, char *argv[]) for (std::vector::iterator ffIt = ffVec.begin(); ffIt != ffVec.end(); ++ffIt) { ref = pathName + (*ffIt) + "_reference.log"; - if (!fexist(ref)) { - #ifndef RDK_NOGZIP - fgunzip(ref); - #else - std::cerr << "Please gunzip " << ref - << ".gz before running the test" << std::endl; - #endif - } molFileVec.clear(); if (molFile == "") { molFileVec.push_back(pathName + (*ffIt) + "_dative." + (*molTypeIt)); diff --git a/Code/ForceField/MMFF/test_data/MMFF94_reference.log.gz b/Code/ForceField/MMFF/test_data/MMFF94_reference.log.gz deleted file mode 100644 index b73f5d003..000000000 Binary files a/Code/ForceField/MMFF/test_data/MMFF94_reference.log.gz and /dev/null differ diff --git a/Code/ForceField/MMFF/test_data/MMFF94s_reference.log.gz b/Code/ForceField/MMFF/test_data/MMFF94s_reference.log.gz deleted file mode 100644 index 035b29323..000000000 Binary files a/Code/ForceField/MMFF/test_data/MMFF94s_reference.log.gz and /dev/null differ diff --git a/Code/ForceField/MMFF/test_data/MMFF_reference_logs.tgz b/Code/ForceField/MMFF/test_data/MMFF_reference_logs.tgz new file mode 100644 index 000000000..25ab7733f Binary files /dev/null and b/Code/ForceField/MMFF/test_data/MMFF_reference_logs.tgz differ diff --git a/Code/ForceField/UFF/Inversion.cpp b/Code/ForceField/UFF/Inversion.cpp index 25badbc74..00f71d746 100644 --- a/Code/ForceField/UFF/Inversion.cpp +++ b/Code/ForceField/UFF/Inversion.cpp @@ -24,8 +24,6 @@ namespace ForceFields { return ((x < 1.0e-10) && (x > -1.0e-10)); } namespace Utils { - static double DEG2RAD = M_PI / 180.0; - static double RAD2DEG = 180.0 / M_PI; double calculateCosY(const RDGeom::Point3D &iPoint, const RDGeom::Point3D &jPoint, const RDGeom::Point3D &kPoint, const RDGeom::Point3D &lPoint) { @@ -59,7 +57,7 @@ namespace ForceFields { else { // group 5 elements are not clearly explained in the UFF paper // the following code was inspired by MCCCS Towhee's ffuff.F - double w0 = DEG2RAD; + double w0 = M_PI / 180.0; switch (at2AtomicNum) { // if the central atom is phosphorous case 15: diff --git a/Code/ForceField/UFF/Params.h b/Code/ForceField/UFF/Params.h index d0fb01b30..6487c62da 100644 --- a/Code/ForceField/UFF/Params.h +++ b/Code/ForceField/UFF/Params.h @@ -14,6 +14,10 @@ #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + namespace ForceFields { namespace UFF { diff --git a/Code/Geometry/point.h b/Code/Geometry/point.h index 95eb0b3f9..a354269ed 100644 --- a/Code/Geometry/point.h +++ b/Code/Geometry/point.h @@ -17,7 +17,7 @@ #include #ifndef M_PI -#define M_PI 3.14159265358979323846 +#define M_PI 3.14159265358979323846 #endif @@ -139,7 +139,8 @@ namespace RDGeom { }; double lengthSq() const { - double res = pow(x,2) + pow(y,2) + pow(z,2); + //double res = pow(x,2) + pow(y,2) + pow(z,2); + double res = x*x+y*y+z*z; return res; }; @@ -337,7 +338,8 @@ namespace RDGeom { } double length() const { - double res = pow(x,2) + pow(y,2); + //double res = pow(x,2) + pow(y,2); + double res = x*x+y*y; return sqrt(res); }; diff --git a/Code/Geometry/testTransforms.cpp b/Code/Geometry/testTransforms.cpp index a38555ab8..25d5cd676 100644 --- a/Code/Geometry/testTransforms.cpp +++ b/Code/Geometry/testTransforms.cpp @@ -213,11 +213,10 @@ void test12D() { } void test23D() { - double PI = 3.1415926535897931; Point3D pt(1.0, 0.0, 0.0); Point3D tpt = pt; Transform3D trans; - trans.SetRotation(PI/2., X_Axis); + trans.SetRotation(M_PI/2., X_Axis); trans.TransformPoint(pt); CHECK_INVARIANT(ptEq(tpt, pt), ""); @@ -233,7 +232,7 @@ void test23D() { // rotate around y-axis Transform3D transy; - transy.SetRotation(PI/2., Y_Axis); + transy.SetRotation(M_PI/2., Y_Axis); transy.TransformPoint(pt); Point3D tpt4(0.0, 0.0, -1.0); CHECK_INVARIANT(ptEq(tpt4, pt), ""); @@ -250,7 +249,7 @@ void test23D() { // z-axis Transform3D transz; - transz.SetRotation(PI/2., Z_Axis); + transz.SetRotation(M_PI/2., Z_Axis); Point3D pt7(1.0, 0.0, 0.0); Point3D tpt7(0.0, 1.0, 0.0); transz.TransformPoint(pt7); @@ -269,7 +268,6 @@ void test23D() { } void test3MatMultiply() { - double PI = 3.1415926535897931; // start with line on the axis starting at 1.0, // transform it into a line on z-axis starting at 3.0 Point3D pt1(1.0, 0.0, 0.0); @@ -289,7 +287,7 @@ void test3MatMultiply() { // rotation around origin Transform3D t2; - t2.SetRotation(-PI/2.0, Y_Axis); + t2.SetRotation(-M_PI/2.0, Y_Axis); t2.TransformPoint(tp1); t2.TransformPoint(tp2); @@ -331,15 +329,15 @@ void test3MatMultiply() { void testFromQuaternion() { double qt[4]; - qt[0] = cos(RDKit::PI/6); - qt[1] = -sin(RDKit::PI/6); + qt[0] = cos(M_PI/6); + qt[1] = -sin(M_PI/6); qt[2] = 0.0; qt[3] = 0.0; Transform3D trans; trans.SetRotationFromQuaternion(qt); Transform3D ntrans; - ntrans.SetRotation(RDKit::PI/3, Point3D(1.0, 0.0, 0.0)); + ntrans.SetRotation(M_PI/3, Point3D(1.0, 0.0, 0.0)); unsigned int i,j; for (i = 0; i < 4; i++) { diff --git a/Code/GraphMol/Depictor/DepictUtils.cpp b/Code/GraphMol/Depictor/DepictUtils.cpp index 69dd072fa..40d633780 100644 --- a/Code/GraphMol/Depictor/DepictUtils.cpp +++ b/Code/GraphMol/Depictor/DepictUtils.cpp @@ -42,7 +42,7 @@ namespace RDDepict { // compute the sweep angle unsigned int na = ring.size(); - double ang = 2*RDKit::PI/na; + double ang = 2*M_PI/na; // compute the arm length double al = BOND_LEN/(sqrt(2*(1 - cos(ang)))); @@ -79,7 +79,7 @@ namespace RDDepict { RDGeom::Point2D cloc = nb1; cloc += nb2; cloc *= 0.5; - if (ang > RDKit::PI) { + if (ang > M_PI) { // invert the cloc cloc -= rcr; cloc *= -1.0; diff --git a/Code/GraphMol/Depictor/DepictUtils.h b/Code/GraphMol/Depictor/DepictUtils.h index f261f0053..b0c27f6fe 100644 --- a/Code/GraphMol/Depictor/DepictUtils.h +++ b/Code/GraphMol/Depictor/DepictUtils.h @@ -184,7 +184,7 @@ namespace RDDepict { angle = 2*M_PI/3; break; default: - angle = 2.*RDKit::PI/degree; + angle = 2.*M_PI/degree; } return angle; } @@ -218,7 +218,7 @@ namespace RDDepict { RDGeom::Point2D pt1 = loc1 - center; RDGeom::Point2D pt2 = loc2 - center; double cross = pt1.x*pt2.y - pt1.y*pt2.x; - double diffAngle = RDKit::PI - remAngle; + double diffAngle = M_PI - remAngle; cross *= diffAngle; if (cross >= 0.0) { return -1; diff --git a/Code/GraphMol/Depictor/EmbeddedFrag.cpp b/Code/GraphMol/Depictor/EmbeddedFrag.cpp index 3cc1e50d7..cb611f417 100644 --- a/Code/GraphMol/Depictor/EmbeddedFrag.cpp +++ b/Code/GraphMol/Depictor/EmbeddedFrag.cpp @@ -211,7 +211,7 @@ namespace RDDepict { d_eatoms[nb2].loc, wAng); d_eatoms[aid].nbr1 = nb1; d_eatoms[aid].nbr2 = nb2; - d_eatoms[aid].angle = 2*RDKit::PI - wAng; + d_eatoms[aid].angle = 2*M_PI - wAng; } // constructor to embed a cis/trans system @@ -672,7 +672,7 @@ namespace RDDepict { // determine the angle at which we want to add the new atom based on the number // of remaining substituents int nnbr = refAtom.neighs.size(); - double remAngle = 2*RDKit::PI - refAtom.angle; + double remAngle = 2*M_PI - refAtom.angle; double currAngle = remAngle/(1 + nnbr); d_eatoms[toAid].angle += currAngle; @@ -782,7 +782,7 @@ namespace RDDepict { } - angle -= RDKit::PI/2; + angle -= M_PI/2; if (!refAtom.ccw) { // we want to rotate cloackwise angle *= -1.0; diff --git a/Code/GraphMol/Descriptors/MolSurf.cpp b/Code/GraphMol/Descriptors/MolSurf.cpp index 9fc9aca2e..b3681b01a 100644 --- a/Code/GraphMol/Descriptors/MolSurf.cpp +++ b/Code/GraphMol/Descriptors/MolSurf.cpp @@ -15,6 +15,10 @@ #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + namespace RDKit{ namespace Descriptors { double getLabuteAtomContribs(const ROMol &mol, diff --git a/Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp b/Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp index 7cb3094f2..503f783f9 100644 --- a/Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp +++ b/Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp @@ -285,19 +285,19 @@ namespace RDKit { // like s1cncc1. This led to GitHub55, which was fixed elsewhere. if ((aHyb == Atom::SP2) || (ringSize==3) || (ringSize==4)) { - angle = RDKit::PI*(1 - 2.0/ringSize); + angle = M_PI*(1 - 2.0/ringSize); } else if (aHyb == Atom::SP3) { if (ringSize == 5) { - angle = 104*RDKit::PI/180; + angle = 104*M_PI/180; } else { - angle = 109.5*RDKit::PI/180; + angle = 109.5*M_PI/180; } } else if (aHyb == Atom::SP3D) { - angle = 105.0*RDKit::PI/180; + angle = 105.0*M_PI/180; } else if (aHyb == Atom::SP3D2) { - angle = 90.0*RDKit::PI/180; + angle = 90.0*M_PI/180; } else { - angle = 120*RDKit::PI/180; + angle = 120*M_PI/180; } } @@ -406,26 +406,26 @@ namespace RDKit { // if we have a sp2 atom things are planar - we simply divide the remaining angle among the // remaining 13 configurations (and there should only be one) if (ahyb == Atom::SP2) { - angle = (2*RDKit::PI - angleTaken[aid2])/(n13-visited[aid2]); + angle = (2*M_PI - angleTaken[aid2])/(n13-visited[aid2]); } else if (ahyb == Atom::SP3) { // in the case of sp3 we will use the tetrahedral angle mostly - but // but with some special cases - angle = 109.5*RDKit::PI/180; + angle = 109.5*M_PI/180; // we will special-case a little bit here for 3, 4 members ring atoms that are sp3 hybirdized // beyond that the angle reasonably close to the tetrahedral angle if (rinfo->isAtomInRingOfSize(aid2, 3)) { - angle = 116.0*RDKit::PI/180; + angle = 116.0*M_PI/180; } else if (rinfo->isAtomInRingOfSize(aid2, 4)) { - angle = 112.0*RDKit::PI/180; + angle = 112.0*M_PI/180; } } else { // other options we will simply based things on the number of substituent if (deg == 5) { - angle = 105.0*RDKit::PI/180; + angle = 105.0*M_PI/180; } else if (deg == 6) { - angle = 135.0*RDKit::PI/180; + angle = 135.0*M_PI/180; } else { - angle = 120.0*RDKit::PI/180; // FIX: this default is probably not the best we can do here + angle = 120.0*M_PI/180; // FIX: this default is probably not the best we can do here } } aid3 = bnd2->getOtherAtomIdx(aid2); @@ -450,20 +450,20 @@ namespace RDKit { const BOND_SPTR bnd2 = mol[*beg2]; bid2 = bnd2->getIdx(); if (ahyb == Atom::SP) { - angle = RDKit::PI; + angle = M_PI; } else if (ahyb == Atom::SP2) { - angle = 2*RDKit::PI/3; + angle = 2*M_PI/3; } else if (ahyb == Atom::SP3) { - angle = 109.5*RDKit::PI/180; + angle = 109.5*M_PI/180; } else if (ahyb == Atom::SP3D){ //FIX: this and the remaining two hybirdization states below should probably be special // cased. These defaults below are probably not the best we can do particularly when // stereo chemistry is know - angle = 105.0*RDKit::PI/180; + angle = 105.0*M_PI/180; } else if (ahyb == Atom::SP3D2){ - angle = 135.0*RDKit::PI/180; + angle = 135.0*M_PI/180; } else { - angle = 120.0*RDKit::PI/180; + angle = 120.0*M_PI/180; } aid3 = bnd2->getOtherAtomIdx(aid2); _set13BoundsHelper(aid1, aid2, aid3, angle, accumData, mmat, mol); @@ -847,7 +847,7 @@ namespace RDKit { // this is *S-S* situation //FIX: this cannot be right is sulfur has more than two coordinated // the torsion angle is 90 deg - dl = RDGeom::compute14Dist3D(bl1, bl2, bl3, ba12, ba23, RDKit::PI/2) - GEN_DIST_TOL; + dl = RDGeom::compute14Dist3D(bl1, bl2, bl3, ba12, ba23, M_PI/2) - GEN_DIST_TOL; du = dl + 2*GEN_DIST_TOL; path14.type = Path14Configuration::OTHER; //BOOST_LOG(rdDebugLog) << "Special 9 " << aid1 << " " << aid4 << "\n"; diff --git a/Code/GraphMol/FileParsers/MolFileStereochem.cpp b/Code/GraphMol/FileParsers/MolFileStereochem.cpp index 53a47badd..c9fd4da71 100644 --- a/Code/GraphMol/FileParsers/MolFileStereochem.cpp +++ b/Code/GraphMol/FileParsers/MolFileStereochem.cpp @@ -804,7 +804,7 @@ namespace RDKit { double ang=RDGeom::computeDihedralAngle(bond1P,beginP,endP,bond2P); bool sameTorsionDir; - if(ang < RDKit::PI/2){ + if(ang < M_PI/2){ sameTorsionDir=false; } else { sameTorsionDir=true; diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp index 4b934d666..5a7df98b8 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.cpp @@ -330,14 +330,10 @@ namespace RDKit { // bit has not yet been set, then move to the next ring // we'll take care of this later if (queryIsAtomInRing(nbrAtom) - //&& (!atomAromSet[nbrAtom->getIdx()])) { - && (!(aromBitVect[nbrAtom->getIdx()]))) { + && (!(aromBitVect[nbrAtom->getIdx()]))) { moveToNextRing = true; break; } - //atomRings[i][j] + 1, nbrAtom->getIdx() + 1, - //mol->getBondBetweenAtoms(atomRings[i][j], - //nbrAtom->getIdx())->getBondTypeAsDouble()); // if the neighbor is in an aromatic ring and is // double-bonded to the current atom, add 1 pi electron if (mol->getBondBetweenAtoms(atomRings[i][j], @@ -360,7 +356,7 @@ namespace RDKit { // loop again over all ring atoms for (j = 0, canBeAromatic = true; j < atomRings[i].size(); ++j) { // set aromaticity as perceived - aromBitVect[atomRings[i][j]]=1; + aromBitVect[atomRings[i][j]] = 1; atom = mol->getAtomWithIdx(atomRings[i][j]); // if this is is a non-sp2 carbon or nitrogen // then this ring can't be aromatic @@ -381,7 +377,7 @@ namespace RDKit { // if this ring satisfies the 4n+2 rule, // then mark its atoms as aromatic if ((pi_e > 2) && (!((pi_e - 2) % 4))) { - aromRingBitVect[i]=1; + aromRingBitVect[i] = 1; for (j = 0; j < atomRings[i].size(); ++j) { mol->getAtomWithIdx(atomRings[i][j])->setIsAromatic(true); } @@ -3126,7 +3122,7 @@ namespace RDKit { nConj = 1; old_nConj = 0; conjNBitVect.reset(); - conjNBitVect[idx]=1; + conjNBitVect[idx] = 1; while (nConj > old_nConj) { old_nConj = nConj; for (i = 0; i < mol->getNumAtoms(); ++i) { @@ -3161,8 +3157,8 @@ namespace RDKit { // if this nitrogen is not yet marked as conjugated, // mark it and increment the counter and eventually // adjust the total formal charge of the conjugated system - if (!conjNBitVect[j]){ - conjNBitVect[j]=1; + if (!conjNBitVect[j]) { + conjNBitVect[j] = 1; fChg += (double)(nbr2Atom->getFormalCharge()); ++nConj; } diff --git a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h index a2bd82c43..6ec7d4f09 100644 --- a/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h +++ b/Code/GraphMol/ForceFieldHelpers/MMFF/AtomTyper.h @@ -28,15 +28,14 @@ namespace RDKit { namespace MMFF { class MMFFAtomProperties { public: + MMFFAtomProperties() : + mmffAtomType(0), + mmffFormalCharge(0.0), + mmffPartialCharge(0.0) {}; + ~MMFFAtomProperties() {}; boost::uint8_t mmffAtomType; double mmffFormalCharge; double mmffPartialCharge; - MMFFAtomProperties() { - mmffAtomType = 0; - mmffFormalCharge = 0.0; - mmffPartialCharge = 0.0; - } - ~MMFFAtomProperties() {}; }; typedef boost::shared_ptr MMFFAtomPropertiesPtr; diff --git a/Code/GraphMol/molopstest.cpp b/Code/GraphMol/molopstest.cpp index ba430d398..04e15db85 100644 --- a/Code/GraphMol/molopstest.cpp +++ b/Code/GraphMol/molopstest.cpp @@ -26,6 +26,10 @@ #include #include +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + using namespace RDKit; using namespace std; RWMol _t; diff --git a/Code/Numerics/Alignment/testAlignment.cpp b/Code/Numerics/Alignment/testAlignment.cpp index 87a2b6a8a..53179d208 100644 --- a/Code/Numerics/Alignment/testAlignment.cpp +++ b/Code/Numerics/Alignment/testAlignment.cpp @@ -43,13 +43,13 @@ void testBasic() { void testTraingle() { // try 3 point two equilateral triangles of different edge lengths RDGeom::Point3DConstPtrVect rpts; - RDGeom::Point3D rpt1(-cos(RDKit::PI/6), -sin(RDKit::PI/6), 0.0); rpts.push_back(&rpt1); - RDGeom::Point3D rpt2(cos(RDKit::PI/6), -sin(RDKit::PI/6), 0.0); rpts.push_back(&rpt2); + RDGeom::Point3D rpt1(-cos(M_PI/6), -sin(M_PI/6), 0.0); rpts.push_back(&rpt1); + RDGeom::Point3D rpt2(cos(M_PI/6), -sin(M_PI/6), 0.0); rpts.push_back(&rpt2); RDGeom::Point3D rpt3(0.0, 1.0, 0.0); rpts.push_back(&rpt3); RDGeom::Point3DConstPtrVect qpts; - RDGeom::Point3D qpt1(-2*sin(RDKit::PI/6) + 3.0, 2*cos(RDKit::PI/6), 4.0); qpts.push_back(&qpt1); - RDGeom::Point3D qpt2(-2*sin(RDKit::PI/6) + 3.0, -2*cos(RDKit::PI/6), 4.0); qpts.push_back(&qpt2); + RDGeom::Point3D qpt1(-2*sin(M_PI/6) + 3.0, 2*cos(M_PI/6), 4.0); qpts.push_back(&qpt1); + RDGeom::Point3D qpt2(-2*sin(M_PI/6) + 3.0, -2*cos(M_PI/6), 4.0); qpts.push_back(&qpt2); RDGeom::Point3D qpt3(5.0, 0.0, 4.0); qpts.push_back(&qpt3); RDGeom::Transform3D trans; diff --git a/Code/RDGeneral/types.h b/Code/RDGeneral/types.h index b23536c3d..385c2333d 100644 --- a/Code/RDGeneral/types.h +++ b/Code/RDGeneral/types.h @@ -61,7 +61,6 @@ namespace RDKit { const double SMALL_DOUBLE = 1.0e-8; const double MAX_INT = static_cast(std::numeric_limits::max()); const double MAX_LONGINT = static_cast(std::numeric_limits::max()); - const double PI=3.1415926535897931; typedef unsigned int UINT; typedef unsigned short USHORT;