-
Notifications
You must be signed in to change notification settings - Fork 230
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
Network Explorer Part 2 #1545
Network Explorer Part 2 #1545
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1545 +/- ##
=======================================
Coverage 41.65% 41.65%
=======================================
Files 166 166
Lines 28452 28452
Branches 5855 5855
=======================================
Hits 11853 11853
Misses 15777 15777
Partials 822 822 Continue to review full report at Codecov.
|
ea62530
to
9153c83
Compare
This should be ready for review now. |
25869a1
to
26419b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! See some comments
arkane/explorer.py
Outdated
flags = np.array([s.molecule[0].getFormula()==form for s in reaction_model.core.species]) | ||
biflags = np.zeros((len(reaction_model.core.species),len(reaction_model.core.species))) | ||
elif len(self.source) == 2: | ||
flags = np.array([s.molecule[0].getFormula()==form for s in reaction_model.core.species]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If flags
is being set the same regardless of the condition, perhaps set it before the if statement? Or should it be set to zeroes if len(self.source)==2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
arkane/explorer.py
Outdated
if network.getLeakCoefficient(T=T,P=P) > self.explore_tol: | ||
kchar = 0.0 #compute the characteristic rate coefficient by summing all rate coefficients from the reactant channel | ||
for rxn in self.network.netReactions:#reaction_model.core.reactions+reaction_model.edge.reactions: | ||
if set(rxn.reactants) == set(self.source) and len(rxn.products) == 1 and rxn.products[0].molecule[0].getFormula() == form: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have len(rxn.products) == 1
but not rxn.products[0].molecule[0].getFormula() == form
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check rxn.products[0].molecule[0].getFormula() == form
as well in this condition? Shouldn't checking for len(rxn.products) == 1
be enough? If there's only one product, can it have a different formula than the PES?
arkane/explorer.py
Outdated
if set(rxn.reactants) == set(self.source) and len(rxn.products) == 1 and rxn.products[0].molecule[0].getFormula() == form: | ||
kchar += rxn.kinetics.getRateCoefficient(T=T,P=P) | ||
elif set(rxn.products) == set(self.source) and len(rxn.reactants) == 1 and rxn.reactants[0].molecule[0].getFormula() == form: | ||
kchar += rxn.generateReverseRateCoefficient(network_kinetics=True).getRateCoefficient(T=T,P=P) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this chunk was added in a commit which is part of this PR:
use the sum of the rate coefficients for all net rates from the
, f236722
Can you merge these instead of deleting the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fixed too.
|
||
def test_arkane_examples(self): | ||
for example_type in self.example_types: | ||
example_type_path = os.path.join(self.base_path, example_type) | ||
for example in os.listdir(example_type_path): | ||
for example in sorted(os.listdir(example_type_path)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check whether #1565 solved this problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't solve the issue
I think this should be ready. |
…e channel to every other channel times the explore_tol for the threshold before explore_tol was simply an unscaled threshold for the leak rate
this results in multiple output files
…s that produces two networks
…ad of explorerjob.network
So it appears that the order of the explorer/network examples matters significantly enough that some orders give you database loading related errors The logic of the errors and the ordering aren't obvious for this reason the explorer examples are run before the network examples and the the os.listdir() output is sorted to maintain consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. See one minor comment. I'd like to test it out before we merge
arkane/explorer.py
Outdated
if network.getLeakCoefficient(T=T,P=P) > self.explore_tol: | ||
kchar = 0.0 #compute the characteristic rate coefficient by summing all rate coefficients from the reactant channel | ||
for rxn in self.network.netReactions:#reaction_model.core.reactions+reaction_model.edge.reactions: | ||
if set(rxn.reactants) == set(self.source) and len(rxn.products) == 1 and rxn.products[0].molecule[0].getFormula() == form: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check rxn.products[0].molecule[0].getFormula() == form
as well in this condition? Shouldn't checking for len(rxn.products) == 1
be enough? If there's only one product, can it have a different formula than the PES?
@mjohnson541, I reviewed by commits, I see that the final code doesn't include the line I commented on. Please ignore my comment above. Maybe you'd like to polish the commits so there won't be additions and deletions of the same code blocks in a single PR? |
I could do that, but the order in which the commits were applied wouldn't make sense any longer. It would mean applying two major changes at once in one commit, which is a lot harder to read than the current way (even if its a bit more difficult to review). |
@alongd pdf overwritting issue is fixed can you merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Sorry for being too slow.
This PR improves the network explorer tool. It enables use of bimolecular reactant channels and changes the definition of explore_tol. Before explore_tol was an explicit rate coefficient the leak flux of the network was compared to. This PR uses the sum of the coefficients for the net reactions from the source to all other channels to scale the leak rate coefficient. This means that the network will be expanded if the leak rate of the network is larger than explore_tol times the characteristic rate coefficient. Where the charactersitic rate coefficient is the sum of the rate coefficients for all (net) reactions taking the source channel to any other channel in the network.
Check that the unittests pass, run the methoxy network example and take a look at how the new explore_tol affects network generation.