Closed MrDarkHorse closed 5 years ago
It seems like the standardizer is tripping over normalizing this structure, so the nodes are out of order when it tries to compare them.
I'm increasingly of the opinion that this change likely caused the regression. I will attempt to prove this tomorrow
https://github.com/partridgejiang/Kekule.js/commit/e1767d7dfa7e935025d56ba09bf35d8ab5bdb01d
@MrDarkHorse Thanks a lot again. A rough fix has been made in commit 8401caa, it seems to solve the problem.
I'm still seeing errors on these 2, but I will investigate further
I don't know. Just seems like the canonical index isn't getting set correctly. I get lost in the graph theory stuff though. :\
A little bewildered... In my test: @MrDarkHorse Could you please provide the source files of your test cases? Thanks.
These should be sufficient. Those 2 files appear to be the same but don't match
eh...... Aren't those two files exactly the same? Maybe a wrong file is pasted here?
Oops... trying again
{ "coordPos2D": 0, "coordPos3D": 0, "renderOptions": { "expanded": true, "__type__": "object" }, "coord2D": { "x": 2.307956300727386, "y": 5.88003329039293, "__type__": "object" }, "charge": 0, "parity": null, "ctab": { "nodes": [{ "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": -0.6928203230275534, "y": 0.40000000000000213, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": -0.6928203230275543, "y": -0.40000000000000213, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0, "y": 0.8000000000000025, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0, "y": -0.8000000000000043, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0.6928203230275525, "y": 0.40000000000000036, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0.6928203230275525, "y": -0.40000000000000213, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }], "anchorNodes": [], "connectors": [{ "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [0, 1] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [0, 2] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [1, 3] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [2, 4] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [3, 5] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "bondType": "covalent", "bondOrder": 2, "electronCount": 4, "isInAromaticRing": false, "connectedObjs": [4, 5] }], "__type__": "Kekule.StructureConnectionTable" }, "__type__": "Kekule.Molecule" }
{ "coordPos2D": 0, "coordPos3D": 0, "renderOptions": { "expanded": true, "__type__": "object" }, "coord2D": { "x": 2.045086640267364, "y": 5.58901262913221, "__type__": "object" }, "charge": 0, "parity": null, "ctab": { "nodes": [{ "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0, "y": -0.8000000000000025, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0.6928203230275525, "y": -0.40000000000000036, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": -0.6928203230275543, "y": -0.40000000000000036, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0.6928203230275525, "y": 0.40000000000000036, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": -0.6928203230275534, "y": 0.40000000000000036, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }, { "__type__": "Kekule.Atom", "coordPos2D": 0, "coordPos3D": 0, "coord2D": { "x": 0, "y": 0.8000000000000025, "__type__": "object" }, "charge": 0, "parity": null, "explicitHydrogenCount": 0, "isotopeId": "C" }], "anchorNodes": [], "connectors": [{ "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [0, 1] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [0, 2] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "bondType": "covalent", "bondOrder": 2, "electronCount": 4, "isInAromaticRing": false, "connectedObjs": [1, 3] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [2, 4] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [3, 5] }, { "__type__": "Kekule.Bond", "coordPos2D": 0, "coordPos3D": 0, "parity": null, "bondType": "covalent", "bondOrder": 1, "electronCount": 2, "isInAromaticRing": false, "connectedObjs": [4, 5] }], "__type__": "Kekule.StructureConnectionTable" }, "__type__": "Kekule.Molecule" }
Still these two structures are same in my test with the latest commits...
Happy New Year!
So I'm running the structure compare demo tool in master, and I pasted the above structures in using the JSON loader.
I modified the demo file to point to the local src, like so:
<title>Molecule Compare</title>
<script src="../../libs/raphael-min.2.0.1.js"></script>
<script src="../../../src/kekule.js"></script>
Still coming up as different.
Are you sure you're both running the latest code and using the exact JSON files that I'm using?
Eh... Sorry that I forgot to update the min js files in demo directoy, and I myself did all those tests on test/algorithmTest/structureCompare.html. Now the demos have been updated, please have another try, :).
Oh man.... somehow we had missed SHA 7601bb4a5cdbe7fca0183c39b7352d613e340c9c in our fork.
So this resolved itself. Just took me a while to figure out what was going on.
Thanks!