modified guess_atom_element for more accurate guess#4168
modified guess_atom_element for more accurate guess#4168IAlibay merged 19 commits intoMDAnalysis:developfrom
Conversation
There was a problem hiding this comment.
Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on the developer mailing list so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.
Linter Bot Results:Hi @pillose! Thanks for making this PR. We linted your code and found the following: Some issues were found with the formatting of your code.
Please have a look at the Please note: The |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #4168 +/- ##
===========================================
+ Coverage 93.40% 93.41% +0.01%
===========================================
Files 169 183 +14
Lines 22202 23309 +1107
Branches 4064 4064
===========================================
+ Hits 20738 21775 +1037
- Misses 948 1018 +70
Partials 516 516
☔ View full report in Codecov by Sentry. |
hmacdope
left a comment
There was a problem hiding this comment.
Hi @pillose! Thanks for the contribution!
Would you be able to add a test of the new behaviour? If you need help getting started with the test suite, feel free to ping me. You will also need to add an entry to package/CHANGELOG.
Also as you are a new contributor (welcome!) please add yourself to package/AUTHORS and also introduce yourself on the developer mailing list or discord.
|
@pillose this PR has been opened for a little while, are you still interested in contributing this code? |
hmacdope
left a comment
There was a problem hiding this comment.
Looks good, two little comments. Did you end up introducing yourself on mailing list or discord :) ?
|
|
||
| Fixes | ||
| * Fix Boltzmann typo in `units.py` (PR #4214, Issue #4213) | ||
| * Fix Atom type guessing error (PR #4168, Issue #4167) |
| # strip symbols and numbers | ||
| no_symbols = re.sub(SYMBOLS, '', atomname) | ||
| name = re.sub(NUMBERS, '', no_symbols).upper() | ||
| no_numbers = re.split(NUMBERS, no_symbols) |
There was a problem hiding this comment.
Add some comments as to why this is now in here.
IAlibay
left a comment
There was a problem hiding this comment.
@pillose - We are changing the license under which future contributions are released. Could you please confirm that you agree to releasing this code under the terms of the LGPLv2.1 and that your contribution also adheres to the developer certificate of origion?
1ce5387 to
66a2b21
Compare
RMeli
left a comment
There was a problem hiding this comment.
Thanks @pillose. Please see #4168 (review), thanks.
Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
| - Mohit Kumar | ||
| - Shubham Kumar | ||
| - Zaheer Timol | ||
| - GeongiMoon |
There was a problem hiding this comment.
Needs a space, I am assuming?
There was a problem hiding this comment.
If not let me know, other than that looks good.
There was a problem hiding this comment.
I missed a space... Thank you!
| ('zn', 'ZN'), | ||
| ('Ca2+', 'CA'), | ||
| ('CA', 'C'), | ||
| ('N0A', 'N'), |
There was a problem hiding this comment.
One more nit sorry could you test Na+ -> Na?
There was a problem hiding this comment.
I just added two tests for Na+ and Cu2+
| no_numbers = re.split(NUMBERS, no_symbols) | ||
| no_numbers = list(filter(None, no_numbers)) #remove '' | ||
| # if no_numbers is not empty, use the first element of no_numbers | ||
| name = list(filter(None, no_numbers))[0].upper() if no_numbers else '' |
There was a problem hiding this comment.
Apologies if I'm missing something obvious, but do you need to apply filter again here? You've already removed the '' entries and you shouldn't have any None entries ?
There was a problem hiding this comment.
Sorry, I think I made a mistake while modifying the code...
remove unnecessary code
IAlibay
left a comment
There was a problem hiding this comment.
Thanks, sorry for this taking so long. lgtm!
|
Cycling CI |
Fixes #4167
Changes made in this Pull Request:
Suppose the function
guess_atom_element()receives 'N0A' as an argumentWith previous code,
name = 'NA' # interpreted as sodiumWhich substitute '0' to ''
With new code,
name = ['N', 'A'][0] #== 'N"PR Checklist
📚 Documentation preview 📚: https://mdanalysis--4168.org.readthedocs.build/en/4168/