diff -Nru schroedinger-coordgenlibs-1.1/appveyor.yml schroedinger-coordgenlibs-1.3/appveyor.yml --- schroedinger-coordgenlibs-1.1/appveyor.yml 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/appveyor.yml 2019-07-11 19:04:54.000000000 +0000 @@ -1,6 +1,6 @@ environment: - BOOST_ROOT: c:/Libraries/boost - BOOST_LIBRARYDIR: c:/Libraries/boost/lib64-msvc-12.0 + BOOST_ROOT_DIR: c:\Libraries\boost + BOOST_LIBRARY_PATH: c:\Libraries\boost\lib64-msvc-12.0 INSTALL_PREFIX : c:\installation CMAKE_PREFIX_PATH : c:\installation\lib\cmake @@ -16,16 +16,29 @@ # by default, all script lines are interpreted as batch build: - project: build\ALL_BUILD.vcxproj + project: build\INSTALL.vcxproj parallel: true before_build: - git clone https://github.com/schrodinger/maeparser.git %APPVEYOR_BUILD_FOLDER%\maeparser - mkdir %APPVEYOR_BUILD_FOLDER%\maeparser\build - cd %APPVEYOR_BUILD_FOLDER%\maeparser\build - - cmake -G "Visual Studio 12 Win64" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" .. - - cmake --build . --target install + - cmake .. -G "Visual Studio 12 Win64" ^ + -DBOOST_ROOT="%BOOST_ROOT_DIR%" ^ + -DBOOST_LIBRARYDIR="%BOOST_LIBRARY_PATH%" ^ + -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" + - cmake --build . --target install --config Release - mkdir %APPVEYOR_BUILD_FOLDER%\build - cd %APPVEYOR_BUILD_FOLDER%\build - - cmake -G "Visual Studio 12 Win64" -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DCMAKE_PREFIX_PATH="%P\lib\cmake" -DCMAKE_INSTALL_PREFIX="INSTALL_PREFIX" .. - + - cmake .. -G "Visual Studio 12 Win64" ^ + -DBOOST_ROOT="%BOOST_ROOT_DIR%" ^ + -DBOOST_LIBRARYDIR="%BOOST_LIBRARY_PATH%" ^ + -DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%" ^ + -DCMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" + +test_script: + - set PATH=%PATH%;%BOOST_LIBRARY_PATH%;%INSTALL_PREFIX%\bin + # For whatever reason, boost_iostreams depends on libbz2.dll (required for maeparser) + - copy %BOOST_LIBRARY_PATH%\boost_bzip2-vc120-mt-1_56.dll %INSTALL_PREFIX%\bin\libbz2.dll + - cd %APPVEYOR_BUILD_FOLDER%\build + - ctest -j2 --output-on-failure diff -Nru schroedinger-coordgenlibs-1.1/.clang-format schroedinger-coordgenlibs-1.3/.clang-format --- schroedinger-coordgenlibs-1.1/.clang-format 1970-01-01 00:00:00.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/.clang-format 2019-07-11 19:04:54.000000000 +0000 @@ -0,0 +1,61 @@ +--- +Language: Cpp +AccessModifierOffset: -2 +ConstructorInitializerIndentWidth: 4 +AlignEscapedNewlinesLeft: false +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AlwaysBreakAfterDefinitionReturnType: false +AlwaysBreakTemplateDeclarations: false +AlwaysBreakBeforeMultilineStrings: false +BreakBeforeBraces: Linux +BreakBeforeBinaryOperators: None +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BinPackParameters: true +BinPackArguments: true +ColumnLimit: 80 +ConstructorInitializerAllOnOneLineOrOnePerLine: false +DerivePointerAlignment: false +ExperimentalAutoDetectBinPacking: false +IndentCaseLabels: false +IndentWrappedFunctionNames: false +IndentFunctionDeclarationAfterType: false +MaxEmptyLinesToKeep: 1 +KeepEmptyLinesAtTheStartOfBlocks: true +NamespaceIndentation: None +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakString: 1000 +PenaltyBreakFirstLessLess: 120 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +SpacesBeforeTrailingComments: 1 +Cpp11BracedListStyle: true +Standard: Cpp11 +IndentWidth: 4 +TabWidth: 8 +UseTab: Never +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpacesInAngles: false +SpaceInEmptyParentheses: false +SpacesInCStyleCastParentheses: false +SpaceAfterCStyleCast: true +SpacesInContainerLiterals: true +SpaceBeforeAssignmentOperators: true +ContinuationIndentWidth: 4 +CommentPragmas: '^ IWYU pragma:' +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +SpaceBeforeParens: ControlStatements +DisableFormat: false +... + diff -Nru schroedinger-coordgenlibs-1.1/CMakeLists.txt schroedinger-coordgenlibs-1.3/CMakeLists.txt --- schroedinger-coordgenlibs-1.1/CMakeLists.txt 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CMakeLists.txt 2019-07-11 19:04:54.000000000 +0000 @@ -1,35 +1,41 @@ -set (CMAKE_CXX_STANDARD 11) cmake_minimum_required(VERSION 3.2) project(coordgen) -#include(ExternalProject) - -#ExternalProject_Add( -# maeparser -# SOURCE_DIR ${coordgen_SOURCE_DIR}/maeparser -#) - +# Options & Project configuration +set(CMAKE_CXX_STANDARD 11) +option(COORDGEN_BUILD_TESTS "Whether test executables should be built" ON) +option(COORDGEN_BUILD_EXAMPLE "Whether to build the sample executable" ON) + +# Dependencies +find_package(Boost COMPONENTS iostreams REQUIRED) +find_package(maeparser REQUIRED) +# Source files & headers file(GLOB SOURCES "*.cpp") -find_package(Boost) -find_package(maeparser) include_directories(${Boost_INCLUDE_DIRS}) include_directories(${maeparser_INCLUDE_DIRS}) -add_library(coordgenlibs SHARED ${SOURCES}) -target_compile_definitions(coordgenlibs PRIVATE IN_COORDGEN) -set_property(TARGET coordgenlibs PROPERTY CXX_VISIBILITY_PRESET "hidden") -add_executable(example example/example.cpp) - -target_link_libraries(coordgenlibs maeparser) -target_link_libraries(example coordgenlibs) -enable_testing() -install(TARGETS coordgenlibs +# Build Targets & Configuration -- coordgen library +add_library(coordgen SHARED ${SOURCES}) +target_compile_definitions(coordgen PRIVATE IN_COORDGEN) +set_property(TARGET coordgen PROPERTY CXX_VISIBILITY_PRESET "hidden") +target_link_libraries(coordgen maeparser) + +set_target_properties(coordgen + PROPERTIES + VERSION 1.3 + SOVERSION 1 +) + +# Install configuration +install(TARGETS coordgen + EXPORT coordgen-targets ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib) install(FILES + CoordgenConfig.hpp CoordgenFragmentBuilder.h CoordgenFragmenter.h CoordgenMacrocycleBuilder.h @@ -50,3 +56,25 @@ sketcherMinimizerRing.h sketcherMinimizerStretchInteraction.h DESTINATION include/coordgen) + +install(FILES + templates.mae + DESTINATION share/coordgen) + +install(EXPORT coordgen-targets + FILE ${PROJECT_NAME}-config.cmake + DESTINATION lib/cmake) + +# Example +if(COORDGEN_BUILD_EXAMPLE) + add_subdirectory(example_dir) +endif(COORDGEN_BUILD_EXAMPLE) + +# Tests +if(COORDGEN_BUILD_TESTS) + set(MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --time-stamp=yes \ + --num-callers=20 --gen-suppressions=all --leak-check=full \ + --show-reachable=no --trace-children=yes --error-exitcode=29") + include(CTest) + add_subdirectory(test) +endif(COORDGEN_BUILD_TESTS) diff -Nru schroedinger-coordgenlibs-1.1/CoordgenConfig.hpp schroedinger-coordgenlibs-1.3/CoordgenConfig.hpp --- schroedinger-coordgenlibs-1.1/CoordgenConfig.hpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenConfig.hpp 2019-07-11 19:04:54.000000000 +0000 @@ -1,5 +1,7 @@ #pragma once +#ifndef STATIC_COORDGEN + #ifdef IN_COORDGEN #ifdef WIN32 #define EXPORT_COORDGEN __declspec(dllexport) @@ -15,4 +17,10 @@ #define EXPORT_COORDGEN #endif -#endif \ No newline at end of file +#endif + +#else + +#define EXPORT_COORDGEN + +#endif diff -Nru schroedinger-coordgenlibs-1.1/CoordgenFragmentBuilder.cpp schroedinger-coordgenlibs-1.3/CoordgenFragmentBuilder.cpp --- schroedinger-coordgenlibs-1.1/CoordgenFragmentBuilder.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenFragmentBuilder.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -35,56 +35,50 @@ if (!f->constrained) return; - int counter = 0; sketcherMinimizerPointF constrainOldCenter(0.f, 0.f); sketcherMinimizerPointF constrainNewCenter(0.f, 0.f); - vector fragmentAtoms = f->getAtoms(); - - foreach (sketcherMinimizerAtom* a, fragmentAtoms) { - if (a->constrained) { - constrainOldCenter += a->templateCoordinates; - constrainNewCenter += a->coordinates; - counter++; + vector constrainedAtoms; + for (const auto& atom : f->getAtoms()) { + if (atom->constrained) { + constrainedAtoms.push_back(atom); } } - foreach (sketcherMinimizerFragment* child, f->_children) { - sketcherMinimizerAtom* at = child->_bondToParent->endAtom; - if (at->constrained) { - constrainOldCenter += at->templateCoordinates; - constrainNewCenter += at->coordinates; - counter++; + for (const auto& child : f->_children) { + sketcherMinimizerAtom* atom = child->_bondToParent->endAtom; + if (atom->constrained) { + constrainedAtoms.push_back(atom); } } - - if (counter > 0) { - constrainOldCenter /= counter; - constrainNewCenter /= counter; + for (const auto& a : constrainedAtoms) { + constrainOldCenter += a->templateCoordinates; + constrainNewCenter += a->coordinates; } - - vector v1, v2; - foreach (sketcherMinimizerAtom* a, fragmentAtoms) { - if (a->constrained) { - v2.push_back(a->coordinates - constrainNewCenter); - v1.push_back(a->templateCoordinates - constrainOldCenter); - } + if (constrainedAtoms.size() > 0) { + constrainOldCenter /= constrainedAtoms.size(); + constrainNewCenter /= constrainedAtoms.size(); } - foreach (sketcherMinimizerFragment* child, f->_children) { - sketcherMinimizerAtom* at = child->_bondToParent->endAtom; - if (at->constrained) { - v2.push_back(at->coordinates - constrainNewCenter); - v1.push_back(at->templateCoordinates - constrainOldCenter); - } + vector v1, v2; + for (const auto& a : constrainedAtoms) { + v2.push_back(a->coordinates - constrainNewCenter); + v1.push_back(a->templateCoordinates - constrainOldCenter); } - float rotMat[4]; sketcherMinimizer::alignmentMatrix(v1, v2, rotMat); - foreach (sketcherMinimizerAtom* a, fragmentAtoms) { + vector rotatedV2; + for (auto p : v2) { + auto rotatedPoint = + sketcherMinimizerPointF(p.x() * rotMat[0] + p.y() * rotMat[1], + p.x() * rotMat[2] + p.y() * rotMat[3]); + + rotatedV2.push_back(rotatedPoint); + } + for (sketcherMinimizerAtom* a : f->getAtoms()) { sketcherMinimizerPointF v = a->getCoordinates() - constrainNewCenter; v = sketcherMinimizerPointF(v.x() * rotMat[0] + v.y() * rotMat[1], v.x() * rotMat[2] + v.y() * rotMat[3]); a->setCoordinates(v + constrainOldCenter); } - foreach (sketcherMinimizerFragment* child, f->_children) { + for (sketcherMinimizerFragment* child : f->_children) { sketcherMinimizerAtom* at = child->_bondToParent->endAtom; sketcherMinimizerPointF v = at->getCoordinates() - constrainNewCenter; v = sketcherMinimizerPointF(v.x() * rotMat[0] + v.y() * rotMat[1], @@ -108,8 +102,8 @@ map isVisited; vector oldIndices; - foreach (sketcherMinimizerRing* r, rings) { - foreach (sketcherMinimizerAtom* a, r->_atoms) { + for (sketcherMinimizerRing* r : rings) { + for (sketcherMinimizerAtom* a : r->_atoms) { if (!isVisited[a]) { isVisited[a] = true; oldIndices.push_back(a->_generalUseN); @@ -119,10 +113,10 @@ } } } - foreach (sketcherMinimizerRing* r, rings) { - foreach (sketcherMinimizerBond* b, r->_bonds) { + for (sketcherMinimizerRing* r : rings) { + for (sketcherMinimizerBond* b : r->_bonds) { bool found = false; - foreach (sketcherMinimizerBond* b2, bonds) { + for (sketcherMinimizerBond* b2 : bonds) { if (b2 == b) { found = true; break; @@ -134,7 +128,7 @@ } } vector mapping; - for (auto temp : sketcherMinimizer::m_templates.getTemplates()) { + for (auto& temp : sketcherMinimizer::m_templates.getTemplates()) { foundTemplate = sketcherMinimizer::compare(atoms, bonds, temp, mapping); if (foundTemplate) { if (atoms.size() > 0) @@ -144,7 +138,7 @@ bondLength); atoms[i]->rigid = true; } - foreach (sketcherMinimizerRing* r, rings) { + for (sketcherMinimizerRing* r : rings) { r->coordinatesGenerated = true; } break; @@ -161,7 +155,7 @@ { sketcherMinimizerRing* highest = rings.at(0); int high_score = -1; - foreach (sketcherMinimizerRing* r, rings) { + for (sketcherMinimizerRing* r : rings) { int priority = 0; if (r->isMacrocycle()) priority += 1000; @@ -187,7 +181,8 @@ if (!foundTemplate) { float planarityScore = newScorePlanarity(rings); if (planarityScore < NON_PLANAR_SYSTEM_SCORE) { - bool needsTemplate = planarityScore > PERFECTLY_PLANAR_SYSTEM_SCORE; + bool needsTemplate = + planarityScore > PERFECTLY_PLANAR_SYSTEM_SCORE; if (needsTemplate) { findTemplate(rings); } @@ -199,11 +194,9 @@ rings.end()); } CoordgenMinimizer::maybeMinimizeRings(rings); - } - else if (planarityScore > UNTREATABLE_SYSTEM_PLANARITY_SCORE) { + } else if (planarityScore > UNTREATABLE_SYSTEM_PLANARITY_SCORE) { return; - } - else { + } else { sketcherMinimizerRing* firstRing = findCentralRingOfSystem(rings); m_macrocycleBuilder.openCycleAndGenerateCoords(firstRing); @@ -222,27 +215,27 @@ { float score = 0.f; - for (auto ring : rings) { + for (const auto& ring : rings) { if (ring->isMacrocycle() && m_macrocycleBuilder.findBondToOpen(ring) == NULL) { continue; } if (ring->isMacrocycle()) { - for (auto otherRing : ring->fusedWith) { + for (const auto& otherRing : ring->fusedWith) { if (otherRing->isMacrocycle()) { score += NON_PLANAR_SYSTEM_SCORE; } } } - for (auto bond : ring->_bonds) { + for (const auto& bond : ring->_bonds) { if (bond->rings.size() > 2) { score += NON_PLANAR_SYSTEM_SCORE * (bond->rings.size() - 2); } } - for (auto atom : ring->getAtoms()) { + for (const auto& atom : ring->getAtoms()) { if (atom->neighbors.size() > 3) { float angle = 0; - foreach (sketcherMinimizerRing* r, atom->rings) { + for (sketcherMinimizerRing* r : atom->rings) { angle += M_PI - (2 * M_PI / r->_atoms.size()); } if (angle >= 1.99 * M_PI) { @@ -288,7 +281,7 @@ fusionAtoms = parent->fusionAtoms[i]; } } - foreach (sketcherMinimizerBond* b, parent->fusionBonds) { + for (sketcherMinimizerBond* b : parent->fusionBonds) { if (ring->containsAtom(b->startAtom) || ring->containsAtom(b->endAtom)) { fusionBond = b; @@ -306,7 +299,7 @@ { vector orderedAtoms; map stillToAdd; - foreach (sketcherMinimizerAtom* a, atoms) { + for (sketcherMinimizerAtom* a : atoms) { stillToAdd[a] = true; } sketcherMinimizerAtom* atomToAdd = startAtom; @@ -316,7 +309,7 @@ if (orderedAtoms.size() >= atoms.size()) break; - foreach (sketcherMinimizerAtom* neighbor, atomToAdd->neighbors) { + for (sketcherMinimizerAtom* neighbor : atomToAdd->neighbors) { if (stillToAdd[neighbor]) { atomToAdd = neighbor; break; @@ -334,8 +327,6 @@ return orderChainOfAtoms(ringAtoms, ringAtoms.at(0)); } - - void CoordgenFragmentBuilder::buildRing(sketcherMinimizerRing* ring) const { if (ring->coordinatesGenerated) @@ -396,8 +387,8 @@ int neighborsN = 0; sketcherMinimizerPointF neighborsMean(0.f, 0.f); - foreach (sketcherMinimizerAtom* neighbor, - pivotAtomOnParent->neighbors) { + for (sketcherMinimizerAtom* neighbor : + pivotAtomOnParent->neighbors) { if (parent->containsAtom(neighbor)) { neighborsMean += neighbor->getCoordinates(); ++neighborsN; @@ -426,7 +417,7 @@ if (fusionBond) { // check ZE inversions if (!fusionBond->checkStereoChemistry()) { - foreach (sketcherMinimizerAtom* atom, atoms) { + for (sketcherMinimizerAtom* atom : atoms) { sketcherMinimizerAtom::mirrorCoordinates(atom, fusionBond); } @@ -630,7 +621,7 @@ atomPriorities.push_back(p); } sketcherMinimizerAtom::orderAtomPriorities(atomPriorities, atom); - foreach (sketcherMinimizerAtomPriority ap, atomPriorities) { + for (sketcherMinimizerAtomPriority ap : atomPriorities) { orderedNeighbors.push_back(ap.a); } } @@ -652,8 +643,7 @@ void CoordgenFragmentBuilder:: initializeVariablesForNeighboursCoordinatesRingAtom( - const sketcherMinimizerAtom* atom, - set& , + const sketcherMinimizerAtom* atom, set&, sketcherMinimizerPointF& startCoordinates, vector& orderedNeighbors, vector& angles) const @@ -661,7 +651,7 @@ vector> ringNeighboursAndAngles; orderedNeighbors.clear(); - foreach (sketcherMinimizerAtom* neigh, atom->neighbors) { + for (sketcherMinimizerAtom* neigh : atom->neighbors) { if (sketcherMinimizer::sameRing(neigh, atom)) { float ang = atan2(neigh->coordinates.y() - atom->coordinates.y(), neigh->coordinates.x() - atom->coordinates.x()); @@ -691,7 +681,7 @@ p.rotate(sine, cosine); sketcherMinimizerPointF point = atom->coordinates + p; vector rings = atom->getFragment()->getRings(); - foreach (sketcherMinimizerRing* r, rings) { + for (sketcherMinimizerRing* r : rings) { if (r->isMacrocycle()) continue; if (r->contains(point)) { @@ -755,7 +745,7 @@ neigh->needsCheckForClashes = true; CoordgenMinimizer::checkForClashes(neigh); } - for (auto dof : at->fragment->getDofsOfAtom(at)) { + for (auto& dof : at->fragment->getDofsOfAtom(at)) { if (dof->getFragment() == fragment) { dof->addAtom(neigh); } @@ -763,7 +753,7 @@ } avoidZEInversions(at, isAtomVisited); maybeAddMacrocycleDOF(at); - for (auto neighbor : at->neighbors) { + for (auto& neighbor : at->neighbors) { if (!sketcherMinimizerAtom::shareARing(at, neighbor) && at->getFragment() == neighbor->getFragment()) { CoordgenScaleAtomsDOF* dof = new CoordgenScaleAtomsDOF(at); @@ -778,11 +768,11 @@ { if (atom->getRings().size() == 1 && atom->getRings().at(0)->isMacrocycle() && atom->neighbors.size() == 3) { - for (auto bond : atom->getBonds()) { + for (auto& bond : atom->getBonds()) { if (bond->isStereo() && !bond->isTerminal()) return; } - for (auto neighbor : atom->neighbors) { + for (auto& neighbor : atom->neighbors) { if (!sketcherMinimizerAtom::shareARing(atom, neighbor)) { CoordgenInvertBondDOF* dof = new CoordgenInvertBondDOF(atom, neighbor); @@ -820,7 +810,7 @@ if (firstCIPNeighborEnd == NULL) return; if (!doubleBond->checkStereoChemistry()) { - foreach (sketcherMinimizerAtom* a, atomsToMirror) { + for (sketcherMinimizerAtom* a : atomsToMirror) { sketcherMinimizerAtom::mirrorCoordinates(a, doubleBond); } } @@ -843,7 +833,6 @@ } } - void CoordgenFragmentBuilder::fallbackIfNanCoordinates( sketcherMinimizerFragment* fragment) const { @@ -865,7 +854,7 @@ if (fragment->getRings().size() < 2) return; vector fragmentAtoms = fragment->getAtoms(); - foreach (sketcherMinimizerAtom* atom, fragmentAtoms) { + for (sketcherMinimizerAtom* atom : fragmentAtoms) { if (atom->rings.size() > 1) { for (unsigned int i = 0; i < atom->rings.size(); i++) { for (unsigned int j = i + 1; j < atom->rings.size(); j++) { @@ -902,12 +891,12 @@ } } vector bonds = fragment->getBonds(); - foreach (sketcherMinimizerBond* b, bonds) { + for (sketcherMinimizerBond* b : bonds) { if ((b->bondOrder != 1) && (b->startAtom->rings.size()) && (b->endAtom->rings.size()) && (!sketcherMinimizer::sameRing(b->startAtom, b->endAtom))) { - foreach (sketcherMinimizerRing* r, b->startAtom->rings) { - foreach (sketcherMinimizerRing* r2, b->endAtom->rings) { + for (sketcherMinimizerRing* r : b->startAtom->rings) { + for (sketcherMinimizerRing* r2 : b->endAtom->rings) { r->fusedWith.push_back(r2); r2->fusedWith.push_back(r); vector ats; @@ -920,16 +909,16 @@ } } vector fragmentRings = fragment->getRings(); - foreach (sketcherMinimizerRing* r, fragmentRings) { + for (sketcherMinimizerRing* r : fragmentRings) { for (unsigned int i = 0; i < r->fusedWith.size(); i++) { vector fusionAtoms = r->fusionAtoms[i]; if (fusionAtoms.size() <= 2) continue; // find an atom with only one neighbor in the vector sketcherMinimizerAtom* startAtom = NULL; - foreach (sketcherMinimizerAtom* a, fusionAtoms) { + for (sketcherMinimizerAtom* a : fusionAtoms) { int counter = 0; - foreach (sketcherMinimizerAtom* n, a->neighbors) { + for (sketcherMinimizerAtom* n : a->neighbors) { if (find(fusionAtoms.begin(), fusionAtoms.end(), n) != fusionAtoms.end()) { counter++; @@ -945,17 +934,17 @@ } } - foreach (sketcherMinimizerRing* r, fragmentRings) { + for (sketcherMinimizerRing* r : fragmentRings) { for (unsigned int ii = 0; ii < r->fusedWith.size(); ii++) { if (r->fusionAtoms[ii].size() > 2) { - foreach (sketcherMinimizerAtom* a, - r->fusionAtoms[ii]) { // looking for atoms with no - // neighbors in r but not in - // r->fusedWith[ii] + for (sketcherMinimizerAtom* a : + r->fusionAtoms[ii]) { // looking for atoms with no + // neighbors in r but not in + // r->fusedWith[ii] bool found = false; - foreach (sketcherMinimizerAtom* n, a->neighbors) { + for (sketcherMinimizerAtom* n : a->neighbors) { int nn = 0; - foreach (sketcherMinimizerRing* nr, n->rings) { + for (sketcherMinimizerRing* nr : n->rings) { if (nr == r) nn++; else if (nr == r->fusedWith[ii]) @@ -983,7 +972,7 @@ map alreadyChosenAsSide; bool found = true; - /*simplify the structure by iteratively removing rings that have only one + /* simplify the structure by iteratively removing rings that have only one fusion partner. These side rings will have coordinates generated separately, one at a time, starting from the closest to the core. @@ -994,7 +983,7 @@ */ while (found) { found = false; - foreach (sketcherMinimizerRing* r, allRings) { + for (sketcherMinimizerRing* r : allRings) { if (alreadyChosenAsSide[r]) continue; if (r->isMacrocycle()) @@ -1006,16 +995,16 @@ if (!alreadyChosenAsSide[fusedRing]) { n++; if (fusedRing->isMacrocycle()) { - /*disable macrocycles*/ + /* disable macrocycles */ n++; } if (r->fusionAtoms.at(ringCounter).size() > 3) { - /*disable rings that share too many atoms*/ + /* disable rings that share too many atoms */ n++; } } } - if (n == 1) /*ring is fused with only one ring, + if (n == 1) /* ring is fused with only one ring, it will be removed from the core of the system and treated as a side ring */ @@ -1031,7 +1020,7 @@ everything that is left after removing the side rings is the core of the ring system */ - foreach (sketcherMinimizerRing* ring, allRings) { + for (sketcherMinimizerRing* ring : allRings) { if (!alreadyChosenAsSide[ring]) centralRings.push_back(ring); } diff -Nru schroedinger-coordgenlibs-1.1/CoordgenFragmentBuilder.h schroedinger-coordgenlibs-1.3/CoordgenFragmentBuilder.h --- schroedinger-coordgenlibs-1.1/CoordgenFragmentBuilder.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenFragmentBuilder.h 2019-07-11 19:04:54.000000000 +0000 @@ -14,6 +14,7 @@ #include #include "CoordgenMacrocycleBuilder.h" +#include "CoordgenConfig.hpp" class sketcherMinimizerAtom; class sketcherMinimizerBond; @@ -24,7 +25,7 @@ /* class that handles the creation of 2d coordinates for a molecular fragment */ -class CoordgenFragmentBuilder +class EXPORT_COORDGEN CoordgenFragmentBuilder { public: /* @@ -33,9 +34,11 @@ void initializeCoordinates(sketcherMinimizerFragment* fragment) const; /* - return a vector of ring atoms so that bound atoms are placed next to each other + return a vector of ring atoms so that bound atoms are placed next to each + other */ - static std::vector orderRingAtoms(const sketcherMinimizerRing* r); + static std::vector + orderRingAtoms(const sketcherMinimizerRing* r); /* return a vector of atoms so that bound atoms are placed next to each other @@ -45,35 +48,38 @@ sketcherMinimizerAtom* startAtom); /* - return a list of coordinates representing a regular polygon for the given atoms in a ring + return a list of coordinates representing a regular polygon for the given + atoms in a ring */ static std::vector listOfCoordinatesFromListofRingAtoms( const std::vector atoms); /* - set a flag that forces the macrocycle builder to skip expensive polyomino matching routines and - go straight to the breaking a bond approach + set a flag that forces the macrocycle builder to skip expensive polyomino + matching routines and go straight to the breaking a bond approach */ void setForceOpenMacrocycles(bool b) { m_macrocycleBuilder.m_forceOpenMacrocycles = b; } - /*set precision of the calculations. Higher precisions settings result better quality but slower - calculations*/ + /* set precision of the calculations. Higher precisions settings result + better + quality but slower + calculations */ void setPrecision(float f) { m_macrocycleBuilder.setPrecision(f); } /* - all bonds are placed at even intervals around the atom, - as opposed for instance to the 90°-90°-120°-60° around tetracoordinated centers + all bonds are placed at even intervals around the atom, as opposed for + instance to the 90°-90°-120°-60° around tetracoordinated centers */ bool m_evenAngles; - private: /* - find if the present ring is fused with another than has already gotten coordiantes for + find if the present ring is fused with another than has already gotten + coordinates for */ sketcherMinimizerRing* getSharedAtomsWithAlreadyDrawnRing( const sketcherMinimizerRing* ring, @@ -86,7 +92,8 @@ void buildRing(sketcherMinimizerRing* ring) const; /* - generate coordinates for a group of fused rings that share more than two atoms with each other + generate coordinates for a group of fused rings that share more than two + atoms with each other */ void generateCoordinatesCentralRings( std::vector centralRings) const; @@ -99,7 +106,8 @@ bool findTemplate(const std::vector rings) const; /* - generate coordinates for rings that have been stripped away from the core (see buildRings) + generate coordinates for rings that have been stripped away from the core + (see buildRings) */ void generateCoordinatesSideRings( std::stack sideRings) const; @@ -115,8 +123,8 @@ void buildFragment(sketcherMinimizerFragment* fragment) const; /* - assign coordinates to all ring atoms. Start by stripping out side rings that only share two atoms - with other rings to find a core of central rings + assign coordinates to all ring atoms. Start by stripping out side rings + that only share two atoms with other rings to find a core of central rings */ void buildRings(sketcherMinimizerFragment* fragment) const; @@ -125,16 +133,15 @@ */ void buildNonRingAtoms(sketcherMinimizerFragment* fragment) const; - /* initialize information about connectivity of rings */ void initializeFusedRingInformation(sketcherMinimizerFragment* fragment) const; - /* - split ring system into side rings and central rings by stripping away recursively rings that only + split ring system into side rings and central rings by stripping away + recursively rings that only share two atoms with other rings */ void @@ -142,21 +149,22 @@ std::stack& sideRings, std::vector& centralRings) const; - /*if the fragment contains any NaN coordinates and 3d coords are available, use - * thouse instead*/ + /* if the fragment contains any NaN coordinates and 3d coords are available, + * use thouse instead */ void fallbackIfNanCoordinates(sketcherMinimizerFragment* fragment) const; - /*generate the coordinates of atoms bound to the first atom in the queue*/ + /* generate the coordinates of atoms bound to the first atom in the queue */ void generateCoordinatesNeighborsOfFirstAtomInQueue( std::queue& atomQueue, std::set& isAtomVisited, const sketcherMinimizerFragment* fragment) const; - /*return a list of angles that bonds frmo the given atoms should form*/ + /* return a list of angles that bonds from the given atoms should form */ std::vector neighborsAnglesAtCenter(const sketcherMinimizerAtom* atom) const; - /*initialize data to generate coordinates of atoms bound to a non-ring atom*/ + /* initialize data to generate coordinates of atoms bound to a non-ring atom + */ void initializeVariablesForNeighboursCoordinates( sketcherMinimizerAtom* atom, std::set& isAtomVisited, @@ -164,7 +172,7 @@ std::vector& orderedNeighbours, std::vector& angles) const; - /*initialize data to generate coordinates of atoms bound to a ring atom*/ + /* initialize data to generate coordinates of atoms bound to a ring atom */ void initializeVariablesForNeighboursCoordinatesRingAtom( const sketcherMinimizerAtom* atom, std::set& isAtomVisited, @@ -172,20 +180,20 @@ std::vector& orderedNeighbours, std::vector& angles) const; - /*check if the atom is part of a macrocycle and has some degrees of freedom that can - be added to be used in the minimizer*/ + /* check if the atom is part of a macrocycle and has some degrees of freedom + that can be added to be used in the minimizer */ void maybeAddMacrocycleDOF(sketcherMinimizerAtom* atom) const; - /*make sure ZE chirality is maintained*/ + /* make sure ZE chirality is maintained */ void avoidZEInversions(const sketcherMinimizerAtom* at, std::set& isAtomVisited) const; - /* assign a score to the possibility of rings to be drawn on a plane*/ - float newScorePlanarity(const std::vector rings) - const; + /* assign a score to the possibility of rings to be drawn on a plane */ + float + newScorePlanarity(const std::vector rings) const; - /*the macrocycle builder*/ + /* the macrocycle builder */ CoordgenMacrocycleBuilder m_macrocycleBuilder; }; diff -Nru schroedinger-coordgenlibs-1.1/CoordgenFragmenter.cpp schroedinger-coordgenlibs-1.3/CoordgenFragmenter.cpp --- schroedinger-coordgenlibs-1.1/CoordgenFragmenter.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenFragmenter.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -90,20 +90,20 @@ { if (bond->getStartAtom()->getFragment() == NULL && bond->getEndAtom()->getFragment() == NULL) { - /*add the two atoms to a new fragment*/ + /* add the two atoms to a new fragment */ sketcherMinimizerFragment* fragment = new sketcherMinimizerFragment(); fragment->addAtom(bond->getStartAtom()); fragment->addAtom(bond->getEndAtom()); fragments.push_back(fragment); } else if (bond->getEndAtom()->getFragment() == NULL) { - /*extend fragment of start atom*/ + /* extend fragment of start atom */ bond->getStartAtom()->getFragment()->addAtom(bond->getEndAtom()); } else if (bond->getStartAtom()->getFragment() == NULL) { - /*extend fragment of end atom*/ + /* extend fragment of end atom */ bond->getEndAtom()->getFragment()->addAtom(bond->getStartAtom()); } else if (bond->getStartAtom()->getFragment() != bond->getEndAtom()->getFragment()) { - /*join the two fragments*/ + /* join the two fragments */ joinFragments(bond->getStartAtom()->getFragment(), bond->getEndAtom()->getFragment(), fragments); } @@ -179,7 +179,7 @@ bool CoordgenFragmenter::isChain(const sketcherMinimizerFragment* fragment) { - /*can this fragment be part of a zig-zag chain, e.g. exane?*/ + /* can this fragment be part of a zig-zag chain, e.g. exane? */ vector fragmentAtoms = fragment->getAtoms(); if (fragmentAtoms.size() > 3) return false; @@ -219,21 +219,21 @@ { switch (checkN) { case 0: - return (fragment->fixed ? 1 : 0); + return fragment->countFixedAtoms(); case 1: - return (fragment->constrained ? 1 : 0); + return fragment->countConstrainedAtoms(); case 2: - return (fragment->getRings().size()); + return fragment->getRings().size(); case 3: - return (fragment->getAtoms().size()); + return fragment->getAtoms().size(); case 4: - return (fragment->_interFragmentBonds.size()); + return fragment->_interFragmentBonds.size(); case 5: - return (fragment->countHeavyAtoms()); + return fragment->countHeavyAtoms(); case 6: - return (fragment->totalWeight()); + return fragment->totalWeight(); case 7: - return (fragment->countDoubleBonds()); + return fragment->countDoubleBonds(); default: checkNoMore = true; return 0; @@ -363,8 +363,8 @@ } foreach (sketcherMinimizerFragment* fragment, fragments) { - /*swap bonds to parent so that startAtom is always the parent's and - * endAtom always the child's*/ + /* swap bonds to parent so that startAtom is always the parent's and + * endAtom always the child's */ if (fragment->_bondToParent) { if (fragment->_bondToParent->getEndAtom()->getFragment() != fragment) { diff -Nru schroedinger-coordgenlibs-1.1/CoordgenFragmenter.h schroedinger-coordgenlibs-1.3/CoordgenFragmenter.h --- schroedinger-coordgenlibs-1.1/CoordgenFragmenter.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenFragmenter.h 2019-07-11 19:04:54.000000000 +0000 @@ -14,8 +14,6 @@ class sketcherMinimizerRing; class sketcherMinimizerAtom; - - /* class to divide a molecule into rigid fragments */ @@ -43,7 +41,6 @@ sketcherMinimizerBond* bond, std::vector& fragments); - /* process bond internal a fragment */ @@ -69,7 +66,8 @@ sketcherMinimizerMolecule* molecule); /* - check if fragment is part of an aliphatic chain and sets the appropriate flag + check if fragment is part of an aliphatic chain and sets the appropriate + flag */ static void setChainInfo(sketcherMinimizerFragment* fragment); @@ -105,7 +103,8 @@ const sketcherMinimizerFragment* fragment2); /* - get the score of a particular descriptor for the given fragment (used to assign priorities) + get the score of a particular descriptor for the given fragment (used to + assign priorities) */ static int getValueOfCheck(const sketcherMinimizerFragment* fragment, int checkN, bool& checkNoMore); @@ -124,17 +123,17 @@ considerChains(std::vector fragments, sketcherMinimizerFragment* mainFragment); - /*empirical minimum length of zigzag chain of fragments + /* empirical minimum length of zigzag chain of fragments that makes the chain get priority over the main fragment in determining the molecule's layout */ static unsigned int acceptableChainLength(sketcherMinimizerFragment* mainFragment); - static std::vector /* find the longest chain of connected fragments */ + static std::vector findLongestChain(std::vector fragments); /* @@ -145,7 +144,8 @@ std::vector fragments); /* - order the vector of fragments so that bound fragments are consecutive, starting from the main fragment + order the vector of fragments so that bound fragments are consecutive, + starting from the main fragment */ static void diff -Nru schroedinger-coordgenlibs-1.1/CoordgenMacrocycleBuilder.cpp schroedinger-coordgenlibs-1.3/CoordgenMacrocycleBuilder.cpp --- schroedinger-coordgenlibs-1.1/CoordgenMacrocycleBuilder.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenMacrocycleBuilder.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -465,9 +465,8 @@ bool Polyomino::isEquivalentWithout(hexCoords c) const { - /*does removing this hexagon yield another polyomino with the same number of - vertices? - true if hte hexagon has 3 neighbors all next to each other*/ + /* does removing this hexagon yield another polyomino with the same number + of vertices? true if hte hexagon has 3 neighbors all next to each other */ if (countNeighbors(c) != 3) return false; vector neighs = Hex::neighboringPositions(c); @@ -491,10 +490,9 @@ if (neighbors.size() == 1) { /* the vertex coordinates differ from its parent's by a single +1 or -1 - (d). - The substituent will be along the same direction, so the other two - coordinates will be incremented by -d. - e.g. (1, 0, 0)-> (1, -1, -1) or (0, -1, 0)-> (1, -1, 1) + (d). The substituent will be along the same direction, so the other two + coordinates will be incremented by -d. e.g. (1, 0, 0)-> (1, -1, -1) + or (0, -1, 0)-> (1, -1, 1) */ vertexCoords parentCoords = neighbors[0]->coords().toVertexCoords(); vertexCoords v = pos - parentCoords; diff -Nru schroedinger-coordgenlibs-1.1/CoordgenMacrocycleBuilder.h schroedinger-coordgenlibs-1.3/CoordgenMacrocycleBuilder.h --- schroedinger-coordgenlibs-1.1/CoordgenMacrocycleBuilder.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenMacrocycleBuilder.h 2019-07-11 19:04:54.000000000 +0000 @@ -9,7 +9,7 @@ #include #include #include - +#include "CoordgenConfig.hpp" class sketcherMinimizerAtom; class sketcherMinimizerRing; @@ -144,11 +144,10 @@ }; /* -hex polyomino (geometrical figure built on a hexagon lattice). All functions assume that - the polyomino has no holes +hex polyomino (geometrical figure built on a hexagon lattice). All functions +assume that the polyomino has no holes */ -class - Polyomino +class EXPORT_COORDGEN Polyomino { public: Polyomino(); @@ -157,22 +156,22 @@ Polyomino& operator=(const Polyomino& rhv); /* - explore the topology of the polyominoes and returns true if they have the same. Takes - into account translations, rotations and mirroring + explore the topology of the polyominoes and returns true if they have the + same. Takes into account translations, rotations and mirroring */ bool isTheSameAs(Polyomino& p) const; - /*returns the number of hexagons in the polyomino*/ + /* returns the number of hexagons in the polyomino */ int size() const; - /*empties the polyomino*/ + /* empties the polyomino */ void clear(); - /*marks one hexagon to be a pentagon*/ + /* marks one hexagon to be a pentagon */ void markOneVertexAsPentagon(); // to get a path with an odd number of vertices - /*returns all hexagons that share the given vertex*/ + /* returns all hexagons that share the given vertex */ std::vector vertexNeighbors(vertexCoords v) const; /* @@ -185,21 +184,19 @@ */ std::vector getPath() const; - /*return the hexagon at the given position*/ + /* return the hexagon at the given position */ Hex* getHex(hexCoords coords) const; - /*find an outer vertex. Used to start path around polyomino.*/ + /* find an outer vertex. Used to start path around polyomino. */ vertexCoords findOuterVertex() const; - /* number of Hexs present at the given vertex*/ - int hexagonsAtVertex( - vertexCoords v) const; - + /* number of Hexs present at the given vertex */ + int hexagonsAtVertex(vertexCoords v) const; - /*build a round-ish polyomino with the given number of vertices*/ + /* build a round-ish polyomino with the given number of vertices */ void buildWithVerticesN(int totVertices); - /* build a box-like polyomino of the given size*/ + /* build a box-like polyomino of the given size */ void buildSkewedBoxShape(int x, int y, bool pentagon = false); // squared shape @@ -232,24 +229,21 @@ */ int countNeighbors(hexCoords) const; - /*add an hexagon at given coordinates*/ + /* add an hexagon at given coordinates */ void addHex(hexCoords coords); - /*remove the hexagon at given coordinates*/ + /* remove the hexagon at given coordinates */ void removeHex(hexCoords coords); - /*does removing this hexagon yield another polyomino with the same number of - vertices? - true if the hexagon has 3 neighbors all next to each other + /* does removing this hexagon yield another polyomino with the same number + of vertices? true if the hexagon has 3 neighbors all next to each other */ bool isEquivalentWithout(hexCoords c) const; - - /*give the coordinates of an hypotetical substituent bound to an atom in - * position pos*/ + /* give the coordinates of an hypotetical substituent bound to an atom in + * position pos */ vertexCoords coordinatesOfSubstituent(vertexCoords pos) const; - // holds pointers to all hexagons std::vector m_list; @@ -257,54 +251,54 @@ std::vector pentagonVertices; private: - /*mark vertex as pentagon (i.e. fuse it with neighbor vertex)*/ + /* mark vertex as pentagon (i.e. fuse it with neighbor vertex) */ void setPentagon(vertexCoords c); - /*resize the grid to new size i*/ + /* resize the grid to new size i */ void resizeGrid(int i) const; - /*reassign hexagons to the grid*/ + /* reassign hexagons to the grid */ void reassignHexs() const; - /* get index of hexagon at the given coordinates*/ + /* get index of hexagon at the given coordinates */ int getIndexInList(hexCoords coords) const; - /*hold pointers to all positions in the - grid, NULL pointers for empty positions*/ + /* hold pointers to all positions in the + grid, NULL pointers for empty positions */ std::vector mutable m_grid; - /*size of the grid*/ + /* size of the grid */ mutable int m_gridSize; }; - /* class that builds coordinates for macrocycles */ -class CoordgenMacrocycleBuilder +class EXPORT_COORDGEN CoordgenMacrocycleBuilder { public: CoordgenMacrocycleBuilder() : m_forceOpenMacrocycles(false){}; ~CoordgenMacrocycleBuilder(){}; - /*assign coordinates to macrocycle*/ + /* assign coordinates to macrocycle */ std::vector newMacrocycle(sketcherMinimizerRing* r, std::vector atoms) const; - /*assign coordinates by removing one bond, generating the coordinates of the resulting - molecule and re-adding the missing bond*/ + /* assign coordinates by removing one bond, generating the coordinates of + the resulting molecule and re-adding the missing bond */ bool openCycleAndGenerateCoords(sketcherMinimizerRing* ring) const; - /*find most suitable bond to be broken*/ + /* find most suitable bond to be broken */ sketcherMinimizerBond* findBondToOpen(sketcherMinimizerRing* ring) const; /* Add constraints to stereoactive double bonds to avoid inversions - public to be accessed by tests*/ + public to be accessed by tests */ std::vector getDoubleBondConstraints(std::vector& atoms) const; - /*Skip the polyomino approach and fall back to opening the macrocycle when generating coordinates*/ + /* Skip the polyomino approach and fall back to opening the macrocycle when + * generating coordinates */ bool m_forceOpenMacrocycles; float getPrecision() const; @@ -313,95 +307,90 @@ private: /* - precision of calculation. Higher values result in better results but longer calculation times + precision of calculation. Higher values result in better results but longer + calculation times */ float m_precision; - /*build polyominos with the given number of vertices*/ + /* build polyominos with the given number of vertices */ std::vector buildSquaredShapes(int totVertices) const; - /*remove duplicate polyominos from the list*/ + /* remove duplicate polyominos from the list */ std::vector removeDuplicates(std::vector& pols) const; std::vector getRingConstraints(std::vector& atoms) const; - /*get total number of atoms bound to a that are not on parent size*/ + /* get total number of atoms bound to a that are not on parent size */ int getNumberOfChildren(sketcherMinimizerAtom* a, sketcherMinimizerAtom* parent) const; - - /* get restraints to try to avoid things like having eteroatoms or substituents - pointing inside of the macrocycle*/ - pathRestraints getPathRestraints(std::vector& atoms) - const; + /* get restraints to try to avoid things like having heteroatoms or + * substituents pointing inside of the macrocycle */ + pathRestraints + getPathRestraints(std::vector& atoms) const; /* a shape is not allowed to break a constraint (i.e. invert stereochemistry on a double bond or put a fused ring inside - the macrocycle)*/ + the macrocycle) */ pathConstraints - getPathConstraints(std::vector& atoms) - const; - - - /* build a list of polyominoes with the - same number of vertices by removing - hexagons with 3 neighbors*/ - std::vector - listOfEquivalent(Polyomino p) const; + getPathConstraints(std::vector& atoms) const; + /* build a list of polyominoes with the same number of vertices by removing + * hexagons with 3 neighbors */ + std::vector listOfEquivalent(Polyomino p) const; std::vector listOfEquivalents(std::vector l) const; - /*check that no ring constraints are violated*/ + /* check that no ring constraints are violated */ bool checkRingConstraints(std::vector& ringConstraints, Polyomino& p, std::vector& path, std::vector& neighborNs, int& startI) const; - /*check that no double bond constraints are violated*/ + /* check that no double bond constraints are violated */ bool checkDoubleBoundConstraints( std::vector& dbConstraints, std::vector& vertices, int& startI) const; - /*score the path restraints*/ + /* score the path restraints */ int scorePathRestraints(pathRestraints& pr, Polyomino& p, std::vector& path, std::vector& neighborNs, int& startI) const; - /*check that no path constraints are violated*/ + /* check that no path constraints are violated */ bool scorePathConstraints(pathConstraints& pc, Polyomino& p, std::vector& path, std::vector& neighborNs, int& startI) const; - /*score restraints and constraints of the given path*/ + /* score restraints and constraints of the given path */ int scorePath(Polyomino& p, std::vector& path, std::vector& neighborNs, int& startI, pathConstraints& pc, pathRestraints& pr) const; - /*acceptable score to consider a shape appropriate*/ + /* acceptable score to consider a shape appropriate */ int acceptableShapeScore(int numberOfAtoms) const; std::vector getVertexNeighborNs(Polyomino& p, std::vector& path) const; - /*return lowest period after which there is a rotation symmetry*/ - int getLowestPeriod(std::vector& neighbors) - const; + /* return lowest period after which there is a rotation symmetry */ + int getLowestPeriod(std::vector& neighbors) const; - /*explore the given polyominoes and score them*/ + /* explore the given polyominoes and score them */ bool matchPolyominoes(std::vector& pols, pathConstraints& pc, pathRestraints& pr, int& bestP, int& bestScore, int& bestStart, int& checkedMacrocycles) const; - /*explore the best starting point to place atoms around the given polyomino*/ + /* explore the best starting point to place atoms around the given polyomino + */ bool matchPolyomino(Polyomino& p, pathConstraints& pc, pathRestraints& pr, int& bestStart, int& bestScore) const; - /*write the coordinates of the given path*/ + /* write the coordinates of the given path */ void writePolyominoCoordinates(std::vector& path, std::vector atoms, int startI) const; - /*return the coordinates of the given vertex*/ + /* return the coordinates of the given vertex */ sketcherMinimizerPointF coordsOfVertex(vertexCoords& v) const; }; diff -Nru schroedinger-coordgenlibs-1.1/CoordgenMinimizer.cpp schroedinger-coordgenlibs-1.3/CoordgenMinimizer.cpp --- schroedinger-coordgenlibs-1.1/CoordgenMinimizer.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenMinimizer.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -14,7 +14,8 @@ #include "sketcherMinimizerBendInteraction.h" #include "sketcherMinimizerEZConstrainInteraction.h" #include "sketcherMinimizerStretchInteraction.h" -#include "sketcherMinimizer.h" //should be removed at the end of refactoring +#include "sketcherMinimizerConstraintInteraction.h" +#include "sketcherMinimizer.h" // should be removed at the end of refactoring #include #include #include "sketcherMinimizerMaths.h" @@ -105,9 +106,9 @@ return true; } -/*store extra interaction to be used when minimizing molecule. +/* store extra interaction to be used when minimizing molecule. cis amides constraints are an example as they need 3d coordinates - to be detected*/ + to be detected */ void CoordgenMinimizer::addExtraInteraction( sketcherMinimizerMolecule* molecule, sketcherMinimizerInteraction* interaction) @@ -203,8 +204,8 @@ } } -/*return a set of all carbons part of a carbonyl group, i.e. doubly bonded to an - * oxygen.*/ +/* return a set of all carbons part of a carbonyl group, i.e. doubly bonded to + * an oxygen. */ std::set CoordgenMinimizer::getChetoCs(std::vector allAtoms) { @@ -226,8 +227,8 @@ return chetoCs; } -/*return a set of all amino nitrogens. Not chemically accurate, doesn't filter - * out nitro Ns for instance.*/ +/* return a set of all amino nitrogens. Not chemically accurate, doesn't filter + * out nitro Ns for instance. */ std::set CoordgenMinimizer::getAminoNs(std::vector allAtoms) { @@ -240,9 +241,9 @@ return aminoNs; } -/*return a set of all aminoacid alpha carbon, i.e. a carbon that is bound to a +/* return a set of all aminoacid alpha carbon, i.e. a carbon that is bound to a nitrogen - and a cheto carbon.*/ + and a cheto carbon. */ std::set CoordgenMinimizer::getAlphaCs(std::vector allAtoms, std::set chetoCs, @@ -273,8 +274,8 @@ return alphaCs; } -/*add constraints to keep all backbone atoms of a peptide in a straight trans - * line.*/ +/* add constraints to keep all backbone atoms of a peptide in a straight trans + * line. */ void CoordgenMinimizer::addPeptideBondInversionConstraintsOfMolecule( sketcherMinimizerMolecule* molecule) { @@ -308,9 +309,8 @@ } } -/*find chains of four bound atoms that are part of the four provided sets. - Useful to detect - portions of a peptide backbone for instance.*/ +/* find chains of four bound atoms that are part of the four provided sets. + Useful to detect portions of a peptide backbone for instance. */ void CoordgenMinimizer::getFourConsecutiveAtomsThatMatchSequence( std::vector>& consecutiveAtomsGroups, std::set firstSet, @@ -343,6 +343,19 @@ } } +void CoordgenMinimizer::addConstrainedInteractionsOfMolecule( + sketcherMinimizerMolecule* molecule) +{ + for (auto atom : molecule->getAtoms()) { + if (atom->constrained) { + auto interaction = new sketcherMinimizerConstraintInteraction( + atom, atom->templateCoordinates); + _intramolecularClashInteractions.push_back(interaction); + _interactions.push_back(interaction); + } + } +} + void CoordgenMinimizer::addChiralInversionConstraintsOfMolecule( sketcherMinimizerMolecule* molecule) { @@ -409,8 +422,8 @@ if (r) { if (!r->isMacrocycle()) { int extraAtoms = 0; - /*if the rings are to be drawn as fused, they will - * result in a bigger ring*/ + /* if the rings are to be drawn as fused, they will + * result in a bigger ring */ for (unsigned int i = 0; i < r->fusedWith.size(); i++) { if (r->fusedWith[i]->isMacrocycle()) continue; @@ -455,7 +468,7 @@ if (fusedToRing || invertedMacrocycleBond) { ringInteractions.push_back(interaction); } else { - /*macrocycles are treated as non rings*/ + /* macrocycles are treated as non rings */ nonRingInteractions.push_back(interaction); } } @@ -527,7 +540,7 @@ } } } - foreach (auto interaction,interactions) { + foreach (auto interaction, interactions) { if (!(interaction->atom1->fixed && interaction->atom2->fixed && interaction->atom3->fixed)) { _interactions.push_back(interaction); @@ -735,8 +748,7 @@ bool scoreProximityRelationsOnOppositeSid) const { float E = 0.f; - foreach (sketcherMinimizerClashInteraction* i, - _intramolecularClashInteractions) { + foreach (auto i, _intramolecularClashInteractions) { i->score(E, true); } foreach (sketcherMinimizerInteraction* i, _extraInteractions) { @@ -885,7 +897,6 @@ return out; } - float CoordgenMinimizer::scoreProximityRelationsOnOppositeSides() const { float out = 0.f; @@ -1220,7 +1231,8 @@ if (skipAvoidClashes) return true; foreach (sketcherMinimizerMolecule* molecule, _molecules) { - allCleanPoses = allCleanPoses && avoidClashesOfMolecule(molecule); + auto cleanPose = avoidClashesOfMolecule(molecule); + allCleanPoses = allCleanPoses && cleanPose; } return allCleanPoses; } @@ -1403,7 +1415,7 @@ vector atoms) { float scale = 35.f; // ratio between average bond length and 2d bond length - /*TODO find best projection*/ + /* TODO find best projection */ foreach (sketcherMinimizerAtom* atom, atoms) { atom->setCoordinates( sketcherMinimizerPointF(atom->m_x3D * scale, -atom->m_y3D * scale)); diff -Nru schroedinger-coordgenlibs-1.1/CoordgenMinimizer.h schroedinger-coordgenlibs-1.3/CoordgenMinimizer.h --- schroedinger-coordgenlibs-1.1/CoordgenMinimizer.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/CoordgenMinimizer.h 2019-07-11 19:04:54.000000000 +0000 @@ -28,8 +28,9 @@ class CoordgenFragmentDOF; class CoordgenMinimizer; -/*class to manage the solutions to a minimization problem. Each solution is a vector that contains values - for each of the degrees of freedom of the problem*/ +/* class to manage the solutions to a minimization problem. Each solution is a + vector that contains values for each of the degrees of freedom of the problem + */ class CoordgenDOFSolutions { public: @@ -40,7 +41,8 @@ { } /* - calculate the value of the scoring function on the currently loaded solution + calculate the value of the scoring function on the currently loaded + solution */ float scoreCurrentSolution(); @@ -50,7 +52,8 @@ std::vector getCurrentSolution(); /* - load the given solution (i.e. set each degree of freedom in the molecule to the given value) + load the given solution (i.e. set each degree of freedom in the molecule to + the given value) */ void loadSolution(std::vector solution); @@ -74,95 +77,99 @@ }; /* - minimizer class that resolves clashes in a molecule. It can explore degrees of freedom conformations - (e.g. flip around single bonds) and perform a force-field based free atom minimization + minimizer class that resolves clashes in a molecule. It can explore degrees of + freedom conformations (e.g. flip around single bonds) and perform a force-field + based free atom minimization */ -class CoordgenMinimizer +class EXPORT_COORDGEN CoordgenMinimizer { public: CoordgenMinimizer(); ~CoordgenMinimizer(); - /*clear all the interactions loaded in the minimizer and free memory*/ + /* clear all the interactions loaded in the minimizer and free memory */ void clearInteractions(); - /*run a force-field based minimization*/ + /* run a force-field based minimization */ void run(); - - /*Apply forces and take a step in the minimization. Returns false if - * converged, true if not.*/ + /* Apply forces and take a step in the minimization. Returns false if + * converged, true if not. */ bool applyForces(float maxd = 3); - /*run a force-field based minimization on residues only*/ + /* run a force-field based minimization on residues only */ void minimizeResidues(); - /*run a force-field based minimization on the given molecule*/ + /* run a force-field based minimization on the given molecule */ void minimizeMolecule(sketcherMinimizerMolecule* molecule); - /*solve clashes of residues in a protein-protein interaction LID*/ + /* solve clashes of residues in a protein-protein interaction LID */ void minimizeProteinOnlyLID( std::map> chains); - /*setup constraints and run a force-field based minimization*/ + /* setup constraints and run a force-field based minimization */ void minimizeAll(); - /*setup constraints on residues only*/ + /* setup constraints on residues only */ void setupInteractionsOnlyResidues(); - /*setup constraints on residues in a protein-protein interaction scenario*/ + /* setup constraints on residues in a protein-protein interaction scenario + */ void setupInteractionsProteinOnly( std::map> chains); - /*setup all constraints*/ + /* setup all constraints */ void setupInteractions(bool intrafragmentClashes = false); - /*setup all constraints of given molecule*/ + /* setup all constraints of given molecule */ void addInteractionsOfMolecule(sketcherMinimizerMolecule* molecule, bool intrafragmentClashes = false); - - /*score the forcefield value of the current conformation*/ + /* score the forcefield value of the current conformation */ float scoreInteractions(); - /*add a list of intermolecular clash constraints between two given molecules*/ + /* add a list of intermolecular clash constraints between two given + * molecules + */ bool findIntermolecularClashes(sketcherMinimizerMolecule* mol1, sketcherMinimizerMolecule* mol2, float threshold); - /*add a list of intermolecular clash constraints between given molecules*/ + /* add a list of intermolecular clash constraints between given molecules */ bool findIntermolecularClashes(std::vector mols, float threshold); - /*run a minimization of the molecules rings constraining their shape to regular polygons*/ + /* run a minimization of the molecules rings constraining their shape to + * regular polygons */ void fixRingsShape(); - /*precision of the minimization. Higher values result in higher times and better results*/ + /* precision of the minimization. Higher values result in higher times and + * better results */ float getPrecision() const; void setPrecision(float f); - /*score all clashes of the given molecule*/ + /* score all clashes of the given molecule */ float scoreClashes(sketcherMinimizerMolecule* molecule, bool residueInteractions = false, bool scoreProximityRelationsOnOppositeSides = true) const; - /*score the penalty for intersecting bonds*/ + /* score the penalty for intersecting bonds */ float scoreCrossBonds(sketcherMinimizerMolecule* molecule, bool residueInteractions = false) const; - /*score the penalty for degrees of freedom set to non-ideal values*/ + /* score the penalty for degrees of freedom set to non-ideal values */ float scoreDofs(sketcherMinimizerMolecule* molecule) const; - /*score the penalty of atoms placed inside rings*/ + /* score the penalty of atoms placed inside rings */ float scoreAtomsInsideRings() const; - /* assign a penalty if a molecule (A) is bound to another (B) with more than a - proximity relation and they are on different sides of A and involving - different fragments. This forces the algorithm to look for poses where all - the atoms of A that have proximity relations with B are on the same side of - A.*/ + /* assign a penalty if a molecule (A) is bound to another (B) with more than + * a proximity relation and they are on different sides of A and involving + * different fragments. This forces the algorithm to look for poses where + * all the atoms of A that have proximity relations with B are on the same + * side of A. */ float scoreProximityRelationsOnOppositeSides() const; /* @@ -180,21 +187,21 @@ std::vector()); /* - set up the DoF list and run a minimization on the given molecuel + set up the DoF list and run a minimization on the given molecule */ bool flipFragments(sketcherMinimizerMolecule* molecule, float& clashE); - /* - run a search on the degrees of freedom, exploring combinations of degrees of freedom + run a search on the degrees of freedom, exploring combinations of degrees + of freedom */ bool runLocalSearch(sketcherMinimizerMolecule* molecule, std::vector dofs, int levels, float& clashE, CoordgenDOFSolutions& solutions); - /* - iteratively grow the pool of solutions by mutating the best scoring one by one degree of freedom + iteratively grow the pool of solutions by mutating the best scoring one by + one degree of freedom */ bool growSolutions( std::set>& allScoredSolutions, @@ -202,16 +209,17 @@ std::map, float>& growingSolutions, CoordgenDOFSolutions& solutions, float& bestScore); - /* - run the search to find good scoring solutions to the problem. Each degree of freedom has a - tier value that ensures that simpler and more aesthetic pleasing ones (e.g. flipping fragments) - are searched before more complex ones (i.e. putting substituents inside macrocycles). - This is alternative and preferred to runExhaustiveSearch and runLocalSearch + run the search to find good scoring solutions to the problem. Each degree + of freedom has a tier value that ensures that simpler and more aesthetic + pleasing ones (e.g. flipping fragments) are searched before more complex + ones (i.e. putting substituents inside macrocycles). This is alternative + and preferred to runExhaustiveSearch and runLocalSearch */ bool runSearch(int tier, CoordgenDOFSolutions& solutions); - /*build a list of tuples of the given order representing all combinations of dofs*/ + /* build a list of tuples of the given order representing all combinations + * of dofs */ std::vector> buildTuplesOfDofs(std::vector dofs, unsigned int order) const; @@ -229,57 +237,59 @@ std::vector& dofs, float& bestResult, bool& abort, CoordgenDOFSolutions& solutions); - - /*return true if the given bonds clash*/ + /* return true if the given bonds clash */ bool bondsClash(sketcherMinimizerBond* bond, sketcherMinimizerBond* bond2) const; /* - quick function to avoid clashes of terminal atoms without running a minimization + quick function to avoid clashes of terminal atoms without running a + minimization */ void avoidTerminalClashes(sketcherMinimizerMolecule* molecule, float& clashE); /* - check if the ring system cannot be drown with regular polygons and needs a FF based minimization + check if the ring system cannot be drown with regular polygons and needs a + FF based minimization */ static void maybeMinimizeRings(std::vector rings); /* - avoid clashes of terminal atoms of the same fragment without running a minimization + avoid clashes of terminal atoms of the same fragment without running a + minimization */ static void avoidInternalClashes(sketcherMinimizerFragment* fragment); - /* - assign coordinates to each atom from the current values of DoFs of the fragments + assign coordinates to each atom from the current values of DoFs of the + fragments */ void buildFromFragments(bool firstTime = false) const; /* - assign coordinates to each atom from the current values of DoFs of the fragments + assign coordinates to each atom from the current values of DoFs of the + fragments */ void buildMoleculeFromFragments(sketcherMinimizerMolecule* molecule, bool firstTime = false) const; - /*find a list of carbons from the backbone C=O of a peptide*/ + /* find a list of carbons from the backbone C=O of a peptide */ std::set getChetoCs(std::vector allAtoms); - /*find a list of nitrogens from the backbon NH of a peptide*/ + /* find a list of nitrogens from the backbon NH of a peptide */ std::set getAminoNs(std::vector allAtoms); - /*find a list of alpha carbons of a peptide*/ + /* find a list of alpha carbons of a peptide */ std::set getAlphaCs(std::vector allAtoms, std::set chetoCs, std::set aminoNs); - /*check the atom for clashes with other atoms*/ + /* check the atom for clashes with other atoms */ static void checkForClashes(sketcherMinimizerAtom* a); - /* return true if atoms have NaN coordinates */ @@ -292,17 +302,17 @@ static bool hasValid3DCoordinates(std::vector atoms); - /*use 3d coordinates in 2d (e.g. when a reasonable 2d structure cannot be found)*/ + /* use 3d coordinates in 2d (e.g. when a reasonable 2d structure cannot be + * found) */ static void fallbackOn3DCoordinates(std::vector atoms); /* add the given constraint to the minimizer */ - void EXPORT_COORDGEN addExtraInteraction(sketcherMinimizerMolecule* molecule, + void addExtraInteraction(sketcherMinimizerMolecule* molecule, sketcherMinimizerInteraction* interaction); - std::vector _atoms; std::vector _bonds; bool m_evenAngles; @@ -312,7 +322,7 @@ std::vector _molecules; bool skipMinimization, skipAvoidClashes, skipFlipFragments, - m_scoreResidueInteractions; + m_scoreResidueInteractions; private: /* @@ -331,6 +341,12 @@ */ void addBendInteractionsOfMolecule(sketcherMinimizerMolecule* molecule); + /* + add constraints to avoid deviating from constrained coordinates (e.g. for + alignment) + */ + void + addConstrainedInteractionsOfMolecule(sketcherMinimizerMolecule* molecule); /* add constraints to avoid chiral inversion of the given molecule @@ -345,8 +361,8 @@ sketcherMinimizerMolecule* molecule); /* - get lists of four atoms that form a chain and are each present in one of the four sets - respectively + get lists of four atoms that form a chain and are each present in one of + the four sets respectively */ void getFourConsecutiveAtomsThatMatchSequence( std::vector>& @@ -360,8 +376,7 @@ std::vector _stretchInteractions; std::vector _bendInteractions; - std::vector - _intramolecularClashInteractions; + std::vector _intramolecularClashInteractions; std::vector _extraInteractions; std::map> diff -Nru schroedinger-coordgenlibs-1.1/debian/changelog schroedinger-coordgenlibs-1.3/debian/changelog --- schroedinger-coordgenlibs-1.1/debian/changelog 2019-07-21 20:05:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/changelog 2019-07-23 03:19:54.000000000 +0000 @@ -1,3 +1,22 @@ +schroedinger-coordgenlibs (1.3-1) unstable; urgency=medium + + * New upstream release. + * debian/patches/SOVERSION.patch: Removed, no longer needed. + * debian/patches/cmake-config.patch: Likewise. + * debian/control (Build-Depends): Added libboost-iostreams-dev. + * debian/rules (override_dh_install): Target removed. + * debian/rules (override_dh_auto_configure): New target defininig + CMAKE_PREFIX_PATH to /usr/lib/$(DEB_HOST_MULTIARCH)/cmake. + * debian/patches/cmake_standard_dirs.patch: New patch, fixes installation + directories. + * debian/examples: Updated. + * debian/libschroedinger-coordgenlibs-dev.install: Install default files. + * debian/libschroedinger-coordgenlibs1.install: Likewise. + * debian/control (Build-Depends): Added versioned Build-Depends on + libschroedinger-maeparser-dev 1.2-1. + + -- Michael Banck Tue, 23 Jul 2019 00:19:54 -0300 + schroedinger-coordgenlibs (1.1-4) unstable; urgency=medium * debian/patches/cmake-config.patch: New patch, adds support for a diff -Nru schroedinger-coordgenlibs-1.1/debian/control schroedinger-coordgenlibs-1.3/debian/control --- schroedinger-coordgenlibs-1.1/debian/control 2019-01-16 17:14:58.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/control 2019-07-23 03:17:07.000000000 +0000 @@ -2,7 +2,7 @@ Priority: optional Maintainer: Debian Science Team Uploaders: Steffen Moeller -Build-Depends: debhelper (>= 11), libschroedinger-maeparser-dev, cmake, libboost-dev +Build-Depends: debhelper (>= 11), libschroedinger-maeparser-dev (>= 1.2-1), cmake, libboost-dev, libboost-iostreams-dev Standards-Version: 4.2.1 Section: libs Homepage: https://github.com/schrodinger/coordgenlibs diff -Nru schroedinger-coordgenlibs-1.1/debian/examples schroedinger-coordgenlibs-1.3/debian/examples --- schroedinger-coordgenlibs-1.1/debian/examples 2018-12-03 16:15:24.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/examples 2019-07-22 01:06:34.000000000 +0000 @@ -1 +1 @@ -example/* +example_dir/*.cpp diff -Nru schroedinger-coordgenlibs-1.1/debian/libschroedinger-coordgenlibs1.install schroedinger-coordgenlibs-1.3/debian/libschroedinger-coordgenlibs1.install --- schroedinger-coordgenlibs-1.1/debian/libschroedinger-coordgenlibs1.install 2018-12-03 16:15:24.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/libschroedinger-coordgenlibs1.install 2019-07-22 01:04:53.000000000 +0000 @@ -1,2 +1 @@ -# No used, installation is performed by d/rules directly -#usr/lib/*/lib*.so.* +usr/lib/*/lib*.so.* diff -Nru schroedinger-coordgenlibs-1.1/debian/libschroedinger-coordgenlibs-dev.install schroedinger-coordgenlibs-1.3/debian/libschroedinger-coordgenlibs-dev.install --- schroedinger-coordgenlibs-1.1/debian/libschroedinger-coordgenlibs-dev.install 2018-12-03 16:15:24.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/libschroedinger-coordgenlibs-dev.install 2019-07-22 01:05:31.000000000 +0000 @@ -1,3 +1,3 @@ -#No used, installation is performed by d/rules directly -#usr/include/* -#usr/lib/*/lib*.so +usr/include/* +usr/lib/*/lib*.so +usr/lib/*/cmake diff -Nru schroedinger-coordgenlibs-1.1/debian/patches/cmake-config.patch schroedinger-coordgenlibs-1.3/debian/patches/cmake-config.patch --- schroedinger-coordgenlibs-1.1/debian/patches/cmake-config.patch 2019-07-21 16:47:06.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/patches/cmake-config.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ ---- ./CMakeLists.txt.orig 2019-07-21 13:45:37.597552410 -0300 -+++ ./CMakeLists.txt 2019-07-21 13:46:58.126156754 -0300 -@@ -30,10 +30,15 @@ - enable_testing() - - install(TARGETS coordgenlibs -+ EXPORT coordgenlibs-targets - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib) - -+INSTALL(EXPORT coordgenlibs-targets -+ FILE ${PROJECT_NAME}-config.cmake -+ DESTINATION lib/cmake) -+ - install(FILES - CoordgenFragmentBuilder.h - CoordgenFragmenter.h diff -Nru schroedinger-coordgenlibs-1.1/debian/patches/cmake_standard_dirs.patch schroedinger-coordgenlibs-1.3/debian/patches/cmake_standard_dirs.patch --- schroedinger-coordgenlibs-1.1/debian/patches/cmake_standard_dirs.patch 1970-01-01 00:00:00.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/patches/cmake_standard_dirs.patch 2019-07-22 00:14:27.000000000 +0000 @@ -0,0 +1,43 @@ +--- ./CMakeLists.txt.orig 2019-07-21 21:10:53.738084758 -0300 ++++ ./CMakeLists.txt 2019-07-21 21:12:55.663928479 -0300 +@@ -6,6 +6,8 @@ + option(COORDGEN_BUILD_TESTS "Whether test executables should be built" ON) + option(COORDGEN_BUILD_EXAMPLE "Whether to build the sample executable" ON) + ++include(GNUInstallDirs) ++ + # Dependencies + find_package(Boost COMPONENTS iostreams REQUIRED) + find_package(maeparser REQUIRED) +@@ -30,9 +32,9 @@ + # Install configuration + install(TARGETS coordgen + EXPORT coordgen-targets +- ARCHIVE DESTINATION lib +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib) ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + install(FILES + CoordgenConfig.hpp +@@ -55,15 +57,15 @@ + sketcherMinimizerResidueInteraction.h + sketcherMinimizerRing.h + sketcherMinimizerStretchInteraction.h +- DESTINATION include/coordgen) ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/coordgen) + + install(FILES + templates.mae +- DESTINATION share/coordgen) ++ DESTINATION ${CMAKE_INSTALL_DATADIR}/coordgen) + + install(EXPORT coordgen-targets + FILE ${PROJECT_NAME}-config.cmake +- DESTINATION lib/cmake) ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake) + + # Example + if(COORDGEN_BUILD_EXAMPLE) diff -Nru schroedinger-coordgenlibs-1.1/debian/patches/series schroedinger-coordgenlibs-1.3/debian/patches/series --- schroedinger-coordgenlibs-1.1/debian/patches/series 2019-07-21 15:04:30.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/patches/series 2019-07-22 00:13:20.000000000 +0000 @@ -1,2 +1 @@ -SOVERSION.patch -cmake-config.patch +cmake_standard_dirs.patch diff -Nru schroedinger-coordgenlibs-1.1/debian/patches/SOVERSION.patch schroedinger-coordgenlibs-1.3/debian/patches/SOVERSION.patch --- schroedinger-coordgenlibs-1.1/debian/patches/SOVERSION.patch 2018-12-03 16:15:24.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/patches/SOVERSION.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Index: schroedinger-coordgenlibs-1.1/CMakeLists.txt -=================================================================== ---- schroedinger-coordgenlibs-1.1.orig/CMakeLists.txt -+++ schroedinger-coordgenlibs-1.1/CMakeLists.txt -@@ -18,6 +18,11 @@ include_directories(${maeparser_INCLUDE_ - add_library(coordgenlibs SHARED ${SOURCES}) - target_compile_definitions(coordgenlibs PRIVATE IN_COORDGEN) - set_property(TARGET coordgenlibs PROPERTY CXX_VISIBILITY_PRESET "hidden") -+SET_TARGET_PROPERTIES(coordgenlibs -+ PROPERTIES -+ VERSION 1.1 -+ SOVERSION 1 -+) - add_executable(example example/example.cpp) - - target_link_libraries(coordgenlibs maeparser) diff -Nru schroedinger-coordgenlibs-1.1/debian/rules schroedinger-coordgenlibs-1.3/debian/rules --- schroedinger-coordgenlibs-1.1/debian/rules 2019-07-21 20:00:40.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/debian/rules 2019-07-22 01:02:34.000000000 +0000 @@ -4,15 +4,9 @@ export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed +DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) %: dh $@ -override_dh_install: - mkdir -p $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/include/coordgen - mkdir -p $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/lib/$$(dpkg-architecture -qDEB_HOST_MULTIARCH) - mkdir -p $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/share/cmake - cp *.h *.hpp $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/include/coordgen/ - mv */*.so $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/lib/$$(dpkg-architecture -qDEB_HOST_MULTIARCH) - cp obj-*/CMakeFiles/Export/lib/cmake/*.cmake $(CURDIR)/debian/libschroedinger-coordgenlibs-dev/usr/share/cmake - mkdir -p $(CURDIR)/debian/libschroedinger-coordgenlibs1/usr/lib/$$(dpkg-architecture -qDEB_HOST_MULTIARCH) - mv */*.so.* $(CURDIR)/debian/libschroedinger-coordgenlibs1/usr/lib/$$(dpkg-architecture -qDEB_HOST_MULTIARCH) +override_dh_auto_configure: + dh_auto_configure -- -DCMAKE_PREFIX_PATH=/usr/lib/$(DEB_HOST_MULTIARCH)/cmake diff -Nru schroedinger-coordgenlibs-1.1/example/example.cpp schroedinger-coordgenlibs-1.3/example/example.cpp --- schroedinger-coordgenlibs-1.1/example/example.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/example/example.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -#include -#include "../sketcherMinimizer.h" - -int main() -{ - sketcherMinimizer minimizer; - - /*create a molecule*/ - sketcherMinimizerMolecule *min_mol = new sketcherMinimizerMolecule(); - - /*add an atom and set its parameters*/ - auto a1 = min_mol->addNewAtom(); - a1->setAtomicNumber(7); - - auto a2 = min_mol->addNewAtom(); - a2->setAtomicNumber(6); - - - /*add a bond and set its parameters*/ - auto b1 = min_mol->addNewBond(a1, a2); - b1->setBondOrder(1); - - /*load minimizer*/ - minimizer.initialize(min_mol); - - /*generate coordinates*/ - minimizer.runGenerateCoordinates(); - - /*print coordinates*/ - auto c1 = a1->getCoordinates(); - auto c2 = a2->getCoordinates(); - std::cerr << c1<<" "< +#include "../sketcherMinimizer.h" + +int main() +{ + sketcherMinimizer minimizer; + + /* create a molecule */ + sketcherMinimizerMolecule* min_mol = new sketcherMinimizerMolecule(); + + /* add an atom and set its parameters */ + auto a1 = min_mol->addNewAtom(); + a1->setAtomicNumber(7); + + auto a2 = min_mol->addNewAtom(); + a2->setAtomicNumber(6); + + /* add a bond and set its parameters */ + auto b1 = min_mol->addNewBond(a1, a2); + b1->setBondOrder(1); + + /* load minimizer */ + minimizer.initialize(min_mol); + + /* generate coordinates */ + minimizer.runGenerateCoordinates(); + + /* print coordinates */ + auto c1 = a1->getCoordinates(); + auto c2 = a2->getCoordinates(); + std::cerr << c1 << " " << c2 << std::endl; + return 0; +} diff -Nru schroedinger-coordgenlibs-1.1/README.md schroedinger-coordgenlibs-1.3/README.md --- schroedinger-coordgenlibs-1.1/README.md 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/README.md 2019-07-11 19:04:54.000000000 +0000 @@ -11,5 +11,11 @@ ### Documentation Examples and documentation will be added/improved over time +### Usage example +Code for a sample executable is provided in the `example_dir` directory. Building the example executable is enabled by default, but can be disabled by means of the `COORDGEN_BUILD_EXAMPLE` option. + ### Automated Testing -Automated testing is still primarily taking place inside Schrodinger's internal build system +Automated testing is still primarily taking place inside Schrodinger's internal build system, although tests are incrementally being added to the `testing` directory. Building the tests is enabled by default, but can be disabled by means of the `COORDGEN_BUILD_TESTS` option. + +Memory debugging is, by default, configured to use `valgrind`. It can be run on the tests by passing `-DCMAKE_BUILD_TYPE=Debug` to cmake, to enable building the debugging symbols, and then using `ctest -T memcheck` inside the build directory. + diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerAtom.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizerAtom.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizerAtom.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerAtom.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -18,12 +18,12 @@ bool CIPAtom::operator<(const CIPAtom& rhs) const { - /*check if this has priority over rhs. An atom is better than another if it + /* check if this has priority over rhs. An atom is better than another if it has a parent in the chain that gets priority. Parents are evaluated starting from the furthest to the closest. Priority is assigned to the atom with highest atomic number, or has been found to have priority due to its children in previous iterations of the - algoirthm (scores) or in the present iteration (medals) + algorithm (scores) or in the present iteration (medals) */ assert(allParents.size() == rhs.allParents.size()); for (unsigned int i = 0; i < allParents.size(); i++) { @@ -173,13 +173,12 @@ sketcherMinimizerAtom::~sketcherMinimizerAtom(){}; sketcherMinimizerAtom::sketcherMinimizerAtom() -: crossLayout(false), fixed(false), constrained(false), rigid(false), -isSharedAndInner(false), atomicNumber(6), charge(0), _valence(-10), -_generalUseN(-1), _generalUseN2(-1), m_chmN(-1), -_generalUseVisited(false), _generalUseVisited2(false), -fragment(NULL), needsCheckForClashes(false), visited(false), -coordinatesSet(false), isR(true), hasStereochemistrySet(false), -_hasRingChirality(false) + : crossLayout(false), fixed(false), constrained(false), rigid(false), + isSharedAndInner(false), atomicNumber(6), charge(0), _valence(-10), + _generalUseN(-1), _generalUseN2(-1), m_chmN(-1), + _generalUseVisited(false), _generalUseVisited2(false), fragment(NULL), + needsCheckForClashes(false), visited(false), coordinatesSet(false), + isR(true), hasStereochemistrySet(false), _hasRingChirality(false) { hidden = false; m_pseudoZ = 0.f; @@ -199,8 +198,8 @@ sketcherMinimizerAtom::shareARing(const sketcherMinimizerAtom* atom1, const sketcherMinimizerAtom* atom2) { - /*return a ring shared by the two atoms. return a non-macrocycle if - * possible*/ + /* return a ring shared by the two atoms. return a non-macrocycle if + * possible */ if (!atom1->rings.size()) return NULL; if (!atom2->rings.size()) @@ -587,16 +586,21 @@ } sketcherMinimizerAtomChiralityInfo::sketcherMinimizerChirality - sketcherMinimizerAtom::getRelativeStereo(sketcherMinimizerAtom* lookingFrom, - sketcherMinimizerAtom* atom1, - sketcherMinimizerAtom* atom2) +sketcherMinimizerAtom::getRelativeStereo(sketcherMinimizerAtom* lookingFrom, + sketcherMinimizerAtom* atom1, + sketcherMinimizerAtom* atom2) { readStereochemistry(); // to set m_RSPriorities auto RSpriorities = m_RSPriorities; if (RSpriorities.size() < 3) { - return sketcherMinimizerAtomChiralityInfo::unspecified;; + return sketcherMinimizerAtomChiralityInfo::unspecified; + ; } vector priorities(4, 3); + + /* order the CIP priority of the atoms in the following order + atom1 - atom2 - atom3 - atomLookingFrom + */ for (unsigned int nn = 0; nn < neighbors.size(); nn++) { sketcherMinimizerAtom* n = neighbors[nn]; if (n == atom1) { @@ -606,39 +610,44 @@ priorities[1] = RSpriorities[nn]; } else if (n == lookingFrom) { priorities[3] = RSpriorities[nn]; - } - else { + } else { priorities[2] = RSpriorities[nn]; } } - bool invert = false; vector can(4); for (unsigned int i = 0; i < 4; i++) can[i] = i; - if (!sketcherMinimizerAtom::matchCIPSequence(priorities, can)) - invert = !invert; - bool isRBool = isR; - if (invert) isRBool = !isRBool; - if (isRBool) return sketcherMinimizerAtomChiralityInfo::clockwise; + /* + this represents a molecule with + atom1 (priority 0 - highest) + atom2 (priority 1) + atom3 (priority 2) + atomLookingFrom (priority 3 -lowest) + which is the opposite of the CIP rules, where the the lowest priority atom + is AWAY from the observer. This is the reason why we return CCW for R and + CW for S. + */ + bool match = sketcherMinimizerAtom::matchCIPSequence(priorities, can); + bool isClockWise = (match ? !isR : isR); + if (isClockWise) + return sketcherMinimizerAtomChiralityInfo::clockwise; return sketcherMinimizerAtomChiralityInfo::counterClockwise; } - bool sketcherMinimizerAtom::setAbsoluteStereoFromChiralityInfo() { auto info = m_chiralityInfo; if (info.direction == sketcherMinimizerAtomChiralityInfo::unspecified) - return true; + return true; readStereochemistry(); // to set m_RSPriorities auto RSpriorities = m_RSPriorities; ; if (RSpriorities.size() < 3) { cerr << "CHMMol-> sketcher stereo error: wrong number for RSpriorities" - << endl; + << endl; return false; } - vector priorities(4, 5); bool at3 = false; @@ -655,8 +664,8 @@ } else { if (at3) { cerr << "CHMMol-> sketcher stereo error: more than 1 atom not " - "matching" - << endl; + "matching" + << endl; return false; } else { @@ -684,7 +693,7 @@ } if (addingHN > 1) { cerr << "CHMMol-> sketcher stereo error: more than 1 H on chiral center" - << endl; + << endl; return false; } @@ -692,22 +701,20 @@ vector can(4); for (unsigned int i = 0; i < 4; i++) - can[i] = i; + can[i] = i; if (!sketcherMinimizerAtom::matchCIPSequence(priorities, can)) - invert = !invert; + invert = !invert; bool isRBool = true; if (info.direction == sketcherMinimizerAtomChiralityInfo::clockwise) - isRBool = false; + isRBool = false; if (invert) - isRBool = !isRBool; + isRBool = !isRBool; isR = isRBool; hasStereochemistrySet = true; writeStereoChemistry(); return true; } - - bool sketcherMinimizerAtom::matchCIPSequence(vector& v1, vector& v2) { @@ -738,7 +745,6 @@ return true; } - void sketcherMinimizerAtom::setCoordinates(sketcherMinimizerPointF coords) { coordinates = coords; @@ -810,7 +816,7 @@ if (center->crossLayout) if (atomPriorities[i].a->neighbors.size() > 1) weights[i] += 200; - if (/*atomPriorities[i].a->isStereogenic &&*/ atomPriorities[i] + if (/* atomPriorities[i].a->isStereogenic && */ atomPriorities[i] .a->hasStereochemistrySet) weights[i] += 10000; // to avoid problems with wedges when 2 // stereocenters are near @@ -867,7 +873,8 @@ } if (atomPriorities.size() != 4) { // cerr << "coordgen: stereo error. (wrong number of atom priorities: - // "<< atomPriorities.size () << ")"<* visited = oldV[an].visited; @@ -1139,7 +1146,7 @@ score--; } } - /*write the score*/ + /* write the score */ for (unsigned int pC = 0; pC < v[i].allParents.size(); pC++) { if ((*scores)[v[i].allParents[pC]] == 0) (*scores)[v[i].allParents[pC]] = score; @@ -1431,8 +1438,8 @@ return true; } -/*get a vector that points out towards the most free region of space around the - * atom. Used to determined where an arrow to the atom will point from*/ +/* get a vector that points out towards the most free region of space around the + * atom. Used to determined where an arrow to the atom will point from */ sketcherMinimizerPointF sketcherMinimizerAtom::getSingleAdditionVector( vector ats) { diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerAtom.h schroedinger-coordgenlibs-1.3/sketcherMinimizerAtom.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerAtom.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerAtom.h 2019-07-11 19:04:54.000000000 +0000 @@ -9,14 +9,13 @@ #ifndef sketcherMINIMIZERATOM_H #define sketcherMINIMIZERATOM_H -//#include +// #include #include #include #include #include "CoordgenConfig.hpp" #include "sketcherMinimizerMaths.h" - static const int COORDINATES_LIMIT = 10000000; static const int INVALID_COORDINATES = COORDINATES_LIMIT + 1; @@ -32,7 +31,6 @@ float priority; } sketcherMinimizerAtomPriority; - struct sketcherMinimizerAtomChiralityInfo { enum sketcherMinimizerChirality { clockwise, @@ -44,10 +42,9 @@ sketcherMinimizerAtom* atom1 = nullptr; sketcherMinimizerAtom* atom2 = nullptr; sketcherMinimizerChirality direction = unspecified; - }; -/*structure to represent an atom in Cahn–Ingold–Prelog priorities assignment*/ +/* structure to represent an atom in Cahn–Ingold–Prelog priorities assignment */ struct CIPAtom { CIPAtom(std::vector> us, sketcherMinimizerAtom* dad, @@ -82,14 +79,12 @@ friend std::ostream& operator<<(std::ostream& os, const CIPAtom& a); }; -/*class to represent an atom*/ -class sketcherMinimizerAtom +/* class to represent an atom */ +class EXPORT_COORDGEN sketcherMinimizerAtom { public: - EXPORT_COORDGEN sketcherMinimizerAtom(); - virtual EXPORT_COORDGEN ~sketcherMinimizerAtom(); - - + sketcherMinimizerAtom(); + virtual ~sketcherMinimizerAtom(); bool crossLayout; // atoms with 4 substituents displayed in a cross style // (such as S in sulphate) @@ -145,37 +140,38 @@ bool _hasRingChirality; // used to keep track of cyclohexane cis/trans // chirality - /*write coordinates to atom*/ - void EXPORT_COORDGEN setCoordinates(sketcherMinimizerPointF coords); + /* write coordinates to atom */ + void setCoordinates(sketcherMinimizerPointF coords); - /*check that the atom has no double bonds possibly involved in E/Z stereochemistry*/ + /* check that the atom has no double bonds possibly involved in E/Z + * stereochemistry */ bool hasNoStereoActiveBonds() const; sketcherMinimizerPointF getCoordinates() const { return coordinates; } int getAtomicNumber() const { return atomicNumber; } - void setAtomicNumber(int number) {atomicNumber = number;} + void setAtomicNumber(int number) { atomicNumber = number; } - void setStereoChemistry(sketcherMinimizerAtomChiralityInfo info) { + void setStereoChemistry(sketcherMinimizerAtomChiralityInfo info) + { m_chiralityInfo = info; } - /*write template coordinates to atom*/ + /* write template coordinates to atom */ void setCoordinatesToTemplate() { setCoordinates(templateCoordinates); } sketcherMinimizerPointF coordinates; sketcherMinimizerPointF templateCoordinates; sketcherMinimizerPointF force; - /*return the expected valence for the atom*/ + /* return the expected valence for the atom */ unsigned int expectedValence(unsigned int atomicNumber) const; - bool canBeChiral() const; // checks if the atom can have 4 substituents (one // can be implicit H). Doesn't actually check if // two of them are the same, so can return true // for achiral centers - /*return true if this and at2 share a bond*/ + /* return true if this and at2 share a bond */ bool isNeighborOf(sketcherMinimizerAtom* at2) const { for (unsigned int i = 0; i < at2->neighbors.size(); i++) { @@ -186,25 +182,25 @@ } sketcherMinimizerAtomChiralityInfo::sketcherMinimizerChirality - getRelativeStereo(sketcherMinimizerAtom* lookingFrom, - sketcherMinimizerAtom* atom1, - sketcherMinimizerAtom* atom2); - bool EXPORT_COORDGEN setAbsoluteStereoFromChiralityInfo(); + getRelativeStereo(sketcherMinimizerAtom* lookingFrom, + sketcherMinimizerAtom* atom1, + sketcherMinimizerAtom* atom2); + bool setAbsoluteStereoFromChiralityInfo(); - /*if this atom and the given one share a bond, return it*/ + /* if this atom and the given one share a bond, return it */ sketcherMinimizerBond* bondTo(sketcherMinimizerAtom* at) const; - /*return all bonded atoms, ordered as they appear clockwise around this*/ + /* return all bonded atoms, ordered as they appear clockwise around this */ std::vector clockwiseOrderedNeighbors() const; unsigned int findHsNumber() const; - void EXPORT_COORDGEN writeStereoChemistry(); // assignes up-down bond flags based on isR and + void writeStereoChemistry(); // assigns up-down bond flags based on isR and // hasStereochemistrySet - /*return true if the two sequences represent the same isomer*/ + /* return true if the two sequences represent the same isomer */ static bool matchCIPSequence(std::vector& v1, std::vector& v2); - /*calculate CIP priorities and assign them*/ + /* calculate CIP priorities and assign them */ static bool setCIPPriorities(std::vector& atomPriorities, sketcherMinimizerAtom* center); @@ -215,61 +211,59 @@ // position 2 and 3 and side // substituents in 1 and 4 - /*return which between at1 and at2 has higher CIP priority. Returns NULL if they have the same*/ - static EXPORT_COORDGEN sketcherMinimizerAtom* CIPPriority(sketcherMinimizerAtom* at1, + /* return which between at1 and at2 has higher CIP priority. Returns NULL if + * they have the same */ + static sketcherMinimizerAtom* CIPPriority(sketcherMinimizerAtom* at1, sketcherMinimizerAtom* at2, sketcherMinimizerAtom* center); - /*consider one additional level of bound atoms in the CIP algorithm to break a tie*/ + /* consider one additional level of bound atoms in the CIP algorithm to + * break a tie */ static std::vector expandOneLevel(std::vector& oldV); /* if any ties between parent atoms was solved, assign two different scores - to them. Also clear the medals for the next iteration*/ + to them. Also clear the medals for the next iteration */ static void finalizeScores(std::vector& v); /* medals are used to mark parent atoms according to the priorities of their - children and also their numbers.*/ + children and also their numbers. */ static void assignMedals(std::vector& v); - /*first atom will be the highest priority, subsequent will be based on atoms - that have already been picked, giving priorities - to branches that have been already been visited. friendsMask keeps track of - parents that have a child that has been already selected*/ + /* first atom will be the highest priority, subsequent will be based on + * atoms that have already been picked, giving priorities to branches that + * have been already been visited. friendsMask keeps track of parents that + * have a child that has been already selected */ static void chooseFirstAndSortAccordingly(std::vector& V); - /*if the two atoms share a ring, return it*/ + /* if the two atoms share a ring, return it */ static sketcherMinimizerRing* shareARing(const sketcherMinimizerAtom* atom1, const sketcherMinimizerAtom* atom2); - /*mirror the coordinates of at wrt bond*/ + /* mirror the coordinates of at wrt bond */ static void mirrorCoordinates(sketcherMinimizerAtom* at, const sketcherMinimizerBond* bond); - /*return the stereochemistry set in the wedges around the atom. 0 if not assigned, 1 if R, -1 if S*/ - int EXPORT_COORDGEN readStereochemistry( - bool readOnly = false); - + /* return the stereochemistry set in the wedges around the atom. 0 if not + * assigned, 1 if R, -1 if S */ + int readStereochemistry(bool readOnly = false); - /*return a direction perpendicular to the atom's bonds average*/ + /* return a direction perpendicular to the atom's bonds average */ sketcherMinimizerPointF getSingleAdditionVector() const; static sketcherMinimizerPointF getSingleAdditionVector(std::vector ats); - /*return true if the atom has valid 3d coordinates*/ - bool EXPORT_COORDGEN hasValid3DCoordinates() const; - - /*return true if the atom is a residue*/ - virtual bool EXPORT_COORDGEN isResidue() const; + /* return true if the atom has valid 3d coordinates */ + bool hasValid3DCoordinates() const; - /*return true if atomicNumber represents a metal*/ - static bool EXPORT_COORDGEN isMetal(const unsigned int atomicNumber); + /* return true if the atom is a residue */ + virtual bool isResidue() const; + /* return true if atomicNumber represents a metal */ + static bool isMetal(const unsigned int atomicNumber); sketcherMinimizerAtomChiralityInfo m_chiralityInfo; }; - - #endif // sketcherMINIMIZERATOM_H diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerBendInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerBendInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerBendInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerBendInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -15,7 +15,7 @@ #define M_PI 3.1415926535897931 #endif -/*forcefield class to represent angle bends*/ +/* forcefield class to represent angle bends */ class sketcherMinimizerBendInteraction : public sketcherMinimizerInteraction { public: @@ -32,8 +32,8 @@ }; virtual ~sketcherMinimizerBendInteraction(){}; - /*calculate energy associated with the current state*/ - virtual void energy(float& e) + /* calculate energy associated with the current state */ + void energy(float& e) override { float dA = angle() - restV; e += 0.5f * k * k2 * dA * dA * 10; @@ -41,8 +41,8 @@ // qDebug () << restV << " " << angle ()<force -= n1 + n2; }; - /*calculate angle between the three atoms*/ + /* calculate angle between the three atoms */ float angle() { float x1 = atom1->coordinates.x(); diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerBond.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizerBond.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizerBond.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerBond.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -59,22 +59,26 @@ return NULL; } -void sketcherMinimizerBond::setAbsoluteStereoFromStereoInfo() { +void sketcherMinimizerBond::setAbsoluteStereoFromStereoInfo() +{ if (isStereo() && m_stereo.atom1 != nullptr && m_stereo.atom2 != nullptr) { auto firstCIPNeighborStart = startAtomCIPFirstNeighbor(); auto firstCIPNeighborEnd = endAtomCIPFirstNeighbor(); if (firstCIPNeighborStart != nullptr && firstCIPNeighborEnd) { bool invert = false; - if (m_stereo.atom1 != firstCIPNeighborStart && m_stereo.atom1 != firstCIPNeighborEnd) { + if (m_stereo.atom1 != firstCIPNeighborStart && + m_stereo.atom1 != firstCIPNeighborEnd) { invert = !invert; } - if (m_stereo.atom2 != firstCIPNeighborStart && m_stereo.atom2 != firstCIPNeighborEnd) { + if (m_stereo.atom2 != firstCIPNeighborStart && + m_stereo.atom2 != firstCIPNeighborEnd) { invert = !invert; } - bool settingIsZ = (m_stereo.stereo == sketcherMinimizerBondStereoInfo::cis); - if (invert) settingIsZ = !settingIsZ; + bool settingIsZ = + (m_stereo.stereo == sketcherMinimizerBondStereoInfo::cis); + if (invert) + settingIsZ = !settingIsZ; isZ = settingIsZ; - } } if (m_stereo.stereo == sketcherMinimizerBondStereoInfo::unspecified) { @@ -82,7 +86,6 @@ } } - bool sketcherMinimizerBond::checkStereoChemistry() const { if (!isStereo()) diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerBond.h schroedinger-coordgenlibs-1.3/sketcherMinimizerBond.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerBond.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerBond.h 2019-07-11 19:04:54.000000000 +0000 @@ -9,30 +9,23 @@ #ifndef sketcherMINIMIZERBOND_H #define sketcherMINIMIZERBOND_H - #include #include #include "CoordgenConfig.hpp" - class sketcherMinimizerRing; class sketcherMinimizerAtom; - struct sketcherMinimizerBondStereoInfo { - enum sketcherMinimizerBondStereo { - cis, - trans, - unspecified - }; + enum sketcherMinimizerBondStereo { cis, trans, unspecified }; sketcherMinimizerAtom* atom1 = nullptr; sketcherMinimizerAtom* atom2 = nullptr; sketcherMinimizerBondStereo stereo = unspecified; }; -/*class to represent a covalent bond*/ -class sketcherMinimizerBond +/* class to represent a covalent bond */ +class EXPORT_COORDGEN sketcherMinimizerBond { public: sketcherMinimizerBond() @@ -43,8 +36,10 @@ rings() { } - sketcherMinimizerBond(sketcherMinimizerAtom* at1, sketcherMinimizerAtom*at2) : - sketcherMinimizerBond() { + sketcherMinimizerBond(sketcherMinimizerAtom* at1, + sketcherMinimizerAtom* at2) + : sketcherMinimizerBond() + { startAtom = at1; endAtom = at2; } @@ -57,48 +52,55 @@ sketcherMinimizerAtom* getStartAtom() const { return startAtom; } sketcherMinimizerAtom* getEndAtom() const { return endAtom; } - /*return bond order*/ + /* return bond order */ int getBondOrder() const { return bondOrder; } - void setBondOrder(int order) {bondOrder = order;} - + void setBondOrder(int order) { bondOrder = order; } - void setStereoChemistry(sketcherMinimizerBondStereoInfo stereo) {m_stereo = stereo;} + void setStereoChemistry(sketcherMinimizerBondStereoInfo stereo) + { + m_stereo = stereo; + } - void EXPORT_COORDGEN setAbsoluteStereoFromStereoInfo(); + void setAbsoluteStereoFromStereoInfo(); - /*return true if the bond is part of a small ring (i.e. 8 members or less)*/ + /* return true if the bond is part of a small ring (i.e. 8 members or less) + */ bool isInSmallRing() const; - /*return true if the bond is part of a macrocycle*/ + /* return true if the bond is part of a macrocycle */ bool isInMacrocycle() const; - /*return true if the bond is to a terminal atom*/ + /* return true if the bond is to a terminal atom */ bool isTerminal() const; /* does this bond separate two rigid fragments? i.e. is bond a single rotatable bond to a non-terminal atom? */ - bool EXPORT_COORDGEN isInterFragment() const; + bool isInterFragment() const; bool isStereo() const; - /*given atom1 and atom2 as substituents on the two sides of a double bond, + /* given atom1 and atom2 as substituents on the two sides of a double bond, should they be put in cis? */ bool markedAsCis(sketcherMinimizerAtom* atom1, sketcherMinimizerAtom* atom2) const; - /*flip the current bond, mirroring the coordinates of all the atoms on one side of it*/ - void EXPORT_COORDGEN flip(); + /* flip the current bond, mirroring the coordinates of all the atoms on one + * side of it */ + void flip(); - /*get the atom bound to the start atom of the bond with the highest CIP priority*/ + /* get the atom bound to the start atom of the bond with the highest CIP + * priority */ sketcherMinimizerAtom* startAtomCIPFirstNeighbor() const; - /*get the atom bound to the end atom of the bond with the highest CIP priority*/ + /* get the atom bound to the end atom of the bond with the highest CIP + * priority */ sketcherMinimizerAtom* endAtomCIPFirstNeighbor() const; - /*return true if the E/Z stereochemistry as read from the atoms coordinates matches the label*/ + /* return true if the E/Z stereochemistry as read from the atoms coordinates + * matches the label */ bool checkStereoChemistry() const; int bondOrder; bool skip; @@ -106,8 +108,8 @@ bool isZ; // used for double bonds to distinguish Z from E form. bonds // default to E - int m_chmN = -1; // idx of the corresponding ChmAtom if molecule comes from 3d - + int m_chmN = + -1; // idx of the corresponding ChmAtom if molecule comes from 3d sketcherMinimizerBondStereoInfo m_stereo; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerClashInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerClashInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerClashInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerClashInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -13,7 +13,7 @@ #include #include "sketcherMinimizerMaths.h" -/*forcefield clash*/ +/* forcefield clash */ class sketcherMinimizerClashInteraction : public sketcherMinimizerInteraction { public: @@ -29,8 +29,8 @@ }; virtual ~sketcherMinimizerClashInteraction(){}; - /*calculate the energy of the clash*/ - virtual void energy(float& e) + /* calculate the energy of the clash */ + void energy(float& e) override { float squaredDistance = sketcherMinimizerMaths::squaredDistancePointSegment( @@ -43,8 +43,8 @@ e += 0.5f * k * k2 * dr; }; - /*calculate the forces of the clash and apply them*/ - void score(float& totalE, bool skipForce = false) + /* calculate the forces of the clash and apply them */ + void score(float& totalE, bool skipForce = false) override { energy(totalE); if (skipForce) @@ -68,7 +68,7 @@ atom1->force -= f * 0.5; atom3->force -= f * 0.5; } - bool isClash() { return true; }; + bool isClash() override { return true; }; float k2; sketcherMinimizerAtom* atom3; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerConstraintInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerConstraintInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerConstraintInteraction.h 1970-01-01 00:00:00.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerConstraintInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * sketcherMinimizerConstraintInteraction.h + * + * Created by Nicola Zonta on 7/02/2019. + * Copyright Schrodinger, LLC. All rights reserved. + * + */ + +#ifndef sketcherMINIMIZERCONSTRAINTINTERACTION +#define sketcherMINIMIZERCONSTRAINTINTERACTION + +#include "sketcherMinimizerInteraction.h" + +static const float CONSTRAINT_SCALE = .5f; +/* force field bond stretches */ +class sketcherMinimizerConstraintInteraction + : public sketcherMinimizerInteraction +{ + public: + sketcherMinimizerConstraintInteraction(sketcherMinimizerAtom* at1, + sketcherMinimizerPointF position) + : sketcherMinimizerInteraction(at1, at1), origin(position) + { + k = CONSTRAINT_SCALE; + }; + virtual ~sketcherMinimizerConstraintInteraction(){}; + + /* calculate the energy of the interaction */ + void energy(float& e) override + { + e += k * sketcherMinimizerMaths::squaredDistance(atom1->coordinates, + origin); + }; + + /* calculate the forces and apply them */ + void score(float& totalE, bool = false) override + { + energy(totalE); + return; + }; + + private: + sketcherMinimizerPointF origin; +}; + +#endif // sketcherMINIMIZERCONSTRAINTINTERACTION diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizer.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizer.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizer.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizer.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -19,11 +19,10 @@ #include "CoordgenFragmenter.h" #include "CoordgenMacrocycleBuilder.h" #include "maeparser/Reader.hpp" -#include +#include using namespace std; - #define RESIDUE_CLASH_DISTANCE_SQUARED 2.0 * 2.0 #ifndef M_PI @@ -283,7 +282,6 @@ return cleanPose; } - void sketcherMinimizer::flagCrossAtoms() { foreach (sketcherMinimizerAtom* at, _atoms) @@ -406,7 +404,6 @@ _molecules.clear(); } - /* void sketcherMinimizer::initializeFromMolecule(ChmMol& mol) { @@ -772,6 +769,7 @@ void sketcherMinimizer::maybeFlip() { + foreach (sketcherMinimizerMolecule* mol, _molecules) { if (mol->hasFixedFragments) continue; @@ -938,7 +936,7 @@ angles.push_back(pair(weight, angle)); } -/*if a peptide chain is present rotate the molecule so it's horizontal*/ +/* if a peptide chain is present rotate the molecule so it's horizontal */ void sketcherMinimizer::addBestRotationInfoForPeptides( vector>& angles, std::vector atoms) @@ -969,14 +967,8 @@ { foreach (sketcherMinimizerMolecule* mol, _molecules) { vector> angles; - if (mol->hasFixedFragments) + if (mol->hasFixedFragments || mol->hasConstrainedFragments) continue; - if (mol->getMainFragment()) { - if (mol->getMainFragment()->constrained) - continue; - if (mol->getMainFragment()->isTemplated) - continue; - } addBestRotationInfoForPeptides(angles, mol->getAtoms()); float angle = 0.f; float lastAngle; @@ -1289,7 +1281,6 @@ } } - std::vector sketcherMinimizer::orderResiduesOfChains( std::map> chains) { @@ -1357,9 +1348,9 @@ } } - /*when searching for a position for res prefer a direction perpendicular - to the direction of interactions - to optimize use of space*/ + /* when searching for a position for res prefer a direction + * perpendicular to the direction of interactions to optimize use of + * space */ sketcherMinimizerPointF direction(0, 1); if (firstPartner) { sketcherMinimizerPointF chainCenterDirections = @@ -1391,9 +1382,8 @@ void sketcherMinimizer::placeResiduesInCrowns() { auto SSEs = groupResiduesInSSEs(_residues); - /*sort secondary structure elements so that the most importants are placed - first. - prefer longer SSEs and ones that make more interactions*/ + /* sort secondary structure elements so that the most importants are placed + * first. prefer longer SSEs and ones that make more interactions */ sort(SSEs.begin(), SSEs.end(), [](const vector& firstSSE, const vector& secondSSE) { @@ -1417,8 +1407,7 @@ int shapeCounter = 0; // place residues in a crowns around the ligand. Keep expanding to further - // away crowns - // until all residues are placed + // away crowns until all residues are placed while (needOtherShape) { vector shape = shapeAroundLigand(shapeCounter++); @@ -1426,8 +1415,8 @@ } } -/*place residues in SSEs in the current shape. Return false if all residues are - * place, true otherwise*/ +/* place residues in SSEs in the current shape. Return false if all residues are + * place, true otherwise */ bool sketcherMinimizer::fillShape( vector>& SSEs, const vector& shape, int shapeN) @@ -1440,8 +1429,8 @@ return !outliers.empty(); } -/*assign a penalty for the stretching of bonds between residues in the same - * SSE*/ +/* assign a penalty for the stretching of bonds between residues in the same + * SSE */ float sketcherMinimizer::scoreSSEBondStretch( sketcherMinimizerPointF coordinates1, sketcherMinimizerPointF coordinates2) { @@ -1450,7 +1439,6 @@ return squaredLength * stretchPenalty; } - float sketcherMinimizer::getResidueDistance( float startF, float increment, sketcherMinimizerResidue* resToConsider, vector SSE) @@ -1460,8 +1448,8 @@ for (auto res : SSE) { if (lastRes) { float result = res->resnum - lastRes->resnum; - /*if the gap is more than 1, make the distance a bit smaller for - * aesthetic reasons*/ + /* if the gap is more than 1, make the distance a bit smaller for + * aesthetic reasons */ result = 1 + (result - 1) * 0.8; if (result < 1.f) result = 1.f; @@ -1474,8 +1462,8 @@ return totalF; } -/*return a score for the placing on the SSE starting at startingPosition and - * separated by increment*/ +/* return a score for the placing on the SSE starting at startingPosition and + * separated by increment */ float sketcherMinimizer::scoreSSEPosition( vector SSE, const vector& shape, int shapeN, @@ -1534,9 +1522,8 @@ } typedef pair Solution; vector> scoredSolutions; - /*move around the crown scoring possible solutions, varying the starting - position - and the separation between consecutive residues*/ + /* move around the crown scoring possible solutions, varying the starting + * position and the separation between consecutive residues */ for (float f = 0.f; f < 1.f; f += 0.004f) { float distance = 5.f / shape.size(); for (float increment = -1 * distance; increment <= 1 * distance; @@ -1587,7 +1574,6 @@ } } - void sketcherMinimizer::markSolution( pair solution, vector SSE, const vector& shape, vector& penalties, @@ -1718,7 +1704,7 @@ minY -= border + maxPocketD; maxY += border + maxPocketD; - /*run a marching square algorithm on a grid of x_interval spacing*/ + /* run a marching square algorithm on a grid of x_interval spacing */ sketcherMinimizerMarchingSquares ms; float x_interval = 20.f; ms.initialize(minX, maxX, minY, maxY, x_interval); @@ -1780,7 +1766,7 @@ float sketcherMinimizer::scoreResiduePosition( int index, const vector& shape, int shapeN, - vector& , sketcherMinimizerResidue* residue) + vector&, sketcherMinimizerResidue* residue) { auto position = shape.at(index); float distancePenalty = 0.01f; @@ -1791,7 +1777,7 @@ targets.push_back(interactionPartner); } float interactionsF = 1.f; - if (targets.empty()) { + if (targets.empty() && residue->m_closestLigandAtom != nullptr) { interactionsF = 0.2f; targets.push_back(residue->m_closestLigandAtom); } @@ -2195,7 +2181,7 @@ vector& proximityMols, map& molMap, map& templateCenters, - vector& ) + vector&) { // placing @@ -2242,7 +2228,7 @@ if (atomsN > 0) atomsCenter /= atomsN; - /*positioning */ + /* positioning */ sketcherMinimizerPointF placeNextTo = templateCenters[mol]; placeNextTo *= counterN; @@ -2780,6 +2766,7 @@ assignNumberOfChildrenAtomsFromHere( indf); // recursively assign it to children } + foreach (sketcherMinimizerFragment* f, _fragments) { m_fragmentBuilder.initializeCoordinates(f); } @@ -3097,10 +3084,11 @@ void sketcherMinimizer::constrainAtoms(vector constrained) { - if (constrained.size() == _atoms.size()) { + if (constrained.size() == _referenceAtoms.size()) { for (unsigned int i = 0; i < constrained.size(); i++) { - if (constrained[i]) - _atoms[i]->constrained = true; + if (constrained[i]) { + _referenceAtoms[i]->constrained = true; + } } } else { cerr << "warning, wrong size of vector for constrained atoms. Ignoring" @@ -3110,10 +3098,10 @@ void sketcherMinimizer::fixAtoms(vector fixed) { - if (fixed.size() == _atoms.size()) { + if (fixed.size() == _referenceAtoms.size()) { for (unsigned int i = 0; i < fixed.size(); i++) { if (fixed[i]) - _atoms[i]->fixed = true; + _referenceAtoms[i]->fixed = true; } } else { cerr << "warning, wrong size of vector for fixed atoms. Ignoring" @@ -3321,8 +3309,9 @@ vector> molBonds; vector> templateBonds; - // vector < vector < int > > templateAllowedZChains; //for double bond - // chirality + // for double bond chirality + // vector < vector < int > > templateAllowedZChains; + vector> molCisTransChains; vector molIsCis; @@ -3535,7 +3524,6 @@ sketcherMinimizer::m_templates.setTemplateDir(dir); } - static string getTempFileProjDir() { return sketcherMinimizer::m_templates.getTemplateDir(); @@ -3550,10 +3538,10 @@ static void loadTemplate(const string& filename, vector& templates) { - std::ifstream ss(filename); - schrodinger::mae::Reader r(ss); - - + auto pFile = fopen(filename.c_str(), "r"); + if (pFile == nullptr) + return; + schrodinger::mae::Reader r(pFile); std::shared_ptr b; while ((b = r.next("f_m_ct")) != nullptr) { auto molecule = new sketcherMinimizerMolecule(); @@ -3562,22 +3550,23 @@ { const auto atom_data = b->getIndexedBlock("m_atom"); // All atoms are gauranteed to have these three field names: - const auto atomic_numbers = atom_data->getIntProperty("i_m_atomic_number"); + const auto atomic_numbers = + atom_data->getIntProperty("i_m_atomic_number"); const auto xs = atom_data->getRealProperty("r_m_x_coord"); const auto ys = atom_data->getRealProperty("r_m_y_coord"); const auto size = atomic_numbers->size(); // atomic numbers, and x, y, and z coordinates - for (size_t i=0; icoordinates = sketcherMinimizerPointF (xs->at(i), ys->at(i)); + atom->coordinates = + sketcherMinimizerPointF(xs->at(i), ys->at(i)); atom->atomicNumber = atomic_numbers->at(i); atom->_generalUseN = atomCounter++; molecule->_atoms.push_back(atom); } } - // Bond data is in the m_bond indexed block { const auto bond_data = b->getIndexedBlock("m_bond"); @@ -3587,7 +3576,7 @@ auto orders = bond_data->getIntProperty("i_m_order"); const auto size = from_atoms->size(); - for (size_t i=0; iat(i) - 1; const auto to_atom = to_atoms->at(i) - 1; @@ -3598,20 +3587,19 @@ bond->endAtom = molecule->_atoms.at(to_atom); bond->bondOrder = order; molecule->_bonds.push_back(bond); - } } templates.push_back(molecule); } - + fclose(pFile); for (auto mol : templates) { // normalize bond length vector dds; vector ns; for (unsigned int i = 0; i < mol->_bonds.size(); i++) { sketcherMinimizerPointF v = mol->_bonds[i]->startAtom->coordinates - - mol->_bonds[i]->endAtom->coordinates; + mol->_bonds[i]->endAtom->coordinates; float dd = v.x() * v.x() + v.y() * v.y(); bool found = false; for (unsigned int j = 0; j < dds.size(); j++) { @@ -3641,11 +3629,6 @@ } } } - - - - - } void sketcherMinimizer::loadTemplates() @@ -3653,12 +3636,12 @@ static int loaded = 0; if (loaded || m_templates.getTemplates().size()) return; - string filename =getTempFileProjDir() + "templates.mae"; + string filename = getTempFileProjDir() + "templates.mae"; + loadTemplate(filename, m_templates.getTemplates()); filename = getUserTemplateFileName(); - // if (ChmFileExists(filename.c_str())) - loadTemplate(filename, m_templates.getTemplates()); + loadTemplate(filename, m_templates.getTemplates()); loaded = 1; } diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerEZConstrainInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerEZConstrainInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerEZConstrainInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerEZConstrainInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -11,7 +11,7 @@ #include "sketcherMinimizerInteraction.h" -/*forcefield constrain to avoid EZ inversion*/ +/* forcefield constrain to avoid EZ inversion */ class sketcherMinimizerEZConstrainInteraction : public sketcherMinimizerInteraction { @@ -30,16 +30,16 @@ }; virtual ~sketcherMinimizerEZConstrainInteraction(){}; - /*calculate the energy of the interaction*/ - virtual void energy(float& e) + /* calculate the energy of the interaction */ + void energy(float& e) override { if (inversion()) { e += 5000; } }; - /*calculate the forces and apply them*/ - void score(float& totalE, bool = false) + /* calculate the forces and apply them */ + void score(float& totalE, bool = false) override { if (!inversion()) { return; @@ -76,7 +76,7 @@ } }; - /*check if the E/Z configuration is inverted*/ + /* check if the E/Z configuration is inverted */ bool inversion() { return sketcherMinimizerMaths::sameSide( diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerFragment.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizerFragment.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizerFragment.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerFragment.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -395,7 +395,7 @@ int n = 0; for (unsigned int i = 0; i < m_bonds.size(); i++) if (m_bonds[i]->bondOrder == 2) - n++; + ++n; return n; }; unsigned int sketcherMinimizerFragment::countHeavyAtoms() const @@ -403,7 +403,27 @@ int n = 0; for (unsigned int i = 0; i < m_atoms.size(); i++) if (m_atoms[i]->atomicNumber != 6) - n++; + ++n; + return n; +} + +unsigned int sketcherMinimizerFragment::countConstrainedAtoms() const +{ + int n = 0; + for (auto atom : m_atoms) { + if (atom->constrained) + ++n; + } + return n; +} + +unsigned int sketcherMinimizerFragment::countFixedAtoms() const +{ + int n = 0; + for (auto atom : m_atoms) { + if (atom->fixed) + ++n; + } return n; } diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerFragment.h schroedinger-coordgenlibs-1.3/sketcherMinimizerFragment.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerFragment.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerFragment.h 2019-07-11 19:04:54.000000000 +0000 @@ -29,37 +29,38 @@ CoordgenFragmentDOF(sketcherMinimizerFragment* fragment); virtual ~CoordgenFragmentDOF(); - /*set the current value as the optimal value for this DOF*/ + /* set the current value as the optimal value for this DOF */ void storeCurrentValueAsOptimal(); - /*load the optimal value*/ + /* load the optimal value */ void setToOptimalValue(); - /*cycle through the various possible values of this DOF*/ + /* cycle through the various possible values of this DOF */ void changeState(); - /*add the given atom to the DoF*/ + /* add the given atom to the DoF */ void addAtom(sketcherMinimizerAtom* atom); - /*get the penalty associated with the current state*/ + /* get the penalty associated with the current state */ virtual float getCurrentPenalty() const; - /*return the number of states*/ + /* return the number of states */ virtual int numberOfStates() const = 0; - /*return the tier of this DoF. Lower tier DoFs are considered first in the minimization*/ + /* return the tier of this DoF. Lower tier DoFs are considered first in the + * minimization */ virtual int tier() const = 0; - /*apply the current DoF value to the atoms coordinates*/ + /* apply the current DoF value to the atoms coordinates */ virtual void apply() const = 0; - /*return the fragment this DoF refers to*/ + /* return the fragment this DoF refers to */ sketcherMinimizerFragment* getFragment() const; - /*return the current state*/ + /* return the current state */ short unsigned int getCurrentState(); - /*set the given state as current*/ + /* set the given state as current */ void setState(short unsigned int state); short unsigned int m_currentState, m_optimalState; @@ -138,7 +139,8 @@ }; /* - invert the direction of a bond (e.g. a substituent to a macrocycle can be placed towards the inside + invert the direction of a bond (e.g. a substituent to a macrocycle can be + placed towards the inside of the ring) */ class CoordgenInvertBondDOF : public CoordgenFragmentDOF @@ -156,7 +158,8 @@ sketcherMinimizerAtom* m_boundAtom; }; -/*flip a ring fused with another with more than 2 bonds (e.g. ring in a macrocycle) */ +/* flip a ring fused with another with more than 2 bonds (e.g. ring in a + * macrocycle) */ class CoordgenFlipRingDOF : public CoordgenFragmentDOF { public: @@ -173,39 +176,44 @@ int m_penalty; }; -/*class that represents a rigid molecular fragment*/ +/* class that represents a rigid molecular fragment */ class sketcherMinimizerFragment { public: sketcherMinimizerFragment(); ~sketcherMinimizerFragment(); - /*return the total weight of the fragment*/ + /* return the total weight of the fragment */ unsigned int totalWeight() const; - /*return the number of double bonds in the fragment*/ + /* return the number of double bonds in the fragment */ unsigned int countDoubleBonds() const; - /*return the number of heavy atoms in the fragment*/ + /* return the number of heavy atoms in the fragment */ unsigned int countHeavyAtoms() const; - /*add an atom to this fragment*/ + /* return the number of constrained atoms in the fragment */ + unsigned int countConstrainedAtoms() const; + + /* return the number of fixed atoms in the fragment */ + unsigned int countFixedAtoms() const; + + /* add an atom to this fragment */ void addAtom(sketcherMinimizerAtom* atom); - /*add a bond to this fragment*/ + /* add a bond to this fragment */ void addBond(sketcherMinimizerBond* bond); - /*add a ring to this fragment*/ + /* add a ring to this fragment */ void addRing(sketcherMinimizerRing* ring); - /*add a degree of freedom to this fragment*/ + /* add a degree of freedom to this fragment */ void addDof(CoordgenFragmentDOF* dof); - /*get all degrees of freedom of this fragment*/ + /* get all degrees of freedom of this fragment */ std::vector getDofs(); - - /*mark the given bond as interfragment*/ + /* mark the given bond as interfragment */ void addInterFragmentBond(sketcherMinimizerBond* bond) { _interFragmentBonds.push_back(bond); @@ -219,29 +227,30 @@ std::vector& bonds() { return m_bonds; } std::vector& rings() { return m_rings; } - /*return the parent fragment*/ + /* return the parent fragment */ sketcherMinimizerFragment* getParent() const { return m_parent; } - /*set the given fragment as parent*/ + /* set the given fragment as parent */ void setParent(sketcherMinimizerFragment* parent) { m_parent = parent; } - /*add the given degree of freedom to the given atom which will be modified by it*/ + /* add the given degree of freedom to the given atom which will be modified + * by it */ void addDofToAtom(sketcherMinimizerAtom* atom, CoordgenFragmentDOF* dof) { m_dofsForAtom[atom].push_back(dof); } - /*return the degrees of freedom that would modify the given atom*/ + /* return the degrees of freedom that would modify the given atom */ std::vector& getDofsOfAtom(sketcherMinimizerAtom* atom) { return m_dofsForAtom[atom]; } - /*set the coordinates of each atom to the template coordinates*/ + /* set the coordinates of each atom to the template coordinates */ void setAllCoordinatesToTemplate(); - /*save coordinates information*/ + /* save coordinates information */ void storeCoordinateInformation(); std::vector _interFragmentBonds; @@ -256,11 +265,13 @@ int numberOfChildrenAtoms; float numberOfChildrenAtomsRank; - /*translate and rotate the fragment and set the resulting coordinates to every atom*/ + /* translate and rotate the fragment and set the resulting coordinates to + * every atom */ void setCoordinates(sketcherMinimizerPointF position, float angle); - /*get the dof that refers to flipping this fragment*/ + /* get the dof that refers to flipping this fragment */ CoordgenFragmentDOF* getFlipDof() const { return m_dofs[0]; } + private: sketcherMinimizerFragment* m_parent; std::vector m_atoms; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizer.h schroedinger-coordgenlibs-1.3/sketcherMinimizer.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizer.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizer.h 2019-07-11 19:04:54.000000000 +0000 @@ -27,7 +27,6 @@ #include "sketcherMinimizerMarchingSquares.h" #include - #include "CoordgenFragmentBuilder.h" #include "CoordgenMinimizer.h" #include "CoordgenConfig.hpp" @@ -47,9 +46,8 @@ std::vector counters; } proximityData; - -/*class to handle templates of common difficult ring structures*/ -class CoordgenTemplates +/* class to handle templates of common difficult ring structures */ +class CoordgenTemplates { public: CoordgenTemplates() {} @@ -73,111 +71,106 @@ void setTemplateDir(std::string dir) { m_templateDir = dir; + if (dir.back() != '/') { + m_templateDir += "/"; + } } - std::string getTemplateDir() - { - return m_templateDir; - } - + std::string getTemplateDir() { return m_templateDir; } private: std::vector m_templates; std::string m_templateDir = ""; }; - -/*main class. Creates 2d coordinates for molecular inputs*/ -class sketcherMinimizer +/* main class. Creates 2d coordinates for molecular inputs */ +class EXPORT_COORDGEN sketcherMinimizer { public: - EXPORT_COORDGEN sketcherMinimizer(float precision = SKETCHER_STANDARD_PRECISION); - EXPORT_COORDGEN ~sketcherMinimizer(); + sketcherMinimizer(float precision = SKETCHER_STANDARD_PRECISION); + ~sketcherMinimizer(); CoordgenFragmentBuilder m_fragmentBuilder; CoordgenMinimizer m_minimizer; - /*run coordinates generation and return true - if the pose is considered optimal*/ - bool EXPORT_COORDGEN runGenerateCoordinates(); + /* run coordinates generation and return true if the pose is considered + * optimal */ + bool runGenerateCoordinates(); - /* - return true if the molecules structure is reasonable (e.g. reasonable amount of fused rings) - */ + /* return true if the molecules structure is reasonable (e.g. reasonable + * amount of fused rings) */ bool structurePassSanityCheck() const; - /* - clear data and free memory - */ + /* clear data and free memory */ void clear(); - /* - initialize data from given molecule - */ - void EXPORT_COORDGEN initialize(sketcherMinimizerMolecule* minMol); + /* initialize data from given molecule */ + void initialize(sketcherMinimizerMolecule* minMol); - /*put atoms in a canonical order to reduce dependency from order in the input vector */ + /* put atoms in a canonical order to reduce dependency from order in the + * input vector */ static void canonicalOrdering(sketcherMinimizerMolecule* minMol); - // void initializeFromMolecule(ChmMol& mol); + // void initializeFromMolecule(ChmMol& mol); - /*if mol contains separate molecules, split them into a vector*/ + /* if mol contains separate molecules, split them into a vector */ void splitIntoMolecules(sketcherMinimizerMolecule* mol, std::vector& mols); - /*flag atoms that will be drawn with 90° angles (e.g. phosphate P)*/ + /* flag atoms that will be drawn with 90° angles (e.g. phosphate P) */ void flagCrossAtoms(); - /*assign coordinates to all molecules and residues*/ + /* assign coordinates to all molecules and residues */ void minimizeAll(); - - /*assign coordinates to given molecule*/ + /* assign coordinates to given molecule */ void minimizeMolecule(sketcherMinimizerMolecule* molecule); - /*find the best angle to rotate each molecule*/ + /* find the best angle to rotate each molecule */ void bestRotation(); - /*add info to choose the best angle so that, if present, peptide chains are horizontal*/ + /* add info to choose the best angle so that, if present, peptide chains are + * horizontal */ void addBestRotationInfoForPeptides(std::vector>& angles, std::vector atoms); - - /*if a peptide chain is present make sure that the N term is on the left*/ + /* if a peptide chain is present make sure that the N term is on the left */ void maybeFlipPeptides(std::vector atoms, float& scoreX); - /*consider flipping the molecule horizontaly and/or vertically*/ + /* consider flipping the molecule horizontally and/or vertically */ void maybeFlip(); - /*mark atoms with wedges as above or below the plane to correctly draw crossing bonds*/ + /* mark atoms with wedges as above or below the plane to correctly draw + * crossing bonds */ void assignPseudoZ(); - /*write wedges and dashed bonds to mark stereochemistry*/ - void EXPORT_COORDGEN writeStereoChemistry(); + /* write wedges and dashed bonds to mark stereochemistry */ + void writeStereoChemistry(); - /*arrange multiple molecules next to each other*/ + /* arrange multiple molecules next to each other */ void arrangeMultipleMolecules(); - /*arrange molecules that have parts that interact with each other so that they are close*/ + /* arrange molecules that have parts that interact with each other so that + * they are close */ void placeMoleculesWithProximityRelations( std::vector proximityMols); - /*place molecules so that one is in the middle and other are around*/ + /* place molecules so that one is in the middle and other are around */ void placeMolResidueLigandStyle(sketcherMinimizerMolecule* mol, sketcherMinimizerMolecule* parent); /* if the molecule has more than one interaction and they cross mirror its - coordinates so they don't cross anymore*/ + coordinates so they don't cross anymore */ void flipIfCrossingInteractions(sketcherMinimizerMolecule* mol); - /*build data vectors to place molecules with proximity relations*/ + /* build data vectors to place molecules with proximity relations */ std::vector buildProximityDataVector( std::vector& proximityMols, std::map& molMap); - /*translate molecules with proximity relations*/ + /* translate molecules with proximity relations */ void translateMoleculesWithProximityRelations( std::vector& proximityMols, std::map& molMap, @@ -185,118 +178,113 @@ templateCenters, std::vector& proximityDataVecto); - /*rotate molecules with proximity relations*/ + /* rotate molecules with proximity relations */ void rotateMoleculesWithProximityRelations( std::vector& proximityMols, std::map& molMap, std::vector& proximityDataVector); - /*place residues in concentric contours around the ligand*/ + /* place residues in concentric contours around the ligand */ void placeResiduesInCrowns(); - /*place residues from the given strands of consecutive residues to fill - the given path*/ + /* place residues from the given strands of consecutive residues to fill + the given path */ bool fillShape(std::vector>& SSEs, const std::vector& shape, int shapeN); - /*place a single strand of consecutive resiudes*/ + /* place a single strand of consecutive residues */ void placeSSE(std::vector SSE, const std::vector& shape, int shapeN, std::vector& penalties, std::set& outliers, bool placeOnlyInteracting = false); - /*score the position of the given strands*/ + /* score the position of the given strands */ float scoreSSEPosition(std::vector SSE, const std::vector& shape, int shapeN, std::vector& penalties, float f, float increment); - /*score the distance between the two given points of connected residues*/ + /* score the distance between the two given points of connected residues */ float scoreSSEBondStretch(sketcherMinimizerPointF coordinates1, sketcherMinimizerPointF coordinates2); - /*return the position of res, which is part of SSE, given that the - first residue of SSE is placed at startF and consecutive residues are placed - increment away from each other. All distances are expressed in floats, where - 0.f is - an arbitrary starting point, 0.5 is the opposite side of the curve and 1.0 is - again - the starting point*/ + /* return the position of res, which is part of SSE, given that the first + * residue of SSE is placed at startF and consecutive residues are placed + * increment away from each other. All distances are expressed in floats, + * where 0.f is an arbitrary starting point, 0.5 is the opposite side of the + * curve and 1.0 is again the starting point */ float getResidueDistance(float startF, float increment, sketcherMinimizerResidue* res, std::vector SSE); - /*return the vector index corresponding to floatPosition*/ - int getShapeIndex(std::vector shape, float floatPosition); - - /*solution represent the placement chosen for residues in SSE. Mark the - corresponding - sections of the crown to prevent other residues to be placed there*/ + /* return the vector index corresponding to floatPosition */ + int getShapeIndex(std::vector shape, + float floatPosition); + + /* solution represent the placement chosen for residues in SSE. Mark the + * corresponding sections of the crown to prevent other residues to be + * placed + * there */ void markSolution(std::pair solution, std::vector SSE, const std::vector& shape, std::vector& penalties, std::set& outliers); - /*return a concentric shape around the ligand. CrownN controls how far away - from the ligand the shape is*/ + /* return a concentric shape around the ligand. CrownN controls how far away + from the ligand the shape is */ std::vector shapeAroundLigand(int crownN); - /*group residues in strands of consecutive residues*/ + /* group residues in strands of consecutive residues */ std::vector> groupResiduesInSSEs(std::vector residues); - /*score the position of given residues*/ + /* score the position of given residues */ float scoreResiduePosition(int index, const std::vector& shape, int shapeN, std::vector& penalties, sketcherMinimizerResidue* residue); - /*assign coordinates to residues*/ + /* assign coordinates to residues */ void placeResidues(std::vector atoms = std::vector(0)); - /*assign coordinates to residues in the context of a protein-protein - interaction diagram*/ + /* assign coordinates to residues in the context of a protein-protein + interaction diagram */ void placeResiduesProteinOnlyMode(); - - /*assign coordinates to residues in a protein-protein interaction - diagram shaped as a circle*/ + /* assign coordinates to residues in a protein-protein interaction + diagram shaped as a circle */ void placeResiduesProteinOnlyModeCircleStyle( std::map> chains); - - /*assign coordinates to residues in a protein-protein interaction - diagram shaped as a LID*/ + /* assign coordinates to residues in a protein-protein interaction + diagram shaped as a LID */ void placeResiduesProteinOnlyModeLIDStyle( std::map> chains); - /* - order residues for drawing, so that residues interacting together are drawn one - after the other and - residues with more interactions are drawn first - */ + /* order residues for drawing, so that residues interacting together are + * drawn one after the other and residues with more interactions are drawn + * first */ std::vector orderResiduesOfChains( std::map> chains); - - /*find center position for each chain of residues using a meta-molecule approach, - building a molecule where each atom represents a chain and each bond connects - two interacting chains*/ + /* find center position for each chain of residues using a meta-molecule + * approach, building a molecule where each atom represents a chain and each + * bond connects two interacting chains */ std::map computeChainsStartingPositionsMetaMol( std::map> chains); - /*place interacting residues closer to each other, so they end up at the perifery - of the chain*/ + /* place interacting residues closer to each other, so they end up at the + * periphery of the chain */ void shortenInteractions( std::map> chains); - /*explore positions in a grid around the current one to ease clashes*/ + /* explore positions in a grid around the current one to ease clashes */ sketcherMinimizerPointF exploreGridAround( sketcherMinimizerPointF centerOfGrid, unsigned int levels, float gridD, float dx = 0.f, float dy = 0.f, float distanceFromAtoms = -1.f, @@ -308,53 +296,52 @@ unsigned int levels, float gridD, float distanceFromAtoms = -1.f); - - /*add given angle to a vector of angles, clustering them - if a close angle is already in the vector*/ + /* add given angle to a vector of angles, clustering them if a close angle + * is already in the vector */ void addToVector(float weight, float angle, std::vector>& angles); - - /*return a score of the alignment between direction and templat.first, weight on the - angle between the two and templat.second*/ + /* return a score of the alignment between direction and templat.first, + * weight on the angle between the two and templat.second */ static float testAlignment(sketcherMinimizerPointF direction, std::pair templat); - - /*find the best alignment of a fragment to its parent and set invert in case the fragment - needs to be flipped*/ + /* find the best alignment of a fragment to its parent and set invert in + * case the fragment needs to be flipped */ static sketcherMinimizerPointF scoreDirections( sketcherMinimizerFragment* fragment, float angle, std::vector> directions, bool& invert); - /*align the fragment to its parent*/ + /* align the fragment to its parent */ static void alignWithParentDirection(sketcherMinimizerFragment* f, sketcherMinimizerPointF position, float angle); - /*align the fragment to its parent in the case of constrained coordinates*/ + /* align the fragment to its parent in the case of constrained coordinates + */ static bool alignWithParentDirectionConstrained(sketcherMinimizerFragment* fragment, sketcherMinimizerPointF position, float angle); - /*align the fragment to its parent in the case of unconstrained coordinates*/ + /* align the fragment to its parent in the case of unconstrained coordinates + */ static bool alignWithParentDirectionUnconstrained(sketcherMinimizerFragment* fragment, float angle); - /*get all bonds to a terminal atom*/ + /* get all bonds to a terminal atom */ static std::vector getAllTerminalBonds(sketcherMinimizerFragment* fragment); - /*return a list of vectors the given fragment can be aligned with and a score of - the importance of each*/ + /* return a list of vectors the given fragment can be aligned with and a + * score of the importance of each */ static std::vector> findDirectionsToAlignWith(sketcherMinimizerFragment* fragment); - std::vector getAtoms() {return _atoms;} + std::vector getAtoms() { return _atoms; } std::vector _atoms; std::vector _referenceAtoms; @@ -373,63 +360,59 @@ void assignLongestChainFromHere(sketcherMinimizerFragment* f); void assignNumberOfChildrenAtomsFromHere(sketcherMinimizerFragment* f); -// void exportCoordinates(ChmMol& molecule); + // void exportCoordinates(ChmMol& molecule); - /*split molecules into rigid fragments*/ - void EXPORT_COORDGEN findFragments(); + /* split molecules into rigid fragments */ + void findFragments(); - /*initialize data and coordinates for each fragment*/ + /* initialize data and coordinates for each fragment */ void initializeFragments(); - /*constrain coordinates on all atoms*/ - void EXPORT_COORDGEN constrainAllAtoms(); + /* constrain coordinates on all atoms */ + void constrainAllAtoms(); - /*constrain coordinates on atoms corresponding to true*/ - void EXPORT_COORDGEN constrainAtoms(std::vector constrained); + /* constrain coordinates on atoms corresponding to true */ + void constrainAtoms(std::vector constrained); - /*fix cooordinates (i.e. guarantee they will not change) on atoms marked as true*/ - void EXPORT_COORDGEN fixAtoms(std::vector fixed); + /* fix cooordinates (i.e. guarantee they will not change) on atoms marked as + * true */ + void fixAtoms(std::vector fixed); - /*set a flag to enable/disable the scoring of interactions with residues*/ - void EXPORT_COORDGEN setScoreResidueInteractions(bool b); + /* set a flag to enable/disable the scoring of interactions with residues */ + void setScoreResidueInteractions(bool b); - /* - pick one atom out of the vector. Arbitrary criteria such as atomic number and connectivity - are used - */ + /* pick one atom out of the vector. Arbitrary criteria such as atomic number + * and connectivity are used */ static sketcherMinimizerAtom* pickBestAtom(std::vector& atoms); - - /*if the three atoms share a ring, return it*/ + /* if the three atoms share a ring, return it */ static sketcherMinimizerRing* sameRing(const sketcherMinimizerAtom* at1, const sketcherMinimizerAtom* at2, const sketcherMinimizerAtom* at3); - /*if the two atoms share a ring, return it*/ + /* if the two atoms share a ring, return it */ static sketcherMinimizerRing* sameRing(const sketcherMinimizerAtom* at1, const sketcherMinimizerAtom* at2); - /*if the two atoms share a bond, return it*/ + /* if the two atoms share a bond, return it */ static sketcherMinimizerBond* getBond(const sketcherMinimizerAtom* a1, const sketcherMinimizerAtom* a2); - /*for each residue, find the closest atom among atoms, or all atoms - if none are given*/ + /* for each residue, find the closest atom among atoms, or all atoms + if none are given */ void findClosestAtomToResidues(std::vector atoms = std::vector(0)); - /*calculate root mean square deviation between templates and points*/ + /* calculate root mean square deviation between templates and points */ static float RMSD(std::vector templates, std::vector points); /* singular value decomposition for 2x2 matrices. - used for 2D alignment.*/ - static void svd(float* a, float* U, float* Sig, - float* V); - + used for 2D alignment. */ + static void svd(float* a, float* U, float* Sig, float* V); - /*set m to a rotation matrix to align ref to points*/ + /* set m to a rotation matrix to align ref to points */ static void alignmentMatrix(std::vector ref, std::vector points, float* m); @@ -444,24 +427,24 @@ std::vector& molIsCis, unsigned int size, bool& found, std::vector& mapping); - - /*compare atoms and bonds to template and map which atom is which in case of a positive match*/ + /* compare atoms and bonds to template and map which atom is which in case + * of a positive match */ static bool compare(std::vector atoms, std::vector bonds, sketcherMinimizerMolecule* templ, std::vector& mapping); - /*calculate morgan scores for the given input*/ + /* calculate morgan scores for the given input */ static int morganScores(std::vector atoms, std::vector bonds, std::vector& scores); std::string m_chainHint; - /*load the templates from the template file*/ - static void EXPORT_COORDGEN setTemplateFileDir(std::string dir); - static void EXPORT_COORDGEN loadTemplates(); - static EXPORT_COORDGEN CoordgenTemplates m_templates; + /* load the templates from the template file */ + static void setTemplateFileDir(std::string dir); + static void loadTemplates(); + static CoordgenTemplates m_templates; }; #endif // sketcherMINIMIZER diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -11,7 +11,7 @@ #include "sketcherMinimizerAtom.h" -/*abstract class for force field interactions*/ +/* abstract class for force field interactions */ class sketcherMinimizerInteraction { public: @@ -26,7 +26,7 @@ }; virtual ~sketcherMinimizerInteraction(){}; - /*return energy associated with it*/ + /* return energy associated with it */ virtual void energy(float& e) { sketcherMinimizerPointF l = atom1->coordinates - atom2->coordinates; @@ -34,7 +34,7 @@ e += 0.5f * k * dr * dr; }; - /*calculate and apply forces*/ + /* calculate and apply forces */ virtual void score(float& totalE, bool = false) { sketcherMinimizerPointF l = atom1->coordinates - atom2->coordinates; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerMarchingSquares.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizerMarchingSquares.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizerMarchingSquares.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerMarchingSquares.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -12,7 +12,6 @@ #include #include "sketcherMinimizer.h" - using namespace std; sketcherMinimizerMarchingSquares::sketcherMinimizerMarchingSquares() diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerMarchingSquares.h schroedinger-coordgenlibs-1.3/sketcherMinimizerMarchingSquares.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerMarchingSquares.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerMarchingSquares.h 2019-07-11 19:04:54.000000000 +0000 @@ -14,7 +14,6 @@ #include #include "CoordgenConfig.hpp" - class sketcherMinimizerPointF; struct sketcherMinimizerMarchingSquaresPoint; @@ -39,49 +38,49 @@ bool visited; }; -/*implementation of a marching squares algorithm*/ -class sketcherMinimizerMarchingSquares +/* implementation of a marching squares algorithm */ +class EXPORT_COORDGEN sketcherMinimizerMarchingSquares { public: - EXPORT_COORDGEN sketcherMinimizerMarchingSquares(); - EXPORT_COORDGEN ~sketcherMinimizerMarchingSquares(); + sketcherMinimizerMarchingSquares(); + ~sketcherMinimizerMarchingSquares(); // inline void clearGrid (); - void EXPORT_COORDGEN setValue(float v, unsigned int x, unsigned int y); - void EXPORT_COORDGEN initialize(float minx, float maxx, float miny, float maxy, + void setValue(float v, unsigned int x, unsigned int y); + void initialize(float minx, float maxx, float miny, float maxy, float x_interval, float y_interval = 0.f); - void EXPORT_COORDGEN clear(); + void clear(); - void EXPORT_COORDGEN setThreshold(float t); - float EXPORT_COORDGEN getThreshold() const; + void setThreshold(float t); + float getThreshold() const; - float EXPORT_COORDGEN toRealx(float x) const; - float EXPORT_COORDGEN toRealy(float y) const; + float toRealx(float x) const; + float toRealy(float y) const; unsigned int getXN() const { return m_XN; }; unsigned int getYN() const { return m_YN; }; - void EXPORT_COORDGEN run(); // computes the isovalue points and segments + void run(); // computes the isovalue points and segments std::vector - /*call after run () is executed, returs the coordinates of all the + /* call after run () is executed, returns the coordinates of all the isovalue line points [x1, y1, x2, y2 .. xn, yn] in the order they - were created*/ - EXPORT_COORDGEN getCoordinatesPoints() const; + were created */ + getCoordinatesPoints() const; std::vector> - /*call after run () is executed. Returns a vector of isovalue closed + /* call after run () is executed. Returns a vector of isovalue closed lines [x1, y1, x2, y2 .. xn, yn]. The points are ordered as they - appear along the line.*/ - EXPORT_COORDGEN getOrderedCoordinatesPoints() const; + appear along the line. */ + getOrderedCoordinatesPoints() const; inline std::vector getRawData() const { return m_grid; }; // returns a vector of all the data set with setValue. - float EXPORT_COORDGEN getNodeValue(unsigned int i, unsigned int j) const; + float getNodeValue(unsigned int i, unsigned int j) const; private: void addSide(sketcherMinimizerMarchingSquaresPoint* p1, diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerMaths.h schroedinger-coordgenlibs-1.3/sketcherMinimizerMaths.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerMaths.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerMaths.h 2019-07-11 19:04:54.000000000 +0000 @@ -42,7 +42,7 @@ return floor(f * pow(10.f, precision) + 0.5) * pow(0.1, precision); } -/*class to represent a point or vector in 2d*/ +/* class to represent a point or vector in 2d */ class sketcherMinimizerPointF { public: @@ -64,7 +64,7 @@ return dd; } - /*return the length of the vector*/ + /* return the length of the vector */ float length() const { float dd = squareLength(); @@ -74,7 +74,7 @@ return 0; }; - /*normalize the vector*/ + /* normalize the vector */ void normalize() { float q = length(); @@ -84,7 +84,7 @@ } }; - /*rotate the vector by the angle with given sine and cosine*/ + /* rotate the vector by the angle with given sine and cosine */ void rotate(float s, float c) { float x = xp; @@ -93,14 +93,14 @@ yp = -x * s + y * c; } - /*parallel component of this along the give axis*/ + /* parallel component of this along the give axis */ sketcherMinimizerPointF parallelComponent(sketcherMinimizerPointF axis) { float dotProduct = x() * axis.x() + y() * axis.y(); return axis * dotProduct / axis.squareLength(); } - /*round the coordinates to the given number of decimal figures*/ + /* round the coordinates to the given number of decimal figures */ void round(int precision = 2) { if (precision == 2) { @@ -191,8 +191,8 @@ float yp; }; -/*return true if the two segments intersect and if a result pointer was given, set it to - the intersection point*/ +/* return true if the two segments intersect and if a result pointer was given, + * set it to the intersection point */ struct sketcherMinimizerMaths { static bool intersectionOfSegments(sketcherMinimizerPointF s1p1, sketcherMinimizerPointF s1p2, @@ -278,7 +278,7 @@ return true; } - /*signed angle between p1p2 and p2p3*/ + /* signed angle between p1p2 and p2p3 */ static float signedAngle(sketcherMinimizerPointF p1, sketcherMinimizerPointF p2, sketcherMinimizerPointF p3) @@ -290,7 +290,7 @@ 180 / M_PI); } - /*unsigned angle between p1p2 and p2p3*/ + /* unsigned angle between p1p2 and p2p3 */ static float unsignedAngle(sketcherMinimizerPointF p1, sketcherMinimizerPointF p2, sketcherMinimizerPointF p3) @@ -318,15 +318,15 @@ return float((acos(cosine)) * 180 / M_PI); } - - /*return true if the two points are very close in space*/ + /* return true if the two points are very close in space */ static bool pointsCoincide(sketcherMinimizerPointF p1, sketcherMinimizerPointF p2) { return ((p1 - p2).squareLength() < SKETCHER_EPSILON * SKETCHER_EPSILON); } - /*return true if p1 and p2 are in the same semiplane defined by the given segment*/ + /* return true if p1 and p2 are in the same semiplane defined by the given + * segment */ static bool sameSide(const sketcherMinimizerPointF p1, const sketcherMinimizerPointF p2, const sketcherMinimizerPointF lineP1, @@ -351,8 +351,7 @@ } } - - /*return the projection of p on the line defined by the given segment*/ + /* return the projection of p on the line defined by the given segment */ static sketcherMinimizerPointF projectPointOnLine(sketcherMinimizerPointF p, sketcherMinimizerPointF sp1, sketcherMinimizerPointF sp2) @@ -368,8 +367,7 @@ return sp1 + t * l3; } - - /*squared distance of the given point from the given segment*/ + /* squared distance of the given point from the given segment */ static float squaredDistancePointSegment(sketcherMinimizerPointF p, sketcherMinimizerPointF sp1, sketcherMinimizerPointF sp2, @@ -447,8 +445,7 @@ return u; } - - /*used by ClosedBezierControlPoints*/ + /* used by ClosedBezierControlPoints */ static std::vector cyclicSolve(std::vector a, std::vector b, std::vector c, float alpha, @@ -493,7 +490,7 @@ sketcherMinimizerPointF cp2, sketcherMinimizerPointF p2, float t) { - // using de casteljiau's algorithm + // using Casteljiau's algorithm auto v1 = (1 - t) * p1 + t * cp1; auto v2 = (1 - t) * cp1 + t * cp2; auto v3 = (1 - t) * cp2 + t * p2; @@ -502,7 +499,8 @@ return (1 - t) * v4 + t * v5; } - /*find control points to a closed bezier curve that passes through the given points*/ + /* find control points to a closed Bezier curve that passes through the + * given points */ static void ClosedBezierControlPoints( std::vector knots, std::vector& firstControlPoints, @@ -552,7 +550,7 @@ } } - /*return the mirror image of the given point wrt the given segment*/ + /* return the mirror image of the given point wrt the given segment */ static sketcherMinimizerPointF mirrorPoint(sketcherMinimizerPointF point, sketcherMinimizerPointF segmentPoint1, @@ -566,7 +564,7 @@ return segmentPoint1 + parallelComponent - normalComponent; } - /*dot product of two vectors*/ + /* dot product of two vectors */ static float dotProduct(sketcherMinimizerPointF a, sketcherMinimizerPointF b) { @@ -574,7 +572,7 @@ return (a.x() * b.x() + a.y() * b.y()); } - /*cross product of two vectors*/ + /* cross product of two vectors */ static float crossProduct(sketcherMinimizerPointF a, sketcherMinimizerPointF b) { @@ -593,7 +591,6 @@ // assume that direction is normalized - float targetdX = targetX - originX; float targetdY = targetY - originY; float targetdZ = targetZ - originZ; @@ -627,7 +624,7 @@ return result; } - /*length of a 3d vector*/ + /* length of a 3d vector */ static float length3D(float x, float y, float z) { float m = x * x + y * y + z * z; @@ -636,14 +633,14 @@ return m; } - /*dot product of two 3d vectors*/ + /* dot product of two 3d vectors */ static float dotProduct3D(float x1, float y1, float z1, float x2, float y2, float z2) { return x1 * x2 + y1 * y2 + z1 * z2; } - /*cross product of two 3d vectors*/ + /* cross product of two 3d vectors */ static void crossProduct3D(float x1, float y1, float z1, float x2, float y2, float z2, float& xr, float& yr, float& zr) @@ -658,10 +655,9 @@ return length3D(x2 - x1, y2 - y1, z2 - z1); } - /*angle between two 3d vectors*/ - static float angle3D(float x1, float y1, float z1, - float x2, float y2, float z2, - float x3, float y3, float z3) + /* angle between two 3d vectors */ + static float angle3D(float x1, float y1, float z1, float x2, float y2, + float z2, float x3, float y3, float z3) { float xa = x1 - x2; float ya = y1 - y2; @@ -675,11 +671,10 @@ return acos(dp / (l1 * l2)) * 180.f / M_PI; } - /*diheadral angle defined by 4 3d points*/ - static float dihedral3D(float x1, float y1, float z1, - float x2, float y2, float z2, - float x3, float y3, float z3, - float x4, float y4, float z4) + /* diheadral angle defined by 4 3d points */ + static float dihedral3D(float x1, float y1, float z1, float x2, float y2, + float z2, float x3, float y3, float z3, float x4, + float y4, float z4) { float xa, ya, za; crossProduct3D(x1 - x2, y1 - y2, z1 - z2, x3 - x2, y3 - y2, z3 - z2, xa, diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerMolecule.cpp schroedinger-coordgenlibs-1.3/sketcherMinimizerMolecule.cpp --- schroedinger-coordgenlibs-1.1/sketcherMinimizerMolecule.cpp 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerMolecule.cpp 2019-07-11 19:04:54.000000000 +0000 @@ -13,7 +13,6 @@ #include "sketcherMinimizerBond.h" #include - using namespace std; sketcherMinimizerMolecule::sketcherMinimizerMolecule() @@ -30,7 +29,6 @@ } }; - sketcherMinimizerAtom* sketcherMinimizerMolecule::addNewAtom() { auto atom = new sketcherMinimizerAtom(); @@ -39,17 +37,15 @@ return atom; } - -sketcherMinimizerBond* sketcherMinimizerMolecule::addNewBond(sketcherMinimizerAtom* at1, - sketcherMinimizerAtom* at2) +sketcherMinimizerBond* +sketcherMinimizerMolecule::addNewBond(sketcherMinimizerAtom* at1, + sketcherMinimizerAtom* at2) { auto bond = new sketcherMinimizerBond(at1, at2); _bonds.push_back(bond); return bond; } - - int sketcherMinimizerMolecule::totalCharge() { int charge = 0; @@ -103,7 +99,7 @@ return c / _atoms.size(); } -void sketcherMinimizerMolecule::assignBondsAndNeighbors( +void sketcherMinimizerMolecule::assignBondsAndNeighbors( std::vector& atoms, std::vector& bonds) { @@ -143,7 +139,8 @@ } } for (unsigned int i = 0; i < atoms.size(); i++) { - if (atoms[i]->_implicitHs == -1) atoms[i]->_implicitHs = atoms[i]->findHsNumber(); + if (atoms[i]->_implicitHs == -1) + atoms[i]->_implicitHs = atoms[i]->findHsNumber(); } } diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerMolecule.h schroedinger-coordgenlibs-1.3/sketcherMinimizerMolecule.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerMolecule.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerMolecule.h 2019-07-11 19:04:54.000000000 +0000 @@ -9,36 +9,31 @@ #include #include "CoordgenConfig.hpp" - #ifndef sketcherMINIMIZERMOLECULE_H #define sketcherMINIMIZERMOLECULE_H - class sketcherMinimizerAtom; class sketcherMinimizerBond; class sketcherMinimizerRing; class sketcherMinimizerPointF; - class sketcherMinimizerFragment; -/*class to define a molecule*/ -class sketcherMinimizerMolecule +/* class to define a molecule */ +class EXPORT_COORDGEN sketcherMinimizerMolecule { public: - EXPORT_COORDGEN sketcherMinimizerMolecule(); - EXPORT_COORDGEN ~sketcherMinimizerMolecule(); + sketcherMinimizerMolecule(); + ~sketcherMinimizerMolecule(); + // create a new atom and add it to the molecule + sketcherMinimizerAtom* addNewAtom(); - //create a new atom and add it to the molecule - EXPORT_COORDGEN sketcherMinimizerAtom* addNewAtom(); - - //create a new bond and add it to the molecule - EXPORT_COORDGEN sketcherMinimizerBond* addNewBond(sketcherMinimizerAtom* at1, + // create a new bond and add it to the molecule + sketcherMinimizerBond* addNewBond(sketcherMinimizerAtom* at1, sketcherMinimizerAtom* at2); - -// void fromChmMol(ChmMol& mol); + // void fromChmMol(ChmMol& mol); std::vector& getAtoms() { return _atoms; } std::vector& getBonds() { return _bonds; } @@ -52,11 +47,11 @@ _fragments = fragments; } - /*set this molecule to require force-field minimization*/ + /* set this molecule to require force-field minimization */ void requireMinimization(); - /*return true if this molecule requires a force field-based minimization (i.e. has clashes - that cannot be solved otherwise)*/ + /* return true if this molecule requires a force field-based minimization + (i.e. has clashes that cannot be solved otherwise) */ bool minimizationIsRequired(); std::vector _atoms; std::vector _bonds; @@ -65,7 +60,7 @@ std::vector _fragments; - /*set the given fragment as the main fragment of the kinematic chain*/ + /* set the given fragment as the main fragment of the kinematic chain */ void setMainFragment(sketcherMinimizerFragment* fragment) { m_mainFragment = fragment; @@ -78,34 +73,35 @@ bool needToAlignWholeMolecule; bool isPlaced; // used by arrangeMultipleMolecules - /*return the total charge of the molecule*/ + /* return the total charge of the molecule */ int totalCharge(); - /*set the top left and bottom right points of the molecule's bounding rectangle*/ + /* set the top left and bottom right points of the molecule's bounding + * rectangle */ void boundingBox(sketcherMinimizerPointF& min, sketcherMinimizerPointF& max); - /*return the coordinates of the center of the molecule*/ + /* return the coordinates of the center of the molecule */ sketcherMinimizerPointF center(); - /*recalculate structure elements (e.g. rings)*/ + /* recalculate structure elements (e.g. rings) */ static void forceUpdateStruct(std::vector& atoms, std::vector& bonds, std::vector& rings); - /*calculate neighbor info of each atom*/ + /* calculate neighbor info of each atom */ static void - EXPORT_COORDGEN assignBondsAndNeighbors(std::vector& atoms, + assignBondsAndNeighbors(std::vector& atoms, std::vector& bonds); - /*run a SSSR algorithm*/ + /* run a SSSR algorithm */ static void findRings(std::vector& bonds, std::vector& rings); - /*convenience function for the SSSR algorithm*/ + /* convenience function for the SSSR algorithm */ static sketcherMinimizerRing* closeRing(sketcherMinimizerBond* bond); - /*convenience function for the SSSR algorithm*/ + /* convenience function for the SSSR algorithm */ static void addRing(sketcherMinimizerRing* ring, std::vector& rings); diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerResidue.h schroedinger-coordgenlibs-1.3/sketcherMinimizerResidue.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerResidue.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerResidue.h 2019-07-11 19:04:54.000000000 +0000 @@ -12,16 +12,15 @@ #include "sketcherMinimizerAtom.h" #include "sketcherMinimizerBond.h" - -/*class to represent protein residues*/ -class sketcherMinimizerResidue : public sketcherMinimizerAtom +/* class to represent protein residues */ +class EXPORT_COORDGEN sketcherMinimizerResidue : public sketcherMinimizerAtom { public: - EXPORT_COORDGEN sketcherMinimizerResidue(); - virtual EXPORT_COORDGEN ~sketcherMinimizerResidue(); + sketcherMinimizerResidue(); + virtual ~sketcherMinimizerResidue(); virtual bool isResidue() const; - /*compute coordinates based on the position of the closest ligand atom*/ + /* compute coordinates based on the position of the closest ligand atom */ sketcherMinimizerPointF computeStartingCoordinates(float d = 2.f) { sketcherMinimizerPointF out = templateCoordinates; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerResidueInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerResidueInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerResidueInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerResidueInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -11,21 +11,21 @@ #include "sketcherMinimizerBond.h" -/*class to represent an interaction with protein residues (e.g. h-bond or - pi-pi stacking*/ -class sketcherMinimizerResidueInteraction +/* class to represent an interaction with protein residues (e.g. h-bond or + pi-pi stacking */ +class EXPORT_COORDGEN sketcherMinimizerResidueInteraction : public sketcherMinimizerBond { public: - EXPORT_COORDGEN sketcherMinimizerResidueInteraction(); - EXPORT_COORDGEN virtual ~sketcherMinimizerResidueInteraction(); + sketcherMinimizerResidueInteraction(); + virtual ~sketcherMinimizerResidueInteraction(); virtual bool isResidueInteraction(); - /*get all the atoms involved at the end side of the interaction*/ + /* get all the atoms involved at the end side of the interaction */ std::vector getAllEndAtoms(); std::vector getAllStartAtoms(); - /*get all the atoms involved at the start side of the interaction*/ + /* get all the atoms involved at the start side of the interaction */ std::vector m_otherEndAtoms; std::vector m_otherStartAtoms; }; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerRing.h schroedinger-coordgenlibs-1.3/sketcherMinimizerRing.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerRing.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerRing.h 2019-07-11 19:04:54.000000000 +0000 @@ -11,61 +11,58 @@ #include "sketcherMinimizerMaths.h" #include "CoordgenConfig.hpp" - #ifndef sketcherMINIMIZERRING_H #define sketcherMINIMIZERRING_H - class sketcherMinimizerAtom; class sketcherMinimizerPointF; class sketcherMinimizerBond; - -/*class to represent a ring*/ -class sketcherMinimizerRing +/* class to represent a ring */ +class EXPORT_COORDGEN sketcherMinimizerRing { public: - EXPORT_COORDGEN sketcherMinimizerRing(); - EXPORT_COORDGEN ~sketcherMinimizerRing(); + sketcherMinimizerRing(); + ~sketcherMinimizerRing(); - /*rings that share atoms with this*/ + /* rings that share atoms with this */ std::vector fusedWith; - /*list of atoms that are shared with each other ring in fusedWith*/ + /* list of atoms that are shared with each other ring in fusedWith */ std::vector> fusionAtoms; - /*list of bonds in the case of two rings attached by a double bond*/ + /* list of bonds in the case of two rings attached by a double bond */ std::vector fusionBonds; - bool visited, coordinatesGenerated, side /*not central */; + bool visited, coordinatesGenerated, side /* not central */; std::vector getAtoms() const { return _atoms; } int size() const { return (int) _atoms.size(); } bool isMacrocycle() const { return size() >= MACROCYCLE; } std::vector _atoms; std::vector _bonds; - /*return the coordinates of the center of the ring*/ + /* return the coordinates of the center of the ring */ sketcherMinimizerPointF findCenter(); - /*return true if the ring is benzene*/ + /* return true if the ring is benzene */ bool isBenzene(); - /*return true if the given point is inside the ring*/ + /* return true if the given point is inside the ring */ bool contains(sketcherMinimizerPointF p); - /*return true if the given atom is part of the ring*/ - bool EXPORT_COORDGEN containsAtom(const sketcherMinimizerAtom* a) const; + /* return true if the given atom is part of the ring */ + bool containsAtom(const sketcherMinimizerAtom* a) const; - /*return true if the given bond is part of the ring*/ + /* return true if the given bond is part of the ring */ bool containsBond(sketcherMinimizerBond* b); - /*return true if this is fused with ring*/ + /* return true if this is fused with ring */ bool isFusedWith(sketcherMinimizerRing* ring); - std::vector - /*return the common atoms between this and ring*/ + /* return the common atoms between this and ring */ + std::vector getFusionAtomsWith(const sketcherMinimizerRing* ring) const; - /*convenience function used by the SSSR algorithm*/ + /* convenience function used by the SSSR algorithm */ bool sameAs(sketcherMinimizerRing* ring); bool isAromatic(); // not chemically accurate, but good enough for minimizer }; diff -Nru schroedinger-coordgenlibs-1.1/sketcherMinimizerStretchInteraction.h schroedinger-coordgenlibs-1.3/sketcherMinimizerStretchInteraction.h --- schroedinger-coordgenlibs-1.1/sketcherMinimizerStretchInteraction.h 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/sketcherMinimizerStretchInteraction.h 2019-07-11 19:04:54.000000000 +0000 @@ -11,7 +11,7 @@ #include "sketcherMinimizerInteraction.h" -/*force field bond stretches*/ +/* force field bond stretches */ class sketcherMinimizerStretchInteraction : public sketcherMinimizerInteraction { public: @@ -20,8 +20,8 @@ : sketcherMinimizerInteraction(at1, at2){}; virtual ~sketcherMinimizerStretchInteraction(){}; - /*calculate forces and apply them*/ - void score(float& totalE, bool = false) + /* calculate forces and apply them */ + void score(float& totalE, bool = false) override { energy(totalE); sketcherMinimizerPointF l = atom1->coordinates - atom2->coordinates; diff -Nru schroedinger-coordgenlibs-1.1/test/CMakeLists.txt schroedinger-coordgenlibs-1.3/test/CMakeLists.txt --- schroedinger-coordgenlibs-1.1/test/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/test/CMakeLists.txt 2019-07-11 19:04:54.000000000 +0000 @@ -0,0 +1,2 @@ +# Use the example executable as a test +add_test(example ${CMAKE_BINARY_DIR}/example_dir/example) \ No newline at end of file diff -Nru schroedinger-coordgenlibs-1.1/.travis.yml schroedinger-coordgenlibs-1.3/.travis.yml --- schroedinger-coordgenlibs-1.1/.travis.yml 2018-05-03 18:07:33.000000000 +0000 +++ schroedinger-coordgenlibs-1.3/.travis.yml 2019-07-11 19:04:54.000000000 +0000 @@ -6,7 +6,7 @@ - git clone https://github.com/schrodinger/maeparser.git - mkdir maeparser/build - pushd maeparser/build - - cmake .. -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/installation + - cmake .. -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/installation -DCMAKE_BUILD_TYPE=Debug - make install - popd @@ -15,9 +15,9 @@ - cd build - export CXX="g++-4.8" - export CMAKE_PREFIX_PATH=$TRAVIS_BUILD_DIR/installation/lib/cmake - - cmake .. + - cmake .. -DCMAKE_BUILD_TYPE=Debug - make - - make test CTEST_OUTPUT_ON_FAILURE=1 + - ctest -V -T memcheck --output-on-failure || (cat Testing/Temporary/MemoryChecker.*.log && exit 29) addons: apt: @@ -30,4 +30,5 @@ - gcc-4.8 - g++-4.8 - libboost-all-dev + - valgrind