-
Notifications
You must be signed in to change notification settings - Fork 46
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
Complete prepare_dump API and apply to occs_aminusb + cleanups #352
Conversation
Reviewer's Guide by SourceryThis pull request introduces a new feature to convert restricted orbitals to unrestricted when File-Level Changes
Tips
|
Here's the code health analysis summary for commits Analysis Summary
|
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.
Hey @tovrstra - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 3 issues found
- 🟡 Complexity: 3 issues found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
The deepsource issues can be ignored:
|
FYI coverage results look ok: https://github.com/theochem/iodata/actions/runs/9695310238/job/26754784217?pr=352#step:6:1013 |
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.
Thanks Toon, I really think this improves the usability.
Thanks for reviewing, Paul. Merging... |
This is another step in #191, adding a small new feature: the conversion of to unrestricted orbitals when restricted orbitals with
occs_aminusb
is not supported by the selected file format.This feature is implemented at two levels:
iodata.orbitals
module, a new functionconvert_to_unrestricted
is added, which provides the basic functionality. It is useful also outside the context of writing files. Splitting this off also facilitates testing. This is a function (and not a method) on purpose: the class itself does not need it to fulfill its main role, so it can be kept separate.iodata.prepare
module, a functionprepare_unrestricted_aminusb
is created, building on the previous, adding all the logic for errors, warnings and geared towardsprepare_dump
functions of the relevant file formats.Test coverage of the new code should be fairly complete, but I'll check the CI output to be sure.
There are a few related changes (and a few deferred ones, new tasks in #191):
dump_one
anddump_many
must now be given as keyword arguments for the sake of clarity. The same change for other functions iniodata.api
will be made in one of the upcoming PRs.load_one
function has been turned into a warning. (Eventually, we need to replace all asserts in non-test code. This is on the list in Janitoring todo list before 1.0.0 #204) A new test for this warning is included.I will YOLO-merge this on Friday July 5, unless reviewed earlier.
Summary by Sourcery
This pull request introduces a new feature to convert restricted orbitals to unrestricted orbitals and integrates this functionality into the
prepare_dump
process for various file formats. It also includes enhancements to the API for clarity, a bug fix for spin polarization handling, and comprehensive test coverage for the new functionality.convert_to_unrestricted
in theiodata.orbitals
module to convert restricted orbitals to unrestricted orbitals.prepare_unrestricted_aminusb
function in theiodata.prepare
module to handle conversion logic forprepare_dump
functions.load_one
function to a warning to handle inconsistencies in spin polarization.dump_one
anddump_many
functions iniodata.api
to require optional arguments as keyword arguments for clarity.prepare_dump
functions in various format modules (Molekel, Molden, WFN, WFX, FCHK, JSON) to use the newprepare_unrestricted_aminusb
function for handlingoccs_aminusb
.convert_to_unrestricted
function iniodata/test/test_orbitals.py
.prepare_unrestricted_aminusb
function iniodata/test/test_prepare.py
.iodata/test/test_molekel.py
to check for warnings when loading files with incorrect spin multiplicity.