aiida_catmat.workchains package¶
Submodules¶
aiida_catmat.workchains.base module¶
BaseWorkChain
to run a VASP calculation
-
class
aiida_catmat.workchains.base.
VaspBaseWorkChain
(*args: Any, **kwargs: Any)[source]¶ Bases:
aiida.engine.processes.workchains.restart.BaseRestartWorkChain
Workchain to run a
VASP
calculation with automated error handling and restarts.-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'aiida_catmat.workchains.base'¶
-
_abc_impl
= <_abc_data object>¶
-
_process_class
¶ alias of
aiida_vasp.calcs.vasp.VaspCalculation
-
handle_timeout
(calculation)[source]¶ Error handler that restarts calculation finished with
TIMEOUT
ExitCode.
-
report_error_handled
(calculation: aiida.orm.nodes.process.calculation.calcjob.CalcJobNode, action: str) → None[source]¶ Report an action taken for a calculation that has failed.
- Args:
calculation (CalcJobNode): the failed calculation node action (str): a string message with the action taken
-
-
aiida_catmat.workchains.base.
apply_strain_on_structure
(retrived_folder: aiida.orm.nodes.data.folder.FolderData) → aiida.orm.nodes.data.structure.StructureData[source]¶ Applies 0.2 strain on structure
- Args:
retrived_folder (FolderData): The retrieved folder in the repository that contains
CONTCAR
- Returns:
StructureData: The structure after applying 0.2 strain.
-
aiida_catmat.workchains.base.
get_stderr_errs
(calculation: aiida.orm.nodes.process.calculation.calcjob.CalcJobNode) → set[source]¶ Parses the
_scheduler-stderr.txt
and searches for pre-defined error messages.- Args:
calculation (CalcJobNode): The calculation
Node
.- Returns:
set: A set of found error messages in
_scheduler-stderr.txt
-
aiida_catmat.workchains.base.
get_stdout_errs
(calculation: aiida.orm.nodes.process.calculation.calcjob.CalcJobNode) → set[source]¶ Parses the
_scheduler-stdout.txt
and searches for pre-defined error messages.- Args:
calculation (CalcJobNode): The calculation Node.
- Returns:
set: A set of found error messages in
_scheduler-stdout.txt
-
aiida_catmat.workchains.base.
update_incar
(incar: aiida.orm.nodes.data.dict.Dict, modifications: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Updates the current
INCAR
with proposed modifications.- Args:
incar (Dict): Current
INCAR
modifications (Dict): Proposed modifications to handle the error.- Returns:
Dict: The updated
INCAR
.
aiida_catmat.workchains.vasp_catmat module¶
VaspCatMatWorkChain wraps VaspMultiStageWorkChain to perform two ccnsecutive calculations to calculate cathode properties considering fully intercalated and deintercalated structures.
-
class
aiida_catmat.workchains.vasp_catmat.
VaspCatMatWorkChain
(*args: Any, **kwargs: Any)[source]¶ Bases:
aiida.engine.processes.workchains.workchain.WorkChain
Convergence WorkChain
-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'aiida_catmat.workchains.vasp_catmat'¶
-
_abc_impl
= <_abc_data object>¶
-
-
aiida_catmat.workchains.vasp_catmat.
calculate_cathode_props
(discharged: aiida.orm.nodes.data.dict.Dict, charged: aiida.orm.nodes.data.dict.Dict, discharged_structure: aiida.orm.nodes.data.structure.StructureData, charged_structure: aiida.orm.nodes.data.structure.StructureData, anode: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Calculates and returns cathode properties.
- Args:
discharged (Dict): Results dictionary for fully intercalated structure. charged (Dict): Results dictionary for fully deintercalated structure. discharged_structure (StructureData): Structure of fully intercalated structure. charged_structure (StructureData): Structure of fully deintercalated structure. anode (Dict): A dictionary with keys to be alkali metal ion strings and values be the chemical potential.
- Returns:
Dict: Calcualted cathode properties.
-
aiida_catmat.workchains.vasp_catmat.
update_structure
(structure: aiida.orm.nodes.data.structure.StructureData, anode: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.structure.StructureData[source]¶ Returns fully deintercalated structure
- Args:
structure (StructureData): Fully intercalated structure anode (Dict): A dictionary with keys to be alkali metal ion strings.
- Returns:
StructureData: Fully deintercalted structure object.
aiida_catmat.workchains.vasp_converge module¶
VaspConvergeWorkChain that wraps VaspMultiStageWorkChain to series of static calculations for getting converged ENCUT and KSPACING
-
class
aiida_catmat.workchains.vasp_converge.
VaspConvergeWorkChain
(*args: Any, **kwargs: Any)[source]¶ Bases:
aiida.engine.processes.workchains.workchain.WorkChain
Convergence WorkChain
-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'aiida_catmat.workchains.vasp_converge'¶
-
_abc_impl
= <_abc_data object>¶
-
-
aiida_catmat.workchains.vasp_converge.
identify_encut_convergence
(threshold: aiida.orm.nodes.data.float.Float, **all_encut_outputs: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Reports the energies for different ENCUT values and identifies the converged one
- Args:
threshold (Float): The threshold for energy changes to consider a ENCUT converged.
- Returns:
Dict: Results dictionary where converged_encut is the identified ENCUT. The converged_encut_conservative is one step beyond the converged_encut.
-
aiida_catmat.workchains.vasp_converge.
identify_kspacing_convergence
(threshold: aiida.orm.nodes.data.float.Float, **all_kspacing_outputs: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Reports energies for different KSPACING and identifies the converged one
- Args:
threshold (Float): The threshold for energy changes to consider a KSPACING converged.
- Returns:
Dict: Results dictionary where converged_kspacing is the identified ENCUT. The converged_kspacing_conservative is one step beyond the converged_encut.
-
aiida_catmat.workchains.vasp_converge.
return_final_results
(encut_results: aiida.orm.nodes.data.dict.Dict, kpspacing_results: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Returns a single dict with converged ENCUT and KSPACING
- Args:
encut_results (Dict): The output of ENCUT convergene runs. kpspacing_results (Dict): The output of KSPACING convergene runs.
- Returns:
Dict: Final results as a disctionary which can be used for subsequent runs.
-
aiida_catmat.workchains.vasp_converge.
update_incar_encut
(parameters: aiida.orm.nodes.data.dict.Dict, encut: aiida.orm.nodes.data.int.Int) → aiida.orm.nodes.data.dict.Dict[source]¶ Updates the ENCUT tag in INCAR
- Args:
parameters (Dict): INCAR dictionary encut (Int): The new ENCUT value
- Returns:
Dict: Updated INCAR with new ENCUT
aiida_catmat.workchains.vasp_multistage module¶
VaspMultiStageWorkChain
- A general purpose and modular AiiDA workchain
to combine any sequence of VASP
calculation
-
class
aiida_catmat.workchains.vasp_multistage.
VaspMultiStageWorkChain
(*args: Any, **kwargs: Any)[source]¶ Bases:
aiida.engine.processes.workchains.workchain.WorkChain
The
VaspMultiStageWorkChain
-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'aiida_catmat.workchains.vasp_multistage'¶
-
_abc_impl
= <_abc_data object>¶
-
_spec
= <aiida.engine.processes.workchains.workchain.WorkChainSpec object>¶
-
-
aiida_catmat.workchains.vasp_multistage.
extract_wrap_results
(**all_outputs: aiida.orm.nodes.data.dict.Dict) → aiida.orm.nodes.data.dict.Dict[source]¶ Exctract and wrap results for whole workchain
- Returns:
Dict: Results in the format of a dictionary.
-
aiida_catmat.workchains.vasp_multistage.
get_hubbard
(structure: aiida.orm.nodes.data.structure.StructureData, hubbard_tag: str) → dict[source]¶ Constructs
LDAU
related parta ofINCAR
.- Args:
structure (StructureData): The
AiiDA
structure objecthubbard_tag (str): The tag which defines which set of
U
parameters should be used.- Returns:
dict: A disctionary of all needed tags related to
DFT+U
calculation.
-
aiida_catmat.workchains.vasp_multistage.
get_last_input
(workchain: aiida.orm.nodes.process.workflow.workchain.WorkChainNode) → aiida.orm.nodes.data.dict.Dict[source]¶ Gets the
INCAR
of the last stage of a workchain.- Args:
workchain (WorkChainNode): An AiiDA WorkChainNode
- Returns:
Dict: The
INCAR
dictionary of the last stage of input workchain.
-
aiida_catmat.workchains.vasp_multistage.
get_magmom
(structure_pmg: pymatgen.core.structure.Structure) → dict[source]¶ Construct
MAGMOM
tag from pymatgen structure object. It is tricky to provide initial magnetization in anAiiDA
structure object as we can only have values of0
,1
, and-1
stored in such object. Here, I first get adefault_magmoms
from thepymatgen
structure and based on the atomic numbers. Then, I check for avilability of spin tag on sites in the structure. This way I can also work on structures with different magnetic ordering. I put these instrc_magmoms
list. Finally, these two lists will be merged.- Args:
structure_pmg (Structure): The input structure
- Returns:
dict: The initial
MAGMOM
to setup the calculation.
-
aiida_catmat.workchains.vasp_multistage.
get_potcar_mapping
(structure: aiida.orm.nodes.data.structure.StructureData, potcar_set_tag: str) → dict[source]¶ Cosntructs potcar_mapping
- Args:
structure (StructureData): The
AiiDA
structure objectpotcar_set_tag (str): This tag defines which set of
POTCAR
files will be used.- Returns:
dict: A dictionary which maps atomic kinds to relevant
POTCAR
s.
-
aiida_catmat.workchains.vasp_multistage.
get_stage_incar
(protocol: aiida.orm.nodes.data.dict.Dict, structure: aiida.orm.nodes.data.structure.StructureData, stage_tag: aiida.orm.nodes.data.str.Str, hubbard_tag: aiida.orm.nodes.data.str.Str = None, prev_incar: aiida.orm.nodes.data.dict.Dict = None, modifications: aiida.orm.nodes.data.dict.Dict = None) → aiida.orm.nodes.data.dict.Dict[source]¶ Constructs the
INCAR
tags for each stage of calculation.- Args:
protocol (Dict): All
INCAR
settings for whole workchain.structure (StructureData): The
AiiDA
structure objectstage_tag (Str): Specific tag for the current stage of calculation.
hubbard_tag (Str, optional): The tag which defines which set
U
parameters to be used. Defaults toNone
.prev_incar (Dict, optional): The
INCAR
settings from a previous stage. Defaults to None.modifications (Dict, optional): The modifications which are suggested by error handler. Defaults to
None
.- Returns:
Dict: The resuting INCAR.
-
aiida_catmat.workchains.vasp_multistage.
set_kpoints
(structure: aiida.orm.nodes.data.structure.StructureData, kspacing: aiida.orm.nodes.data.float.Float, kgamma: aiida.orm.nodes.data.bool.Bool, force_parity: aiida.orm.nodes.data.bool.Bool) → aiida.orm.nodes.data.array.kpoints.KpointsData[source]¶ Constructs
KpointsData
object.- Args:
structure (StructureData): The
AiiDA
structure objectkspacing (Float): The value for
KSPACING
kgamma (Bool): Set to
True
for Gamma-centered mesh.force_parity (Bool): Set to
True
to force parity in generating the mesh.- Returns:
KpointsData: The
AiiDA
kpoints data object.
-
aiida_catmat.workchains.vasp_multistage.
setup_protocols
(protocol_tag: aiida.orm.nodes.data.str.Str, structure: aiida.orm.nodes.data.structure.StructureData, user_incar_settings: aiida.orm.nodes.data.str.Str) → aiida.orm.nodes.data.dict.Dict[source]¶ Constructs the all
INCAR
settings from aprotocol_tag
and user-defined settings.- Args:
protocol_tag (Str): An string which defines the protocol to be used.
structure (StructureData): The
AiiDA
structure objectuser_incar_settings (Str): The user-defined
INCAR
tags to overwrite/append protocol onces.- Returns:
Dict: A dictionary of all
INCAR
settings for the whole stages of workchain.
-
aiida_catmat.workchains.vasp_multistage.
should_sort_structure
(structure: aiida.orm.nodes.data.structure.StructureData) → bool[source]¶ Checks whether structure after calculations needs to be sorted again. If sign of magnetic moment is changed after the calculation, it groups spin-up and spin-down sites togther.
- Args:
structure (StructureData): The
AiiDA
structure object- Returns:
bool: Returns
True
if the structure needs to sorted.
-
aiida_catmat.workchains.vasp_multistage.
sort_structure
(structure: aiida.orm.nodes.data.structure.StructureData) → aiida.orm.nodes.data.structure.StructureData[source]¶ Sorts structure if the
should_sort_structure
returnsTrue
.- Args:
structure (StructureData): The
AiiDA
structure object- Returns:
StructureData: The
AiiDA
structure object (sorted version of input structure)
aiida_catmat.workchains.vasp_multistage_ddec module¶
VaspMultiStageDdecWorkChain It wraps VaspMultiStageWorkChain to a single point calculation and consecuently calculates the atomic charges and spin moments using DDEC method.
-
class
aiida_catmat.workchains.vasp_multistage_ddec.
VaspMultiStageDdecWorkChain
(*args: Any, **kwargs: Any)[source]¶ Bases:
aiida.engine.processes.workchains.workchain.WorkChain
VASP+DDEC WorkChain
-
__abstractmethods__
= frozenset({})¶
-
__module__
= 'aiida_catmat.workchains.vasp_multistage_ddec'¶
-
_abc_impl
= <_abc_data object>¶
-
Module contents¶
Import modules