Closed Zhirnoff closed 2 months ago
I am working on the issue. Find below analysis.
The structure we want to create is trigonal. But in the code, it is considered as Tetrahydral because of below parameter is by default set to true.
Due to this, the CML conversion trying to add atomRefs4 attributes, but this trigonal structure has only 2 atoms present and tetrahydral requires at least 3 atoms. The 3rd atom id is set to -1 and that is why the exception occurs.
I tried to make the default variable is_tetrahydral(false) After this change the CML conversion is successful but the ABS is not handled in this case. I am currently looking into this.
Because of the stereolabel, the stereocenter is constructed. stereo_centers.size=1 addStereocentersIgnoreBad method inserts neighbor vertices into the pyramid array.
A stereocenter is an atom, typically carbon, that has four attachments. As per this statement, this case is incorrect.
The solution could be- Add a virtual atom to the molecule to make it tetrahedral structure. While setting atomParity, use virtual atomId to set atomref4 attribute.
Verified. Windows 10 Chrome Version 125.0.6422.113 (Official Build) (64-bit) Ketcher Version 2.21.0-rc.2 Build at 2024-05-31; 10:48:44 Indigo Toolkit Version 1.21.0-dev.5.2-g994bdab98-x86_64-linux-gnu-11.2.1
Steps to Reproduce
Actual behavior The structure saved in CML format does not open. System throws exception: Convert error! Given string could not be loaded as (query or plain) molecule or reaction, see the error messages: 'CML loader: 'query features' are allowed only for queries', 'RXN loader: bad header <?xml version="1.0" encoding="UTF-8"?>', 'RXN loader: bad header <?xml version="1.0" encoding="UTF-8"?>', 'CML loader: atom id a-1 cannot be found'![image](https://github.com/epam/Indigo/assets/26869421/b614bce3-6425-4161-b267-8beb8f64064a)
Expected behavior The structure saved in CML format opens![image](https://github.com/epam/Indigo/assets/26869421/f6ebd99a-bc8d-42ff-b2e8-3d63c8262447)
Desktop (please complete the following information):
Indigo version [Version 1.19.0-rc.2]
Attachments Error in Standalone mode:![2024-03-25_20h36_52](https://github.com/epam/Indigo/assets/62464241/013bbb73-6722-44f9-8d30-b669c7ee8c24)
Error in Remote mode:
![2024-03-25_20h38_14](https://github.com/epam/Indigo/assets/62464241/b3420961-3b1d-4326-9e86-afa69dc87df5)