"""Core-level photoemission through native KKRSPEC (serial scope)."""
import numpy as np
from .arpes import input_parameters_definition as arpes_parameters
from ..task_definition import TaskDefinition
from ..tasks._spec_files import SPEC_INPUT_FILES, SPEC_OUTPUT_FILES
from ._sections import CONTROL
from ...common.grammar_types import Integer, Keyword, SetOf
from ...common.warnings import DataValidityError
from ..input_parameters_definitions import InputSectionDefinition as Section, InputValueDefinition as V
[docs]
def _validate_clpes(p, _container, why):
if why == "set":
return None
errors = []
def error(message):
errors.append(DataValidityError(message))
if p.TASK.TASK() != "CLPES":
error("This definition requires TASK CLPES.")
if p.TASK.INPVER() == 0:
return errors
if p.SPEC_PH.NPOL() is not None and p.SPEC_PH.NPOL() not in ("1", "2"):
error("CLPES does not implement NPOL=0 or 3.")
if p.ENERGY.SPLITSS() or len(p.ENERGY.NE()) != 1:
error("CLPES requires a single energy mesh without SPLITSS.")
if p.ENERGY.NE()[0] == 1 and p.SPEC_CL.IE_ICST() > 4 * "SPDF".index(p.SPEC_CL.CL()[1]) + 2:
error("IE_ICST exceeds the selected core shell state count.")
if p.SPEC_EL.NT() != 1 or p.SPEC_EL.NP() != 1:
error("This CLPES definition audits fixed electron angles only.")
for name in ("THETA", "PHI"):
v = p.SPEC_EL[name]()
if not np.all(np.isfinite(v)) or v[0] != v[-1]:
error("Use fixed finite electron angles for CLPES.")
if any(p.SPEC_EL[n]() is not None for n in ("KA", "K1", "K2", "K3", "K4", "NK1", "NK2", "NK3", "NK4")):
error("Momentum scans are outside this CLPES definition.")
for name in ("EWORK_EV", "IMV_INI_EV", "IMV_FIN_EV"):
if not np.isfinite(p.ENERGY[name]()) or p.ENERGY[name]() < 0:
error(f"{name} must be finite and nonnegative.")
if not np.isfinite(p.SPEC_PH.EPHOT()) or p.SPEC_PH.EPHOT() <= 0:
error("EPHOT must be finite and positive; also choose it above the core emission threshold.")
return errors or None