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

Fluorine fixes #1656

Merged
merged 3 commits into from Jul 18, 2019
Merged

Fluorine fixes #1656

merged 3 commits into from Jul 18, 2019

Conversation

rwest
Copy link
Member

@rwest rwest commented Jul 17, 2019

A couple of small atomType fixes for Fluorine, that were causing segfaults when testing the database ReactionMechanismGenerator/RMG-database#317

@rwest rwest added Status: Ready for Review PR is complete and ready to be reviewed Complexity: Low Type: Bug labels Jul 17, 2019
@codecov
Copy link

codecov bot commented Jul 17, 2019

Codecov Report

Merging #1656 into master will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1656      +/-   ##
==========================================
- Coverage   41.68%   41.67%   -0.02%     
==========================================
  Files         176      176              
  Lines       29374    29374              
  Branches     6059     6059              
==========================================
- Hits        12246    12241       -5     
- Misses      16259    16263       +4     
- Partials      869      870       +1
Impacted Files Coverage Δ
rmgpy/molecule/atomtype.py 0% <0%> (ø) ⬆️
rmgpy/data/kinetics/family.py 52.67% <0%> (-0.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c1f46c...8f87035. Read the comment docs.

Otherwise when trying to make a sample molecule
with an F groupAtom, it fails (and crashes
with a segfault)
Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

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

Thanks!
Please see a couple of comments

@@ -665,7 +665,7 @@ def getFeatures(self):
atomTypes['F1s'].setActions(incrementBond=[], decrementBond=[], formBond=['F1s'], breakBond=['F1s'], incrementRadical=['F1s'], decrementRadical=['F1s'], incrementLonePair=[], decrementLonePair=[])

#these are ordered on priority of picking if we encounter a more general atomType for make
allElements=['H', 'C', 'O', 'N', 'S', 'Si', 'Cl', 'Ne', 'Ar', 'He', 'X']
allElements=['H', 'C', 'O', 'N', 'S', 'Si', 'Cl', 'F', 'Ne', 'Ar', 'He', 'X']
Copy link
Member

Choose a reason for hiding this comment

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

While at it, and although beyond the scope of the PR title, perhaps add I as well?
BTW, if Ar is here, should we also consider He and Ne?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point with I. Added in subsequent commit.
He and Ne are already listed.

@@ -548,7 +548,7 @@ def getFeatures(self):

atomTypes['F' ] = AtomType('F', generic=['R','R!H','Val7'], specific=['F1s'])
atomTypes['F1s'] = AtomType('F1s', generic=['R','R!H','F','Val7'], specific=[],
single=[0,1], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], benzene=[0], lonePairs=[3], charge=[0])
single=[0,1], allDouble=[0], rDouble=[], oDouble=[], sDouble=[], triple=[0], quadruple=[0], benzene=[0], lonePairs=[3], charge=[0])
Copy link
Member

Choose a reason for hiding this comment

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

The default value for quadruple is an empty list. Shouldn't that be enough (I guess not from your experience with F, but I wonder why)?
Perhaps a quicker fix for all elements would be to change the default behaviour of AtomType.
I suggest editing line 118 to:
self.quadruple = quadruple or [0]
so zero quadruple bonds becomes the default.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, we don't know that the default was causing a problem, we just thought we'd make Fluorine the same as Chlorine. I think our actual problem was solved by the other change.

This list should cover all elements used in atomTypes.
Copy link
Member

@alongd alongd left a comment

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complexity: Low Status: Ready for Review PR is complete and ready to be reviewed Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants