Skip to content

Fix Procar.get_projection_on_elements for structures with multiple same-element ionic sites - #3261

Merged
janosh merged 4 commits into
materialsproject:masterfrom
Na-Kawa:Na-Kawa-patch-1
Aug 23, 2023
Merged

janosh merged 4 commits into
materialsproject:masterfrom
Na-Kawa:Na-Kawa-patch-1

Conversation

@Na-Kawa

@Na-Kawa Na-Kawa commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor

Summary

Major changes:
Fixes a bug in the get_projection_on_elements function of Procar. In the current version, the code computes projections only for the final ion of each element when there are multiple ionic sites of the same element in the structure. To ensure projections are correctly computed and accumulated for all ions, I have corrected the assignment operator from '=' to '+='."

Signed-off-by: Naoto kawaguchi <82787855+Na-Kawa@users.noreply.github.com>
@janosh janosh added needs testing PRs that are not ready to merge due to lacking tests io Input/output functionality fix Bug fix PRs vasp Vienna Ab initio Simulation Package labels Aug 22, 2023
@Na-Kawa Na-Kawa changed the title Update outputs.py Bugfix for Procar get_projection_on_elements Aug 22, 2023
@Na-Kawa Na-Kawa changed the title Bugfix for Procar get_projection_on_elements Bugfix for Procar get_projection_on_elements function Aug 22, 2023

@janosh janosh left a comment

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.

Thanks for fixing this @Na-Kawa! 👍 Could you add a test that makes sure get_projection_on_elements() now works correctly for multiple ionic sites?

Add test for get_projction_on_elements() when structure have multiple ionic sites with the same elements.

Signed-off-by: Naoto kawaguchi <82787855+Na-Kawa@users.noreply.github.com>
@Na-Kawa

Na-Kawa commented Aug 23, 2023

Copy link
Copy Markdown
Contributor Author

Hello @janosh,
I have added the test code for get_projction_on_elements() when the structure have multiple ionic sites with the same elements. Please check if it meets the requirements.

@janosh janosh left a comment

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.

Looks great! Thanks for the test! 👍

@janosh janosh changed the title Bugfix for Procar get_projection_on_elements function Fix Procar.get_projection_on_elements for structures with multiple same-element ionic sites Aug 23, 2023
@janosh
janosh merged commit 6dacfff into materialsproject:master Aug 23, 2023
@janosh janosh removed the needs testing PRs that are not ready to merge due to lacking tests label Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix PRs io Input/output functionality vasp Vienna Ab initio Simulation Package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants