Skip to content

Conversation

@nyee
Copy link
Contributor

@nyee nyee commented Apr 9, 2014

-Add suggested groups to checkWellFormed
-Improved filtering of possible products in checkWellFormed

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 causes the challenge, but I don't understand why the order of the groups is allowed to change?
Shouldn't the libraryNode be "group1name;group2name;group3name" in that order?

eg:

entry(
    index = 489,
    label = "H_rad;Cmethyl_Csrad", # the name here is  "group1name;group2name" in that order.
    group1 = 
"""
1 *1 H 1
""",
    group2 = 
"""
1 *2 C  0 {2,S} {3,S} {4,S} {5,S}
2 *3 Cs 1 {1,S}
3 *4 H  0 {1,S}
4    H  0 {1,S}
5    H  0 {1,S}
""",
    kinetics = ArrheniusEP(
        A = (3610000000000.0, 'cm^3/(mol*s)', '*|/', 2),
        n = 0,
        alpha = 0,
        E0 = (0, 'kcal/mol'),
        Tmin = (300, 'K'),
        Tmax = (2500, 'K'),
    ),
    rank = 4,
    shortDesc = u"""Tsang [91] Literature review.""",
    longDesc = u""" """,
)

Does the order sometimes change?

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, it was not listed in order for many cases. Not sure why. I could probably try to directly access group1 and group2 using if statements, but like I was saying it seems like a pain for a check that will soon be obsolete.

Copy link
Member

Choose a reason for hiding this comment

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

For the cases when it was not in order, do you mean that libraryEntry.item.reactants is returning [group2, group1], or do you mean that we had (erroneously) called the label 'group2name;group1name'? if the latter, why don't we say this is an error and fix those too? (which would make your checks a lot simpler, and identify many more "fixes")

@rwest
Copy link
Member

rwest commented Apr 9, 2014

How do I execute this section of code?
I have put a breakpoint in, but am not sure how to run it! :)

@nyee
Copy link
Contributor Author

nyee commented Apr 9, 2014

run EvaluateKinetics.py in RMG-database. It needs to have the most updated version from my databaseTest branch in both RMG-database and RMG-py

@rwest
Copy link
Member

rwest commented Apr 10, 2014

In rwest@95d8eb9 I suggest a different way of doing it. Detects incorrect names and suggests correct ones if the groups match anything (else you need to change the group definitions)

nyee and others added 6 commits May 20, 2014 18:01
Add bit of code to identify products better. I check the name of groups I
think are products vs the products listed in forwardTemplate.products.

One error we check for is if a label in rules.py is misnamed, i.e. if any
part of the label is not a group in group.py. There a decent amount of
these errors due to the recent Java/Py database merge. To make my life
database debugging life easier, I added a new feature which tells me if
there is a group which matches the misnamed label.

For example, let's say we have a rule label, A;B. Somebody changed the
name of A to C in groups.py, but left it unchanged in rules.py. The new
feature would suggest C as the correct name for A, by comparing adj lists
of the rule and those in groups.py

Unfortunately, there is a bug I can't figure out. If somebody changed A to
C
AND B to D, it suggest C for A and C for B. The manual work around
is to visually verify which one adjList C matches, make the fix, and run
checkWellFormed again. It will then suggest D for B. I feel like this
isn't worth fixing because it will be unable to suggest groups with the
upgrade to universal database (once all adjlists are removed from
rules.py)
The identifying of node names and labels based on the actual nodes 
is different.
First, we check if it's right, i.e. if the groups named in 
the label 'group1;group2;group3' are indeed the same groups in 
the groups.py file.

Then, if not, we try to figure out what it should be called.
For each group in the actual node, we look through the groups.py
file to see if we can find one, and if so suggest that name.

I think this logic flow works better than what was there before,
but I did change/break the way it reports errors. Previously it would
collect them in a list of tuples, then return a tuple of lists, and
whatever function had called it (eg. in EvaluateKinetics.py in the RMG-database
project) would have to deduce what this meant and report the errors.
That means keeping the two files, in different projects, in sync
as the tuple/list syntax changes.  Rather than figure this out, I 
just report the errors as they are detected. If you prefer the other,
mute my logging lines, and compile a tuple as before.

Hope this helps.
1) Less code duplication by grouping the if statements 'if not (a and b):'
2) Report what the group definition should be if the label were correct
   (this could be helpful if the label was right but the groups out of date)
Previously, I had to develop back and forth between the RMG-Py and
RMG-database every time I wanted to make a change to checkWellFormed. Now
I have moved it so it is entirely in RMG-Py.

The format which I report errors has also changed. At the moment, some errors
are returned as tuples, parsed and recorded into a file called
DatabaseWellFormedSummary.txt. Some of the other errors are reported using the
logging library. I plan on unifying how this is done in subsequent
commits.
Now all the errors that are searched for print to a database.log instead
of the hardcoded output file I had previously.
When the database is formed, it also creates groups for the products,
which would not be found in groups.py. These were usually labeled as
'product' + an integer. I ran into comparison issues with names with
parenthesis. I have revised the regex I used with re.escape, so that I
don't get these false positives anymore.
@connie
Copy link
Member

connie commented Jun 10, 2014

Replacing with pull request #223 so that people can commit to official/universalDatabase

@connie connie closed this Jun 10, 2014
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.

3 participants