diff --git a/docs/source/howto/xas.rst b/docs/source/howto/xas.rst index 1e0ac2b36..e6273d333 100644 --- a/docs/source/howto/xas.rst +++ b/docs/source/howto/xas.rst @@ -167,6 +167,19 @@ Finally, click on the "Download CSV" button to the upper left of the plot area t * The normalised & weighted spectrum. (with respect to ratio of site multiplicity to total multiplicity) * The normalised & un-weighted spectrum. +Additional Note on Charged Systems +---------------------------------- +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 +available in the QE App, however such workflows should always be tested by the user against experimental data if possible. + +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 +core-hole treatment is applied correctly: + +* "xch_fixed" or "xch_smear": Set the total charge as required for the system's charged ground-state. +* "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). + +Note that for neutral systems (total charge = 0), the QE App will handle these settings automatically. + Summary ------- diff --git a/src/aiidalab_qe/plugins/xas/workchain.py b/src/aiidalab_qe/plugins/xas/workchain.py index b195a441a..9ad99c207 100644 --- a/src/aiidalab_qe/plugins/xas/workchain.py +++ b/src/aiidalab_qe/plugins/xas/workchain.py @@ -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"] @@ -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