From 4336396b42fa4eb9e549e035580956d81a6ff6f2 Mon Sep 17 00:00:00 2001 From: even1024 Date: Thu, 30 Jan 2025 11:25:16 +0100 Subject: [PATCH] sort fix --- .../ref/layout/acs_style_reaction.py.out | 2 + .../tests/layout/ref/acs_issue_2458.ket | 66 ++++++++++++++----- .../src/reaction_multistep_detector.cpp | 10 +-- utils/indigo-depict/main.c | 2 +- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/api/tests/integration/ref/layout/acs_style_reaction.py.out b/api/tests/integration/ref/layout/acs_style_reaction.py.out index 9f08549e40..ae0379efba 100644 --- a/api/tests/integration/ref/layout/acs_style_reaction.py.out +++ b/api/tests/integration/ref/layout/acs_style_reaction.py.out @@ -25,3 +25,5 @@ acs_issue_2389.ket:SUCCEED Molecule #4: Success Molecule #5: Success Molecule #6: Success + Molecule #7: Success + Molecule #8: Success diff --git a/api/tests/integration/tests/layout/ref/acs_issue_2458.ket b/api/tests/integration/tests/layout/ref/acs_issue_2458.ket index 71d349214d..79a641a4ea 100644 --- a/api/tests/integration/tests/layout/ref/acs_issue_2458.ket +++ b/api/tests/integration/tests/layout/ref/acs_issue_2458.ket @@ -22,6 +22,12 @@ { "$ref": "mol6" }, + { + "$ref": "mol7" + }, + { + "$ref": "mol8" + }, { "type": "arrow", "data": { @@ -33,7 +39,7 @@ "z": 0.0 }, { - "x": 16.708332, + "x": 20.458332, "y": 0.0, "z": 0.0 } @@ -284,9 +290,9 @@ "type": "molecule", "atoms": [ { - "label": "O", + "label": "P", "location": [ - 10.423611, + 9.451388, 0.902778, 0.0 ] @@ -323,12 +329,26 @@ "bonds": [] }, "mol5": { + "type": "molecule", + "atoms": [ + { + "label": "O", + "location": [ + 16.048611, + 0.902778, + 0.0 + ] + } + ], + "bonds": [] + }, + "mol6": { "type": "molecule", "atoms": [ { "label": "N", "location": [ - 17.854164, + 21.604164, 1.309017, 0.0 ] @@ -336,7 +356,7 @@ { "label": "C", "location": [ - 18.805222, + 22.555222, 1.0, 0.0 ] @@ -344,7 +364,7 @@ { "label": "C", "location": [ - 17.26638, + 21.01638, 0.5, 0.0 ] @@ -352,7 +372,7 @@ { "label": "C", "location": [ - 18.805222, + 22.555222, -0.0, 0.0 ] @@ -360,7 +380,7 @@ { "label": "N", "location": [ - 19.671247, + 23.421247, 1.5, 0.0 ] @@ -368,7 +388,7 @@ { "label": "N", "location": [ - 17.854166, + 21.604166, -0.309017, 0.0 ] @@ -376,7 +396,7 @@ { "label": "C", "location": [ - 19.671247, + 23.421247, -0.5, 0.0 ] @@ -384,7 +404,7 @@ { "label": "C", "location": [ - 20.537273, + 24.287273, 1.0, 0.0 ] @@ -392,7 +412,7 @@ { "label": "N", "location": [ - 20.537273, + 24.287273, 0.0, 0.0 ] @@ -400,7 +420,7 @@ { "label": "O", "location": [ - 19.671247, + 23.421247, -1.5, 0.0 ] @@ -408,7 +428,7 @@ { "label": "N", "location": [ - 21.403297, + 25.153297, 1.5, 0.0 ] @@ -501,13 +521,27 @@ } ] }, - "mol6": { + "mol7": { "type": "molecule", "atoms": [ { "label": "P", "location": [ - 15.076388, + 16.951387, + 0.902778, + 0.0 + ] + } + ], + "bonds": [] + }, + "mol8": { + "type": "molecule", + "atoms": [ + { + "label": "O", + "location": [ + 19.798611, 0.902778, 0.0 ] diff --git a/core/indigo-core/reaction/src/reaction_multistep_detector.cpp b/core/indigo-core/reaction/src/reaction_multistep_detector.cpp index 7e276b1e52..91950f6c21 100644 --- a/core/indigo-core/reaction/src/reaction_multistep_detector.cpp +++ b/core/indigo-core/reaction/src/reaction_multistep_detector.cpp @@ -1432,9 +1432,9 @@ void ReactionMultistepDetector::constructSimpleArrowReaction(BaseReaction& rxn) switch (comp.component_type) { case ReactionComponent::MOLECULE: { - if (comp.molecule && comp.summ_block_idx != ReactionComponent::NOT_CONNECTED && - _component_summ_blocks[comp.summ_block_idx].role != BaseReaction::UNDEFINED) + if (comp.molecule && comp.summ_block_idx != ReactionComponent::NOT_CONNECTED) { + auto role = _component_summ_blocks[comp.summ_block_idx].role; auto& cmol = *comp.molecule; for (int idx = cmol.vertexBegin(); idx < cmol.vertexEnd(); idx = cmol.vertexNext(idx)) { @@ -1449,10 +1449,12 @@ void ReactionMultistepDetector::constructSimpleArrowReaction(BaseReaction& rxn) rxn.addCatalystCopy(cmol, 0, 0); break; case KProductArea: - rxn.addProductCopy(cmol, 0, 0); + if (role != BaseReaction::UNDEFINED) + rxn.addProductCopy(cmol, 0, 0); break; default: - rxn.addReactantCopy(cmol, 0, 0); + if (role != BaseReaction::UNDEFINED) + rxn.addReactantCopy(cmol, 0, 0); break; } break; diff --git a/utils/indigo-depict/main.c b/utils/indigo-depict/main.c index bc0b64e516..1f468387d5 100644 --- a/utils/indigo-depict/main.c +++ b/utils/indigo-depict/main.c @@ -1059,7 +1059,7 @@ int main(int argc, char* argv[]) _prepare(obj, p.aromatization); if (p.action == ACTION_LAYOUT) { - indigoLayout(obj); + //indigoLayout(obj); if (p.out_ext == OEXT_CML) indigoSaveCmlToFile(obj, p.outfile); else if (p.out_ext == OEXT_RXN)