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

Fix tot magnetization #512

Merged
merged 27 commits into from
Apr 5, 2024
Merged

Fix tot magnetization #512

merged 27 commits into from
Apr 5, 2024

Conversation

AndresOrtegaGuerrero
Copy link
Member

This PR solves #412

@AndresOrtegaGuerrero
Copy link
Member Author

AndresOrtegaGuerrero commented Oct 17, 2023

@unkcpz This is a draft, but in order for me to continue there must be a PR (in aiida-quantumespresso) to deal with the logic that if the system has tot_magnetization , it should remove starting_magnetization for PwBaseWorkChain. Likewise that the logic in PdosWorkChain (Since is a spin polarized calculation with no Fermi) and BandsWorkchain is not affected

Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Thanks a lot for trying this @AndresOrtegaGuerrero, and sorry for the late review. The logic looks all good, but I think it requires some iron-up on the clarity of implementation. Can you fix the conflict and we arrange a pair coding session to check things together?

src/aiidalab_qe/app/configuration/advanced.py Show resolved Hide resolved
parameters["kpoints_distance"] = self.value.get("kpoints_distance")

Copy link
Member

Choose a reason for hiding this comment

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

Can you write a comment here for all conditions?
For instance:

# insulator and colliner: xxxx
# metal and collinear: xxx

Can the if..else clause below can be simplified with inverse and break return?

self.pseudo_setter.structure = None
self.pseudo_setter._reset()
else:
self.pseudo_setter._reset()
Copy link
Member

Choose a reason for hiding this comment

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

Why can not call pseudo_setter.structure = None if input_structure is not None? If I understand correct, the reset should also do self.structure=None first.

src/aiidalab_qe/app/configuration/advanced.py Outdated Show resolved Hide resolved
src/aiidalab_qe/app/configuration/advanced.py Outdated Show resolved Hide resolved
src/aiidalab_qe/app/configuration/advanced.py Outdated Show resolved Hide resolved
src/aiidalab_qe/plugins/bands/workchain.py Show resolved Hide resolved
@AndresOrtegaGuerrero
Copy link
Member Author

AndresOrtegaGuerrero commented Nov 29, 2023

To complete this PR the following requirements should be met

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 35 lines in your changes are missing coverage. Please review.

Project coverage is 75.47%. Comparing base (97c9c10) to head (a31aeea).

Files Patch % Lines
src/aiidalab_qe/common/bandpdoswidget.py 41.17% 20 Missing ⚠️
src/aiidalab_qe/app/configuration/advanced.py 82.45% 10 Missing ⚠️
src/aiidalab_qe/plugins/bands/workchain.py 33.33% 2 Missing ⚠️
src/aiidalab_qe/plugins/pdos/workchain.py 33.33% 2 Missing ⚠️
src/aiidalab_qe/workflows/__init__.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   75.73%   75.47%   -0.26%     
==========================================
  Files          60       60              
  Lines        4319     4404      +85     
==========================================
+ Hits         3271     3324      +53     
- Misses       1048     1080      +32     
Flag Coverage Δ
python-3.10 75.47% <66.66%> (-0.26%) ⬇️
python-3.9 75.50% <66.66%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@AndresOrtegaGuerrero AndresOrtegaGuerrero marked this pull request as ready for review February 22, 2024 10:54
@AndresOrtegaGuerrero AndresOrtegaGuerrero added this to the v2024.4.0 milestone Feb 22, 2024
Copy link
Member

@superstar54 superstar54 left a comment

Choose a reason for hiding this comment

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

@AndresOrtegaGuerrero , thanks for the work! LGTM!

There are two things we could improve:

  • If users set Magnetism to Off, the Magnetization section could be hidden.
  • When switching on Magnetism, the pdos plot could has an optios to plot up and down in two sides.

Could you create issues on this? so that we can do these in the future PRs.

@superstar54
Copy link
Member

Before merging the PR, two small changes are needed:

  • the tot_magnetization should be an integer for a fixed occupation.
  • There are two tot_magnetization when I load the previous job.
    image

@AndresOrtegaGuerrero
Copy link
Member Author

@superstar54 thank you for the review, I thought i fixed the duplication i will have a look. Regarding the tot_magnetization , i kept as a Real number since in the pw.x manual is a real.

@superstar54
Copy link
Member

In the fixed occupation, if one sets a non-integer value for the tot_magnetization, pw will raise an error. In the smearing case, it will not.

@AndresOrtegaGuerrero
Copy link
Member Author

In the fixed occupation, if one sets a non-integer value for the tot_magnetization, pw will raise an error. In the smearing case, it will not.

Then i guess it should be conditioned then , thank you !

@AndresOrtegaGuerrero AndresOrtegaGuerrero enabled auto-merge (squash) April 5, 2024 12:36
@superstar54 superstar54 merged commit 2c5ca55 into main Apr 5, 2024
19 checks passed
@superstar54 superstar54 deleted the fix_tot_magnetization branch April 5, 2024 12:43
t-reents added a commit to t-reents/aiidalab-qe that referenced this pull request Apr 30, 2024
If `tot_magnetization` is specified, the results contain a fermi energy
for each spin channel. The general support was added in aiidalab#512 and this
commit introduces the required changes to the widget.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants