Skip to content

modified guess_atom_element for more accurate guess#4168

Merged
IAlibay merged 19 commits intoMDAnalysis:developfrom
pillose:develop
Aug 16, 2023
Merged

modified guess_atom_element for more accurate guess#4168
IAlibay merged 19 commits intoMDAnalysis:developfrom
pillose:develop

Conversation

@pillose
Copy link
Copy Markdown
Contributor

@pillose pillose commented Jun 14, 2023

Fixes #4167

Changes made in this Pull Request:

  • Suppose the function guess_atom_element() receives 'N0A' as an argument

  • With previous code,
    name = 'NA' # interpreted as sodium
    Which substitute '0' to ''

  • With new code,
    name = ['N', 'A'][0] #== 'N"

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

📚 Documentation preview 📚: https://mdanalysis--4168.org.readthedocs.build/en/4168/

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 14, 2023

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.

Code Location Outcome
main package ⚠️ Possible failure
testsuite ⚠️ Possible failure

Please have a look at the darker-main-code and darker-test-code steps here for more details: https://github.com/MDAnalysis/mdanalysis/actions/runs/5879473341/job/15943597343


Please note: The black linter is purely informational, you can safely ignore these outcomes if there are no flake8 failures!

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (a14e98d) 93.40% compared to head (19511fc) 93.41%.

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              
Files Changed Coverage Δ
package/MDAnalysis/topology/guessers.py 99.22% <100.00%> (+0.01%) ⬆️

... and 14 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

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.

@IAlibay
Copy link
Copy Markdown
Member

IAlibay commented Jul 29, 2023

@pillose this PR has been opened for a little while, are you still interested in contributing this code?

@IAlibay IAlibay added the close? Evaluate if issue/PR is stale and can be closed. label Jul 29, 2023
@pillose
Copy link
Copy Markdown
Contributor Author

pillose commented Jul 29, 2023

@hmacdope I added some test and change log. Also, I added my name(Geongi Moon) to package/AUTHORS.
I apologize for missing your comment.

@IAlibay Thank you for the reminder.

Copy link
Copy Markdown
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

Looks good, two little comments. Did you end up introducing yourself on mailing list or discord :) ?

Comment thread package/CHANGELOG Outdated

Fixes
* Fix Boltzmann typo in `units.py` (PR #4214, Issue #4213)
* Fix Atom type guessing error (PR #4168, Issue #4167)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Order this newest first.

Comment thread package/MDAnalysis/topology/guessers.py Outdated
# strip symbols and numbers
no_symbols = re.sub(SYMBOLS, '', atomname)
name = re.sub(NUMBERS, '', no_symbols).upper()
no_numbers = re.split(NUMBERS, no_symbols)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add some comments as to why this is now in here.

Copy link
Copy Markdown
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

@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?

@IAlibay IAlibay removed the close? Evaluate if issue/PR is stale and can be closed. label Jul 31, 2023
@pillose pillose closed this Aug 1, 2023
@pillose pillose force-pushed the develop branch 2 times, most recently from 1ce5387 to 66a2b21 Compare August 1, 2023 10:44
Copy link
Copy Markdown
Member

@RMeli RMeli left a comment

Choose a reason for hiding this comment

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

Thanks @pillose. Please see #4168 (review), thanks.

Comment thread package/CHANGELOG Outdated
Comment thread package/AUTHORS Outdated
Comment thread package/MDAnalysis/topology/guessers.py Outdated
@pillose
Copy link
Copy Markdown
Contributor Author

pillose commented Aug 15, 2023

@IAlibay I agree to changing the license.
@hmacdope I just introduced myself on mailing list.
@RMeli Thank you for the reminder.

pillose and others added 4 commits August 15, 2023 23:12
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>
@pillose pillose requested review from IAlibay and hmacdope August 16, 2023 05:37
Comment thread package/AUTHORS Outdated
- Mohit Kumar
- Shubham Kumar
- Zaheer Timol
- GeongiMoon
Copy link
Copy Markdown
Member

@hmacdope hmacdope Aug 16, 2023

Choose a reason for hiding this comment

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

Needs a space, I am assuming?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If not let me know, other than that looks good.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I missed a space... Thank you!

('zn', 'ZN'),
('Ca2+', 'CA'),
('CA', 'C'),
('N0A', 'N'),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One more nit sorry could you test Na+ -> Na?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just added two tests for Na+ and Cu2+

Copy link
Copy Markdown
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

The one question from me.

Comment thread package/MDAnalysis/topology/guessers.py Outdated
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 ''
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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 ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I think I made a mistake while modifying the code...

remove unnecessary code
Copy link
Copy Markdown
Member

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Thanks, sorry for this taking so long. lgtm!

Copy link
Copy Markdown
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

LGTM also thanks @pillose

@hmacdope
Copy link
Copy Markdown
Member

Cycling CI

@IAlibay IAlibay merged commit acfd122 into MDAnalysis:develop Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Atom type guessing error when parse gro file

4 participants