ReactionMechanismGenerator / ARC

ARC - Automatic Rate Calculator
https://reactionmechanismgenerator.github.io/ARC/index.html
MIT License
43 stars 21 forks source link

ValueError in the "coordinates conversions" tutoial #681

Closed JintaoWu98 closed 1 year ago

JintaoWu98 commented 1 year ago

Describe the bug We received the following error shown below, in the section of "zmat to xyz" from the tutorial in ARC/ipython/Toolscoordinates conversions.ipynb.

ValueError: Could not find value 15 in the dictionary
{0: 5, 1: 4, 2: 'X', 3: 3, 4: 2, 5: 6, 6: 1, 7: 7, 8: 0, 9: 8, 10: 'X', 11: 9, 12: 10, 13: 11, 14: 12, 15: 13, 16: 'X', 17: 14}

How to reproduce You can either run the file ARC/ipython/Toolscoordinates conversions.ipynb, or the following code

from arc.species.converter import (zmat_to_xyz,
                                   check_zmat_dict,)
import pprint
zmat = {'symbols': ('N', 'C', 'X', 'C', 'C', 'C', 'C', 'C', 'C',
                    'C', 'X', 'C', 'H', 'H', 'H', 'H', 'X', 'H'),
        'coords': ((None, None, None),
                   ('R_1_0', None, None),
                   ('RX_2|10|16_1|9|11', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16', None),
                   ('R_3_1', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16',
                    'DX_3|11|17_1|9|11_2|10|16_0|7|7'),
                   ('R_4_3', 'A_4_3_1', 'D_4_3_1_0'),
                   ('R_5_3', 'A_5_3_4', 'D_5|9_3|7_4|8_1|6'),
                   ('R_6_4', 'A_6_4_3', 'D_6_4_3_5'),
                   ('R_7_5', 'A_7_5_3', 'D_7|8_5|6_3|4_4|3'),
                   ('R_8_6', 'A_8_6_4', 'D_7|8_5|6_3|4_4|3'),
                   ('R_9_7', 'A_9_7_8', 'D_5|9_3|7_4|8_1|6'),
                   ('RX_2|10|16_1|9|11', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16', 'DX_10_9_7_8'),
                   ('R_11_9', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16',
                    'DX_3|11|17_1|9|11_2|10|16_0|7|7'),
                   ('R_12_8', 'A_12_8_6', 'D_12|13|14_8|6|4_6|8|6_4|7|8'),
                   ('R_13_6', 'A_13_6_8', 'D_12|13|14_8|6|4_6|8|6_4|7|8'),
                   ('R_14|15_4|5', 'A_14_4_6', 'D_12|13|14_8|6|4_6|8|6_4|7|8'),
                   ('R_14|15_4|5', 'A_15_5_7', 'D_15_5_7_9'),
                   ('RX_2|10|16_1|9|11', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16', 'DX_16_11_7_9'),
                   ('R_17_11', 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16',
                    'DX_3|11|17_1|9|11_2|10|16_0|7|7')),
        'vars': {'R_1_0': 1.160587988259717, 'R_3_1': 1.4334034806467013, 'R_4_3': 1.399627009160122,
                 'A_4_3_1': 120.07019183443934, 'D_4_3_1_0': 359.9937872737281,
                 'R_5_3': 1.399473903784766, 'A_5_3_4': 119.881331942158, 'R_6_4': 1.3958533508611464,
                 'A_6_4_3': 120.08126334426318, 'D_6_4_3_5': 359.9999896133953,
                 'R_7_5': 1.3971923740671386, 'A_7_5_3': 119.9563068700548, 'R_8_6': 1.3959594593665048,
                 'A_8_6_4': 119.9482566876851, 'R_9_7': 1.4305023206087322, 'A_9_7_8': 120.02391642181419,
                 'DX_10_9_7_8': 179.99687489419622, 'R_11_9': 1.2007843136670773,
                 'R_12_8': 1.0880999543508234, 'A_12_8_6': 119.53324505705585,
                 'R_13_6': 1.0875755415362989, 'A_13_6_8': 119.9515345136673,
                 'A_14_4_6': 119.41761055861897, 'A_15_5_7': 119.8756160539422,
                 'DX_16_11_7_9': 179.99364917335183, 'R_17_11': 1.0653051483625748,
                 'RX_2|10|16_1|9|11': 1.0, 'R_14|15_4|5': 1.088721623781535,
                 'AX_2|3|10|11|16|17_1|1|9|9|11|11_0|2|7|10|7|16': 90.0,
                 'DX_3|11|17_1|9|11_2|10|16_0|7|7': 180.0,
                 'D_12|13|14_8|6|4_6|8|6_4|7|8': 180.00000001419417,
                 'D_5|9_3|7_4|8_1|6': 180.0000026484778, 'D_15_5_7_9': 7.778248095798993e-06,
                 'D_7|8_5|6_3|4_4|3': 6.434770254282058e-06},
        'map': {0: 5, 1: 4, 2: 'X', 3: 3, 4: 2, 5: 6, 6: 1, 7: 7, 8: 0, 9: 8, 10: 'X', 11: 9, 12: 10,
                13: 11, 14: 12, 15: 13, 16: 'X', 17: 14}}

xyz_dict = zmat_to_xyz(check_zmat_dict(zmat))

pprint.pprint(xyz_dict)

Expected behavior Return zmat to xyz successfully.

alongd commented 1 year ago

Thanks, @JintaoWu98, for reporting the issue The zmat in this example is incorrect, so in other words its OK to get this error (ARC was updated after writing this example). I think that the problem is that these examples were not added as tests to ARC. The error is right, since there's really no value 15 in the zmat 'map'.

I suggest updating this example, and then creating a new test for our converter module with a clear name (of the test function) that reflects it is related to this notebook. During development, if one of these tests fails, we'll know we need to not only fix it, but also perhaps update this example notebook.

alongd commented 1 year ago

@JintaoWu98, would you like to resolve this issue following our example from yesterday?

JintaoWu98 commented 1 year ago

@JintaoWu98, would you like to resolve this issue following our example from yesterday?

Sure, I would like to give it a shot.

alongd commented 1 year ago

closed by PR #692