Skip to content

Commit b34e997

Browse files
authored
XAS: Fix Conflict Between tot_charge Override and CH Protocol (#809)
- 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. - Adds a note to the documentation for the XAS plugin regarding charged systems and provides some suggestions for how to handle them.
1 parent 924ae5f commit b34e997

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

docs/source/howto/xas.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,19 @@ Finally, click on the "Download CSV" button to the upper left of the plot area t
167167
* The normalised & weighted spectrum. (with respect to ratio of site multiplicity to total multiplicity)
168168
* The normalised & un-weighted spectrum.
169169

170+
Additional Note on Charged Systems
171+
----------------------------------
172+
Computing XANES spectra for systems where a charge has been applied (in this case using the `Total charge` advanced setting) is possible using the tools
173+
available in the QE App, however such workflows should always be tested by the user against experimental data if possible.
174+
175+
When running XAS workflows for systems where a total charge has been applied, it is suggested to use the following settings for the total charge to ensure the corresponding
176+
core-hole treatment is applied correctly:
177+
178+
* "xch_fixed" or "xch_smear": Set the total charge as required for the system's charged ground-state.
179+
* "full": **Increase** the total charge by 1 *relative* to the system's charged ground-state (e.g. set total charge = 2 in the advanced settings tab if the charge is normally 1).
180+
181+
Note that for neutral systems (total charge = 0), the QE App will handle these settings automatically.
182+
170183
Summary
171184
-------
172185

src/aiidalab_qe/plugins/xas/workchain.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def update_resources(builder, codes):
2323
def get_builder(codes, structure, parameters, **kwargs):
2424
from copy import deepcopy
2525

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

0 commit comments

Comments
 (0)