Commit 8ead26ce authored by Vedran Miletić's avatar Vedran Miletić

Convert std::cout to spdlog

parent 3c52eb3b
......@@ -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
std::cout << std::endl << "Trying to match " << *aIter << std::endl;
#endif //_DEBUG
spdlog::debug("SetupPartialIonicGroups: Trying to match {}", *aIter);
// Find the atoms which match the specifier string
RbtAtomList selectedAtoms = Rbt::GetMatchingAtomList(atoms, *aIter);
// Now we've got the matching atoms, set the group charge on each atom
for (RbtAtomListIter iter = selectedAtoms.begin();
iter != selectedAtoms.end(); iter++) {
(*iter)->SetGroupCharge(partialCharge);
#ifdef _DEBUG
std::cout << "INFO Setting group charge on " << (*iter)->GetFullAtomName()
<< " to " << partialCharge << std::endl;
#endif //_DEBUG
spdlog::info("Setting group charge on {} to {}",
(*iter)->GetFullAtomName(), partialCharge);
}
}
}