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: Running PDOS for spin-polarised system #206

Merged
merged 6 commits into from
Apr 5, 2022

Conversation

mbercx
Copy link
Member

@mbercx mbercx commented Feb 22, 2022

Fixes #202

Currently it is not possible to calculate the PDOS for a spin-polarised
system (i.e. setting Magnetism to Ferromagnetic), since the
QeAppWorkChain expects the projections output from the
PdosWorkChain. However, for spin-polarised systems the
ProjwfcCalculation returns two outputs: projections_up and
projections_down.

Here we adapt the QeAppWorkChain to check for the projections_up
output, and in case it is present it will add both projections_up and
projections_down to the outputs. Otherwise it will only add the
projections output (both only in case the workchain_pdos was
actually run).

To deal with plotting the corresponding (P)DOS, we simply add the total
DOS up and down states together, and separately add the PDOS orbitals
for the up and down states to the list passed to the widget-bandsplot.
Since the widget currently adds all the PDOS of the same orbital types
(s, p, d, f) together, there will currently not be any differentiation
between the up and down states in the visualization. This is something
that will need to be improved on the widget side.

@unkcpz
Copy link
Member

unkcpz commented Feb 25, 2022

Hi @mbercx, thanks for this fix. I find another issue that when running the test on an oxygen structure with the setting ElectronicType=insulator, Magnetism=ferromagnetic, the workflow failed at a very early stage.

It is caused by the occupation=fixed while no tot_magnetization is set in the input file. But can be in another PR.

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.

@mbercx thanks. I still running some tests on your branch. all looks good to me but some minor questions.

aiidalab_qe/node_view.py Show resolved Hide resolved
aiidalab_qe/node_view.py Show resolved Hide resolved
@mbercx
Copy link
Member Author

mbercx commented Feb 25, 2022

It is caused by the occupation=fixed while no tot_magnetization is set in the input file. But can be in another PR

Yeah, this is a known issue, but needs to be fixed in the plugin. Thought I already opened an issue for this, but apparently not. Will do so now.

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.

@mbercx Thanks! I still have some minor questions. Bit almost there I think.

aiidalab_qe/node_view.py Outdated Show resolved Hide resolved
src/aiidalab_qe_workchain/__init__.py Outdated Show resolved Hide resolved
@unkcpz unkcpz modified the milestones: 2022.04.0, Ready to send email Mar 14, 2022
@mbercx mbercx force-pushed the fix/202/spin-polarised-pdos branch from 0cb784c to 989ff63 Compare March 29, 2022 07:50
@mbercx mbercx requested a review from unkcpz March 29, 2022 07:50
@mbercx
Copy link
Member Author

mbercx commented Mar 29, 2022

Hmm, it seems to fail to initialize the pre-commit env. I'm also having this issue locally...

@unkcpz
Copy link
Member

unkcpz commented Mar 29, 2022

I think it relates to the issue ContinuumIO/anaconda-issues#12094 (comment). I encountered it also in my aiida-sssp-workflow repo, add python -m pip install virtualenv==20.0.33 in pre-commit CI fixes it, but not sure why it happened.

@unkcpz
Copy link
Member

unkcpz commented Mar 29, 2022

@csadorf do you know which cause this pre-commit issue?

@csadorf
Copy link
Member

csadorf commented Mar 29, 2022

@csadorf do you know which cause this pre-commit issue?

@unkcpz Yes, I provided some summary here.

unkcpz added a commit that referenced this pull request Mar 30, 2022
Remove workaround, after problem described in #206 (comment)
 is resolved.
unkcpz added a commit that referenced this pull request Mar 30, 2022
Remove workaround, after problem described in #206 (comment)
 is resolved.
unkcpz added a commit that referenced this pull request Mar 30, 2022
- Remove workaround, after problem described in #206 (comment)
 is resolved.
- new psf/black version for issue psf/black#2964 (comment)
unkcpz added a commit that referenced this pull request Mar 30, 2022
- Remove workaround, after problem described in #206 (comment)
 is resolved.
- new psf/black version for issue psf/black#2964 (comment)
@unkcpz
Copy link
Member

unkcpz commented Mar 30, 2022

Hi @mbercx, the pre-commit issue is temporarily fixed, can you update the branch and try it again. I think there is a minor issue with code which cause other pre-commit fail that is,

aiidalab_qe/node_view.py:147:54: F821 undefined name 'ProjectionData'
        for projections, suffix in projection_list:  # type: ProjectionData, str
                                                     ^
1     F821 undefined name 'ProjectionData'

@unkcpz
Copy link
Member

unkcpz commented Apr 4, 2022

Hi @mbercx, could you have a look and we finish this PR these days? should be nothing to add and block it. I force push with rebase the latest master branch, hope you don't mind.

mbercx and others added 4 commits April 4, 2022 13:29
Currently it is not possible to calculate the PDOS for a spin-polarised
system (i.e. setting Magnetism to Ferromagnetic), since the
`QeAppWorkChain` expects the `projections` output from the
`PdosWorkChain`. However, for spin-polarised systems the
`ProjwfcCalculation` returns two outputs: `projectsion_up` and
`projections_down`.

Here we adapt the `QeAppWorkChain` to check for the `projections_up`
output, and in case it is present it will add both `projections_up` and
`projections_down` to the outputs. Otherwise it will only add the
`projections` output (both only in case the `workchain_pdos` was
actually run).

To deal with plotting the corresponding (P)DOS, we simply add the total
DOS up and down states together, and separately add the PDOS orbitals
for the up and down states to the list passed to the `widget-bandsplot`.
Since the widget currently adds all the PDOS of the same orbital types
(s, p, d, f) together, there will currently not be any differentiation
between the up and down states in the visualization. This is something
that will need to be improved on the widget side.
@unkcpz unkcpz force-pushed the fix/202/spin-polarised-pdos branch from 989ff63 to 0ab6d21 Compare April 4, 2022 13:29
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 @mbercx, looks all good.

@mbercx mbercx merged commit e8ec8d2 into aiidalab:master Apr 5, 2022
@mbercx mbercx deleted the fix/202/spin-polarised-pdos branch April 5, 2022 09:45
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.

Bug report: Application crashed with NotExistentAttributeError
3 participants