Skip to content

Commit cf9e90e

Browse files
sevyharrisrwest
authored andcommitted
Delete unreachable code in _make_rule
It looks like the unreachable code is just a slight variation of the code above it and was never intended to be included in the first place.
1 parent 961185d commit cf9e90e

1 file changed

Lines changed: 0 additions & 63 deletions

File tree

rmgpy/data/kinetics/family.py

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -4670,69 +4670,6 @@ def _make_rule(rr):
46704670
else:
46714671
return None
46724672

4673-
if isinstance(rs[0].kinetics, Arrhenius):
4674-
arr = ArrheniusBM
4675-
else:
4676-
arr = ArrheniusChargeTransferBM
4677-
if n > 1:
4678-
kin = arr().fit_to_reactions(rs, recipe=recipe)
4679-
if n == 1 or kin.E0.value_si < 0.0:
4680-
# still run it through the averaging function when n=1 to standardize the units and run checks
4681-
kin = average_kinetics([r.kinetics for r in rs])
4682-
if n == 1:
4683-
kin.uncertainty = RateUncertainty(mu=0.0, var=(np.log(fmax) / 2.0) ** 2, N=1, Tref=Tref, data_mean=data_mean, correlation=label)
4684-
kin.comment = f"Only one reaction rate: {rs[0]!s}"
4685-
else:
4686-
kin.comment = f"Blowers-Masel fit was bad (E0<0) so instead averaged from {n} reactions."
4687-
dlnks = np.array([
4688-
np.log(
4689-
average_kinetics([r.kinetics for r in rs[list(set(range(len(rs))) - {i})]]).get_rate_coefficient(T=Tref) / rxn.get_rate_coefficient(T=Tref)
4690-
) for i, rxn in enumerate(rs)
4691-
]) # 1) fit to set of reactions without the current reaction (k) 2) compute log(kfit/kactual) at Tref
4692-
varis = (np.array([rank_accuracy_map[rxn.rank].value_si for rxn in rs]) / (2.0 * 8.314 * Tref)) ** 2
4693-
# weighted average calculations
4694-
ws = 1.0 / varis
4695-
V1 = ws.sum()
4696-
V2 = (ws ** 2).sum()
4697-
mu = np.dot(ws, dlnks) / V1
4698-
s = np.sqrt(np.dot(ws, (dlnks - mu) ** 2) / (V1 - V2 / V1))
4699-
kin.uncertainty = RateUncertainty(mu=mu, var=s ** 2, N=n, Tref=Tref, data_mean=data_mean, correlation=label)
4700-
else: # Blowers-Masel fit was good
4701-
if isinstance(rs[0].kinetics, Arrhenius):
4702-
dlnks = np.array([
4703-
np.log(
4704-
arr().fit_to_reactions(rs[list(set(range(len(rs))) - {i})], recipe=recipe)
4705-
.to_arrhenius(rxn.get_enthalpy_of_reaction(298.))
4706-
.get_rate_coefficient(T=Tref) / rxn.get_rate_coefficient(T=Tref)
4707-
) for i, rxn in enumerate(rs)
4708-
]) # 1) fit to set of reactions without the current reaction (k) 2) compute log(kfit/kactual) at Tref
4709-
else: # SurfaceChargeTransfer or ArrheniusChargeTransfer
4710-
dlnks = np.array([
4711-
np.log(
4712-
arr().fit_to_reactions(rs[list(set(range(len(rs))) - {i})], recipe=recipe)
4713-
.to_arrhenius_charge_transfer(rxn.get_enthalpy_of_reaction(298.))
4714-
.get_rate_coefficient(T=Tref) / rxn.get_rate_coefficient(T=Tref)
4715-
) for i, rxn in enumerate(rs)
4716-
]) # 1) fit to set of reactions without the current reaction (k) 2) compute log(kfit/kactual) at Tref
4717-
varis = (np.array([rank_accuracy_map[rxn.rank].value_si for rxn in rs]) / (2.0 * 8.314 * Tref)) ** 2
4718-
# weighted average calculations
4719-
ws = 1.0 / varis
4720-
V1 = ws.sum()
4721-
V2 = (ws ** 2).sum()
4722-
mu = np.dot(ws, dlnks) / V1
4723-
s = np.sqrt(np.dot(ws, (dlnks - mu) ** 2) / (V1 - V2 / V1))
4724-
kin.uncertainty = RateUncertainty(mu=mu, var=s ** 2, N=n, Tref=Tref, data_mean=data_mean, correlation=label)
4725-
4726-
#site solute parameters
4727-
site_datas = [get_site_solute_data(rxn) for rxn in rxns]
4728-
site_datas = [sdata for sdata in site_datas if sdata is not None]
4729-
if len(site_datas) > 0:
4730-
site_data = SoluteTSData()
4731-
for sdata in site_datas:
4732-
site_data += sdata
4733-
site_data = site_data * (1.0/len(site_datas))
4734-
kin.solute = site_data
4735-
return kin
47364673

47374674
def _spawn_tree_process(family, template_rxn_map, obj, T, nprocs, depth, min_splitable_entry_num, min_rxns_to_spawn, extension_iter_max, extension_iter_item_cap):
47384675
parent_conn, child_conn = mp.Pipe()

0 commit comments

Comments
 (0)