...
 
Commits (6)
......@@ -29,8 +29,6 @@ Make sure you have the following packages installed:
- gcc GNU C compiler (or your preferred C compiler)
- g++ GNU C++ compiler (or your preferred C++ compiler)
- make
- cppunit C++ unit testing framework (port of JUnit)
- cppunit-devel C++ unit testing framework (port of JUnit)
After installing these dependencies, please follow the following steps:
......
#include "RbtConfig.h"
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
const std::string EXEVERSION = " ($Id$)";
int main(int argc, char **argv) {
std::string strExeName(argv[0]);
Rbt::PrintStdHeader(std::cout, strExeName + EXEVERSION);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry &registry =
CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
runner.run();
_RBTOBJECTCOUNTER_DUMP_(std::cout)
return 0;
}
// Unit tests for solvent occupancy
//
// Required input files:
// 1YET.prm rDock receptor file
// 1YET.psf Receptor topology file
// 1YET.crd Receptor coordinate file
// 1YET_c.sd Ligand coordinate file
// 1YET.as Docking site
//
// Required environment:
// Make sure the above files are colocated in a single directory
// and define RBT_HOME env. variable to point at this directory
#ifndef OCCUPANCY_H_
#define OCCUPANCY_H_
#include <cppunit/extensions/HelperMacros.h>
#include "RbtBiMolWorkSpace.h"
#include "RbtModel.h"
class OccupancyTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(OccupancyTest);
CPPUNIT_TEST(testSolvationSF);
CPPUNIT_TEST(testPolarSF);
CPPUNIT_TEST(testVdwSF);
CPPUNIT_TEST(testVdwSFSolventModes);
CPPUNIT_TEST(testFlexAtomFactoryReceptor);
CPPUNIT_TEST(testFlexAtomFactorySolvent);
CPPUNIT_TEST(testFlexAtomFactoryLigand);
CPPUNIT_TEST_SUITE_END();
public:
static double TINY;
// TextFixture methods
void setUp();
void tearDown();
// 1) Check that the total desolvation score for receptor / ligand /
// (disabled) solvent matches the total score with no solvent present
void testSolvationSF();
// 2) Check that the total polar score for receptor / ligand / (disabled)
// solvent matches the total score with no solvent present
void testPolarSF();
// 3) Check that the total vdW score for receptor / ligand / (disabled)
// solvent matches the total score with no solvent present
void testVdwSF();
void testVdwSFSolventModes();
// 5) Checks the results of RbtFlexAtomFactory for receptor flexibility modes
void testFlexAtomFactoryReceptor();
// 6) Checks the results of RbtFlexAtomFactory for solvent flexibility modes
void testFlexAtomFactorySolvent();
// 7) Checks the results of RbtFlexAtomFactory for ligand flexibility modes
void testFlexAtomFactoryLigand();
private:
// Helper functions
double CompareScoresForDisabledAndNoSolvent();
double CompareScoresForSolventModes();
bool testFlexAtomFactory(RbtModel *pModel, int expected[9][3]);
RbtBiMolWorkSpacePtr m_workSpace;
RbtModelList m_solventList;
};
#endif /*OCCUPANCY_TEST_H_*/
This diff is collapsed.
// Unit tests for RbtChromElement and subclasses
//
// Required input files:
// 1koc.prm rDock receptor file
// 1koc.psf Receptor topology file
// 1koc.crd Receptor coordinate file
// 1koc_c.sd Ligand coordinate file
// 1koc.as Docking site
//
// Required environment:
// Make sure the above files are colocated in a single directory
// and define RBT_HOME env. variable to point at this directory
#ifndef RBTCHROMTEST_H_
#define RBTCHROMTEST_H_
#include <cppunit/extensions/HelperMacros.h>
#include "RbtBiMolWorkSpace.h"
#include "RbtChrom.h"
#include "RbtDockingSite.h"
#include "RbtModel.h"
#include "RbtSFAgg.h"
class RbtChromTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(RbtChromTest);
CPPUNIT_TEST(testChromFactory);
CPPUNIT_TEST(testCloneDestructor);
CPPUNIT_TEST(testCloneLengthEquals);
CPPUNIT_TEST(testChromOperatorEquals);
CPPUNIT_TEST(testChromOperatorEqualsAfterMutate);
CPPUNIT_TEST(testSyncToModel);
CPPUNIT_TEST(testSyncToModelAfterMutate);
CPPUNIT_TEST(testSyncToModelAfterReset);
CPPUNIT_TEST(testCloneReset);
CPPUNIT_TEST(testMutatedCloneReset);
CPPUNIT_TEST(testChromOperatorEqualsAfterRandomise);
CPPUNIT_TEST(testSyncToModelAfterRandomise);
CPPUNIT_TEST(testSyncToModelAfterRandomiseReset);
CPPUNIT_TEST(testChromOperatorEqualsAfterMutateReset);
CPPUNIT_TEST(testChromOperatorEqualsAfterRandomiseReset);
CPPUNIT_TEST(testNullCrossover);
CPPUNIT_TEST(testEuler);
CPPUNIT_TEST(testRepeatedSync);
CPPUNIT_TEST(testCompareWithNullChrom);
CPPUNIT_TEST(testCompareAfterMutate);
CPPUNIT_TEST(testOperatorEqualsWithModifiedThreshold);
CPPUNIT_TEST(testPopulationConstructor);
CPPUNIT_TEST_EXCEPTION(testPopulationConstructorZeroSize, RbtBadArgument);
CPPUNIT_TEST_EXCEPTION(testPopulationConstructorNullChromosome,
RbtBadArgument);
CPPUNIT_TEST_EXCEPTION(testPopulationConstructorNullSF, RbtBadArgument);
CPPUNIT_TEST(testPopulationRWFitness);
CPPUNIT_TEST(testPopulationRWSelect);
CPPUNIT_TEST(testPopulationGAstep);
CPPUNIT_TEST(testRbtModelGetChromUndefinedFlexData);
CPPUNIT_TEST(testRbtModelGetChromNullFlexData);
CPPUNIT_TEST(testRbtModelGetChrom);
CPPUNIT_TEST(testRandomiseTetheredOrientation);
CPPUNIT_TEST(testRandomiseTetheredCOM);
CPPUNIT_TEST(testMutateTetheredOrientation);
CPPUNIT_TEST(testMutateTetheredCOM);
CPPUNIT_TEST(testCrossoverTetheredOrientation);
CPPUNIT_TEST(testCrossoverTetheredCOM);
CPPUNIT_TEST(testRandomiseTetheredDihedral);
CPPUNIT_TEST(testMutateTetheredDihedral);
CPPUNIT_TEST(testCrossoverTetheredDihedral);
CPPUNIT_TEST(testRandomiseOccupancy);
CPPUNIT_TEST(testOccupancyThreshold);
CPPUNIT_TEST_SUITE_END();
public:
static double TINY;
// TextFixture methods
void setUp();
void tearDown();
// extra setup for building a simple scoring function and workspace
void setupWorkSpace();
// rdock helper methods
// RMSD calculation between two coordinate lists
double rmsd(const RbtCoordList &rc, const RbtCoordList &c);
// Measures the variation in chromosome vector values for repeated
// mutations or randomisations
void measureRandOrMutateDiff(RbtChromElement *chrom, int nTrials,
bool bMutate, // true=mutate; false=randomise
double &meanDiff, double &minDiff,
double &maxDiff);
// Measures the variation in chromosome vector values for repeated
// crossovers
void measureCrossoverDiff(RbtChromElement *chrom, int nTrials,
double &meanDiff, double &minDiff, double &maxDiff);
// The unit tests
// 1) Does RbtChromFactory create a valid chromosome?
void testChromFactory();
// 2) Can we delete a cloned chromosome without affecting the original?
void testCloneDestructor();
// 3) Is the length of a cloned chromosome equal to the original?
void testCloneLengthEquals();
// 4) Does operator== return true for a clone and an original (before
// mutation)?
void testChromOperatorEquals();
// 5) Does operator!= return true for a mutated clone and an original?
void testChromOperatorEqualsAfterMutate();
// 6) Does SyncToModel leave the model coords unchanged if chromosome has
// not been mutated?
void testSyncToModel();
// 7) Does SyncToModel change the model coords after a mutation?
void testSyncToModelAfterMutate();
// 8) Does SyncToModel leave the model coords unchanged if chromosome has
// been mutated then reset?
void testSyncToModelAfterReset();
// 9) If we make a clone BEFORE the original has been mutated, check that
// Reset() on the clone will reset to the original (unmutated) model coords
void testCloneReset();
// 10) If we make a clone AFTER the original has been mutated, check that
// Reset() on the clone still resets to the original (unmutated) model coords
void testMutatedCloneReset();
// 11) Does operator!= return true for a randomised clone and an original?
void testChromOperatorEqualsAfterRandomise();
// 12) Does SyncToModel change the model coords after a randomisation?
void testSyncToModelAfterRandomise();
// 13) Does SyncToModel leave the model coords unchanged if chromosome has
// been randomised then reset?
void testSyncToModelAfterRandomiseReset();
// 14) Does operator== return true for a mutated, reset clone and an original?
void testChromOperatorEqualsAfterMutateReset();
// 15) Does operator== return true for a randomised, reset clone and an
// original?
void testChromOperatorEqualsAfterRandomiseReset();
// 16) Check that chromosomes are still equal after crossover of unmutated
// clones
void testNullCrossover();
// 17) Check that conversion from quaternion to Euler angles and back
// is a null operation
void testEuler();
// 18) Check that repeated sync to/from model leaves the genotype and
// phenotype unchanged
void testRepeatedSync();
// 19) Check that an invalid Compare() returns -1 (i.e. for unequal chromosome
// lengths)
void testCompareWithNullChrom();
// 20) Check that Compare() after a single mutation never returns greater than
// the relative mutation distance (loops over 10000 repeats)
void testCompareAfterMutate();
// 21) Test operator== with modified _THRESHOLD
void testOperatorEqualsWithModifiedThreshold();
// 22) Test population constructor
void testPopulationConstructor();
// 23) Check that population constructor with zero size throws an error
void testPopulationConstructorZeroSize();
// 24) Check that population constructor with null chromosome throws an error
void testPopulationConstructorNullChromosome();
// 25) Check that population constructor with null scoring function throws an
// error
void testPopulationConstructorNullSF();
// 26) Check that roulette wheel fitness values are calculated OK
void testPopulationRWFitness();
// 27) Check that roulette wheel selection will select higher scoring genomes
// on average
void testPopulationRWSelect();
// 28) Check that population GAstep does not decrease the score of the best
// genome and that population size remains constant
void testPopulationGAstep();
// 29) Checks the behaviour of RbtModel::GetChrom if flex data has not been
// defined Should return a zero length chromosome for rigid model
void testRbtModelGetChromUndefinedFlexData();
// 30) Checks the behaviour of RbtModel::SetFlexData(NULL)
// Should return a zero length chromosome for rigid model
void testRbtModelGetChromNullFlexData();
// 31) Checks that RbtModel::SetFlexData creates the same chromosome
// as the manual method
void testRbtModelGetChrom();
// 32) Checks that the variation in randomised values remains in bounds
// for tethered orientations
void testRandomiseTetheredOrientation();
// 33) Checks that the variation in randomised values remains in bounds
// for tethered COM
void testRandomiseTetheredCOM();
// 34) Checks that the variation in mutated values remains in bounds
// for tethered orientations
void testMutateTetheredOrientation();
// 35) Checks that the variation in mutated values remains in bounds
// for tethered COM
void testMutateTetheredCOM();
// 36) Checks that the variation in crossed over values remains in bounds
// for tethered orientations
void testCrossoverTetheredOrientation();
// 37) Checks that the variation in crossed over values remains in bounds
// for tethered COM
void testCrossoverTetheredCOM();
// 38) Checks that the variation in randomised values remains in bounds
// for tethered dihedral
void testRandomiseTetheredDihedral();
// 39) Checks that the variation in mutated values remains in bounds
// for tethered dihedral
void testMutateTetheredDihedral();
// 40) Checks that the variation in crossed over values remains in bounds
// for tethered dihedral
void testCrossoverTetheredDihedral();
// 41) Checks that randomised occupancy is from a rectangular distribution
void testRandomiseOccupancy();
// 42) Checks that actual occupancy probability matches the desired
// probability
void testOccupancyThreshold();
private:
RbtModelPtr m_recep_1koc;
RbtModelPtr m_lig_1koc;
RbtDockingSitePtr m_site_1koc;
RbtChromElementPtr m_chrom_1koc;
RbtAtomList m_atomList; // All atoms in receptor and ligand
RbtBiMolWorkSpacePtr m_workSpace; // simple workspace
RbtSFAggPtr m_SF; // simple scoring function
};
#endif /*RBTCHROMTEST_H_*/
#include "SearchTest.h"
#include "RbtBiMolWorkSpace.h"
#include "RbtCavityGridSF.h"
#include "RbtGATransform.h"
#include "RbtMdlFileSink.h"
#include "RbtMdlFileSource.h"
#include "RbtPRMFactory.h"
#include "RbtRandPopTransform.h"
#include "RbtSimAnnTransform.h"
#include "RbtSimplexTransform.h"
#include "RbtTransformAgg.h"
#include "RbtVdwIdxSF.h"
#include "RbtVdwIntraSF.h"
CPPUNIT_TEST_SUITE_REGISTRATION(SearchTest);
void SearchTest::setUp() {
try {
// Create the docking site, receptor, ligand and solvent objects
const std::string &wsName = "1YET";
std::string prmFileName = Rbt::GetRbtFileName("", wsName + ".prm");
std::string ligFileName = Rbt::GetRbtFileName("", wsName + "_c.sd");
std::string asFileName = Rbt::GetRbtFileName("", wsName + ".as");
RbtParameterFileSourcePtr spPrmSource(
new RbtParameterFileSource(prmFileName));
RbtMolecularFileSourcePtr spMdlFileSource(
new RbtMdlFileSource(ligFileName, true, true, true));
m_workSpace = new RbtBiMolWorkSpace();
std::ifstream istr(asFileName.c_str(),
std::ios_base::in | std::ios_base::binary);
m_workSpace->SetDockingSite(new RbtDockingSite(istr));
istr.close();
RbtPRMFactory prmFactory(spPrmSource, m_workSpace->GetDockingSite());
m_workSpace->SetReceptor(prmFactory.CreateReceptor());
m_workSpace->SetLigand(prmFactory.CreateLigand(spMdlFileSource));
m_workSpace->SetSolvent(prmFactory.CreateSolvent());
// Combine the atom lists of receptor, ligand and solvent
int nModels = m_workSpace->GetNumModels();
for (int i = 0; i < nModels; i++) {
RbtAtomList atomList = m_workSpace->GetModel(i)->GetAtomList();
std::copy(atomList.begin(), atomList.end(),
std::back_inserter(m_atomList));
}
// Set up a minimal workspace and scoring function for docking
m_SF = new RbtSFAgg("SCORE");
RbtBaseSF *sfInter = new RbtVdwIdxSF("INTER_VDW");
sfInter->SetParameter(RbtVdwSF::_ECUT, 1.0);
m_SF->Add(sfInter);
RbtBaseSF *sfIntra = new RbtVdwIntraSF("INTRA_VDW");
sfIntra->SetParameter(RbtVdwSF::_ECUT, 1.0);
m_SF->Add(sfIntra);
m_workSpace->SetSF(m_SF);
} catch (RbtError &e) {
std::cout << e << std::endl;
}
}
void SearchTest::tearDown() {
m_atomList.clear();
m_SF.SetNull();
m_workSpace.SetNull();
}
// RMSD calculation between two coordinate lists
double SearchTest::rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
double retVal(0.0);
unsigned int nCoords = rc.size();
if (c.size() != nCoords) {
retVal = 999.9;
} else {
for (unsigned int i = 0; i < nCoords; i++) {
retVal += Rbt::Length2(rc[i], c[i]);
}
retVal = sqrt(retVal / float(nCoords));
}
return retVal;
}
void SearchTest::testPRMFactory() {
CPPUNIT_ASSERT(m_workSpace->GetNumModels() == 6);
}
void SearchTest::testHeavyAtomFactory() {
RbtAtomRList heavyAtomList;
// find all the movable heavy atoms in the receptor, ligand and solvent
if (m_workSpace) {
RbtCavityGridSF::HeavyAtomFactory atomFactory(m_workSpace->GetModels());
heavyAtomList = atomFactory.GetAtomList();
}
CPPUNIT_ASSERT(heavyAtomList.size() == 42);
}
void SearchTest::testGA() {
RbtTransformAggPtr spTransformAgg(new RbtTransformAgg());
RbtBaseTransform *pRandPop = new RbtRandPopTransform();
RbtBaseTransform *pGA = new RbtGATransform();
pRandPop->SetParameter(RbtBaseObject::_TRACE, 4);
pGA->SetParameter(RbtBaseObject::_TRACE, 4);
spTransformAgg->Add(pRandPop);
spTransformAgg->Add(pGA);
m_workSpace->SetTransform(spTransformAgg);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
std::cout << e.Message() << std::endl;
isOK = false;
}
CPPUNIT_ASSERT(isOK);
}
void SearchTest::testSimplex() {
RbtTransformAggPtr spTransformAgg(new RbtTransformAgg());
// RbtBaseTransform* pRandPop = new RbtRandPopTransform();
RbtBaseTransform *pSimplex = new RbtSimplexTransform();
// pRandPop->SetParameter(RbtBaseObject::_TRACE, 4);
pSimplex->SetParameter(RbtBaseObject::_TRACE, 1);
pSimplex->SetParameter(RbtSimplexTransform::_MAX_CALLS, 500);
pSimplex->SetParameter(RbtSimplexTransform::_NCYCLES, 100);
pSimplex->SetParameter(RbtSimplexTransform::_STEP_SIZE, 1.0);
// spTransformAgg->Add(pRandPop);
spTransformAgg->Add(pSimplex);
m_workSpace->SetTransform(spTransformAgg);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
std::cout << e.Message() << std::endl;
isOK = false;
}
CPPUNIT_ASSERT(isOK);
}
void SearchTest::testSimAnn() {
RbtBaseTransform *pSimAnn = new RbtSimAnnTransform();
pSimAnn->SetParameter(RbtBaseObject::_TRACE, 2);
pSimAnn->SetParameter(RbtSimAnnTransform::_BLOCK_LENGTH, 100);
pSimAnn->SetParameter(RbtSimAnnTransform::_NUM_BLOCKS, 50);
pSimAnn->SetParameter(RbtSimAnnTransform::_START_T, 300.0);
pSimAnn->SetParameter(RbtSimAnnTransform::_FINAL_T, 50.0);
pSimAnn->SetParameter(RbtSimAnnTransform::_STEP_SIZE, 0.5);
pSimAnn->SetParameter(RbtSimAnnTransform::_PARTITION_DIST, 0.0);
pSimAnn->SetParameter(RbtSimAnnTransform::_PARTITION_FREQ, 0);
m_workSpace->SetTransform(pSimAnn);
bool isOK(true);
try {
m_workSpace->Run();
} catch (RbtError &e) {
std::cout << e.Message() << std::endl;
isOK = false;
}
delete pSimAnn;
CPPUNIT_ASSERT(isOK);
}
void SearchTest::testRestart() {
RbtTransformAggPtr spTransformAgg(new RbtTransformAgg());
RbtBaseTransform *pSimplex = new RbtSimplexTransform();
pSimplex->SetParameter(RbtBaseObject::_TRACE, 1);
pSimplex->SetParameter(RbtSimplexTransform::_MAX_CALLS, 500);
pSimplex->SetParameter(RbtSimplexTransform::_NCYCLES, 100);
pSimplex->SetParameter(RbtSimplexTransform::_STEP_SIZE, 1.0);
spTransformAgg->Add(pSimplex);
m_workSpace->SetTransform(spTransformAgg);
bool isOK(true);
double finalScore(0.0);
double restartScore(0.0);
try {
// create an output sink for the minimised ligand/solvent
RbtMolecularFileSinkPtr spMdlFileSink(
new RbtMdlFileSink("restart.sd", RbtModelPtr()));
m_workSpace->SetSink(spMdlFileSink);
m_workSpace->Run();
m_workSpace->Save();
finalScore = m_workSpace->GetSF()->Score();
// Reload the receptor, minimised ligand and solvent
std::string prmFileName = Rbt::GetRbtFileName("", "1YET.prm");
RbtParameterFileSourcePtr spPrmSource(
new RbtParameterFileSource(prmFileName));
RbtMolecularFileSourcePtr spMdlFileSource(
new RbtMdlFileSource("restart.sd", true, true, true));
// Ligand segment is always called H, solvent will be H2, H3 etc.
spMdlFileSource->SetSegmentFilterMap(Rbt::ConvertStringToSegmentMap("H"));
RbtPRMFactory prmFactory(spPrmSource, m_workSpace->GetDockingSite());
prmFactory.SetTrace(1);
m_workSpace->SetReceptor(prmFactory.CreateReceptor());
m_workSpace->SetLigand(prmFactory.CreateLigand(spMdlFileSource));
m_workSpace->SetSolvent(prmFactory.CreateSolvent());
m_workSpace->UpdateModelCoordsFromChromRecords(spMdlFileSource, 1);
restartScore = m_workSpace->GetSF()->Score();
// RbtStringVariantMap scoreMap;
// m_workSpace->GetSF()->ScoreMap(scoreMap);
// for (RbtStringVariantMapConstIter iter = scoreMap.begin(); iter !=
// scoreMap.end(); ++iter) {
// std::cout << iter->first << " = " << iter->second << std::endl;
//}
std::cout << "Final score = " << finalScore << std::endl;
std::cout << "Restart score = " << restartScore << std::endl;
} catch (RbtError &e) {
std::cout << e.Message() << std::endl;
isOK = false;
}
CPPUNIT_ASSERT(isOK && (fabs(restartScore - finalScore) < 0.01));
}
// Unit tests for rDock search algorithms
//
// Required input files:
// 1YET.prm rDock receptor file
// 1YET.psf Receptor topology file
// 1YET.crd Receptor coordinate file
// 1YET_c.sd Ligand coordinate file
// 1YET.as Docking site
//
// Required environment:
// Make sure the above files are colocated in a single directory
// and define RBT_HOME env. variable to point at this directory
#ifndef SEARCHTEST_H_
#define SEARCHTEST_H_
#include <cppunit/extensions/HelperMacros.h>
#include "RbtBiMolWorkSpace.h"
#include "RbtChrom.h"
#include "RbtDockingSite.h"
#include "RbtModel.h"
#include "RbtSFAgg.h"
class SearchTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(SearchTest);
CPPUNIT_TEST(testPRMFactory);
CPPUNIT_TEST(testHeavyAtomFactory);
CPPUNIT_TEST(testGA);
CPPUNIT_TEST(testSimplex);
CPPUNIT_TEST(testSimAnn);
CPPUNIT_TEST(testRestart);
CPPUNIT_TEST_SUITE_END();
public:
// TextFixture methods
void setUp();
void tearDown();
// rdock helper methods
// RMSD calculation between two coordinate lists
double rmsd(const RbtCoordList &rc, const RbtCoordList &c);
// 1 Check that receptor, ligand and solvent models are loaded into workspace
// Should be 6 models in total (4 solvent)
void testPRMFactory();
// 2 Check RbtFlexDataVisitor subclass correctly identifies movable heavy
// atoms in cavity
void testHeavyAtomFactory();
// 3 Run a sample GA
void testGA();
// 4 Run a sample Simplex
void testSimplex();
// 5 Run a sample simulated annealing
void testSimAnn();
// 6 Check we can reload solvent coords from ligand SD file
void testRestart();
private:
RbtAtomList m_atomList; // All atoms in receptor, ligand and solvent
RbtBiMolWorkSpacePtr m_workSpace; // simple workspace
RbtSFAggPtr m_SF; // simple scoring function
};
#endif /*SEARCHTEST_H_*/
......@@ -41,7 +41,6 @@ First of all, you will need to install several packages before compiling and run
* gcc and g++ compilers version > 3.3
* make
* cppunit and cppunit-devel
.. note::
......@@ -123,10 +122,6 @@ For full production use, you would typically compile rDock on a separate build m
+-------------+------------------------------------+------------+---------+
|g++ |GNU C++ compiler |Compile-time|>=3.3.4 |
+-------------+------------------------------------+------------+---------+
|cppunit |C++ unit test framework |Compile-time|>=1.10.2 |
+-------------+------------------------------------+------------+---------+
|cppunit-devel|Development files for cppunit |Compile-time|>=1.10.2 |
+-------------+------------------------------------+------------+---------+
Unpacking the distribution files
================================
......
......@@ -16,6 +16,7 @@
#define _RBT_CELL_H_
#include "RbtGPTypes.h"
#include <spdlog/spdlog.h>
class RbtCell {
public:
......@@ -67,7 +68,7 @@ public:
if (constant)
constant = false;
else
std::cout << "ERROR\n";
spdlog::error("Constant was already reset");
}
private:
......
......@@ -254,12 +254,8 @@ public:
RbtTriposAtomType::eType GetTriposType() const { return m_triposType; }
void SetTriposType(RbtTriposAtomType::eType aType) { m_triposType = aType; }
// XB
// reweighting factor
// RbtDouble GetReweight() const {return m_dReweight;}
// void SetReweight(const RbtDouble dReweight) {m_dReweight = dReweight;}
// XB END MODIFICATIONS
double GetReweight() const {return m_dReweight;}
void SetReweight(const double dReweight) {m_dReweight = dReweight;}
///////////////////////////////////////////////
// Other public methods
///////////////////////////////////////////////
......@@ -337,7 +333,7 @@ private:
double m_dAtomicMass; // atomic mass
double m_dVdwRadius; // atomic mass
std::string m_strFFType; // force field atom type
// RbtDouble m_dReweight; // XB reweighting factor
double m_dReweight; // XB reweighting factor
RbtUIntCoordMap m_savedCoords; // DM 08 Feb 1999 - now store all saved coords
// in a map<RbtUInt,RbtCoord>
......
......@@ -19,6 +19,8 @@
#include "RbtContext.h"
#include "RbtFilterExpression.h"
#include <sstream>
class FilterVbleExp;
class FilterAddExp;
class FilterSubExp;
......@@ -56,6 +58,7 @@ protected:
class PrintVisitor : public RbtFilterExpressionVisitor {
public:
PrintVisitor(RbtContextPtr);
~PrintVisitor();
virtual void VisitVbleExp(FilterVbleExp *);
virtual void VisitAddExp(FilterAddExp *);
virtual void VisitSubExp(FilterSubExp *);
......@@ -68,11 +71,13 @@ public:
private:
RbtContextPtr contextp;
std::ostringstream strbuf;
};
class PrettyPrintVisitor : public RbtFilterExpressionVisitor {
public:
PrettyPrintVisitor(RbtContextPtr);
~PrettyPrintVisitor();
virtual void VisitVbleExp(FilterVbleExp *);
virtual void VisitAddExp(FilterAddExp *);
virtual void VisitSubExp(FilterSubExp *);
......@@ -85,6 +90,7 @@ public:
private:
RbtContextPtr contextp;
std::ostringstream strbuf;
};
class EvaluateVisitor : public RbtFilterExpressionVisitor {
......
......@@ -44,8 +44,7 @@ protected:
virtual double RawScore() const;
private:
void SetupAtomList(RbtAtomList &atomList, const RbtAtomList &neighbourList,
int traceTriggerLevel);
void SetupAtomList(RbtAtomList &atomList, const RbtAtomList &neighbourList);
};
#endif //_RBTSETUPPOLARSF_H_
......@@ -78,10 +78,13 @@ library_soversion = '0'
eigen3_dep = dependency('eigen3', version : '>=3.0.0',
fallback : ['eigen', 'eigen_dep']
)
spdlog_dep = dependency('spdlog', version : '>=1.0.0',
fallback : ['spdlog', 'spdlog_dep']
)
libRbt = shared_library(
'Rbt', srcRbt, soversion : library_soversion,
version : library_soversion + '.' + meson.project_version(),
dependencies: eigen3_dep, include_directories : incRbtAll
dependencies: [eigen3_dep, spdlog_dep], include_directories : incRbtAll
)
executable(
......@@ -130,19 +133,32 @@ if dt_smarts.found() and dt_smiles.found()
)
endif
cppunit = dependency('cppunit', required : false)
if cppunit.found()
incTest = include_directories('build/test')
srcTest = [
'build/test/Main.cxx', 'build/test/OccupancyTest.cxx',
'build/test/RbtChromTest.cxx', 'build/test/SearchTest.cxx'
]
unit_test = executable(
'unit_test', srcTest, dependencies : cppunit, link_with : libRbt,
tests_opt = get_option('tests')
if tests_opt
catch2_dep = dependency('catch2', version : '>=2.0.0',
fallback : ['catch2', 'catch2_dep']
)
incTest = include_directories('tests')
search_test = executable('search-test', 'tests/SearchTest.cxx',
dependencies : catch2_dep, link_with : libRbt,
include_directories : [incTest, incRbt]
)
occupancy_test = executable('occupancy-test', 'tests/OccupancyTest.cxx',
dependencies : catch2_dep, link_with : libRbt,
include_directories : [incTest, incRbt]
)
test(
'unit_test', unit_test,
env : 'RBT_HOME=' + meson.current_source_dir() + '/build/test/RBT_HOME'
genetic_algorithm_test = executable('genetic-algorithm-test',
'tests/GeneticAlgorithmTest.cxx', dependencies : catch2_dep,
link_with : libRbt, include_directories : [incTest, incRbt]
)
test('search-test', search_test,
env : 'RBT_HOME=' + meson.current_source_dir() + '/tests/data/pdb/1yet'
)
test('occupancy-test', occupancy_test,
env : 'RBT_HOME=' + meson.current_source_dir() + '/tests/data/pdb/1yet'
)
test('genetic-algorithm-test', genetic_algorithm_test,
env : 'RBT_HOME=' + meson.current_source_dir() + '/tests/data/pdb/1koc'
)
endif
option(
'tests',
type : 'boolean',
value : false,
description : 'Build the unit tests'
)
......@@ -23,6 +23,7 @@
#include "Rbt.h"
#include "RbtFileError.h"
#include "RbtResources.h"
#include <spdlog/spdlog.h>
// GetRbtRoot - returns value of RBT_ROOT env variable
std::string Rbt::GetRbtRoot() {
......@@ -184,10 +185,7 @@ RbtStringList Rbt::GetDirList(const std::string &strDir,
// Converts (comma)-delimited string of segment names to segment map
RbtSegmentMap Rbt::ConvertStringToSegmentMap(const std::string &strSegments,
const std::string &strDelimiter) {
#ifdef _DEBUG
// std::cout << "ConvertStringToSegmentMap: " << strSegments << " delimiter="
// << strDelimiter << std::endl;
#endif //_DEBUG
spdlog::trace("Rbt::ConvertStringToSegmentMap: {} delimiter={}", strSegments, strDelimiter);
std::string::size_type nDelimiterSize = strDelimiter.size();
RbtSegmentMap segmentMap;
......@@ -202,9 +200,7 @@ RbtSegmentMap Rbt::ConvertStringToSegmentMap(const std::string &strSegments,
// string
do {
iEnd = strSegments.find(strDelimiter, iBegin);
#ifdef _DEBUG
// std::cout << strSegments.substr(iBegin, iEnd-iBegin) << std::endl;
#endif //_DEBUG
spdlog::debug("Rbt::ConvertStringToSegmentMap: {}", strSegments.substr(iBegin, iEnd-iBegin));
segmentMap[strSegments.substr(iBegin, iEnd - iBegin)] = 0;
iBegin = iEnd + nDelimiterSize;
} while (iEnd !=
......
......@@ -13,6 +13,8 @@
#include "RbtAlignTransform.h"
#include "RbtDockingSite.h"
#include "RbtWorkSpace.h"
#include <spdlog/fmt/ostr.h>
#include <spdlog/spdlog.h>
// Static data member for class type
std::string RbtAlignTransform::_CT("RbtAlignTransform");
......@@ -28,16 +30,12 @@ RbtAlignTransform::RbtAlignTransform(const std::string &strName)
// Add parameters
AddParameter(_COM, "ALIGN");
AddParameter(_AXES, "ALIGN");
#ifdef _DEBUG
std::cout << _CT << " parameterised constructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtAlignTransform parameterised constructor");
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtAlignTransform::~RbtAlignTransform() {
#ifdef _DEBUG
std::cout << _CT << " destructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtAlignTransform destructor");
_RBTOBJECTCOUNTER_DESTR_(_CT);
}
......@@ -79,8 +77,6 @@ void RbtAlignTransform::Execute() {
if (spLigand.Null() || m_cavities.empty())
return;
int iTrace = GetTrace();
// Select a cavity at random, weighted by each cavity size
int iRnd = m_rand.GetRandomInt(m_totalSize);
int iCavity(0);
......@@ -102,19 +98,14 @@ void RbtAlignTransform::Execute() {
// Select a coord at random
int iRand = m_rand.GetRandomInt(coordList.size());
RbtCoord asCavityCoord = coordList[iRand];
if (iTrace > 1) {
std::cout << "Translating ligand COM to active site coord #" << iRand
<< ": " << asCavityCoord << std::endl;
}
spdlog::info("Translating ligand COM to active site coord #{}: {}", iRand,
asCavityCoord);
// Translate the ligand center of mass to the selected coord
spLigand->SetCenterOfMass(asCavityCoord);
}
// B. Active site center of mass
else if (strPlaceCOM == "ALIGN") {
if (iTrace > 1) {
std::cout << "Translating ligand COM to active site COM: " << prAxes.com
<< std::endl;
}
spdlog::info("Translating ligand COM to active site COM: {}", prAxes.com);
spLigand->SetCenterOfMass(prAxes.com);
}
......@@ -123,10 +114,8 @@ void RbtAlignTransform::Execute() {
if (strPlaceAxes == "RANDOM") {
double thetaDeg = 180.0 * m_rand.GetRandom01();
RbtCoord axis = m_rand.GetRandomUnitVector();
if (iTrace > 1) {
std::cout << "Rotating ligand by " << thetaDeg
<< " deg around axis=" << axis << " through COM" << std::endl;
}
spdlog::info("Rotating ligand by {} deg around axis={} through COM",
thetaDeg, axis);
spLigand->Rotate(axis, thetaDeg);
}
// B. Align ligand principal axes with principal axes of active site
......@@ -134,29 +123,20 @@ void RbtAlignTransform::Execute() {
spLigand->AlignPrincipalAxes(
prAxes,
false); // false = don't translate COM as we've already done it above
if (iTrace > 1) {
std::cout
<< "Aligning ligand principal axes with active site principal axes"
<< std::endl;
}
spdlog::info(
"Aligning ligand principal axes with active site principal axes");
// Make random 180 deg rotations around each of the principal axes
if (m_rand.GetRandom01() < 0.5) {
spLigand->Rotate(prAxes.axis1, 180.0, prAxes.com);
if (iTrace > 1) {
std::cout << "180 deg rotation around PA#1" << std::endl;
}
spdlog::info("180 deg rotation around PA#1");
}
if (m_rand.GetRandom01() < 0.5) {
spLigand->Rotate(prAxes.axis2, 180.0, prAxes.com);
if (iTrace > 1) {
std::cout << "180 deg rotation around PA#2" << std::endl;
}
spdlog::info("180 deg rotation around PA#3");
}
if (m_rand.GetRandom01() < 0.5) {
spLigand->Rotate(prAxes.axis3, 180.0, prAxes.com);
if (iTrace > 1) {
std::cout << "180 deg rotation around PA#3" << std::endl;
}
spdlog::info("180 deg rotation around PA#3");
}
}
}
......@@ -12,6 +12,7 @@
#include "RbtAromIdxSF.h"
#include "RbtWorkSpace.h"
#include <spdlog/spdlog.h>
// Static data members
std::string RbtAromIdxSF::_CT("RbtAromIdxSF");
......@@ -34,18 +35,14 @@ RbtAromIdxSF::RbtAromIdxSF(const std::string &strName)
AddParameter(_DAMIN, m_DAMin);
AddParameter(_DAMAX, m_DAMax);
AddParameter(_THRESHOLD, m_threshold);
#ifdef _DEBUG
std::cout << _CT << " parameterised constructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtAromIdxSF parameterised constructor");
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtAromIdxSF::~RbtAromIdxSF() {
ClearReceptor();
ClearLigand();
#ifdef _DEBUG
std::cout << _CT << " destructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtAromIdxSF destructor");
_RBTOBJECTCOUNTER_DESTR_(_CT);
}
......@@ -128,7 +125,7 @@ void RbtAromIdxSF::SetupReceptor() {
}
for (int i = 1; i <= nCoords; i++) {
std::cout << _CT << ": Indexing receptor coords # " << i << std::endl;
spdlog::debug("RbtAromIdxSF setup indexing receptor coords #{}", i);
GetReceptor()->RevertCoords(i);
for (RbtInteractionCenterListConstIter iter = m_recepAromList.begin();
iter != m_recepAromList.end(); iter++) {
......
......@@ -14,6 +14,7 @@
#include "RbtBond.h"
#include "RbtModel.h"
#include "RbtPseudoAtom.h"
#include <spdlog/spdlog.h>
///////////////////////////////////////////////
// Constructors / destructors
......@@ -696,11 +697,8 @@ RbtAtomList Rbt::GetMatchingAtomList(const RbtAtomList &atomList,
if (!componentList[idx].empty()) {
matchingAtoms = Rbt::GetAtomList(
matchingAtoms, Rbt::isSegmentName_eq(componentList[idx]));
#ifdef _DEBUG
// std::cout << "Matching segment name=" << componentList[idx] << ",
// #atoms="
// << matchingAtoms.size() << std::endl;
#endif //_DEBUG
spdlog::debug("Matching segment name={}, #atoms={}", componentList[idx],
matchingAtoms.size());
}
idx++;
......@@ -714,27 +712,19 @@ RbtAtomList Rbt::GetMatchingAtomList(const RbtAtomList &atomList,
if (!subunitList[1].empty()) {
matchingAtoms = Rbt::GetAtomList(matchingAtoms,
Rbt::isSubunitId_eq(subunitList[1]));
#ifdef _DEBUG
// std::cout << "Matching subunit id=" << subunitList[1] << ",
// #atoms=" << matchingAtoms.size() << std::endl;
#endif //_DEBUG
spdlog::debug("Matching subunit id={}, #atoms={}", subunitList[1],
matchingAtoms.size());
}
case 1: // Fall-through!! Only the subunit name is specified
if (!subunitList[0].empty()) {
matchingAtoms = Rbt::GetAtomList(
matchingAtoms, Rbt::isSubunitName_eq(subunitList[0]));
#ifdef _DEBUG
// std::cout << "Matching subunit name=" << subunitList[0] << ",
// #atoms="
// << matchingAtoms.size() << std::endl;
#endif //_DEBUG
spdlog::debug("Matching subunit name={}, #atoms={}", subunitList[0],
matchingAtoms.size());
}
break;
default:
#ifdef _DEBUG
// std::cout << "Invalid subunit string in " << strFullName <<
// std::endl;
#endif //_DEBUG
spdlog::debug("Invalid subunit string in {}", strFullName);
break;
}
}
......@@ -744,17 +734,13 @@ RbtAtomList Rbt::GetMatchingAtomList(const RbtAtomList &atomList,
if (!componentList[idx].empty()) {
matchingAtoms = Rbt::GetAtomList(matchingAtoms,
Rbt::isAtomName_eq(componentList[idx]));
#ifdef _DEBUG
// std::cout << "Matching atom name=" << componentList[idx] << ", #atoms="
// << matchingAtoms.size() << std::endl;
#endif //_DEBUG
spdlog::debug("Matching atom name={}, #atoms={}", componentList[idx],
matchingAtoms.size());
}
break;
default:
#ifdef _DEBUG
// std::cout << "Too many colons (:) in " << strFullName << std::endl;
#endif //_DEBUG
spdlog::warn("Too many colons (:) in {}", strFullName);
break;
}
......@@ -908,18 +894,14 @@ void Rbt::RemoveZwitterions(RbtAtomList &atomList) {
for (RbtAtomListIter iter = cationicAtomList.begin(); iter != c14begin;
iter++) {
(*iter)->SetGroupCharge(0.0);
#ifdef _DEBUG
std::cout << "RemoveZwitterions: Neutralising cation "
<< (*iter)->GetFullAtomName() << std::endl;
#endif //_DEBUG
spdlog::debug("Removing zwitterions: neutralising cation {}",
(*iter)->GetFullAtomName());
}
for (RbtAtomListIter iter = anionicAtomList.begin(); iter != a14begin;
iter++) {
(*iter)->SetGroupCharge(0.0);
#ifdef _DEBUG
std::cout << "RemoveZwitterions: Neutralising anion "
<< (*iter)->GetFullAtomName() << std::endl;
#endif //_DEBUG
spdlog::debug("Removing zwitterions: neutralising anion {}",
(*iter)->GetFullAtomName());
}
}
......@@ -11,6 +11,7 @@
***********************************************************************/
#include "RbtAtomFuncs.h"
#include <spdlog/spdlog.h>
// DM 31 Oct 2000
// Given a bond, determines if it is in a ring (cutdown version of ToSpin)
......@@ -59,9 +60,7 @@ bool Rbt::FindCyclic(RbtBondPtr spBond, RbtAtomList &atomList,
RbtAtomPtr spA2 =
((*bIter).second) ? pBnd->GetAtom2Ptr() : pBnd->GetAtom1Ptr();
if (spA2 == spAtom1) {
#ifdef _DEBUG
std::cout << spAtom1->GetFullAtomName() << " is cyclic" << std::endl;
#endif //_DEBUG
spdlog::debug("{} is cyclic", spAtom1->GetFullAtomName());
return true;
} else if (!spA2->GetSelectionFlag()) {
// Mark the atom and bond as selected and add the atom to the pending
......@@ -104,18 +103,14 @@ bool Rbt::ToSpin(RbtBondPtr spBond, RbtAtomList &atomList,
spBond->SetSelectionFlag(true);
pendingAtomList.push_back(spAtom2);
#ifdef _DEBUG
// std::cout << "ToSpin: Bond ID=" << spBond->GetBondId() << std::endl;
#endif //_DEBUG
spdlog::debug("ToSpin: Bond ID={}", spBond->GetBondId());
// While we still have atoms to process
while (!pendingAtomList.empty()) {
// Take the last atom from the list and remove it
RbtAtomPtr spA1 = pendingAtomList.back();
pendingAtomList.pop_back();
#ifdef _DEBUG
// std::cout << "ToSpin: Checking atom " << spA1->GetAtomId() << std::endl;
#endif //_DEBUG
spdlog::debug("ToSpin: Checking atom {}", spA1->GetAtomId());
// Get the bonds this atom is in
const RbtBondMap &bondMap = spA1->GetBondMap();
......@@ -130,31 +125,24 @@ bool Rbt::ToSpin(RbtBondPtr spBond, RbtAtomList &atomList,
// ptr, else get atom 1 ptr
RbtAtomPtr spA2 =
((*bIter).second) ? pBnd->GetAtom2Ptr() : pBnd->GetAtom1Ptr();
#ifdef _DEBUG
// std::cout << "ToSpin: Checking bond " << spBnd->GetBondId() << " to
// atom " << spA2->GetAtomId() << std::endl;
#endif //_DEBUG
// If we've got back to atom 1 of the bond passed into ToSpin, then the
// bond must be in a ring so set the cyclic flag but don't consider this
// atom any further (we don't want to set the selection flag otherwise
// we'd end up selecting the entire molecule).
spdlog::debug("ToSpin: Checking bond {} to atom {}", pBnd->GetBondId(),
spA2->GetAtomId());
// If we've got back to atom 1 of the bond passed into ToSpin, then the
// bond must be in a ring so set the cyclic flag but don't consider this
// atom any further (we don't want to set the selection flag otherwise
// we'd end up selecting the entire molecule).
if (spA2 == spAtom1) {
bIsCyclic = true;
#ifdef _DEBUG
// std::cout << "ToSpin: We've hit " << spAtom1->GetAtomId() << " so
// must be cyclic!!" << std::endl;
#endif //_DEBUG
spdlog::debug("ToSpin: We've hit {} so compound must be cyclic",
spAtom1->GetAtomId());
} else if (!spA2->GetSelectionFlag()) {
// Mark the atom and bond as selected and add the atom to the pending
// list
spA2->SetSelectionFlag(true);
pBnd->SetSelectionFlag(true);
pendingAtomList.push_back(spA2);
#ifdef _DEBUG
// std::cout << "ToSpin: Adding atom " << spA2->GetAtomId() << "
// to
// the pending list" << std::endl;
#endif //_DEBUG
spdlog::debug("ToSpin: Adding atom {} to the pending list",
spA2->GetAtomId());
}
}
}
......@@ -219,10 +207,7 @@ RbtAtomList Rbt::FindRing(RbtAtomPtr spAtom, RbtBondList &bondList) {
// First replicate any partial rings whose head atom is at a ring branch
// point (defined by having >1 unselected cyclic bond)
unsigned int nRings = partialRings.size();
#ifdef _DEBUG
// std::cout << "FindRing: " << nRings << " rings prior to forking" <<
// std::endl;
#endif //_DEBUG
spdlog::debug("FindRing: {} rings prior to forking", nRings);
// Use indices rather than iterators, as we may be increasing the number of
// partial rings in the ring list (Iterators are unstable if the container
......@@ -240,19 +225,14 @@ RbtAtomList Rbt::FindRing(RbtAtomPtr spAtom, RbtBondList &bondList) {
if (!(*bIter).first->GetSelectionFlag())
nUnSelected++;
}
#ifdef _DEBUG
// std::cout << "FindRing: #Unselected cyclic bonds = " << nUnSelected <<
// " for " << ringIter << " at atom " << spHeadAtom->GetAtomId() <<
// std::endl;
#endif //_DEBUG
spdlog::debug("FindRing: #Unselected cyclic bonds={} for {} at atom {}",
nUnSelected, ringIter, spHeadAtom->GetAtomId());
// Add a new copy of the partial ring for each unselected cyclic bond from
// this atom above the normal one
for (int forkIter = 0; forkIter < (nUnSelected - 1); forkIter++) {
#ifdef _DEBUG
// std::cout << "FindRing: Forking ring path " << ringIter << " at atom
// " << spHeadAtom->GetAtomId() << std::endl;
#endif //_DEBUG
spdlog::debug("FindRing: Forking ring path {} at atom {}", ringIter,
spHeadAtom->GetAtomId());
partialRings.push_back(partialRings[ringIter]);
}
}
......@@ -274,17 +254,11 @@ RbtAtomList Rbt::FindRing(RbtAtomPtr spAtom, RbtBondList &bondList) {
RbtAtomPtr spA2 = Rbt::GetBondedAtomPtr(*bIter);
// We've hit atom 1 so this must be the smallest ring
if (spA2 == spAtom) {
#ifdef _DEBUG
// std::cout << "FindRing: Found seed atom " << spAtom->GetAtomId()
// << std::endl;
#endif //_DEBUG
spdlog::debug("FindRing: Found seed atom {}", spAtom->GetAtomId());
return *rIter;
} else {
#ifdef _DEBUG
// std::cout << "FindRing: Adding atom " << spA2->GetAtomId() << "
// to "
// << spHeadAtom->GetAtomId() << std::endl;
#endif //_DEBUG
spdlog::debug("FindRing: Adding atom {} to {}", spA2->GetAtomId(),
spHeadAtom->GetAtomId());
(*rIter).push_back(spA2);
pBnd->SetSelectionFlag(true);
break; // Break because we only want to add one atom to each head
......
......@@ -12,6 +12,7 @@
#include "RbtBaseBiMolTransform.h"
#include "RbtWorkSpace.h"
#include <spdlog/spdlog.h>
// Static data members
std::string RbtBaseBiMolTransform::_CT("RbtBaseBiMolTransform");
......@@ -21,16 +22,12 @@ std::string RbtBaseBiMolTransform::_CT("RbtBaseBiMolTransform");
RbtBaseBiMolTransform::RbtBaseBiMolTransform(const std::string &strClass,
const std::string &strName)
: RbtBaseTransform(strClass, strName) {
#ifdef _DEBUG
std::cout << _CT << " parameterised constructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseBiMolTransform parameterised constructor");
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtBaseBiMolTransform::~RbtBaseBiMolTransform() {
#ifdef _DEBUG
std::cout << _CT << " destructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseBiMolTransform destructor");
_RBTOBJECTCOUNTER_DESTR_(_CT);
}
......@@ -52,10 +49,8 @@ void RbtBaseBiMolTransform::Update(RbtSubject *theChangedSubject) {
if (numModels >= 1) {
RbtModelPtr spReceptor = pWorkSpace->GetModel(0);
if (spReceptor != m_spReceptor) {
#ifdef _DEBUG
std::cout << _CT << "::Update(): Receptor has been updated"
<< std::endl;
#endif //_DEBUG
spdlog::trace(
"RbtBaseBiMolTransform::Update(): Receptor has been updated");
m_spReceptor = spReceptor;
SetupReceptor();
}
......@@ -64,9 +59,8 @@ void RbtBaseBiMolTransform::Update(RbtSubject *theChangedSubject) {
if (numModels >= 2) {
RbtModelPtr spLigand = pWorkSpace->GetModel(1);
if (spLigand != m_spLigand) {
#ifdef _DEBUG
std::cout << _CT << "::Update(): Ligand has been updated" << std::endl;
#endif //_DEBUG
spdlog::trace(
"RbtBaseBiMolTransform::Update(): Ligand has been updated");
m_spLigand = spLigand;
SetupLigand();
}
......
......@@ -13,6 +13,7 @@
#include "RbtBaseFileSource.h"
#include "RbtFileError.h"
#include <cstring>
#include <spdlog/spdlog.h>
// Constructors
// RbtBaseFileSource::RbtBaseFileSource(const char* fileName)
......@@ -133,9 +134,7 @@ void RbtBaseFileSource::Read(bool aDelimiterAtEnd) {
int n = strlen(cszRecDelim);
while ((m_fileIn.getline(m_szBuf, MAXLINELENGTH)) &&
(strncmp(m_szBuf, cszRecDelim, n) != 0)) {
#ifdef _DEBUG
std::cout << m_szBuf << std::endl;
#endif //_DEBUG
spdlog::debug("File line read is {}", m_szBuf);
m_lineRecs.push_back(m_szBuf);
}
}
......@@ -174,9 +173,7 @@ void RbtBaseFileSource::Read(bool aDelimiterAtEnd) {
;
while ((m_fileIn.getline(m_szBuf, MAXLINELENGTH)) &&
(strncmp(m_szBuf, cszRecDelim, n) != 0)) {
#ifdef _DEBUG
std::cout << m_szBuf << std::endl;
#endif //_DEBUG
spdlog::debug("File line read is {}", m_szBuf);
m_lineRecs.push_back(m_szBuf);
}
}
......
......@@ -12,6 +12,7 @@
#include "RbtBaseIdxSF.h"
#include "RbtWorkSpace.h"
#include <spdlog/spdlog.h>
// Static data members
std::string RbtBaseIdxSF::_CT("RbtBaseIdxSF");
......@@ -19,10 +20,8 @@ std::string RbtBaseIdxSF::_GRIDSTEP("GRIDSTEP");
std::string RbtBaseIdxSF::_BORDER("BORDER");
RbtBaseIdxSF::RbtBaseIdxSF() : m_gridStep(0.5), m_border(1.0) {
#ifdef _DEBUG
std::cout << _CT << " default constructor" << std::endl;
#endif //_DEBUG
// Add parameters
spdlog::trace("RbtBaseIdxSF default constructor");
// Add parameters
AddParameter(_GRIDSTEP, m_gridStep);
AddParameter(_BORDER, m_border);
_RBTOBJECTCOUNTER_CONSTR_(_CT);
......
......@@ -12,6 +12,7 @@
#include "RbtBaseInterSF.h"
#include "RbtWorkSpace.h"
#include <spdlog/spdlog.h>
// Static data members
std::string RbtBaseInterSF::_CT("RbtBaseInterSF");
......@@ -19,16 +20,12 @@ std::string RbtBaseInterSF::_CT("RbtBaseInterSF");
////////////////////////////////////////
// Constructors/destructors
RbtBaseInterSF::RbtBaseInterSF() {
#ifdef _DEBUG
std::cout << _CT << " default constructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseInterSF default constructor");
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtBaseInterSF::~RbtBaseInterSF() {
#ifdef _DEBUG
std::cout << _CT << " destructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseInterSF destructor");
_RBTOBJECTCOUNTER_DESTR_(_CT);
}
......@@ -50,10 +47,7 @@ void RbtBaseInterSF::Update(RbtSubject *theChangedSubject) {
if (numModels >= 1) {
RbtModelPtr spReceptor = pWorkSpace->GetModel(0);
if (spReceptor != m_spReceptor) {
#ifdef _DEBUG
std::cout << "RbtBaseInterSF::Update(): Receptor has been updated"
<< std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseInterSF::Update(): Receptor has been updated");
m_spReceptor = spReceptor;
SetupReceptor();
}
......@@ -62,10 +56,7 @@ void RbtBaseInterSF::Update(RbtSubject *theChangedSubject) {
if (numModels >= 2) {
RbtModelPtr spLigand = pWorkSpace->GetModel(1);
if (spLigand != m_spLigand) {
#ifdef _DEBUG
std::cout << "RbtBaseInterSF::Update(): Ligand has been updated"
<< std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseInterSF::Update(): Ligand has been updated");
m_spLigand = spLigand;
SetupLigand();
}
......
......@@ -12,21 +12,18 @@
#include "RbtBaseIntraSF.h"
#include "RbtWorkSpace.h"
#include <spdlog/spdlog.h>
// Static data members
std::string RbtBaseIntraSF::_CT("RbtBaseIntraSF");
RbtBaseIntraSF::RbtBaseIntraSF() : m_zero(0.0) {
#ifdef _DEBUG
std::cout << _CT << " default constructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseIntraSF default constructor");
_RBTOBJECTCOUNTER_CONSTR_(_CT);
}
RbtBaseIntraSF::~RbtBaseIntraSF() {
#ifdef _DEBUG
std::cout << _CT << " destructor" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseIntraSF destructor");
_RBTOBJECTCOUNTER_DESTR_(_CT);
}
......@@ -45,9 +42,7 @@ void RbtBaseIntraSF::Update(RbtSubject *theChangedSubject) {
if (pWorkSpace->GetNumModels() >= 2) {
RbtModelPtr spLigand = GetWorkSpace()->GetModel(1);
if (spLigand != m_spLigand) {
#ifdef _DEBUG
std::cout << _CT << "::Update(): Ligand has been updated" << std::endl;
#endif //_DEBUG
spdlog::trace("RbtBaseIntraSF::Update(): Ligand has been updated");
m_spLigand = spLigand;
SetupScore();
// Retain the zero-point offset from the ligand model data if present
......
......@@ -12,6 +12,7 @@
#include "RbtBaseMolecularFileSource.h"
#include "RbtFileError.h"
#include <spdlog/spdlog.h>
// Constructors
// RbtBaseMolecularFileSource::RbtBaseMolecularFileSource(const char* fileName,
......@@ -240,11 +241,9 @@ void RbtBaseMolecularFileSource::RemoveAtom(RbtAtomPtr spAtom) {
RbtBondListIter bIter =
Rbt::FindBond(m_bondList, Rbt::isBond_eq((*mapIter).first));
if (bIter != m_bondList.end()) {
#ifdef _DEBUG
std::cout << "Removing bond #" << (*bIter)->GetBondId() << " ("
<< (*bIter)->GetAtom1Ptr()->GetAtomName() << "-"
<< (*bIter)->GetAtom2Ptr()->GetAtomName() << ")" << std::endl;
#endif //_DEBUG
spdlog::debug("Removing bond #{} ({}-{})", (*bIter)->GetBondId(),
(*bIter)->GetAtom1Ptr()->GetAtomName(),
(*bIter)->GetAtom2Ptr()->GetAtomName());
m_bondList.erase(bIter); // Erase the bond
}
}
......@@ -257,10 +256,8 @@ void RbtBaseMolecularFileSource::RemoveAtom(RbtAtomPtr spAtom) {
RbtAtomListIter aIter =
Rbt::FindAtom(m_atomList, std::bind2nd(Rbt::isAtom_eq(), spAtom));
if (aIter != m_atomList.end()) {
#ifdef _DEBUG
std::cout << "Removing atom #" << (*aIter)->GetAtomId() << ", "
<< (*aIter)->GetAtomName() << std::endl;
#endif //_DEBUG
spdlog::debug("Removing atom #{}, {}", (*aIter)->GetAtomId(),
(*aIter)->GetAtomName());
m_atomList.erase(aIter); // Erase the atom
}
}
......@@ -366,8 +363,7 @@ void RbtBaseMolecularFileSource::SetupPartialIonicGroups(
const std::string _MANDATORY("MANDATORY");
const std::string _FORBIDDEN("FORBIDDEN");
if (atoms.empty()) {
std::cout << "WARNING SetupPartialIonicGroups: Empty atom list"
<< std::endl;
spdlog::warn("SetupPartialIonicGroups: Empty atom list");
return;
}
RbtAtomPtr leadAtom = atoms.front();
......@@ -375,16 +371,15 @@ void RbtBaseMolecularFileSource::SetupPartialIonicGroups(
std::string match = leadAtom->GetSegmentName() + ":" + subunitName + "_" +
leadAtom->GetSubunitId() + ":";
if (Rbt::GetNumMatchingAtoms(atoms, match) != atoms.size()) {
std::cout
<< "WARNING SetupPartialIonicGroups: Inconsistent subunit names in "
"atom list headed by "
<< leadAtom->GetFullAtomName() << std::endl;
spdlog::warn("SetupPartialIonicGroups: Inconsistent subunit names in "
"atom list headed by {}",
leadAtom->GetFullAtomName());
return;
}
RbtStringList resList(spParamSource->GetSectionList());
if (std::find(resList.begin(), resList.end(), subunitName) == resList.end()) {
// std::cout << "INFO SetupPartialIonicGroups: No section for residue " <<
// subunitName << std::endl;
spdlog::info("SetupPartialIonicGroups: No section for residue {}",
subunitName);
return;
}
......@@ -396,12 +391,9 @@ void RbtBaseMolecularFileSource::SetupPartialIonicGroups(
RbtStringList mandAtoms = Rbt::ConvertDelimitedStringToList(mandatory);
unsigned int nPresent = Rbt::GetNumMatchingAtoms(atoms, mandAtoms);
if (nPresent != mandAtoms.size()) {
#ifdef _DEBUG
std::cout << "INFO SetupPartialIonicGroups: Only " << nPresent
<< " out of " << mandAtoms.size()
<< " mandatory atoms present in atom list headed by "
<< leadAtom->GetFullAtomName() << std::endl;
#endif //_DEBUG
spdlog::info("SetupPartialIonicGroups: Only {} out of {} mandatory atoms "
"present in atom list headed by {}",
nPresent, mandAtoms.size(), leadAtom->GetFullAtomName());
return;
}
std::remove(atList.begin(), atList.end(), _MANDATORY);
......@@ -412,11 +404,9 @@ void RbtBaseMolecularFileSource::SetupPartialIonicGroups(
RbtStringList forbAtoms = Rbt::ConvertDelimitedStringToList(forbidden);
int nPresent = Rbt::GetNumMatchingAtoms(atoms, forbAtoms);
if (nPresent > 0) {
#ifdef _DEBUG
std::cout << "INFO SetupPartialIonicGroups: " << nPresent
<< " forbidden atoms present in atom list headed by "
<< leadAtom->GetFullAtomName() << std::endl;
#endif //_DEBUG
spdlog::info("SetupPartialIonicGroups: {} forbidden atoms present in "
"atom list headed by {}",
nPresent, leadAtom->GetFullAtomName());
return;
}
std::remove(atList.begin(), atList.end(), _FORBIDDEN);
......@@ -426,19 +416,15 @@ void RbtBaseMolecularFileSource::SetupPartialIonicGroups(
aIter++) {
double partialCharge(spParamSource->GetParameterValue(
*aIter)); // Get the partial charge value
#ifdef _DEBUG