Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved TS energy checks #690

Merged
merged 13 commits into from
Oct 2, 2023
Merged

Improved TS energy checks #690

merged 13 commits into from
Oct 2, 2023

Conversation

alongd
Copy link
Member

@alongd alongd commented Aug 3, 2023

Calling the checks from a centralized function
Refactoring ts_check functions
Tests added

@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Merging #690 (e8e3fe4) into main (82d915d) will increase coverage by 0.07%.
The diff coverage is 85.32%.

@@            Coverage Diff             @@
##             main     #690      +/-   ##
==========================================
+ Coverage   73.24%   73.31%   +0.07%     
==========================================
  Files          99       99              
  Lines       26582    26609      +27     
  Branches     5558     5563       +5     
==========================================
+ Hits        19469    19508      +39     
+ Misses       5771     5758      -13     
- Partials     1342     1343       +1     
Flag Coverage Δ
unittests 73.31% <85.32%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
arc/checks/ts_test.py 99.43% <100.00%> (+0.02%) ⬆️
arc/scheduler_test.py 100.00% <100.00%> (ø)
arc/species/species.py 71.96% <100.00%> (+0.04%) ⬆️
arc/reaction.py 67.03% <85.71%> (+0.24%) ⬆️
arc/scheduler.py 21.79% <68.42%> (+0.48%) ⬆️
arc/checks/ts.py 78.51% <77.50%> (-0.50%) ⬇️

... and 2 files with indirect coverage changes

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

Copy link
Collaborator

@kfir4444 kfir4444 left a comment

Choose a reason for hiding this comment

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

Hey @alongd thanks for this PR!
I have added some comments.

arc/scheduler.py Show resolved Hide resolved
arc/scheduler.py Show resolved Hide resolved
arc/scheduler.py Show resolved Hide resolved
arc/scheduler.py Show resolved Hide resolved
arc/checks/ts.py Show resolved Hide resolved
return False
return True
return False
return rxn_copy
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not clear from the name and use of this function that it should return a reaction object. The name contains compute, so it should either return a computed result, or populate an object property. Could you elaborate and consider renaming?

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment in the docstring. It's indeed unclear from the name, but the use does show it, also the type hint and now the docstring.

@@ -2431,20 +2429,22 @@ def check_rxn_e0_by_spc(self, label: str):
"""
for rxn in self.rxn_list:
labels = rxn.reactants + rxn.products + [rxn.ts_label]
if label in labels and not rxn.ts_species.ts_checks['E0'] \
if label in labels and rxn.ts_species.ts_checks['E0'] is None \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not None is equivalent to True, no need to change this line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, this is just semantics, not logic. I think the current version is more explicit.

arc/scheduler.py Outdated
and all([(species_has_sp(output_dict) and species_has_freq(output_dict))
or self.species_dict[spc_label].yml_path is not None
and all([(species_has_sp(output_dict, self.species_dict[spc_label].yml_path)
and species_has_freq(output_dict, self.species_dict[spc_label].yml_path))
Copy link
Collaborator

Choose a reason for hiding this comment

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

good catch, the original code would have caused issues and wasn't readable!

@alongd
Copy link
Member Author

alongd commented Aug 22, 2023

Thanks, @kfir4444, I addressed the comments with fixup commits, let me know if you have additional comments or whether I can go ahead and squash

arc/checks/ts.py Outdated Show resolved Hide resolved
@kfir4444 kfir4444 merged commit 5c3aab6 into main Oct 2, 2023
7 checks passed
@kfir4444 kfir4444 deleted the ts_check branch October 2, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants