diff --git a/api/tests/integration/ref/formats/smarts.py.out b/api/tests/integration/ref/formats/smarts.py.out index a71e300f34..b9a44de9c8 100644 --- a/api/tests/integration/ref/formats/smarts.py.out +++ b/api/tests/integration/ref/formats/smarts.py.out @@ -74,12 +74,18 @@ Ok expected smarts generated [#6,#7;a]:[o] is ok. expected string found in json [c,n,o]:[o] is ok. json_in==json_out [c,n,o]:[o] is ok. expected string found in json +[c,C,c] is ok. smarts_in==smarts_out [c,C,c] is ok. json_in==json_out [c,C,c] is ok. expected string found in json +[C,c] is ok. smarts_in==smarts_out [C,c] is ok. json_in==json_out [C,c] is ok. expected string found in json +[C,c,n,o] is ok. smarts_in==smarts_out [C,c,n,o] is ok. json_in==json_out [C,c,n,o] is ok. expected string found in json +[#7;v4]-[#6] is ok. smarts_in==smarts_out +[#7;v4]-[#6] is ok. json_in==json_out +[#7;v4]-[#6] is ok. expected string found in json *** SMARTS specific *** Smarts [C,N] loaded as smarts - OK. Smarts [C;N] loaded as smarts - OK. diff --git a/api/tests/integration/tests/formats/smarts.py b/api/tests/integration/tests/formats/smarts.py index 906b084658..6fe3361a59 100755 --- a/api/tests/integration/tests/formats/smarts.py +++ b/api/tests/integration/tests/formats/smarts.py @@ -215,13 +215,16 @@ def test_smarts_load_save_through_ket( test_smarts_load_save_through_ket(smarts, expected, False) smarts = "[c,C,c]" expected = '"atoms":[{"label":"C","location":[0.0,0.0,0.0],"queryProperties":{"customQuery":"c,C,c"}}]' -test_smarts_load_save_through_ket(smarts, expected, False) +test_smarts_load_save_through_ket(smarts, expected) smarts = "[C,c]" expected = '"atoms":[{"label":"C","location":[0.0,0.0,0.0],"queryProperties":{"customQuery":"C,c"}}]' -test_smarts_load_save_through_ket(smarts, expected, False) +test_smarts_load_save_through_ket(smarts, expected) smarts = "[C,c,n,o]" expected = '"atoms":[{"label":"","location":[0.0,0.0,0.0],"queryProperties":{"customQuery":"C,c,n,o"}}]' -test_smarts_load_save_through_ket(smarts, expected, False) +test_smarts_load_save_through_ket(smarts, expected) +smarts = "[#7;v4]-[#6]" +expected = '"atoms":[{"label":"N","location":[0.0,0.0,0.0],"explicitValence":4},{"label":"C","location":[1.0,0.0,0.0]}]' +test_smarts_load_save_through_ket(smarts, expected) print(" *** SMARTS specific ***") smarts_list = [ "[C,N]", diff --git a/core/indigo-core/molecule/src/molecule_json_loader.cpp b/core/indigo-core/molecule/src/molecule_json_loader.cpp index 592274793a..be18de100d 100644 --- a/core/indigo-core/molecule/src/molecule_json_loader.cpp +++ b/core/indigo-core/molecule/src/molecule_json_loader.cpp @@ -178,7 +178,7 @@ int MoleculeJsonLoader::addAtomToMoleculeQuery(const char* label, int element, i { if (valence == 15) valence = 0; - atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_VALENCE, valence))); + atom.reset(QueryMolecule::Atom::und(atom.release(), new QueryMolecule::Atom(QueryMolecule::ATOM_TOTAL_BOND_ORDER, valence))); } if (isotope != 0) diff --git a/core/indigo-core/molecule/src/molecule_json_saver.cpp b/core/indigo-core/molecule/src/molecule_json_saver.cpp index f1d124e8ea..0d3c5cc8fc 100644 --- a/core/indigo-core/molecule/src/molecule_json_saver.cpp +++ b/core/indigo-core/molecule/src/molecule_json_saver.cpp @@ -930,7 +930,13 @@ void MoleculeJsonSaver::saveAtoms(BaseMolecule& mol, JsonWriter& writer) writer.Int(charge); } - if (evalence > 0) + int total_bond_count = 0; + if (_pqmol && _pqmol->getAtom(i).sureValue(QueryMolecule::ATOM_TOTAL_BOND_ORDER, total_bond_count)) + { + writer.Key("explicitValence"); + writer.Int(total_bond_count); + } + else if (evalence > 0) { writer.Key("explicitValence"); writer.Int(evalence);