mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
update to coordgen 2.0.0 (#3974)
change option name for setTreatAllBondsToMetalAsZOBs update expected minimizeOnly output (note: these new results don't look great)
This commit is contained in:
13
External/CoordGen/CMakeLists.txt
vendored
13
External/CoordGen/CMakeLists.txt
vendored
@@ -82,8 +82,8 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${COORDGEN_DIR}/sketcherMinimizer.h")
|
||||
set(RELEASE_NO "1.4.2")
|
||||
set(MD5 "47aa5fe6d8186b6c8d3b871d4400218a")
|
||||
set(RELEASE_NO "2.0.0")
|
||||
set(MD5 "d819cacd84b4938f49c0d5b486fcb653")
|
||||
downloadAndCheckMD5("https://github.com/schrodinger/coordgenlibs/archive/v${RELEASE_NO}.tar.gz"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/coordgenlibs-${RELEASE_NO}.tar.gz" ${MD5})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar zxf
|
||||
@@ -91,15 +91,6 @@ if(RDK_BUILD_COORDGEN_SUPPORT)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
file(RENAME "coordgenlibs-${RELEASE_NO}" "${COORDGEN_DIR}")
|
||||
# # FIX: this is a workaround until https://github.com/schrodinger/coordgenlibs/pull/76
|
||||
# # is merged and a new coordgen release is done
|
||||
# set(fileToPatch "${COORDGEN_DIR}/CoordgenFragmenter.h")
|
||||
# configure_file("${fileToPatch}" "${fileToPatch}.orig" COPYONLY)
|
||||
# file(READ "${fileToPatch}" buffer)
|
||||
# string(REPLACE "class CoordgenFragmenter"
|
||||
# "#include \"CoordgenConfig.hpp\"\nclass EXPORT_COORDGEN CoordgenFragmenter"
|
||||
# buffer "${buffer}")
|
||||
# file(WRITE "${fileToPatch}" "${buffer}")
|
||||
else()
|
||||
message("-- Found coordgenlibs source in ${COORDGEN_DIR}")
|
||||
endif()
|
||||
|
||||
7
External/CoordGen/CoordGen.h
vendored
7
External/CoordGen/CoordGen.h
vendored
@@ -38,8 +38,8 @@ struct CoordGenParams {
|
||||
bool dbg_useConstrained = true; // debugging
|
||||
bool dbg_useFixed = false; // debugging
|
||||
bool minimizeOnly = false; // don't actually generate full coords
|
||||
bool treatBondsToMetalAsZeroOrder =
|
||||
false; // set all bonds to metal atoms to be zero-order bonds
|
||||
bool treatNonterminalBondsToMetalAsZeroOrder =
|
||||
false; // set non-terminal bonds to metal atoms to be zero-order bonds
|
||||
};
|
||||
|
||||
static CoordGenParams defaultParams;
|
||||
@@ -77,7 +77,8 @@ unsigned int addCoords(T& mol, const CoordGenParams* params = nullptr) {
|
||||
sketcherMinimizer minimizer(params->minimizerPrecision);
|
||||
auto min_mol = new sketcherMinimizerMolecule();
|
||||
|
||||
minimizer.setTreatAllBondsToMetalAsZOBs(params->treatBondsToMetalAsZeroOrder);
|
||||
minimizer.setTreatNonterminalBondsToMetalAsZOBs(
|
||||
params->treatNonterminalBondsToMetalAsZeroOrder);
|
||||
|
||||
// FIX: only do this check once.
|
||||
// std::cerr << " TEMPLATES: " << templateFileDir << std::endl;
|
||||
|
||||
5
External/CoordGen/Wrap/rdCoordGen.cpp
vendored
5
External/CoordGen/Wrap/rdCoordGen.cpp
vendored
@@ -91,8 +91,9 @@ struct coordgen_wrapper {
|
||||
.def_readwrite("minimizerPrecision",
|
||||
&CoordGen::CoordGenParams::minimizerPrecision,
|
||||
"controls sketcher precision")
|
||||
.def_readwrite("treatBondsToMetalAsZOBs",
|
||||
&CoordGen::CoordGenParams::treatBondsToMetalAsZeroOrder);
|
||||
.def_readwrite(
|
||||
"treatNonterminalBondsToMetalAsZOBs",
|
||||
&CoordGen::CoordGenParams::treatNonterminalBondsToMetalAsZeroOrder);
|
||||
python::def("SetDefaultTemplateFileDir", SetDefaultTemplateFileDir);
|
||||
docString =
|
||||
"Add 2D coordinates.\n"
|
||||
|
||||
100
External/CoordGen/Wrap/testCoordGen.py
vendored
100
External/CoordGen/Wrap/testCoordGen.py
vendored
@@ -79,65 +79,58 @@ class TestCase(unittest.TestCase) :
|
||||
|
||||
def testMinimizeOnly(self):
|
||||
m = Chem.MolFromMolBlock('''
|
||||
Mrv2014 08052005392D
|
||||
Mrv2014 03252113022D
|
||||
|
||||
0 0 0 0 0 999 V3000
|
||||
M V30 BEGIN CTAB
|
||||
M V30 COUNTS 14 15 0 0 0
|
||||
M V30 BEGIN ATOM
|
||||
M V30 1 C -1.4287 -1.4523 0 0
|
||||
M V30 2 C -2.9638 -1.5752 0 0
|
||||
M V30 3 C -3.8377 -0.3072 0 0
|
||||
M V30 4 C -3.1766 1.0837 0 0
|
||||
M V30 5 C -1.6416 1.2066 0 0
|
||||
M V30 6 C -0.7675 -0.0614 0 0
|
||||
M V30 7 C 0.7675 0.0614 0 0
|
||||
M V30 8 C 1.6416 -1.2066 0 0
|
||||
M V30 9 C 0.9804 -2.5975 0 0
|
||||
M V30 10 N 3.1766 -1.0837 0 0
|
||||
M V30 11 C 3.8377 0.3072 0 0
|
||||
M V30 12 C 2.9638 1.5752 0 0
|
||||
M V30 13 C 1.4287 1.4523 0 0
|
||||
M V30 14 F -0.5548 -2.7203 0 0
|
||||
M V30 END ATOM
|
||||
M V30 BEGIN BOND
|
||||
M V30 1 2 1 2
|
||||
M V30 2 1 2 3
|
||||
M V30 3 2 3 4
|
||||
M V30 4 1 4 5
|
||||
M V30 5 2 5 6
|
||||
M V30 6 1 6 7
|
||||
M V30 7 2 7 8
|
||||
M V30 8 1 8 9
|
||||
M V30 9 1 8 10
|
||||
M V30 10 2 10 11
|
||||
M V30 11 1 11 12
|
||||
M V30 12 2 12 13
|
||||
M V30 13 1 6 1
|
||||
M V30 14 1 13 7
|
||||
M V30 15 1 1 14
|
||||
M V30 END BOND
|
||||
M V30 END CTAB
|
||||
14 15 0 0 0 0 999 V2000
|
||||
-0.7654 -0.7780 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.5877 -0.8439 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-2.0559 -0.1646 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.7017 0.5805 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.8794 0.6464 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.4112 -0.0329 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.4112 0.0329 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.8794 -0.6464 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.7771 -1.4237 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.7017 -0.5805 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
2.0559 0.1646 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.5877 0.8439 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.7654 0.7780 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.7654 -1.6519 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1 2 2 0 0 0 0
|
||||
2 3 1 0 0 0 0
|
||||
3 4 2 0 0 0 0
|
||||
4 5 1 0 0 0 0
|
||||
5 6 2 0 0 0 0
|
||||
6 7 1 0 0 0 0
|
||||
7 8 2 0 0 0 0
|
||||
8 9 1 0 0 0 0
|
||||
8 10 1 0 0 0 0
|
||||
10 11 2 0 0 0 0
|
||||
11 12 1 0 0 0 0
|
||||
12 13 2 0 0 0 0
|
||||
6 1 1 0 0 0 0
|
||||
13 7 1 0 0 0 0
|
||||
1 14 1 0 0 0 0
|
||||
M END
|
||||
''')
|
||||
ref = Chem.MolFromMolBlock('''
|
||||
RDKit 2D
|
||||
|
||||
14 15 0 0 0 0 0 0 0 0999 V2000
|
||||
-1.5379 -1.4859 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-3.1218 -1.5958 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-3.9595 -0.2554 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-3.2641 1.1663 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.6778 1.2217 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.7941 -0.0886 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.7983 0.0383 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.7524 -1.2209 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.1246 -2.6443 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
3.3306 -1.0787 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
3.9439 0.3747 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
3.0337 1.6656 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.4617 1.4692 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.6924 -2.7917 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.5957 -0.8221 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.4185 -0.8441 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.8520 -0.1434 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-1.4595 0.5814 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.6368 0.6072 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.2063 -0.0955 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.2087 -0.0625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.7102 -0.7158 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.4040 -1.4774 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.5259 -0.6099 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.8401 0.1516 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1.3405 0.8062 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0.5252 0.6981 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
-0.1735 -1.5240 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
|
||||
1 2 2 0
|
||||
2 3 1 0
|
||||
3 4 2 0
|
||||
@@ -153,7 +146,8 @@ M END
|
||||
6 1 1 0
|
||||
13 7 1 0
|
||||
1 14 1 0
|
||||
M END''')
|
||||
M END
|
||||
''')
|
||||
ps = rdCoordGen.CoordGenParams()
|
||||
ps.minimizeOnly = True
|
||||
m2 = Chem.Mol(m)
|
||||
|
||||
2
External/CoordGen/test.cpp
vendored
2
External/CoordGen/test.cpp
vendored
@@ -607,7 +607,7 @@ M END
|
||||
}
|
||||
|
||||
CoordGen::CoordGenParams ps;
|
||||
ps.treatBondsToMetalAsZeroOrder = true;
|
||||
ps.treatNonterminalBondsToMetalAsZeroOrder = true;
|
||||
CoordGen::addCoords(*m1, &ps);
|
||||
{
|
||||
// the ZOB behavior screws up the double bond stereo here... detect that
|
||||
|
||||
Reference in New Issue
Block a user