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

apply_modifications(calculation)[source]

Apply all requested modifications

classmethod define(spec)[source]

Define the process specification.

handle_amin(calculation)[source]

Handle ERROR_AMIN exit code

handle_brions(calculation)[source]

Handle ERROR_BRIONS exit code

handle_edddav(calculation)[source]

Handle ERROR_EDDDAV exit code

handle_eddrmm(calculation)[source]

Handle ERROR_EDDRMM exit code

handle_elf_kpar(calculation)[source]

Handle ERROR_ELF_KPAR exit code

handle_grad_not_orth(calculation)[source]

Handle ERROR_GRAD_NOT_ORTH exit code

handle_inverse_rotation_matrix(calculation)[source]

Handle ERROR_INVERSE_ROTATION_MATRIX exit code

handle_lreal(calculation)[source]

Handle ERROR_LREAL_SMALL_SUPERCELL exit code

handle_point_group(calculation)[source]

Handle ERROR_POINT_GROUP exit code

handle_posmap(calculation)[source]

Handle ERROR_POSMAP exit code

handle_pricel(calculation)[source]

Handle ERROR_PRICEL exit code

handle_pssyevx(calculation)[source]

Handle ERROR_PSSYEVX exit code

handle_rhosyg(calculation)[source]

Handle ERROR_RHOSYG exit code

handle_rsphere(calculation)[source]

Handle ERROR_RSPHERE exit code

handle_subspace_matrix(calculation)[source]

Handle ERROR_SUBSPACEMATRIX exit code

handle_tetrahedron(calculation)[source]

Handle ERROR_TETRAHEDRON exit code

handle_timeout(calculation)[source]

Error handler that restarts calculation finished with TIMEOUT ExitCode.

handle_zbrent(calculation)[source]

Handle ERROR_ZBRENT exit code

handle_zheev(calculation)[source]

Handle ERROR_ZHEEV exit code

handle_zpotrf(calculation)[source]

Handle ERROR_ZPOTRF exit code

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

setup()[source]

Call the setup of the BaseRestartWorkChain and then create the inputs dictionary in self.ctx.inputs. This self.ctx.inputs dictionary will be used by the BaseRestartWorkChain to submit the calculations in the internal loop.

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>
classmethod define(spec)[source]

Define the specification of the process, including its inputs, outputs and known exit codes.

A metadata input namespace is defined, with optional ports that are not stored in the database.

initialize()[source]

Initialize inputs and settings

results()[source]

Handle results

run_charged()[source]

Submit VaspMultiStageWorkChain on charged structure

run_discharged()[source]

Submit VaspMultiStageWorkChain on discharged structure

should_run_discharged()[source]

Checks whether should run calculation on discharged structure

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>
classmethod define(spec)[source]

Define the specification of the process, including its inputs, outputs and known exit codes.

A metadata input namespace is defined, with optional ports that are not stored in the database.

initialize()[source]

Initialize inputs and settings

inspect_encut_converge()[source]

Asserts whether all ENCUT calculations are finished ok

inspect_kspacing_converge()[source]

Asserts whether all ENCUT calculations are finished ok

process_encut_converge()[source]

Process and extract results of ENCUT convergence

process_kspacing_converge()[source]

Process and extract results of ENCUT convergence

results()[source]

Handle results

run_encut_converge()[source]

Submit VaspMultiStageWorkChain with all items in ENCUT list

run_kspacing_converge()[source]

Submit VaspMultiStageWorkChain with all items in ENCUT list

should_converge_encut()[source]

Return true until whole ENCUT values are submitted!

should_converge_kspacing()[source]

Return true until whole KSPACING values are submitted!

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>
classmethod define(spec)[source]

Define the specification of the process, including its inputs, outputs and known exit codes.

A metadata input namespace is defined, with optional ports that are not stored in the database.

initialize()[source]

Initialize inputs and settings

inspect_stage()[source]

Do the inspection of finished stage!

results()[source]

Attach the remaining output results.

run_stage()[source]

Prepares and submits static calculations as long as they are needed.

should_run_next_stage()[source]

True if there is another stage to run

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 of INCAR.

Args:

structure (StructureData): The AiiDA structure object

hubbard_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 an AiiDA structure object as we can only have values of 0, 1, and -1 stored in such object. Here, I first get a default_magmoms from the pymatgen 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 in strc_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 object

potcar_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 object

stage_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 to None.

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 object

kspacing (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 a protocol_tag and user-defined settings.

Args:

protocol_tag (Str): An string which defines the protocol to be used.

structure (StructureData): The AiiDA structure object

user_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 returns True.

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>
classmethod define(spec)[source]

Define the specification of the process, including its inputs, outputs and known exit codes.

A metadata input namespace is defined, with optional ports that are not stored in the database.

initialize()[source]

Initialize inputs and settings

results()[source]

Handle results

run_ddec()[source]

Submit DdecCalculation

run_vasp()[source]

Submit VaspMultiStageWorkChain

aiida_catmat.workchains.vasp_multistage_ddec.get_remote_folder(wcnode)[source]

Get remote folder from worchain

Module contents

Import modules