Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Code/GraphMol/AddHs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ void mergeQueryHs(RWMol &mol, bool mergeUnmappedOnly) {
// recurse if needed (was github isusue 544)
if (atom->hasQuery()) {
// std::cerr<<" q: "<<atom->getQuery()->getDescription()<<std::endl;
if (atom->getQuery()->getDescription() == "RecursiveStructure") {
if (atom->getQuery()->getDescription() == "RS") {
auto *rqm = static_cast<RWMol *>(const_cast<ROMol *>(
static_cast<RecursiveStructureQuery *>(atom->getQuery())
->getQueryMol()));
Expand All @@ -1109,7 +1109,7 @@ void mergeQueryHs(RWMol &mol, bool mergeUnmappedOnly) {
QueryAtom::QUERYATOM_QUERY::CHILD_TYPE qry = childStack.front();
childStack.pop_front();
// std::cerr<<" child: "<<qry->getDescription()<<std::endl;
if (qry->getDescription() == "RecursiveStructure") {
if (qry->getDescription() == "RS") {
// std::cerr<<" recurse"<<std::endl;
auto *rqm = static_cast<RWMol *>(const_cast<ROMol *>(
static_cast<RecursiveStructureQuery *>(qry.get())
Expand Down
15 changes: 15 additions & 0 deletions Code/GraphMol/Atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,21 @@ int Atom::getPerturbationOrder(const INT_LIST &probe) const {
int nSwaps = static_cast<int>(countSwapsToInterconvert(probe, ref));
return nSwaps;
}
int Atom::getPerturbationOrder(const INT_VECT &probe) const {
PRECONDITION(
dp_mol,
"perturbation order not defined for atoms not associated with molecules")
INT_VECT ref;
ref.reserve(getOwningMol().getAtomDegree(this));
ROMol::OEDGE_ITER beg, end;
boost::tie(beg, end) = getOwningMol().getAtomBonds(this);
while (beg != end) {
ref.push_back(getOwningMol()[*beg]->getIdx());
++beg;
}
int nSwaps = static_cast<int>(countSwapsToInterconvert(probe, ref));
return nSwaps;
}

void Atom::invertChirality() {
switch (getChiralTag()) {
Expand Down
1 change: 1 addition & 0 deletions Code/GraphMol/Atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ class RDKIT_GRAPHMOL_EXPORT Atom : public RDProps {

*/
int getPerturbationOrder(const INT_LIST &probe) const;
int getPerturbationOrder(const INT_VECT &probe) const;

//! calculates any of our lazy \c properties
/*!
Expand Down
54 changes: 54 additions & 0 deletions Code/GraphMol/Bond.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,60 @@ double Bond::getBondTypeAsDouble() const {
}
}

uint8_t Bond::getTwiceBondType() const {
switch (getBondType()) {
case UNSPECIFIED:
case IONIC:
case ZERO:
return 0;
break;
case SINGLE:
return 2;
break;
case DOUBLE:
return 4;
break;
case TRIPLE:
return 6;
break;
case QUADRUPLE:
return 8;
break;
case QUINTUPLE:
return 10;
break;
case HEXTUPLE:
return 12;
break;
case ONEANDAHALF:
return 3;
break;
case TWOANDAHALF:
return 5;
break;
case THREEANDAHALF:
return 7;
break;
case FOURANDAHALF:
return 9;
break;
case FIVEANDAHALF:
return 11;
break;
case AROMATIC:
return 3;
break;
case DATIVEONE:
return 2;
break; // FIX: this should probably be different
case DATIVE:
return 2;
break; // FIX: again probably wrong
default:
UNDER_CONSTRUCTION("Bad bond type");
}
}

double Bond::getValenceContrib(const Atom *atom) const {
switch (getBondType()) {
case UNSPECIFIED:
Expand Down
7 changes: 5 additions & 2 deletions Code/GraphMol/Bond.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps {
//! \brief returns our \c bondType as a double
//! (e.g. SINGLE->1.0, AROMATIC->1.5, etc.)
double getBondTypeAsDouble() const;
//! \brief returns twice our \c bondType
//! (e.g. SINGLE->2, AROMATIC->3, etc.)
uint8_t getTwiceBondType() const;

//! returns our contribution to the explicit valence of an Atom
/*!
Expand Down Expand Up @@ -335,8 +338,8 @@ class RDKIT_GRAPHMOL_EXPORT Bond : public RDProps {
std::uint8_t d_bondType;
std::uint8_t d_dirTag;
std::uint8_t d_stereo;
atomindex_t d_index;
atomindex_t d_beginAtomIdx, d_endAtomIdx;
std::uint16_t d_index;
std::uint16_t d_beginAtomIdx, d_endAtomIdx;
ROMol *dp_mol;
INT_VECT *dp_stereoAtoms;

Expand Down
Loading