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

Feature: tot charge #377

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions aiidalab_qe/parameters/qeapp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ electronic_type: metal
protocol: moderate
kpoints_distance_override:
pseudo_family: SSSP/1.2/PBEsol/efficiency

tot_charge: 0
1 change: 1 addition & 0 deletions aiidalab_qe/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def _generate_report_dict(qeapp_wc: WorkChainNode):
# Material settings
yield "material_magnetic", builder_parameters["spin_type"]
yield "electronic_type", builder_parameters["electronic_type"]
yield "tot_charge", builder_parameters["tot_charge"]
AndresOrtegaGuerrero marked this conversation as resolved.
Show resolved Hide resolved

# Calculation settings
yield "protocol", builder_parameters["protocol"]
Expand Down
4 changes: 4 additions & 0 deletions aiidalab_qe/static/workflow_summary.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<td>Electronic type</td>
<td>{{ electronic_type }}</td>
</tr>
<tr>
<td>Total Charge</td>
<td>{{ tot_charge }}</td>
</tr>

</table>
</div>
Expand Down
38 changes: 38 additions & 0 deletions aiidalab_qe/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ def __init__(self, **kwargs):
style={"description_width": "initial"},
)

# tot_charge: total charge of the simulations
self.tot_charge = ipw.IntSlider(
value=DEFAULT_PARAMETERS["tot_charge"],
min=-2,
max=2,
step=1,
)

# Checkbox to see if the band structure should be calculated
self.bands_run = ipw.Checkbox(
description="",
Expand Down Expand Up @@ -159,6 +167,17 @@ def __init__(self, **kwargs):
self.spin_type,
]
),
ipw.HBox(
children=[
ipw.Label(
"Total charge:",
layout=ipw.Layout(
justify_content="flex-start", width="120px"
),
),
self.tot_charge,
]
),
self.properties_title,
ipw.HTML("Select which properties to calculate:"),
ipw.HBox(children=[ipw.HTML("<b>Band structure</b>"), self.bands_run]),
Expand Down Expand Up @@ -404,6 +423,7 @@ def set_input_parameters(self, parameters):
self.workchain_settings.bands_run.value = parameters["run_bands"]
self.workchain_settings.pdos_run.value = parameters["run_pdos"]
self.workchain_settings.workchain_protocol.value = parameters["protocol"]
self.workchain_settings.tot_charge.value = parameters["tot_charge"]

# Advanced settings
self.pseudo_family_selector.value = parameters["pseudo_family"]
Expand Down Expand Up @@ -774,6 +794,7 @@ def get_input_parameters(self):
run_bands=self.workchain_settings.bands_run.value,
run_pdos=self.workchain_settings.pdos_run.value,
protocol=self.workchain_settings.workchain_protocol.value,
tot_charge=self.workchain_settings.total_charge.value,
# Codes
pw_code=self.pw_code.value,
dos_code=self.dos_code.value,
Expand Down Expand Up @@ -856,6 +877,23 @@ def update_builder(buildy, resources, npools):
electronic_type=ElectronicType(parameters["electronic_type"]),
)

# Updating tot_charge of the builder
builder.relax.base.pw.parameters["SYSTEM"]["tot_charge"] = parameters[
"tot_charge"
]
builder.bands.bands.pw.parameters["SYSTEM"]["tot_charge"] = parameters[
"tot_charge"
]
builder.bands.scf.pw.parameters["SYSTEM"]["tot_charge"] = parameters[
"tot_charge"
]
builder.pdos.scf.pw.parameters["SYSTEM"]["tot_charge"] = parameters[
"tot_charge"
]
builder.pdos.nscf.pw.parameters["SYSTEM"]["tot_charge"] = parameters[
"tot_charge"
]
AndresOrtegaGuerrero marked this conversation as resolved.
Show resolved Hide resolved

if "kpoints_distance_override" in parameters:
builder.kpoints_distance_override = Float(
parameters["kpoints_distance_override"]
Expand Down