Closed PNOGillespie closed 1 year ago
Ok @superstar54, I've applied the suggested changes. I am planning to look into re-factoring the Core and Crystal WorkChains to properly maintain data provenance, but I think this would be too time-consuming to finish at the moment - especially considering the other plans we have going on with AiiDALab.
Rest assured, I have a list of potential improvements that I want to investigate and implement once time allows for it.
@sphuber Thanks for the explanation.
@PNOGillespie thanks for the implementation and changes. Considering the need for our parallel work with AiiDAlab, I agree that we can merge this PR first, then add improvements in the future PR.
For the improvement, please also consider this issue.
When caching
is enabled. I got this:
XspectraCalculation ⏸ Waiting Pausing after failed transport task: upload_calculation failed 5 times consecutively
The error are:
| Traceback (most recent call last):
| File "/opt/conda/lib/python3.9/site-packages/aiida/engine/utils.py", line 186, in exponential_backoff_retry
| result = await coro()
| File "/opt/conda/lib/python3.9/site-packages/aiida/engine/processes/calcjobs/tasks.py", line 90, in do_upload
| execmanager.upload_calculation(node, transport, calc_info, folder)
| File "/opt/conda/lib/python3.9/site-packages/aiida/engine/daemon/execmanager.py", line 254, in upload_calculation
| transport.copy(remote_abs_path, dest_rel_path)
| File "/opt/conda/lib/python3.9/site-packages/aiida/transports/plugins/local.py", line 560, in copy
| raise OSError('Source not found')
| OSError: Source not found
This only happens when using upf2plotcore
. It seems that the shell job upf2plotcore
does not work with caching
. I am not sure if this is special to upf2plotcore
or is common for all ShellJob
.
Overview
In this PR we propose to implement a new WorkChain intended to fully automate the calculation of K-edge XANES spectra for each element in a given input structure. This new WorkChain essentially automates the generation of input structures for
XspectraCoreWorkChain
sub-processes, as well as handling generation and setting of inputs for each sub-process, in order to compute a complete K-edge XANES spectrum for each element requested. The workflow process defined herein applies specifically to periodic systems as it uses theget_xspectra_structures
CalcFunction to prepare input structures under the assumption that the input structure is not molecular. Due to the lack of pseudopotentials currently available which either contain GIPAW information or define a core-hole state, such pseudopotentials are presently required to be given as input. A code node to calculate the core wavefunction usingupf2plotcore.sh
in AiiDA-Shell can be provided to produce the core wavefunction data for each pseudopotential on-the-fly if desired, however pre-computed core wavefunction files can also be provided as input, either directly or viaget_builder_from_protocol
.Process Flow
The steps of the WorkChain are:
PwRelaxWorkChain
(optional)get_xspectra_structures
and return a marked structure for each symmetrically inequivalent absorbing atom site. Use the spacegroup number obtained to determine the list of polarisation vectors to calculate for each marked structure.XspectraCoreWorkChain
sub-process for each marked structureXspectraCoreWorkChain
sub-process and compile a final spectrum for each element using a weighted average, based on the multiplicity of each absorbing atom site of the same element.Inputs
In addition to inputs for the
XspectraCoreWorkChain
andPwRelaxWorkChain
, other inputs to take notice of are:gipaw_pseudos
- an input namespace forUpfData
nodes, taking the form{{element} : {upf}}
, which defines the ground-state pseudopotential for the associated element.core_hole_pseudos
- an input namespace analagous togipaw_pseudos
, used to define each pseudopotential containing the core-hole. The namespace keys must be those of their associated element, not the marker to be used for the absorbing atom.core_wfc_data
- an optional input namespace forSinglefileData
nodes, taking the form{{element} : {singlefile}}
. The WorkChain will automatically skip theupf2plotcore.sh
step if this input is provided. Note that this input must be complete for all elements to be calculated.core_hole_treatments
- an optionalDict
input which defines the core-hole treatment (approximation) to be used in theXspectraCoreWorkChain
for each element. Note that this does not need to be complete as any elements not defined in this input will use the default full-core-hole (FCH) approximation instead.spglib_settings
- an optionalDict
input which defines symmetry tolerances to be used byspglib
. Must contain valid options used byspglib.get_symmetry_dataset()
andspglib.standardize_structure()
, though not all options must be defined.structure_preparation_settings
- an optionalDict
input which defines parameters to be used byget_xspectra_structures()
. Must contain valid options used byget_xspectra_structures
, though not all options must be defined.return_all_powder_spectra
- an optionalBool
input which requests that all powder spectra generated during the runtime of the entire WorkChain be returned as output to the main WorkChain. Optional and set toFalse
by default in order to keep the terminal display of the WorkChain's outputs in a condensed format, though potentially useful if spectra for each absorbing atom site are of interest.