Skip to content

Commit

Permalink
XAS: Fix Conflict Between tot_charge Override and CH Protocol
Browse files Browse the repository at this point in the history
Addresses aiidalab#807.

Fixes a conflict between `tot_charge` being set explicitly in
overrides by default and the XAS plugin assuming that `tot_charge`
isn't specified in the overrides.
  • Loading branch information
PNOGillespie committed Sep 24, 2024
1 parent 95e8f4b commit bc1a56f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/aiidalab_qe/plugins/xas/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ def update_resources(builder, codes):
def get_builder(codes, structure, parameters, **kwargs):
from copy import deepcopy

adv_parameters = deepcopy(parameters["advanced"])
# Setting `tot_charge = 0` will cause FCH calculations to fail due to
# inputs being incorrect, thus we pop this from the overrides
if adv_parameters["pw"]["parameters"]["SYSTEM"].get("tot_charge") == 0:
adv_parameters["pw"]["parameters"]["SYSTEM"].pop("tot_charge")
protocol = parameters["workchain"]["protocol"]
xas_parameters = parameters["xas"]
core_hole_treatments = xas_parameters["core_hole_treatments"]
Expand Down Expand Up @@ -61,7 +66,7 @@ def get_builder(codes, structure, parameters, **kwargs):
xs_code = codes["xspectra"]["code"]
overrides = {
"core": {
"scf": deepcopy(parameters["advanced"]),
"scf": adv_parameters,
# PG: Here, we set a "variable" broadening scheme, which actually defines a constant broadening
# The reason for this is that in "gamma_mode = constant", the Lorenzian broadening parameter
# is defined by "xgamma" (in "PLOT"), but this parameter *also* controls the broadening value
Expand Down

0 comments on commit bc1a56f

Please sign in to comment.