Skip to content

Solving the 'Fragment' object has no attribute 'count_internal_rotors' error#2395

Merged
xiaoruiDong merged 2 commits intomainfrom
frag_err
Mar 7, 2023
Merged

Solving the 'Fragment' object has no attribute 'count_internal_rotors' error#2395
xiaoruiDong merged 2 commits intomainfrom
frag_err

Conversation

@alongd
Copy link
Copy Markdown
Member

@alongd alongd commented Mar 5, 2023

Motivation or Problem

Recently, RMG crashes often, for different chemistries, with the following trace:

  File "/home/alongd/Code/RMG-Py/rmg.py", line 118, in <module>
    main()
  File "/home/alongd/Code/RMG-Py/rmg.py", line 112, in main
    rmg.execute(**kwargs)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/main.py", line 944, in execute
    self.reaction_model.enlarge(objectToEnlarge)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/model.py", line 709, in enlarge
    self.update_unimolecular_reaction_networks()
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/model.py", line 1918, in update_unimolecular_reaction_networks
    network.update(self, self.pressure_dependence)
  File "/home/alongd/Code/RMG-Py/rmgpy/rmg/pdep.py", line 808, in update
    spec.generate_statmech()
  File "rmgpy/species.py", line 821, in rmgpy.species.Species.generate_statmech
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 679, in get_statmech_data
    statmech_model = self.get_statmech_data_from_groups(molecule, thermo_model)
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 713, in get_statmech_data_from_groups
    return self.groups['groups'].get_statmech_data(molecule, thermo_model)
  File "/home/alongd/Code/RMG-Py/rmgpy/data/statmech.py", line 384, in get_statmech_data
    num_rotors = molecule.count_internal_rotors()
AttributeError: 'Fragment' object has no attribute 'count_internal_rotors'

Description of Changes

Two methods, count_internal_rotors() and is_bond_in_cycle() were added to the Fragment class.

@alongd alongd requested a review from lily90502 March 5, 2023 07:45
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 5, 2023

Codecov Report

Merging #2395 (d0f1e64) into main (c2b0944) will decrease coverage by 0.01%.
The diff coverage is 20.00%.

@@            Coverage Diff             @@
##             main    #2395      +/-   ##
==========================================
- Coverage   48.25%   48.24%   -0.01%     
==========================================
  Files         110      110              
  Lines       30616    30626      +10     
  Branches     7982     7986       +4     
==========================================
+ Hits        14774    14776       +2     
- Misses      14298    14305       +7     
- Partials     1544     1545       +1     
Impacted Files Coverage Δ
rmgpy/molecule/fragment.py 73.11% <20.00%> (-0.53%) ⬇️
arkane/kinetics.py 12.24% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

lily90502
lily90502 previously approved these changes Mar 5, 2023
Copy link
Copy Markdown
Contributor

@lily90502 lily90502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding these functions. These two look okay to me!

@alongd
Copy link
Copy Markdown
Member Author

alongd commented Mar 6, 2023

@lily90502, I rebased. Could you please re-approve and merge?

Copy link
Copy Markdown
Contributor

@xiaoruiDong xiaoruiDong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @alongd @lily90502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants