ReactionMechanismGenerator / RMG-Py

Python version of the amazing Reaction Mechanism Generator (RMG).
http://reactionmechanismgenerator.github.io/RMG-Py/
Other
400 stars 228 forks source link

UnboundLocalError: local variable 'optical_isomers' referenced before assignment #2690

Closed wanufey closed 2 weeks ago

wanufey commented 4 months ago

Bug Description

I ran Arkane (through ARC) and got this trace-back:

Traceback (most recent call last):
  File "/home/william.d/Code/ARC/ARC.py", line 69, in <module>
    main()
  File "/home/william.d/Code/ARC/ARC.py", line 65, in main
    arc_object.execute()
  File "/home/william.d/Code/ARC/arc/main.py", line 664, in execute
    skip_nmd=self.skip_nmd,
  File "/home/william.d/Code/ARC/arc/processor.py", line 161, in process_arc_project
    statmech_adapter.compute_thermo(kinetics_flag=False, e0_only=species.e0_only)
  File "/home/william.d/Code/ARC/arc/statmech/arkane.py", line 166, in compute_thermo
    plot=False)
  File "/home/william.d/Code/ARC/arc/statmech/arkane.py", line 340, in run_statmech
    raise e
  File "/home/william.d/Code/ARC/arc/statmech/arkane.py", line 332, in run_statmech
    statmech_job.execute(output_directory=arkane_output_path, plot=plot)
  File "/home/william.d/Code/RMG-Py/arkane/statmech.py", line 291, in execute
    self.load(pdep, plot)
  File "/home/william.d/Code/RMG-Py/arkane/statmech.py", line 695, in load
    optical_isomers_read, symmetry_read, point_group_read = statmech_log.get_symmetry_properties()
  File "/home/william.d/Code/RMG-Py/arkane/ess/adapter.py", line 202, in get_symmetry_properties
    return optical_isomers, symmetry, pg.point_group
UnboundLocalError: local variable 'optical_isomers' referenced before assignment

On this line optical_isomers is only defined if the above condition is true, and is not defined otherwise.

How To Reproduce

This is the input file used for ARC:

project: run2
level_of_theory: CBS-QB3
compute_thermo: true
allow_nonisomorphic_2d: True

species:
  - label: 'OH'
    smiles: '[OH]'
  - label: 'H2O'
    smiles: 'O'      
  - label: 'hexyl'
    smiles: '[CH2]CCCCC'
  - label: 'hexene'
    smiles: 'C=CCCCC'

reactions:
  - label: "OH + hexyl <=> H2O + hexene"
    ts_xyz_guess:
    - |
      C                 -4.63348110   -1.82712873    0.07491964
      H                 -4.63361931   -2.89708527    0.06407507
      H                 -3.94798874   -1.46304379   -0.66159045
      H                 -5.61717432   -1.46808634   -0.14497755
      C                 -4.20408350   -1.32795465    1.46703351
      H                 -3.22039072   -1.68697900    1.68692450
      H                 -4.20395989   -0.25799300    1.47788501
      C                 -5.19068242   -1.85196270    2.52706503
      H                 -5.19076266   -2.92192175    2.51625455
      H                 -6.17437597   -1.49299294    2.30711259
      C                 -4.76140129   -1.35273238    3.91921005
      H                 -4.76134670   -0.28277204    3.93004999
      H                 -3.77769712   -1.71171135    4.13914324
      C                 -5.74804453   -1.87678658    4.97920345
      H                 -5.74804986   -2.94673933    4.96837672
      H                 -6.73174866   -1.51782719    4.75920244
      C                 -5.31887645   -1.37756108    6.37138205
      H                 -4.55004540    0.02347956    6.51980114
      H                 -5.53326765   -1.96473097    7.23979811
      O                 -3.86025180    1.28042445    6.65326912
      H                 -3.66612881    1.44212132    7.57944521

Expected Behavior

We a expected Arkane not to crash.

Installation Information

Describe your installation method and system information.

JacksonBurns commented 4 months ago

I think you might have this output from Arkane in your logs somewhere:

Symmetry algorithm errored when computing point group
for log file located at [...].
Manually provide values in Arkane input.

given that the try command that the line you linked to does not have an except block, I believe this exception being raised is a (rather hamfisted) way of informing you that the call to symmetry failed.

Could you try triggering a similar calculation that would call out to symmetry in pure Arkane?

github-actions[bot] commented 1 month ago

This issue is being automatically marked as stale because it has not received any interaction in the last 90 days. Please leave a comment if this is still a relevant issue, otherwise it will automatically be closed in 30 days.