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

Radii fix #463

Merged
merged 19 commits into from
Sep 26, 2023
Merged

Radii fix #463

merged 19 commits into from
Sep 26, 2023

Conversation

Gabrielgerez
Copy link
Contributor

Finally I implement a simple fix for the default radii for the solvent. This has been an open issue since #419.
Its not the prettiest fix, but I think it does its job.

@stigrj
Copy link
Contributor

stigrj commented Sep 20, 2023

I would really like to avoid introducing qcelemental as a runtime dependency.

If I understand the PhysicalConstants analogue correctly, qcelemental is used only as a dev dependency when updating the input template.yml file. Then, in update_input_parser.py, the parameters are fetched from qcelemental and put as default values in a dedicated Constants section in the regular input. Not sure if we want to pass all these radii through the standard input file, though?

How about having update_input_parser.py write directly to the periodictable.py file?

Any thoughts @robertodr ?

@stigrj
Copy link
Contributor

stigrj commented Sep 20, 2023

Actually, perhaps it's not such a bad idea to pass the entire periodic table through the regular input file? In general we would of course fall back to default values, so the regular user would never have to bother with it. But then the advanced user could easily change a single parameter directly in the input file for use in a particular run, without hard coding a change in a static periodictable.py file.

@robertodr
Copy link
Contributor

I agree with Stig that we should not add Python packages as required production dependencies. They should all stay as development dependencies and the data needed from them should be saved in the mrchem Python module, which only needs a working Python interpreter to do its job.

I think it's OK to update periodictable.py using qcelemental and I think passing it through the parser as done with the constants is a good idea, since it's exposed to the advanced user.

@Gabrielgerez
Copy link
Contributor Author

I have now added the periodic table to the template through the update_input_parser. There are some issues, for example there are elements for which there are no valid vdw-radii in the mantina set. Another one is that the element No is confusing the parser since no is a reserved yaml keyword for a boolean false (also the yes keyword for true)

@Gabrielgerez
Copy link
Contributor Author

Tests are failing, have added a lot of the files that are under python/mrchem/input_parser/plumbing/pyparsing as it seems there is a bit of version issues. Will most likely revert these changes later

@codecov
Copy link

codecov bot commented Sep 21, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (master@d8f2b39). Click here to learn what that means.

❗ Current head 7f015dc differs from pull request most recent head d4dfb86. Consider uploading reports for the commit d4dfb86 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #463   +/-   ##
=========================================
  Coverage          ?   69.57%           
=========================================
  Files             ?      179           
  Lines             ?    15036           
  Branches          ?        0           
=========================================
  Hits              ?    10461           
  Misses            ?     4575           
  Partials          ?        0           

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

@Gabrielgerez
Copy link
Contributor Author

Everything should be working now. Have some issues with Nobellium and elements without radius entry in the mantina set, but otherwise it should be ok.

Copy link
Contributor

@robertodr robertodr left a comment

Choose a reason for hiding this comment

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

I think you need to run Black and isort on periodictable.py and validators.py

Gabrielgerez and others added 2 commits September 25, 2023 10:56
less lines of code

Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
@Gabrielgerez
Copy link
Contributor Author

I think you need to run Black and isort on periodictable.py and validators.py

Do we have a special configuration file for this? I ran isort --profile black on both files, but it barely changed anything

on `update_input_parser.py` and `validators.py`
@robertodr
Copy link
Contributor

So for formatting it's:
black <files-to-format>
and for sorting the imports it's:
isort <files-to-sort>

def radiusNotFound(x):
# This raises an exception in the list comprehension if the radius is not valid.
raise ValueError(
"The vdw-radius of element {x} is not defined in the mantina set".format(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

f-strings should be preferred:

Suggested change
"The vdw-radius of element {x} is not defined in the mantina set".format(x)
f"The vdw-radius of element {x} is not defined in the mantina set"

Copy link
Contributor

@robertodr robertodr left a comment

Choose a reason for hiding this comment

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

Two more small comments, but otherwise looks good!

@Gabrielgerez
Copy link
Contributor Author

Two more small comments, but otherwise looks good!

Alright, i have now added all suggestions :)
We can finally fix this bug

Copy link
Contributor

@robertodr robertodr left a comment

Choose a reason for hiding this comment

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

Thanks Gabriel!

@robertodr robertodr merged commit 5343bf6 into MRChemSoft:master Sep 26, 2023
4 checks passed
@robertodr robertodr deleted the radii_fix branch September 26, 2023 12:19
gitpeterwind pushed a commit to gitpeterwind/mrchem that referenced this pull request Aug 5, 2024
Close MRChemSoft#419 We now use qcelemental to fetch Bondi radii, and use alpha=1.2 for hydrogen

---------

Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants