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

patches in default LORBIT writing #1424

Merged
merged 4 commits into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions pyiron_atomistics/vasp/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,33 @@ def write_magmoms(self):
if self.structure.has("initial_magmoms"):
if "ISPIN" not in self.input.incar._dataset["Parameter"]:
self.input.incar["ISPIN"] = 2

# LORBIT MUST BE SET TO WRITE PER-ATOM MAGNETISATIONS
# Check if LORBIT is in the INCAR parameters
if "LORBIT" not in self.input.incar._dataset["Parameter"]:
# If LORBIT is not set, set it to 10
self.input.incar["LORBIT"] = 10
self.logger.warning(
"We have set LORBIT = 10 to write magmoms to OUTCAR! This is a spin-polarized calculation."
)
else:
# If LORBIT is set but not in the valid range, set it to 10 and warn
if self.input.incar["LORBIT"] not in [
0,
1,
2,
5,
10,
11,
12,
13,
14,
]:
self.logger.warning(
"Invalid LORBIT tag. We have set LORBIT = 10 to write magmoms to OUTCAR! This is a spin-polarized calculation."
)
self.input.incar["LORBIT"] = 10

if self.input.incar["ISPIN"] != 1:
final_cmd = " ".join(
[
Expand Down Expand Up @@ -913,6 +940,31 @@ def write_magmoms(self):
raise ValueError(
"Spin constraints are only avilable for non collinear calculations."
)
# LORBIT MUST BE SET TO WRITE PER-ATOM MAGNETISATIONS
# Check if LORBIT is in the INCAR parameters
if "LORBIT" not in self.input.incar._dataset["Parameter"]:
# If LORBIT is not set, set it to 10
self.input.incar["LORBIT"] = 10
self.logger.warning(
"We have set LORBIT = 10 to write magmoms to OUTCAR! This is a spin-polarized calculation."
)
else:
# If LORBIT is set but not in the valid range, set it to 10 and warn
if self.input.incar["LORBIT"] not in [
0,
1,
2,
5,
10,
11,
12,
13,
14,
]:
self.logger.warning(
"Invalid LORBIT tag. We have set LORBIT = 10 to write magmoms to OUTCAR! This is a spin-polarized calculation."
)
self.input.incar["LORBIT"] = 10
else:
state.logger.debug(
"Spin polarized calculation is switched off by the user. No magnetic moments are written."
Expand Down
Loading