-
Notifications
You must be signed in to change notification settings - Fork 250
Add phosphorus atom types #2037
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2037 +/- ##
=======================================
Coverage 47.54% 47.54%
=======================================
Files 88 88
Lines 23300 23300
Branches 6061 6061
=======================================
Hits 11079 11079
+ Misses 11063 11062 -1
- Partials 1158 1159 +1
Continue to review full report at Codecov.
|
|
I think there might be some more considerations when adding new atom types, see the commits in #1310 |
Thanks, @alongd! I forgot to take more things into considerations. It looks like I have to also change I'm not sure whether I should modify So my primary purpose of adding phosphorus in RMG is so that I can make solvation thermo groups for phosphorus containing molecules in the future. I haven't considered any reactions involving phosphorus containing molecules. |
|
@yunsiechung, was this PR closed by mistake? |
|
@aelong Sorry, I closed it by mistake. I reopened the PR. Thanks for help. I will make all the necessary changes and make Phosphorus reactive as well. |
57efcc0 to
bf84542
Compare
|
@alongd I believe I made all the necessary changes for adding Phosphorus. I have listed all the changes I have made in my very top comment under 'Description of Changes'. ( I decided not to remove N3sc atomType in this PR (#1233). I will make it as a separate PR) @mjohnson541 @amarkpayne I would really appreciate it if any of you could also review this PR when you have time. |
bf84542 to
d12e137
Compare
mjohnson541
left a comment
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 think this looks fine except we need BDE values for phosphorus bonds in rmgpy/molecule/element.py.
|
@mjohnson541 Thanks for your comment! I just have a few questions regarding BDE values in RMG. Do I need to add BDE values for bonds between phosphorus and all the other elements in Also, I'm not sure which elements are supposed to be added to |
|
So essentially this is required for using Blower's Masel rate coefficient forms that automatic trees use. Currently I believe rate estimation for R_Recombination will error if you try to estimate a reaction that breaks or forms a bond that's BDE pair isn't in the dictionary. |
|
@mjohnson541 I see, thanks! |
xiaoruiDong
left a comment
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.
Thank @yunsiechung, thank you for adding support of phosphorous into RMG. I went through your codes and they look good. I just have a minor concern about the atom type part, and please see the comment.
| ATOMTYPES['P'].set_actions(increment_bond=['P'], decrement_bond=['P'], form_bond=['P'], break_bond=['P'], increment_radical=['P'], decrement_radical=['P'], increment_lone_pair=['P'], decrement_lone_pair=['P']) | ||
| ATOMTYPES['P0sc'].set_actions(increment_bond=[], decrement_bond=[], form_bond=['P0sc'], break_bond=['P0sc'], increment_radical=['P0sc'], decrement_radical=['P0sc'], increment_lone_pair=[], decrement_lone_pair=['P1s', 'P1sc']) | ||
| ATOMTYPES['P1s'].set_actions(increment_bond=['P1dc'], decrement_bond=[], form_bond=['P1s'], break_bond=['P1s'], increment_radical=['P1s'], decrement_radical=['P1s'], increment_lone_pair=['P0sc'], decrement_lone_pair=['P3s']) | ||
| ATOMTYPES['P1sc'].set_actions(increment_bond=['P1dc'], decrement_bond=[], form_bond=['P1sc'], break_bond=['P1sc'], increment_radical=['P1sc'], decrement_radical=['P1sc'], increment_lone_pair=['P0sc'], decrement_lone_pair=['P3s']) |
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.
Not sure whether this will be a problem. Since P3sc is no longer included, decrement_lone_pair=['P3s'] for atom type P1sc. But P1sc has a charge of -1, while P3s has a charge of 0. It seems to me that the charge will be conflicted. I guess we can either keep the P3sc or modify P3s's charge attribute?
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.
Okay, it seems like the charge will be updated, after applying decrement_lone_pair()
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 looking at Nitrogen and Sulfur AtomType, and they have something similar to that (charged AtomType has non-charged AtomType for decrement_lone_pair() and increment_lone_pair()), so I thought it would be alright.
So it's okay as it is?
d12e137 to
ee26f7a
Compare
|
@mjohnson541 I added BDE for Phosphorus as well as F, Br, and I. |
Phosphorus is added to PeriodicSystem class object so phosphorus can supported by RMG
A method to check whether the atom is a phosphorus atom or not is added
A unit test to test the Atom.is_phosphorus() method has been added
Atomtypes for Phosphorus are created to support phosphorus compounds in RMG. 20 atomtypes are added for phosphorus, and most of them are created by referencing to nitrogen atomtypes since nitrogen and phosphorus share many similar bond types. For each atomtype, SMILES strings of sample compounds have been added as comments. Atomtype attributes such as 'increment_bond', 'decrement_bond', and etc. are also created by referncing to those of nitrogen. Notice that phosphorus has several new atomtypes that do not exist for nitrogen, including P5s, P5d, P5td, etc.
Unit test for phosphorus atomtype, test_phosphorus_types, is added. This tests all phosphorus atomtypes.
Phosphorus is added to `make_sample_molecule` method. Br was missing from here, so Br is also added. Positively charged and negatively charged phosphorus atomtypes are added to `make_sample_molecule`. S4sc was missing from `negative_charged` so it is also added.
In `test_make_sample_molecule`, I added two more cases with phosphorus for creating positively and negatively charged species. Also, the test species in `test_get_element_count` is slightly modified to test whether phosphorus can be properly counted as well.
Phosphorus is added to isomorphismTest. For creating a molecule using `create_molecule`, it is forbidden to create a molecule containing the phosphorus with +1 partial charge and 1 lone pair because this is chemically infeasible. Creating such molecules raises AtomTypeError, not InvalidAdjacenctListError, so additional lines are added in `create_molecule` to pass creating such molecules.
Phosphorus is added to get_sorting_key() in generate_pairs().
A unit test `test_phosphorus_reaction_pairs()` is added to test whether reaction pairs can be correctly generated for the reaction involving phosphorus species.
Documentation for Phosphorus atomType is added
Bond dissociation energies for P, F, Br, and I are added. The source is added as comment. The bond disccosiation energies in `bde_dict` are a bit re-arranged. Some are missing because they could not be found (e.g. N-P, N-Br, N-I, etc). The information about reference state is also added as comment.
ee26f7a to
40fd4f3
Compare
Motivation or Problem
Phosphorus is currently not supported by RMG. Phosphorus should be added for future use.
(My own motivation in more detail
My primary purpose of adding phosphorus in RMG is so that I can make solvation thermo groups for phosphorus containing molecules later. I did not include the phosphorus solvation thermo in this pull request because I actually need to make more extensive changes in
solvation.pyin order to add phosphorus solvation thermo group. So I figured it would be better to divide it into two pull requests, and use this one to only add Phosphorus atomtypes to make reviewing process easier.)Description of Changes
For each atomtype, sample compounds that contain the corresponding atomtype are also added as comments.
Nearly all the sample compounds are the ones that could be found from PubChem molecule search. (This is to make sure that I'm not adding non-existing atomtypes for phosphorus).
For some atomtypes such as
P1sc,P1dc,P5ddc, and etc., the sample compounds given in comments are ionic ones and neutral ones are very unlikely to be found in real life. Although RMG does not support ionic compounds now, these atomtypes are still added in this commit for potential use in the future.Many phosphorus atomtypes are generated by referencing to nitrogen ones because they share many similar types of bonding. Although the aromaticity of heterocycles containing phosphorus is much smaller than other heterocyclic aromatics, I still added aromatic phosphorus atomtypes (
P3b,P5b,P5bd). (Some study on aromaticity of phosphorus heterocycles can be found on doi: 10.1021/cr990321)I have added 20 atomtypes for phosphorus. If any of these atomtypes doesn't make sense, please let me know and I can just comment them out.
A set of actions (increment_bond, decrement_bond, form_bond, etc.) has been added for each atomtype.
Phosphorus is added to
make_sample_atom()andmake_sample_molecule()functions inrmgpy/molecule/group.py. Relevant unit test has been added.Added phosphorus to
isomorphismTest.py. In this test, infeasible phosphorus groups (+1 partial charge with 1 lone pair) are forbidden.Phosphorus is added to sorting key for
generate_pairs()inrmgpy/reaction.py. Relevant unit test has been added to confirm that RMG can now make reactions involving phosphorus.Documentation for phosphorus atomType is added
Testing
A unit test for Atom.is_phosphorus() is added.
A unit test,
test_phosphorus_types, is added to test all phosphorus atomtypes.Phosphorus containing molecules have been added to
rmgpy/molecule/groupTest.pyunit tests.Phosphorus has been added to
rmgpy/molecule/isomorphismTest.pyunit test.A unit test,
test_phosphorus_reaction_pairs(), is added tormgpy/reactionTest.pyto test that reaction pairs can be correctly generated for the reaction involving phosphorus species.The modified documentation has been tested with
make htmlcommand to make sure the documentation can be generated correctly.Reviewer Tips
You can run unit tests and also try generating some compounds and reactions containing phosphorus.