"""Integrate positron density and calculate the annihilation lifetime."""
import numpy as np
from ...common.grammar_types import Keyword, SetOf, Integer
from ...common.warnings import DataValidityError, DataValidityWarning
from ._sections import TASK, CONTROL, TAU, ENERGY, SITES, STRCONST, MODE, CPA
from ..input_parameters_definitions import InputParametersDefinition as InputParameters, InputValueDefinition as V, InputSectionDefinition as Section
from ..task_definition import TaskDefinition
[docs]
def _validate_posanitau(p, _values, why):
if why == "set":
return None
issues = []
if p.MODE.MODE() in ("NREL", "SREL", "SP-SREL"):
issues.append(DataValidityError("POSANITAU requires FREL."))
if p.SCF.FULLPOT():
issues.append(DataValidityError("This POSANITAU definition audits the ASA workflow only."))
if p.ENERGY.GRID().tolist() != ["5"] or len(p.ENERGY.NE()) != 1 or p.ENERGY.SPLITSS():
issues.append(DataValidityError("POSANITAU requires one GRID=5 integration contour without SPLITSS."))
if p.ENERGY.EMIN() is None or not np.isfinite(p.ENERGY.EMIN()) or p.ENERGY.EMINEV() is not None:
issues.append(DataValidityError("Set a finite absolute EMIN for the positron integration, without EMINEV."))
if p.ENERGY.EMAXEV() is not None or (p.ENERGY.EMAX() is not None and not np.isfinite(p.ENERGY.EMAX())):
issues.append(DataValidityError("Use a finite absolute EMAX, without EMAXEV, for this workflow."))
if p.TAU.BZINT() != "POINTS":
issues.append(DataValidityError("This periodic POSANITAU definition requires BZINT=POINTS."))
issues.append(DataValidityWarning("Choose integration bounds for the positron band; omitted EMAX uses the electronic EF, which need not be appropriate. "
"Native POSANITAU requires 3D; POSVC does not change the fixed lifetime enhancement factor."))
return issues