Commit 74717a30 by Maarten L. Hekkelman

Do not bail out in bondmap creation if compound is unknown

parent 0ca04bed
...@@ -69,7 +69,7 @@ if(MSVC) ...@@ -69,7 +69,7 @@ if(MSVC)
set(COFF_SPEC "--coff=${COFF_TYPE}") set(COFF_SPEC "--coff=${COFF_TYPE}")
endif() endif()
if(LINUX) if(UNIX AND NOT APPLE)
# On Linux, install in the $HOME/.local folder by default # On Linux, install in the $HOME/.local folder by default
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(WARNING "The library and auxiliary files will be installed in $ENV{HOME}/.local") message(WARNING "The library and auxiliary files will be installed in $ENV{HOME}/.local")
...@@ -349,4 +349,4 @@ if(CIFPP_BUILD_TESTS) ...@@ -349,4 +349,4 @@ if(CIFPP_BUILD_TESTS)
endif() endif()
message("Still to do: libcifpp.pc, package, tools, create symop_Data") message("Still to do: package, tools, create symop_Data")
...@@ -323,23 +323,26 @@ bool CompoundBondMap::bonded(const std::string &compoundID, const std::string& a ...@@ -323,23 +323,26 @@ bool CompoundBondMap::bonded(const std::string &compoundID, const std::string& a
return bi.bonded(a1, a2); return bi.bonded(a1, a2);
} }
// not found in our cache, calculate
auto compound = mmcif::CompoundFactory::instance().create(compoundID);
if (not compound)
throw BondMapException("Missing compound bond info for " + compoundID);
bool result = false; bool result = false;
// not found in our cache, calculate
CompoundBondInfo bondInfo{ id }; CompoundBondInfo bondInfo{ id };
for (auto &atom: compound->bonds())
auto compound = mmcif::CompoundFactory::instance().create(compoundID);
if (not compound)
std::cerr << "Missing compound bond info for " << compoundID << std::endl;
else
{ {
uint32_t ca1 = getAtomID(atom.atomID[0]); for (auto &atom: compound->bonds())
uint32_t ca2 = getAtomID(atom.atomID[1]); {
if (ca1 > ca2) uint32_t ca1 = getAtomID(atom.atomID[0]);
std::swap(ca1, ca2); uint32_t ca2 = getAtomID(atom.atomID[1]);
if (ca1 > ca2)
bondInfo.mBonded.insert({ca1, ca2}); std::swap(ca1, ca2);
result = result or (a1 == ca1 and a2 == ca2);
bondInfo.mBonded.insert({ca1, ca2});
result = result or (a1 == ca1 and a2 == ca2);
}
} }
mCompounds.push_back(bondInfo); mCompounds.push_back(bondInfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment