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

Set initial magnetic moments #895

Merged
merged 21 commits into from
Dec 8, 2022
Merged

Set initial magnetic moments #895

merged 21 commits into from
Dec 8, 2022

Conversation

samwaseda
Copy link
Member

This allow the user to set the magnetic moments via single value or dict:

Example I

structure = pr.create.structure.bulk('Ni', cubic=True)
structure[-1] = 'Fe'
v_dict = {'Fe': 1, 'Ni': 2}
structure.set_initial_magnetic_moments(v_dict)
print(structure.get_initial_magnetic_moments())

Output: array([2, 2, 2, 1])

Example II

structure = pr.create.structure.bulk('Ni', cubic=True)
structure[-1] = 'Fe'
structure.set_initial_magnetic_moments(1)
structure.get_initial_magnetic_moments()

Output array([1, 1, 1, 1])

Moreover, I saw that the default behaviour was setting the system non-magnetic, i.e. regardless of what was set for the magnetic moments, structure.set_initial_magnetic_moments() would make the structure non-magnetic. This is now disabled, i.e. if the user wants to make it non-magnetic, they are required to explicitly set structure.set_initial_magnetic_moments(None)

@samwaseda samwaseda marked this pull request as draft December 6, 2022 08:09
@samwaseda samwaseda added the format_black reformat the code using the black standard label Dec 6, 2022
@samwaseda samwaseda marked this pull request as ready for review December 6, 2022 13:48
@coveralls
Copy link

coveralls commented Dec 6, 2022

Pull Request Test Coverage Report for Build 3639206527

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 68.674%

Totals Coverage Status
Change from base Build 3622625190: 0.01%
Covered Lines: 12121
Relevant Lines: 17650

💛 - Coveralls

Copy link
Contributor

@pmrv pmrv left a comment

Choose a reason for hiding this comment

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

Some nits, but generally ok with me.

pyiron_atomistics/atomistics/structure/atoms.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/atoms.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/atoms.py Outdated Show resolved Hide resolved
pyiron_atomistics/atomistics/structure/atoms.py Outdated Show resolved Hide resolved
@samwaseda samwaseda added the enhancement New feature or request label Dec 6, 2022
@ligerzero-ai ligerzero-ai added format_black reformat the code using the black standard and removed format_black reformat the code using the black standard labels Dec 7, 2022
@ligerzero-ai ligerzero-ai added format_black reformat the code using the black standard and removed format_black reformat the code using the black standard labels Dec 7, 2022
@ligerzero-ai ligerzero-ai removed the format_black reformat the code using the black standard label Dec 7, 2022
Copy link
Contributor

@ligerzero-ai ligerzero-ai left a comment

Choose a reason for hiding this comment

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

All done - let's get this merged.

@samwaseda samwaseda merged commit 58a9c4f into main Dec 8, 2022
@delete-merged-branch delete-merged-branch bot deleted the set_initial_magnetic_moments branch December 8, 2022 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants