remove no-op macros and dead code (pt 2) (#8035)

* remove no-op macros and dead code (pt 2)

* test failures due to whitespace changes?

* actually run the testFeatures tests

---------

Co-authored-by: greg landrum <greg.landrum@gmail.com>
This commit is contained in:
Hussein Faara
2025-01-11 05:10:00 -08:00
committed by GitHub
parent 41a2a79fa8
commit 8411f4535e
19 changed files with 78 additions and 435 deletions

View File

@@ -501,12 +501,10 @@ void test5() {
int main(int argc, char *argv[]) {
RDLog::InitLogs();
#if 1
test1();
test2();
test3();
test4();
test5();
#endif
return 0;
}

View File

@@ -350,12 +350,6 @@ RWMOL_SPTR_VECT enumerateLibrary(RWMol *templateMol,
// existing result set and move the molecules we just generated
// over
if (tmp.size()) {
#if 0
RWMOL_SPTR_VECT::iterator tmpMolIt;
for(tmpMolIt=res.begin();tmpMolIt!=res.end();tmpMolIt++){
delete *tmpMolIt;
}
#endif
res = tmp;
tmp.clear();
}
@@ -404,16 +398,6 @@ RWMOL_SPTR_VECT enumFromFiles(const char *templateName,
//
//--------------------------
delete templ;
#if 0
VECT_RWMOL_SPTR_VECT::iterator vmpvI;
for(vmpvI=allSidechains.begin();vmpvI!=allSidechains.end();vmpvI++){
RWMOL_SPTR_VECT::iterator mpvI;
for(mpvI=vmpvI->begin();mpvI!=vmpvI->end();mpvI++){
delete *mpvI;
}
vmpvI->clear();
}
#endif
allSidechains.clear();
return library;

View File

@@ -1,2 +1,5 @@
rdkit_headers(Feature.h
DEST Features)
rdkit_test(testBaseFeatures testFeatures.cpp
LINK_LIBRARIES RDGeneral RDGeometryLib )

View File

@@ -1,6 +1,5 @@
// $Id$
//
// Copyright (C) 2004-2006 Rational Discovery LLC
// Copyright (C) 2004-2040 Greg Landrum and other RDKit contributors
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
@@ -16,10 +15,6 @@
#include <Features/Feature.h>
#include <boost/spirit/core.hpp>
#include <boost/spirit/actor/assign_actor.hpp>
using namespace boost::spirit;
using namespace RDKit;
using namespace RDGeom;
using namespace RDFeatures;
@@ -75,7 +70,7 @@ void test2() {
std::cerr << "Basics for ImplicitFeatures." << std::endl;
ImplicitFeature<TypeMarker> f1;
f1.setFamily(fooType);
f1.setType(fooType);
TEST_ASSERT(f1.getType() == fooType);
f1.setType(grnType);
TEST_ASSERT(f1.getType() == grnType);
@@ -86,7 +81,7 @@ void test2() {
f1 = ImplicitFeature<TypeMarker>(barType, fooType);
TEST_ASSERT(f1.getFamily() == barType);
TEST_ASSERT(f1.getType() == barType);
TEST_ASSERT(f1.getType() == fooType);
TEST_ASSERT(feq(f1.getLoc().x, 0.0));
TEST_ASSERT(feq(f1.getLoc().y, 0.0));
TEST_ASSERT(feq(f1.getLoc().z, 0.0));
@@ -127,7 +122,7 @@ void test3() {
TEST_ASSERT(f1.getDirs().size() == 0);
f1 = LocalFeature("foo", "bar");
TEST_ASSERT(f1.getFamily() == "bar");
TEST_ASSERT(f1.getFamily() == "foo");
TEST_ASSERT(f1.getType() == "bar");
TEST_ASSERT(feq(f1.getLoc().x, 0.0));
TEST_ASSERT(feq(f1.getLoc().y, 0.0));
@@ -148,35 +143,8 @@ void test3() {
std::cerr << " done" << std::endl;
}
void testParser() {
std::cerr << "-------------------------------------" << std::endl;
std::cerr << "parser testing." << std::endl;
std::string text;
int n;
bool ok;
text = "p1";
ok = parse(text.c_str(), (ch_p('p') >> int_p[assign_a(n)]), space_p).full;
TEST_ASSERT(ok);
TEST_ASSERT(n == 1);
text = "p12";
ok = parse(text.c_str(), (ch_p('p') >> int_p[assign_a(n)]), space_p).full;
TEST_ASSERT(ok);
TEST_ASSERT(n == 12);
text = "p2 + p3";
ok = parse(text.c_str(), (ch_p('p') >> int_p[assign_a(n)]), space_p).full;
TEST_ASSERT(!ok);
std::cerr << " done" << std::endl;
}
int main() {
#if 0
test1();
test2();
test3();
#endif
testParser();
}

View File

@@ -1716,7 +1716,6 @@ void test17Issue1920627() {
TEST_ASSERT(rxn->getNumReactantTemplates() == 1);
TEST_ASSERT(rxn->getNumProductTemplates() == 1);
#if 1
reacts.clear();
smi = "C[C@](Cl)(CO)CC(=O)NC";
mol = SmilesToMol(smi);
@@ -1844,7 +1843,6 @@ void test17Issue1920627() {
TEST_ASSERT(prod->getAtomWithIdx(4)->hasProp(common_properties::_CIPCode));
prod->getAtomWithIdx(4)->getProp(common_properties::_CIPCode, cip);
TEST_ASSERT(cip == "R");
#endif
reacts.clear();
smi = "C(=O)N[C@@H](CC)C";

View File

@@ -1812,23 +1812,6 @@ void testFragmentOnBRICSBonds() {
BOOST_LOG(rdInfoLog) << "\tdone" << std::endl;
}
void benchFragmentOnBRICSBonds() {
BOOST_LOG(rdInfoLog) << "-------------------------------------" << std::endl;
BOOST_LOG(rdInfoLog) << "Testing fragmentOnBRICSBonds" << std::endl;
{
std::string pathName = getenv("RDBASE");
pathName += "/Regress/Data/mols.1000.sdf";
SDMolSupplier suppl(pathName);
while (!suppl.atEnd()) {
ROMol *m = suppl.next();
ROMol *nmol = MolFragmenter::fragmentOnBRICSBonds(*m);
delete m;
delete nmol;
}
}
BOOST_LOG(rdInfoLog) << "\tdone" << std::endl;
}
void testFragmentOnSomeBonds() {
BOOST_LOG(rdInfoLog) << "-------------------------------------" << std::endl;
BOOST_LOG(rdInfoLog) << "Testing fragmentOnSomeBonds" << std::endl;
@@ -2169,7 +2152,6 @@ int main() {
<< "********************************************************\n";
BOOST_LOG(rdInfoLog) << "Testing Chemical Transforms \n";
#if 1
testDeleteSubstruct();
testReplaceSubstructs();
testReplaceSubstructs2();
@@ -2195,12 +2177,10 @@ int main() {
testFragmentOnBonds();
testFragmentOnBRICSBonds();
testFragmentOnSomeBonds();
// benchFragmentOnBRICSBonds();
testGithubIssue429();
testGithubIssue430();
testGithubIssue511();
testReplaceCore2();
#endif
testGithub1734();
testGithub3206();
testGithub4019();

View File

@@ -171,14 +171,6 @@ void updateDoubleBondNeighbors(ROMol &mol, Bond *dblBond, const Conformer *conf,
return;
}
needsDir.set(dblBond->getIdx(), 0);
#if 0
std::cerr << "**********************\n";
std::cerr << "**********************\n";
std::cerr << "**********************\n";
std::cerr << "UDBN: " << dblBond->getIdx() << " "
<< dblBond->getBeginAtomIdx() << "=" << dblBond->getEndAtomIdx()
<< "\n";
#endif
std::vector<Bond *> followupBonds;
@@ -380,24 +372,7 @@ void updateDoubleBondNeighbors(ROMol &mol, Bond *dblBond, const Conformer *conf,
bond2->getBeginAtom() == atom2, needsDir);
needsDir[obond2->getIdx()] = 0;
}
#if 0
std::cerr << " 1:" << bond1->getIdx() << " ";
if (obond1)
std::cerr << obond1->getIdx() << std::endl;
else
std::cerr << "N/A" << std::endl;
std::cerr << " 2:" << bond2->getIdx() << " ";
if (obond2)
std::cerr << obond2->getIdx() << std::endl;
else
std::cerr << "N/A" << std::endl;
std::cerr << "**********************\n";
std::cerr << "**********************\n";
std::cerr << "**********************\n";
#endif
for (Bond *oDblBond : followupBonds) {
// std::cerr << "FOLLOWUP: " << oDblBond->getIdx() << " "
// << needsDir[oDblBond->getIdx()] << std::endl;
updateDoubleBondNeighbors(mol, oDblBond, conf, needsDir, singleBondCounts,
singleBondNbrs);
}
@@ -820,24 +795,6 @@ std::optional<Atom::ChiralType> atomChiralTypeFromBondDirPseudo3D(
const auto crossp2 = bv1.crossProduct(bv3);
const auto dotp2 = bondVects[order[1]].dotProduct(bondVects[order[3]]);
auto vol2 = crossp2.dotProduct(bondVects[order[0]]);
#if 0
std::cerr << neighborBondIndices[order[0]] << " " <<
bondVects[order[0]]
<< std::endl;
std::cerr << neighborBondIndices[order[1]] << " " <<
bondVects[order[1]]
<< std::endl;
std::cerr << neighborBondIndices[order[2]] << " " <<
bondVects[order[2]]
<< std::endl;
std::cerr << neighborBondIndices[order[3]] << " " <<
bondVects[order[3]]
<< std::endl;
std::cerr << "------------" << std::endl;
std::cerr << crossp1 << " l2=" << crossp1.lengthSq()<<" " << std::endl;
std::cerr << crossp2 << " l2=" << crossp2.lengthSq()<< " " << dotp2 << std::endl;
std::cerr << " !!! " << vol << " " << vol2 << std::endl;
#endif
// detect the case where there's no chiral volume for the default
// evaluation
@@ -1054,27 +1011,6 @@ void buildCIPInvariants(const ROMol &mol, DOUBLE_VECT &res) {
mass = mass % maxMass;
}
#if 0
// NOTE: the inclusion of hybridization in the invariant (as
// suggested in the original paper), leads to the situation
// that
// C[C@@](O)(C=C)C(C)CC
// and
// C[C@@](O)(C=C)C(C)CO
// are assigned S chirality even though the rest of the world
// seems to agree that they ought to be R (atom 3, sp2, is ranked
// higher than atom 5, sp3, no matter what their environments)
int hyb=0;
switch(atom->getHybridization()) {
case Atom::SP: hyb=6;break;
case Atom::SP2: hyb=5;break;
case Atom::SP3: hyb=1;break;
case Atom::SP3D: hyb=3;break;
case Atom::SP3D2: hyb=2;break;
default: break;
}
#endif
invariant = num; // 7 bits here
invariant = (invariant << nMassBits) | mass;
@@ -2332,12 +2268,6 @@ void legacyStereoPerception(ROMol &mol, bool cleanIt,
MolOps::fastFindRings(mol);
}
#if 0
std::cerr << ">>>>>>>>>>>>>\n";
std::cerr << "assign stereochem\n";
mol.debugMol(std::cerr);
#endif
// as part of the preparation, we'll loop over the atoms and
// bonds to see if anything has stereochemistry
// indicated. There's no point in doing the work here if there
@@ -2433,13 +2363,6 @@ void legacyStereoPerception(ROMol &mol, bool cleanIt,
// update the atom ranks based on the new information we have:
Chirality::rerankAtoms(mol, atomRanks);
}
#if 0
std::cout << "*************** done iteration " << keepGoing
<< " ***********" << std::endl;
mol.debugMol(std::cout);
std::cout << "*************** done iteration " << keepGoing
<< " ***********" << std::endl;
#endif
}
if (cleanIt) {
@@ -2994,19 +2917,6 @@ void findPotentialStereoBonds(ROMol &mol, bool cleanIt) {
// if both of the atoms have 2 neighbors (other than the one
// connected
// by the double bond) and ....
#if 0
std::cerr << "Bond: " << dblBond->getIdx() << " "
<< begAtom->getIdx() << "=" << endAtom->getIdx()
<< std::endl;
std::cerr << " " << begAtomNeighbors[0] << "="
<< ranks[begAtomNeighbors[0]] << ":";
std::cerr << " " << begAtomNeighbors[1] << "="
<< ranks[begAtomNeighbors[1]] << std::endl;
std::cerr << " " << endAtomNeighbors[0] << "="
<< ranks[endAtomNeighbors[0]] << ":";
std::cerr << " " << endAtomNeighbors[1] << "="
<< ranks[endAtomNeighbors[1]] << std::endl;
#endif
if ((ranks[begAtomNeighbors[0]] !=
ranks[begAtomNeighbors[1]]) &&
(ranks[endAtomNeighbors[0]] !=
@@ -3268,11 +3178,6 @@ static bool assignNontetrahedralChiralTypeFrom3D(ROMol &mol,
}
}
#if 0
printf("count=%u pairs=%u [%u,%u,%u,%u,%u,%u]\n", count, pairs,
pair[0], pair[1], pair[2], pair[3], pair[4], pair[5]);
#endif
Atom::ChiralType tag;
unsigned int perm;
bool res = false;

View File

@@ -801,10 +801,6 @@ void testGitHubIssue910() {
}
MolOps::addHs(*m, false, false, &chiralAts);
RDDepict::compute2DCoords(*m, nullptr, true);
#if 0
m->setProp("_Name", "github910");
std::cerr << MolToMolBlock(*m);
#endif
// now look for close contacts.
const Conformer &conf = m->getConformer();
for (unsigned int i = 0; i < conf.getNumAtoms(); ++i) {
@@ -971,7 +967,6 @@ void testGithub1691() {
<< "-----------------------\n Testing Github issue "
"1691: Acetylenic hydrogens not given appropriate 2D coordinates"
<< std::endl;
#if 1
{
SmilesParserParams ps;
ps.removeHs = false;
@@ -994,7 +989,6 @@ void testGithub1691() {
TEST_ASSERT(v20.dotProduct(v10) <= -1.0);
TEST_ASSERT(v31.dotProduct(v01) <= -1.0);
}
#endif
{
SmilesParserParams ps;
ps.removeHs = false;
@@ -1799,7 +1793,6 @@ int main() {
#endif
RDLog::InitLogs();
#if 1
BOOST_LOG(rdInfoLog)
<< "***********************************************************\n";
BOOST_LOG(rdInfoLog) << " test1 \n";
@@ -1991,7 +1984,6 @@ int main() {
BOOST_LOG(rdInfoLog)
<< "***********************************************************\n";
testGithub1691();
#endif
testGithub2027();
testGenerate2DDepictionRefPatternMatchVect();
testGenerate2DDepictionAllowRGroupsOrig();

View File

@@ -76,13 +76,6 @@ void test1() {
const Conformer &conf1 = m->getConformer(0);
const Conformer &conf2 = m2->getConformer(0);
#if 0
BOOST_LOG(rdInfoLog) << "-----------------------" << std::endl;
BOOST_LOG(rdInfoLog) << MolToMolBlock(*m2) << std::endl;
BOOST_LOG(rdInfoLog) << "---" << std::endl;
BOOST_LOG(rdInfoLog) << MolToMolBlock(*m) << std::endl;
BOOST_LOG(rdInfoLog) << "-----------------------" << std::endl;
#endif
for (unsigned int i = 0; i < nat; i++) {
RDGeom::Point3D pt1i = conf1.getAtomPos(i);
RDGeom::Point3D pt2i = conf2.getAtomPos(i);
@@ -147,7 +140,6 @@ void test2() {
int cid;
unsigned int nat = mol->getNumAtoms();
#if 1
bm.reset(new DistGeom::BoundsMatrix(nat));
DGeomHelpers::initBoundsMat(bm, 0.0, 1000.0);
DGeomHelpers::setTopolBounds(*mol, bm);
@@ -221,7 +213,6 @@ void test2() {
delete mol;
delete dmat;
#endif
std::cerr << "-------------------------------------\n\n";
smi = "C/C=C/C";
mol = SmilesToMol(smi, 0, 1);
@@ -296,46 +287,6 @@ void test2() {
delete mol;
delete dmat;
#if 0
// this next block of tests all handle the special case that led to Issue284
smi = "COC=O";
mol = SmilesToMol(smi, 0, 1);
nat = mol->getNumAtoms();
bm.reset(new DistGeom::BoundsMatrix(nat));
DGeomHelpers::initBoundsMat(bm, 0.0, 1000.0);
DGeomHelpers::setTopolBounds(*mol, bm);
cid = DGeomHelpers::EmbedMolecule(*mol, 10, 1);
TEST_ASSERT(cid>-1);
dmat = new RDNumeric::DoubleSymmMatrix(nat, 0.0);
computeMolDmat(*mol, *dmat);
//TEST_ASSERT( (bm->getUpperBound(0,3) - bm->getLowerBound(0,3)) < .13);
double x,y,z;
x = bm->getUpperBound(0,3);
y = bm->getLowerBound(0,3);
z = dmat->getVal(0,3);
//TEST_ASSERT( (bm->getUpperBound(0,3) - dmat->getVal(0,3) > -0.1)
// && (bm->getLowerBound(0,3) - dmat->getVal(0,3) < 0.10 ));
delete mol;
delete dmat;
smi = "C[NH]C=O";
mol = SmilesToMol(smi, 0, 1);
nat = mol->getNumAtoms();
bm.reset(new DistGeom::BoundsMatrix(nat));
DGeomHelpers::initBoundsMat(bm, 0.0, 1000.0);
DGeomHelpers::setTopolBounds(*mol, bm);
cid = DGeomHelpers::EmbedMolecule(*mol, 10, 1);
TEST_ASSERT(cid>-1);
dmat = new RDNumeric::DoubleSymmMatrix(nat, 0.0);
computeMolDmat(*mol, *dmat);
TEST_ASSERT( (bm->getUpperBound(0,3) - bm->getLowerBound(0,3)) < .13);
//TEST_ASSERT( (bm->getUpperBound(0,3) - dmat->getVal(0,3) > -0.1)
// && (bm->getLowerBound(0,3) - dmat->getVal(0,3) < 0.10));
delete mol;
delete dmat;
#endif
boost::logging::enable_logs("rdApp.warning");
}
@@ -627,7 +578,6 @@ void testOrdering() {
delete m2;
}
#if 1
void testIssue227() {
std::string smi =
"CCOP1(OCC)=CC(c2ccccc2)=C(c2ccc([N+]([O-])=O)cc2)N=C1c1ccccc1";
@@ -652,7 +602,6 @@ void testIssue227() {
TEST_ASSERT(ok);
delete m;
}
#endif
void testIssue236() {
std::string smi =
@@ -731,18 +680,6 @@ void testIssue276() {
DistGeom::BoundsMatPtr bm(mat);
DGeomHelpers::initBoundsMat(bm);
DGeomHelpers::setTopolBounds(*m, bm);
#if 0
for(unsigned int i=0;i<nat;i++){
for(unsigned int j=0;j<nat;j++){
if(i<j) std::cout << bm->getUpperBound(i,j) << " ";
else if(i>j) std::cout << bm->getLowerBound(i,j) << " ";
else std::cout << "0.00000" << " ";
}
std::cout << std::endl;
}
std::cout << std::endl;
#endif
ok = DistGeom::triangleSmoothBounds(bm);
TEST_ASSERT(ok);
@@ -916,7 +853,6 @@ void testRandomCoords() {
CHECK_INVARIANT(cid >= 0, "");
// writer.write(*m);
// writer.flush();
#if 1
m2 = static_cast<RWMol *>(sdsup.next());
// ROMol *m2 = NULL;
if (m2) {
@@ -925,13 +861,6 @@ void testRandomCoords() {
const Conformer &conf1 = m->getConformer(0);
const Conformer &conf2 = m2->getConformer(0);
#if 0
BOOST_LOG(rdWarningLog) << "-----------------------" << std::endl;
BOOST_LOG(rdWarningLog) << MolToMolBlock(*m2) << std::endl;
BOOST_LOG(rdWarningLog) << "---" << std::endl;
BOOST_LOG(rdWarningLog) << MolToMolBlock(*m) << std::endl;
BOOST_LOG(rdWarningLog) << "-----------------------" << std::endl;
#endif
for (unsigned int i = 0; i < nat; i++) {
RDGeom::Point3D pt1i = conf1.getAtomPos(i);
RDGeom::Point3D pt2i = conf2.getAtomPos(i);
@@ -949,7 +878,6 @@ void testRandomCoords() {
}
}
delete m2;
#endif
delete m;
}
}
@@ -998,7 +926,6 @@ void testConstrainedEmbedding() {
coords[3] = ref->getConformer().getAtomPos(3);
coords[4] = ref->getConformer().getAtomPos(4);
#if 1
int cid = DGeomHelpers::EmbedMolecule(*test, 30, 22, true, false, 2., true,
1, &coords);
TEST_ASSERT(cid > -1);
@@ -1012,7 +939,6 @@ void testConstrainedEmbedding() {
double ssd = MolAlign::alignMol(*test, *ref, -1, -1, &alignMap);
BOOST_LOG(rdInfoLog) << "ssd: " << ssd << std::endl;
TEST_ASSERT(ssd < 0.1);
#endif
delete test;
}
@@ -1100,7 +1026,6 @@ void testIssue2091974() {
void testIssue2835784() {
boost::logging::disable_logs("rdApp.warning");
#if 1
{
std::string smi = "C1C=C1";
RWMol *m = SmilesToMol(smi);
@@ -1133,7 +1058,6 @@ void testIssue2835784() {
TEST_ASSERT(std::find(cids.begin(), cids.end(), -1) == cids.end());
delete m;
}
#endif
{
std::string smi = "C12=CCC1C2";
ROMol *m = SmilesToMol(smi);
@@ -2352,41 +2276,6 @@ void testForceTransAmides() {
mol->addBond(3, 5, Bond::BondType::SINGLE);
MolOps::sanitizeMol(*mol);
MolOps::addHs(*mol);
#if 0
// worth leaving this here just to allow looking at the conformers if anything goes wrong later
{
DGeomHelpers::EmbedParameters params;
params.forceTransAmides = true;
params.randomSeed = 0xf00d;
params.useExpTorsionAnglePrefs = false;
params.useBasicKnowledge = true;
auto cids = DGeomHelpers::EmbedMultipleConfs(*mol, 10, params);
SDWriter w("amide.sdf");
for (auto cid : cids) {
TEST_ASSERT(cid >= 0);
auto conf = mol->getConformer(cid);
auto tors = MolTransforms::getDihedralDeg(conf, 0, 1, 3, 4);
if (fabs(fabs(tors) - 180) > 5) {
w.write(*mol, cid);
std::cerr << cid << " TORS: " << tors << std::endl;
if (fabs(fabs(tors) - 180) > 40) {
std::cerr << "---------- DM " << std::endl;
double *dm = MolOps::get3DDistanceMat(*mol, cid);
auto nAtoms = mol->getNumAtoms();
for (unsigned int i = 0; i < nAtoms; ++i) {
for (unsigned int j = 0; j < nAtoms; ++j) {
std::cerr << " " << std::setprecision(3) << std::setw(5)
<< dm[i * nAtoms + j];
}
std::cerr << std::endl;
}
}
}
// TEST_ASSERT(fabs(fabs(tors) - 180) < 5);
}
w.flush();
}
#endif
{
DGeomHelpers::EmbedParameters params;
params.forceTransAmides = true;
@@ -2482,7 +2371,6 @@ int main() {
<< "********************************************************\n";
BOOST_LOG(rdInfoLog) << "Testing DistGeomHelpers\n";
#if 1
BOOST_LOG(rdInfoLog) << "\t---------------------------------\n";
BOOST_LOG(rdInfoLog) << "\t test2 \n\n";
test2();
@@ -2679,7 +2567,6 @@ int main() {
BOOST_LOG(rdInfoLog) << "\t Using symmetry in conformation pruning.\n";
testSymmetryPruning();
#endif
BOOST_LOG(rdInfoLog) << "\t---------------------------------\n";
BOOST_LOG(rdInfoLog) << "\t Force trans amides.\n";
testForceTransAmides();

View File

@@ -621,16 +621,6 @@ const std::string GetMolFileAtomLine(const Atom *atom, const Conformer *conf,
rxnComponentNumber);
std::string symbol = AtomGetMolFileSymbol(atom, true, queryListAtoms);
#if 0
const boost::format fmter(
"%10.4f%10.4f%10.4f %3s%2d%3d%3d%3d%3d%3d 0%3d%3d%3d%3d%3d");
std::stringstream ss;
ss << boost::format(fmter) % x % y % z % symbol.c_str() % massDiff % chg %
parityFlag % hCount % stereoCare % totValence % rxnComponentType %
rxnComponentNumber % atomMapNumber % inversionFlag %
exactChangeFlag;
res += ss.str();
#else
// it feels ugly to use snprintf instead of boost::format, but at least of the
// time of this writing (with boost 1.55), the snprintf version runs in 20% of
// the time.
@@ -654,7 +644,6 @@ const std::string GetMolFileAtomLine(const Atom *atom, const Conformer *conf,
#endif
res += dest;
#endif
return res;
};

View File

@@ -42,7 +42,7 @@ TEST_CASE("Github #5863: failure in WedgeMolBonds") {
TEST_CASE("translating the chiral flag to stereo groups") {
SECTION("basics") {
auto withFlag = R"CTAB(
Mrv2211 03302308372D
Mrv2211 03302308372D
5 4 0 0 1 0 999 V2000
-6.5625 3.9286 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
@@ -103,7 +103,7 @@ M END
SECTION("explicit zero chiral flag") {
auto zeroFlag = R"CTAB(
Mrv2211 03302308372D
Mrv2211 03302308372D
5 4 0 0 o 0 999 V2000
-6.5625 3.9286 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
@@ -240,11 +240,10 @@ void testStereoExample(const std::string &mb, unsigned int aidx,
}
TEST_CASE("IUPAC recommendations") {
#if 1
SECTION("simple examples") {
std::vector<std::string> mbs = {
R"CTAB(
Mrv2211 06082308462D
Mrv2211 06082308462D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -266,7 +265,7 @@ M V30 END CTAB
M END
)CTAB",
R"CTAB(
Mrv2211 06082309052D
Mrv2211 06082309052D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -288,7 +287,7 @@ M V30 END CTAB
M END
)CTAB",
R"CTAB(
Mrv2211 06082309052D
Mrv2211 06082309052D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -310,7 +309,7 @@ M V30 END CTAB
M END
)CTAB",
R"CTAB(IUPAC does not like this one
Mrv2211 06082309142D
Mrv2211 06082309142D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -332,7 +331,7 @@ M V30 END CTAB
M END
)CTAB",
R"CTAB(IUPAC does not like this one2
Mrv2211 06082309142D
Mrv2211 06082309142D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -347,7 +346,7 @@ M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 1 2
M V30 2 1 2 3
M V30 3 1 2 4
M V30 3 1 2 4
M V30 4 1 2 5 CFG=1
M V30 END BOND
M V30 END CTAB
@@ -369,7 +368,7 @@ M END
}
SECTION("three coordinate") {
auto m = R"CTAB(
Mrv2108 01192209042D
Mrv2108 01192209042D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -403,7 +402,6 @@ M END)CTAB"_ctab;
CHECK(m->getAtomWithIdx(5)->getChiralTag() ==
Atom::ChiralType::CHI_TETRAHEDRAL_CCW);
}
#endif
SECTION("this came up") {
std::string rdbase = getenv("RDBASE");
std::string fName = rdbase + "/Code/GraphMol/test_data/github87.mol";
@@ -415,7 +413,7 @@ M END)CTAB"_ctab;
SECTION("narrow angle") {
auto m = R"CTAB(
Mrv2211 06092305312D
Mrv2211 06092305312D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -469,7 +467,7 @@ M END)CTAB"_ctab;
SECTION("linear arrangements") {
{
auto m = R"CTAB(
Mrv2211 06102314502D
Mrv2211 06102314502D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -498,7 +496,7 @@ M END
}
{
auto m = R"CTAB(opposing stereo
Mrv2211 06102314502D
Mrv2211 06102314502D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -528,7 +526,7 @@ M END
{
// std::cerr<<"11111111111111"<<std::endl;
auto m = R"CTAB(opposing stereo, order change
Mrv2211 06102314502D
Mrv2211 06102314502D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -558,7 +556,7 @@ M END)CTAB"_ctab;
// IUPAC (ST-1.2.12) says this one is wrong. It definitely requires making
// an assumption about where the H is.
auto m = R"CTAB(three-coordinate, T shaped, wedge in the middle
Mrv2211 06102314502D
Mrv2211 06102314502D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -601,7 +599,7 @@ TEST_CASE(
TEST_CASE("stereo in ring", "[molblock][stereo]") {
SECTION("test 1") {
auto molblock = R"CTAB(
Mrv2311 10242314442D
Mrv2311 10242314442D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB

View File

@@ -584,7 +584,6 @@ void testSmilesSupFromText() {
"mol-2 CC 4.0\n"
"mol-3 CCC 9.0\n"
"mol-4 CCCC 16.0\n";
#if 1
nSup2.setData(text, " ", 1, 0, true, true);
mol = nSup2[3];
// BOOST_LOG(rdErrorLog) << "SIZE: " << nSup2.length() << std::endl;
@@ -631,7 +630,6 @@ void testSmilesSupFromText() {
mol = nSup2[2];
TEST_ASSERT(!mol);
delete mol;
#endif
// issue 114, no \n at EOF:
text =
@@ -2566,7 +2564,7 @@ CC(C)(C)(C)C duff2
}
std::string sdf1 = R"SDF(
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-13.3985 4.9850 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2577,7 +2575,7 @@ CC(C)(C)(C)C duff2
M END
$$$$
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-10.3083 4.8496 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2614,7 +2612,7 @@ $$$$
// truncated file1
std::string sdf2 = R"SDF(
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-13.3985 4.9850 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2625,7 +2623,7 @@ $$$$
M END
$$$$
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-10.3083 4.8496 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2636,7 +2634,7 @@ $$$$
M END
$$$$
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-10.3083 4.8496 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2669,7 +2667,7 @@ $$$$
}
// truncated file2
std::string sdf3 = R"SDF(
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-13.3985 4.9850 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2678,12 +2676,12 @@ $$$$
1 2 1 0 0 0 0
2 3 1 0 0 0 0
M END
> <pval> (1)
> <pval> (1)
[1,2,]
$$$$
Mrv1810 06051911332D
Mrv1810 06051911332D
3 2 0 0 0 0 999 V2000
-10.3083 4.8496 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
@@ -2692,7 +2690,7 @@ $$$$
1 2 1 0 0 0 0
2 3 1 0 0 0 0
M END
> <pval> (1)
> <pval> (1)
[1,2,]
)SDF";
{
@@ -2717,7 +2715,7 @@ M END
#ifdef RDK_BUILD_MAEPARSER_SUPPORT
void testGitHub2881() {
std::string data = R"DATA(f_m_ct {
std::string data = R"DATA(f_m_ct {
s_m_title
s_m_entry_id
s_m_entry_name
@@ -2731,28 +2729,28 @@ void testGitHub2881() {
b_m_subgroup_collapsed
i_m_ct_format
:::
"Untitled Document-4"
17
newTemplates2.1
/Users/nicola/schrodinger/coordgen_standalone
templates.mae
"Untitled Document-4"
17
3_S_4_6_2
7_S_8_9_6_10
templates->templates->templates
templates->templates1->templates11
newTemplates2.1
/Users/nicola/schrodinger/coordgen_standalone
templates.mae
17
3_S_4_6_2
7_S_8_9_6_10
templates->templates->templates
templates->templates1->templates11
0
2
m_depend[2] {
m_depend[2] {
# First column is dependency index #
i_m_depend_dependency
s_m_depend_property
:::
1 10 s_st_Chirality_1
2 10 s_st_Chirality_2
1 10 s_st_Chirality_1
2 10 s_st_Chirality_2
:::
}
m_atom[15] {
}
m_atom[15] {
# First column is atom index #
i_m_mmod_type
r_m_x_coord
@@ -2764,24 +2762,24 @@ void testGitHub2881() {
s_m_color_rgb
s_m_atom_name
:::
1 5 1.186400 1.035900 0.000000 900 2 6 A0A0A0 C1
2 5 0.370300 1.157000 0.000000 900 2 6 A0A0A0 C2
3 4 -0.326500 0.715300 0.000000 900 2 6 A0A0A0 C3
4 5 0.085100 0.000400 0.000000 900 2 6 A0A0A0 C4
5 26 -0.328300 -0.713600 0.000000 900 43 7 5757FF N5
6 5 -1.151500 0.716400 0.000000 900 2 6 A0A0A0 C6
7 5 -1.564900 0.002400 0.000000 900 2 6 A0A0A0 C7
8 5 -1.153300 -0.712600 0.000000 900 2 6 A0A0A0 C9
9 2 1.724800 0.410800 0.000000 900 2 6 A0A0A0 C12
10 2 1.723800 -0.414200 0.000000 900 2 6 A0A0A0 C13
11 5 1.183800 -1.037900 0.000000 900 2 6 A0A0A0 C14
12 5 0.367400 -1.157000 0.000000 900 2 6 A0A0A0 C15
13 7 2.508100 -0.670100 0.000000 900 2 6 A0A0A0 C16
14 7 2.993800 -0.003300 0.000000 900 2 6 A0A0A0 C17
15 29 2.509700 0.664800 0.000000 900 43 7 5757FF N18
1 5 1.186400 1.035900 0.000000 900 2 6 A0A0A0 C1
2 5 0.370300 1.157000 0.000000 900 2 6 A0A0A0 C2
3 4 -0.326500 0.715300 0.000000 900 2 6 A0A0A0 C3
4 5 0.085100 0.000400 0.000000 900 2 6 A0A0A0 C4
5 26 -0.328300 -0.713600 0.000000 900 43 7 5757FF N5
6 5 -1.151500 0.716400 0.000000 900 2 6 A0A0A0 C6
7 5 -1.564900 0.002400 0.000000 900 2 6 A0A0A0 C7
8 5 -1.153300 -0.712600 0.000000 900 2 6 A0A0A0 C9
9 2 1.724800 0.410800 0.000000 900 2 6 A0A0A0 C12
10 2 1.723800 -0.414200 0.000000 900 2 6 A0A0A0 C13
11 5 1.183800 -1.037900 0.000000 900 2 6 A0A0A0 C14
12 5 0.367400 -1.157000 0.000000 900 2 6 A0A0A0 C15
13 7 2.508100 -0.670100 0.000000 900 2 6 A0A0A0 C16
14 7 2.993800 -0.003300 0.000000 900 2 6 A0A0A0 C17
15 29 2.509700 0.664800 0.000000 900 43 7 5757FF N18
:::
}
m_bond[17] {
}
m_bond[17] {
# First column is bond index #
i_m_from
i_m_to
@@ -2805,8 +2803,8 @@ void testGitHub2881() {
16 13 14 2
17 14 15 1
:::
}
}
}
}
)DATA";
{
auto *iss = new std::istringstream(data);
@@ -2840,7 +2838,6 @@ void testGitHub3517() {
int main() {
RDLog::InitLogs();
#if 1
BOOST_LOG(rdErrorLog) << "\n-----------------------------------------\n";
testMolSup();
BOOST_LOG(rdErrorLog) << "Finished: testMolSup()\n";
@@ -3014,7 +3011,6 @@ int main() {
testGitHub2285();
BOOST_LOG(rdErrorLog) << "Finished: testGitHub2285()\n";
BOOST_LOG(rdErrorLog) << "-----------------------------------------\n\n";
#endif
BOOST_LOG(rdErrorLog) << "-----------------------------------------\n";
testGitHub2479();

View File

@@ -545,10 +545,8 @@ void testGithub4281() {
int main() {
RDLog::InitLogs();
#if 1
test1();
test2();
#endif
testGithub2414();
testNormalizeMultipleAltSmarts();
testGithub3460();

View File

@@ -512,7 +512,6 @@ void testGitHubIssue1705() {
BOOST_LOG(rdInfoLog)
<< "test grouping substituents in chunks as large as possible"
<< std::endl;
#if 1
{
RWMol *core = SmilesToMol("Oc1ccccc1");
RGroupDecompositionParameters params;
@@ -566,8 +565,6 @@ Cl[*:2]
TEST_ASSERT(ss.str() == expected);
#endif
}
#endif
// std::cerr<<"n\n\n\n\n\n--------------------------------------------------------------\n\n\n\n\n";
{
RWMol *core = SmilesToMol("Cc1ccccc1");
RGroupDecompositionParameters params;
@@ -4157,7 +4154,6 @@ int main() {
<< "********************************************************\n";
BOOST_LOG(rdInfoLog) << "Testing R-Group Decomposition \n";
#if 1
testSymmetryMatching(FingerprintVariance);
testSymmetryMatching();
testRGroupOnlyMatching();
@@ -4182,7 +4178,6 @@ int main() {
testUnprocessedMapping();
testSingleAtomBridge();
#endif
testSymmetryPerformance();
testScorePermutations();
testMultiCorePreLabelled();

View File

@@ -201,14 +201,6 @@ void parseAtomAttribs(Atom *atom, AttribListType attribs, bool doingQuery) {
BOOST_LOG(rdWarningLog) << "Chiral modifier m ignored, chiral spec "
<< attribVal[0] << " will be used\n";
}
#if 0
} else if(attribVal=="r"){
} else if(attribVal=="r*"){
} else if(attribVal=="rm"){
} else if(attribVal=="s"){
} else if(attribVal=="s*"){
} else if(attribVal=="sm"){
#endif
} else {
BOOST_LOG(rdWarningLog) << "Unsupported stereochemistry specifier '"
<< attribVal << "' ignored.\n";

View File

@@ -32,7 +32,6 @@
#include <GraphMol/test_fixtures.h>
using namespace RDKit;
#if 1
TEST_CASE("SMILES Parsing works", "[molops]") {
std::unique_ptr<RWMol> mol(SmilesToMol("C1CC1"));
REQUIRE(mol);
@@ -1151,7 +1150,7 @@ TEST_CASE("RemoveHsParameters", "[molops]") {
}
}
}
#endif
TEST_CASE("github #2895: acepentalene aromaticity perception ",
"[molops][bug][aromaticity]") {
SECTION("acepentalene") {
@@ -1679,7 +1678,7 @@ M END)CTAB"_ctab;
}
SECTION("a simpler system") {
auto m = R"CTAB(
Mrv2014 03092106042D
Mrv2014 03092106042D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -2607,7 +2606,7 @@ TEST_CASE("query moves") {
TEST_CASE("moves with conformer") {
auto m1 = R"CTAB(
Mrv2108 01192209042D
Mrv2108 01192209042D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -3905,8 +3904,8 @@ TEST_CASE("atom output") {
ss.str("");
}
SECTION("chirality 2") {
// same as
// C[Pt@SP2]([H])(F)Cl which is stored internally as
// same as
// C[Pt@SP2]([H])(F)Cl which is stored internally as
// C[Pt@SP3](F)(Cl)[H]
auto m = "C[Pt@SP2H](F)Cl"_smiles;
REQUIRE(m);
@@ -3924,7 +3923,7 @@ TEST_CASE(
"[RWMol]") {
// This mols is made up, it probably doesn't make sense at all.
auto m1 = R"CTAB(
Mrv2311 02062417062D
Mrv2311 02062417062D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -4198,7 +4197,7 @@ TEST_CASE("Try not to set wedged bonds as double in the kekulization") {
// verify that in both cases the kekulization results in assigning
// a single bond order to the wedged bonds.
auto mblock1 = R"(
Mrv2311 05242408112D
Mrv2311 05242408112D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -4251,7 +4250,7 @@ M END
Bond::BondType::DOUBLE);
auto mblock2 = R"(
Mrv2311 05242408162D
Mrv2311 05242408162D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -4313,7 +4312,7 @@ M END
// similar to the previous test case, but adding fused rings and
// an O atom that wouldn't accept double bonds
auto mblock1 = R"(
Mrv2311 05282412322D
Mrv2311 05282412322D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -4373,7 +4372,7 @@ M END
Bond::BondType::DOUBLE);
auto mblock2 = R"(
Mrv2311 05282412342D
Mrv2311 05282412342D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
@@ -4438,7 +4437,6 @@ M END
pathName += "/Code/GraphMol/FileParsers/test_data/atropisomers/";
std::vector<std::pair<std::string, int>> prs = {
#if 1
{"BMS-986142_atrop8.sdf", 8},
{"Mrtx1719_atrop3.sdf", 21},
{"AtropManyChiralsEnhanced2.sdf", 7},
@@ -4497,7 +4495,6 @@ M END
{"RP-6306_atrop3.sdf", 3},
{"macrocycle-8-ortho-broken-hash.sdf", 14},
{"JDQ443_atrop3.sdf", 26},
#endif
{"JDQ443_3d.sdf", 26},
// keep
};
@@ -4715,7 +4712,7 @@ TEST_CASE("Github #7873: monomer info segfaults and mem leaks", "[PDB]") {
*deleted = true;
}
};
bool sanitize = true;
int flavor = 0;
std::unique_ptr<RWMol> mol(SequenceToMol("KY", sanitize, flavor));
@@ -4730,7 +4727,7 @@ TEST_CASE("Github #7873: monomer info segfaults and mem leaks", "[PDB]") {
mol->getAtomWithIdx(0)->setMonomerInfo(res);
mol->getAtomWithIdx(0)->setMonomerInfo(nullptr);
CHECK(was_deleted == true);
}
}
}

View File

@@ -246,7 +246,6 @@ void test5() {
BOOST_LOG(rdInfoLog) << "test5 done" << endl;
}
#if 1
void _test6Help(const ROMol *m) {
Mol::ConstAtomIterator atIt;
unsigned int idx = 0;
@@ -312,11 +311,9 @@ void test6() {
delete m;
BOOST_LOG(rdInfoLog) << "test6 done" << endl;
};
#endif
void test7() {
string smi = "c1ccccc1C";
#if 1
Mol *m = SmilesToMol(smi);
Mol::AromaticAtomIterator atomIt;
Mol::AromaticAtomIterator beginP(m->beginAromaticAtoms());
@@ -346,13 +343,11 @@ void test7() {
TEST_ASSERT(idx == 6);
delete m;
#endif
BOOST_LOG(rdInfoLog) << "test7 done" << endl;
}
void testIssue263() {
string smi = "c1ccccc1C";
#if 1
Mol *m = SmilesToMol(smi);
Mol::AtomIterator atomIt;
unsigned int idx = 0;
@@ -371,7 +366,6 @@ void testIssue263() {
CHECK_INVARIANT(idx == 7, "bad idx");
delete m;
#endif
BOOST_LOG(rdInfoLog) << "testIssue263 done" << endl;
}

View File

@@ -1032,11 +1032,7 @@ extern "C" bytea *makeLowSparseFingerPrint(CSfp data, int numInts) {
n = iter->first % numInts;
if (iterV > INTRANGEMAX) {
#if 0
elog(ERROR, "sparse fingerprint is too big, increase INTRANGEMAX in rdkit.h");
#else
iterV = INTRANGEMAX;
#endif
}
if (s[n].low == 0 || s[n].low > iterV) {

View File

@@ -491,29 +491,6 @@ void testConstReturns() {
TEST_ASSERT(nv == "foo");
}
#if 0
{
Dict d;
std::string v="foo";
d.setVal("foo",v);
double ls=0;
BOOST_LOG(rdErrorLog) << "copy" << std::endl;
for(int i=0;i<100000000;++i){
std::string nv=d.getVal<std::string>("foo");
ls+= nv.size();
}
BOOST_LOG(rdErrorLog) << "done: "<<ls << std::endl;
ls=0;
BOOST_LOG(rdErrorLog) << "ref" << std::endl;
for(int i=0;i<100000000;++i){
const std::string &nv=d.getVal<std::string>("foo");
ls+= nv.size();
}
BOOST_LOG(rdErrorLog) << "done: "<<ls << std::endl;
//std::string nv=d.getVal<std::string>("foo");
}
#else
{
// int nreps=100000000;
int nreps = 100000;
@@ -590,8 +567,6 @@ void testConstReturns() {
// std::string nv=d.getVal<std::string>("foo");
}
#endif
BOOST_LOG(rdErrorLog) << "\tdone" << std::endl;
}
@@ -726,7 +701,6 @@ int main() {
RDLog::InitLogs();
testGithub940();
#if 1
testRDAny();
Dict d;
INT_VECT fooV;
@@ -812,7 +786,6 @@ int main() {
testStringVals();
testVectToString();
#endif
testConstReturns();
testUpdate();
testCustomProps();