-
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
Collection of small fixes #1842
Changes from all commits
2899833
71abbcb
e926c06
7d2e60c
987cf74
1655008
08e8a1d
58fce35
8748f73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ requirements: | |
- lpsolve55 | ||
- markupsafe | ||
- matplotlib >=1.5 | ||
- mock | ||
- mopac | ||
- mpmath | ||
- networkx | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ dependencies: | |
- lpsolve55 | ||
- markupsafe | ||
- matplotlib >=1.5 | ||
- mock | ||
- mopac | ||
- mpmath | ||
- networkx | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2758,63 +2758,6 @@ def add_atom_labels_for_reaction(self, reaction, output_with_resonance=True): | |
for species in reaction.reactants + reaction.products: | ||
species.generate_resonance_structures() | ||
|
||
def get_w0(self, rxn): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions are also listed under rmgpy.data.kinetics.family in rmg2to3.py. I am not sure if this needs to be updated, as what you really want is for these functions to instead call Arrhenius. But I doubt this will come up anyways There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the function has existed long enough for anyone to have scripts using it (except Matt). I added a change to remove them from rmg2to3.py. |
||
""" | ||
calculates the w0 for Blower Masel kinetics by calculating wf (total bond energy of bonds formed) | ||
and wb (total bond energy of bonds broken) with w0 = (wf+wb)/2 | ||
""" | ||
mol = None | ||
a_dict = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked and these functions are essentially the same, but the one we are keeping in arrhenius.pyx has a few additional PEP-8 changes. Can you make these changes?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
for r in rxn.reactants: | ||
m = r.molecule[0] | ||
a_dict.update(m.get_all_labeled_atoms()) | ||
if mol: | ||
mol = mol.merge(m) | ||
else: | ||
mol = m.copy(deep=True) | ||
|
||
recipe = self.forward_recipe.actions | ||
|
||
wb = 0.0 | ||
wf = 0.0 | ||
for act in recipe: | ||
|
||
if act[0] == 'BREAK_BOND': | ||
bd = mol.get_bond(a_dict[act[1]], a_dict[act[3]]) | ||
wb += bd.get_bde() | ||
elif act[0] == 'FORM_BOND': | ||
bd = Bond(a_dict[act[1]], a_dict[act[3]], act[2]) | ||
wf += bd.get_bde() | ||
elif act[0] == 'CHANGE_BOND': | ||
bd1 = mol.get_bond(a_dict[act[1]], a_dict[act[3]]) | ||
|
||
if act[2] + bd1.order == 0.5: | ||
mol2 = None | ||
for r in rxn.products: | ||
m = r.molecule[0] | ||
if mol2: | ||
mol2 = mol2.merge(m) | ||
else: | ||
mol2 = m.copy(deep=True) | ||
bd2 = mol2.get_bond(a_dict[act[1]], a_dict[act[3]]) | ||
else: | ||
bd2 = Bond(a_dict[act[1]], a_dict[act[3]], bd1.order + act[2]) | ||
|
||
if bd2.order == 0: | ||
bd2_bde = 0.0 | ||
else: | ||
bd2_bde = bd2.get_bde() | ||
bde_diff = bd2_bde - bd1.get_bde() | ||
if bde_diff > 0: | ||
wf += abs(bde_diff) | ||
else: | ||
wb += abs(bde_diff) | ||
|
||
return (wf + wb) / 2.0 | ||
|
||
def get_w0s(self, rxns): | ||
return list(map(self.get_w0, rxns)) | ||
|
||
def get_training_depository(self): | ||
""" | ||
Returns the `training` depository from self.depositories | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -531,6 +531,8 @@ def _write(mol, identifier_type, backend): | |
logging.debug('Backend {0} is not able to generate {1} for this molecule:\n' | ||
'{2}'.format(option, identifier_type, mol.to_adjacency_list())) | ||
|
||
logging.error('Unable to generate identifier for this molecule:\n{0}'.format(mol.to_adjacency_list())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe instead add the adjlist to the error message below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about doing that originally. One consideration is that with the current setup, logging goes into RMG.log, while the error goes into stderr, which is only printed to the terminal (or slurm/sge output files). I can move it though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough, then let's keep it. I'm OK with all other commits too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might not be relevant here but the discussion reminded me: I am a fan of using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might not be relevant here but the discussion reminded me: I am a fan of using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I was actually hoping that this would be a good opportunity to use logging.exception(), but that has to be called from an exception handler. It seemed easier to log this message once in this function rather than logging the exception in each function which calls it. I do think there are a lot of instances where we use |
||
|
||
raise ValueError("Unable to generate identifier type {0} with backend {1}.".format(identifier_type, backend)) | ||
|
||
|
||
|
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.
What do you think about making this a percentage test.
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 was disappointed that
assertAlmostEquals
did not support a percentage delta, but I think I would prefer the simplicity of using it with a fixed delta over calculating the percentage. I could change the delta to 0.01*88.88 if you prefer.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.
No that is okay, we can leave it as is then. I do like the simplicity of just using delta