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

adding spin-orbit coupling to process label #954

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion src/aiidalab_qe/app/submission/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ def update_process_label(self):
"workchain",
{"properties": []},
)

soc_parameters = self.input_parameters["advanced"]["pw"]["parameters"][
"SYSTEM"
].get("lspinorb", False)

if soc_parameters:
soc_info = ", spin-orbit coupling"
else:
soc_info = ""
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if soc_parameters:
soc_info = ", spin-orbit coupling"
else:
soc_info = ""
soc_info = ", spin-orbit coupling" if soc_parameters else ""

A bit more concise. If using VS Code, consider installing the Sourcery extension. It'll recommend (and optionally apply) best practices as you code.


properties = [p for p in workchain_data["properties"] if p != "relax"]
relax_type = workchain_data.get("relax_type", "none")
relax_info = "unrelaxed"
Expand All @@ -109,7 +119,7 @@ def update_process_label(self):
if workchain_data["spin_type"] != "none":
protocol_and_magnetic_info += ", magnetic"
properties_info = f"→ {', '.join(properties)}" if properties else ""
label = f"{structure_label} [{relax_info}, {protocol_and_magnetic_info}] {properties_info}".strip()
label = f"{structure_label} [{relax_info}, {protocol_and_magnetic_info}{soc_info}] {properties_info}".strip()
Copy link
Member

Choose a reason for hiding this comment

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

Consider doing

label_parts = [
    relax_info,
    protocol_and_magnetic_info,
    soc_info,
    ...,  # future info bits :)
]

then here

label = f"{structure_label} [{', '.join(label_parts)}] {properties_info}.strip()

Makes for easy future expansion 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

I have updated the code , according to your suggestions , thanks!

self.process_label = label

def update_submission_blockers(self):
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def get_builder_from_protocol(
"base_final_scf": parameters["advanced"],
}
protocol = parameters["workchain"]["protocol"]
print("codes: ", codes["global"]["codes"].get("quantumespresso.pw"))

relax_builder = PwRelaxWorkChain.get_builder_from_protocol(
code=codes["global"]["codes"].get("quantumespresso.pw")["code"],
structure=structure,
Expand Down
Loading