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

skip generation when # tree reactants != # given reactants #1675

Merged
merged 3 commits into from Aug 7, 2019
Merged

Conversation

mjohnson541
Copy link
Contributor

Fixes #1674.

@mjohnson541 mjohnson541 requested a review from mliu49 August 7, 2019 15:15
@alongd
Copy link
Member

alongd commented Aug 7, 2019

Could you also add a test for a birad?

@amarkpayne amarkpayne added Before Py3 Should be merged before Python 3 transition Priority: Critical Should be addressed ASAP Type: Bug labels Aug 7, 2019

reactantNum = self.productNum

if self.autoGenerated and reactantNum != len(reactants):
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have to be autoGenerated for this to be a good check to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because for non-autogenerated trees self.reactantNum seems to be guessed from the template number, which really only works for bimolecular families.

@mliu49
Copy link
Contributor

mliu49 commented Aug 7, 2019

I think this looks fine overall. I agree that it would be good to add a test.

@codecov
Copy link

codecov bot commented Aug 7, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@5f95c4d). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1675   +/-   ##
=========================================
  Coverage          ?   41.55%           
=========================================
  Files             ?      176           
  Lines             ?    29837           
  Branches          ?     6192           
=========================================
  Hits              ?    12399           
  Misses            ?    16530           
  Partials          ?      908
Impacted Files Coverage Δ
rmgpy/data/kinetics/family.py 48.87% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f95c4d...b7e4fac. Read the comment docs.

@codecov
Copy link

codecov bot commented Aug 7, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@5f95c4d). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1675   +/-   ##
=========================================
  Coverage          ?   41.54%           
=========================================
  Files             ?      176           
  Lines             ?    29840           
  Branches          ?     6192           
=========================================
  Hits              ?    12398           
  Misses            ?    16533           
  Partials          ?      909
Impacted Files Coverage Δ
...tabase/kinetics/families/R_Recombination/groups.py 100% <100%> (ø)
rmgpy/data/kinetics/family.py 48.71% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f95c4d...212a224. Read the comment docs.



def testReactantNumID(self):
family = self.database.families['R_Recombination']
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

spc = Molecule().fromSMILES("[CH2]CC[CH2]")
out = family._KineticsFamily__generateReactions(reactants=[spc],forward=True)
logging.error(out)
self.assertTrue(out==[])
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use assertEqual.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

family = self.database.families['R_Recombination']
spc = Molecule().fromSMILES("[CH2]CC[CH2]")
out = family._KineticsFamily__generateReactions(reactants=[spc],forward=True)
logging.error(out)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need to log this. If the assertion fails, it will print out the value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@mliu49 mliu49 merged commit 114bd34 into master Aug 7, 2019
@mliu49 mliu49 deleted the atg_fix branch August 7, 2019 21:12
@mliu49 mliu49 mentioned this pull request Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Before Py3 Should be merged before Python 3 transition Priority: Critical Should be addressed ASAP Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimal Example Does Not Run on Current Master
4 participants