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

Improve Rule Generation #2277

Closed
wants to merge 16 commits into from
Closed

Improve Rule Generation #2277

wants to merge 16 commits into from

Conversation

mjohnson541
Copy link
Contributor

This has four main changes

  1. Enables tree generation for charge transfer families
  2. Updates tree generation, if E0 < 0 or n = 1 it simply uses the average instead of the BM rule
  3. Improves BM fitting using dH298
  4. Adds a SolventData attribute to reactions that can hold transition state solute information

@lgtm-com
Copy link

lgtm-com bot commented Feb 28, 2022

This pull request introduces 2 alerts and fixes 2 when merging ea72bf4 into 603b7f4 - view on LGTM.com

new alerts:

  • 1 for Syntax error
  • 1 for Unreachable code

fixed alerts:

  • 2 for Suspicious unused loop iteration variable

@lgtm-com
Copy link

lgtm-com bot commented Mar 1, 2022

This pull request introduces 2 alerts and fixes 2 when merging 4174c91 into 603b7f4 - view on LGTM.com

new alerts:

  • 1 for Syntax error
  • 1 for Unreachable code

fixed alerts:

  • 2 for Suspicious unused loop iteration variable

@@ -880,9 +877,60 @@ def reverse_sticking_coeff_rate(self, k_forward, reverse_units, surface_site_den
kr.fit_to_data(Tlist, klist, reverse_units, kf.T0.value_si)
return kr

<<<<<<< HEAD
Copy link
Contributor

@hwpang hwpang Oct 6, 2022

Choose a reason for hiding this comment

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

Can you resolve this? It seems some version conflicts are committed

kr.fit_to_data(Tlist, klist, reverse_units, kf.T0.value_si)
return kr

>>>>>>> 3afc9cc91 (handle ChargeTransfer kinetics with in reaction.py)
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 remove this

"Cannot determine phases of species. We will assume gas"
)
n_surf = len(surf_prods)
n_gas = len(self.products) - len(surf_prods)
kunits = get_rate_coefficient_units_from_reaction_order(n_gas, n_surf)

kf = self.kinetics
<<<<<<< HEAD
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 remove this

return self.reverse_arrhenius_charge_transfer_rate(kf, kunits, Tmin, Tmax)

elif isinstance(kf, KineticsData):
>>>>>>> 3afc9cc91 (handle ChargeTransfer kinetics with in reaction.py)
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 remove this and resolve the conflicts?

elif self.electrons > 0:
products_net_charge -= self.electrons

>>>>>>> 3afc9cc91 (handle ChargeTransfer kinetics with in reaction.py)
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 remove this and resolve the conflicts?

kinetics = kinetics.to_arrhenius(rxn.get_enthalpy_of_reaction(T))
L = list(set(template_rxn_map[entry.label]) - set(rxns_test))

if L != []:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a more Pythonic way to check empty list is by if not L?

Copy link
Contributor

@hwpang hwpang left a comment

Choose a reason for hiding this comment

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

@mjohnson541 Thanks for the PR! I have a few comments. Could you rebase as well?

Copy link
Member

@rwest rwest left a comment

Choose a reason for hiding this comment

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

Need to figure out how this relates to #2264
I think both are trying to solve some similar problems.

Can you explain why NOT to fit a Blowers Masel when there's only one training reaction? (if that's the new proposal) ?

return kin
else:
if n == 1:
kin.uncertainty = RateUncertainty(mu=0.0, var=(np.log(fmax) / 2.0) ** 2, N=1, Tref=Tref, data_mean=data_mean, correlation=label)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is unreachable?

if n==1: # on line 4611
else: # line 4631
    if n==1: # line 432

@@ -3704,47 +3704,43 @@ def cross_validate(self, folds=5, template_rxn_map=None, test_rxn_inds=None, T=1
if entry.parent:
entry = entry.parent

boo = True
Copy link
Member

Choose a reason for hiding this comment

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

Why boo? A more informative name would help. ANd I don't see where boo is ever set to anything but True? So what's this infinite loop about?
Does it mean while entry.parent: ?

def kfcn(E0):
Vp = 2 * w0 * (2 * w0 + 2 * E0) / (2 * w0 - 2 * E0)
out = Ea - (w0 + dHrxn / 2.0) * (Vp - 2 * w0 + dHrxn) * (Vp - 2 * w0 + dHrxn) / (Vp * Vp - (2 * w0) * (2 * w0) + dHrxn * dHrxn)
return out

if abs(dHrxn) > 4 * w0 / 10.0:
E0 = w0 / 10.0
Copy link
Member

Choose a reason for hiding this comment

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

can you explain why removing this? (in the commit message, ideally)

@mjohnson541
Copy link
Contributor Author

I'm not sure how up to date this PR is relative to the electrochem branch. It's been a while, I think as defined in the paper the dHrxn is at 298 K which implies that the Ea is constant with respect to temperature so you only have one datapoint to determine E0. You can determine E0 this way, but I think someone was having problems with those fits? At some point I think this was a matter of significant urgency to get merged and then we (or at least I) forgot about it?

@rwest
Copy link
Member

rwest commented Jun 22, 2023

I think this would address #1748

@rwest
Copy link
Member

rwest commented Jul 18, 2023

I think this is now part of #2316 which has been more recently rebased and checked. Hopefully that will be merged soon.

@rwest rwest closed this Jul 18, 2023
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.

Blowers Masel Arrhenius trained and evaluated with T-varying ∆Hr(T) ?
4 participants