Fixes github #1073 (#1074)

* Fixes #1073

* add a tests for #1073
This commit is contained in:
Greg Landrum
2016-09-23 04:55:14 +02:00
parent eddb281a8f
commit 88e193269d
2 changed files with 34 additions and 3 deletions

View File

@@ -179,14 +179,16 @@ void computeInitialCoords(RDKit::ROMol &mol,
for (unsigned int i = 0; i < mol.getNumAtoms(); ++i) {
atomRanks[i] = getAtomDepictRank(mol.getAtomWithIdx(i));
}
RDKit::MolOps::assignStereochemistry(mol, false);
efrags.clear();
RDKit::VECT_INT_VECT arings;
// first find all the rings
RDKit::MolOps::symmetrizeSSSR(mol, arings);
// do stereochemistry
RDKit::MolOps::assignStereochemistry(mol, false);
efrags.clear();
// user specfied coordinates exist
bool preSpec = false;
// first embed any atoms for which the coordinates have been specified.

View File

@@ -802,6 +802,27 @@ void testGitHubIssue910() {
delete m;
}
}
void testGitHubIssue1073() {
// computeInitialCoords() should call the SSSR code before it calls
// assignStereochemistry()
{
std::string smarts = "[a]12[a][a][a][a][a]1[a][a][a]2";
RWMol *m = SmartsToMol(smarts);
TEST_ASSERT(m);
RDDepict::compute2DCoords(*m);
RingInfo *ri = m->getRingInfo();
TEST_ASSERT(ri->isInitialized());
TEST_ASSERT(ri->isAtomInRingOfSize(0, 6));
TEST_ASSERT(ri->isAtomInRingOfSize(0, 5));
TEST_ASSERT(!ri->isAtomInRingOfSize(0, 9));
delete m;
}
}
int main() {
RDLog::InitLogs();
#if 1
@@ -965,5 +986,13 @@ int main() {
testGitHubIssue910();
BOOST_LOG(rdInfoLog)
<< "***********************************************************\n";
BOOST_LOG(rdInfoLog)
<< "***********************************************************\n";
BOOST_LOG(rdInfoLog) << " Test GitHub Issue 1073\n";
testGitHubIssue1073();
BOOST_LOG(rdInfoLog)
<< "***********************************************************\n";
return (0);
}