aiida_vasp.workchains package¶
Submodules¶
Bands workchain.
- class aiida_vasp.workchains.bands.BandsWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
WorkChain
Extract the band structure using k-point paths fetched from SeeKpath.
- 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.
- aiida_vasp.workchains.bands.seekpath_structure_analysis(structure, parameters)[source]¶
Workfunction to extract k-points in the reciprocal cell.
This workfunction will take a structure and pass it through SeeKpath to get the primitive cell and the path of high symmetry k-points through its Brillouin zone. Note that the returned primitive cell may differ from the original structure in which case the k-points are only congruent with the primitive cell.
Convergence workchain.
- class aiida_vasp.workchains.converge.ConvergeWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
WorkChain
A workchain to perform convergence tests.
- 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.
- results_kpoints_conv_calc()[source]¶
Fetch and store the relevant convergence parameters for each k-point grid calculation.
- results_pw_conv_calc()[source]¶
Fetch and store the relevant convergence parameters for each plane wave calculation.
- run_kpoints_conv_comp_calcs()[source]¶
Should a new kpoints compression convergence calculation run?
- run_kpoints_conv_disp_calcs()[source]¶
Should a new kpoints displacement convergence calculation run?
- run_pw_conv_comp_calcs()[source]¶
Should a new plane wave cutoff compression convergence calculation run?
- aiida_vasp.workchains.converge.default_array(name, array)[source]¶
Used to set ArrayData for spec.input.
- aiida_vasp.workchains.converge.store_conv_data(convergence_context)[source]¶
Store convergence data in the array.
- aiida_vasp.workchains.converge.store_conv_data_single(array, key, data)[source]¶
Store a single convergence data entry in the dict.
- aiida_vasp.workchains.converge.store_conv_kgrid(convergence_context)[source]¶
Store the recommended kpoints from the convergence.
- aiida_vasp.workchains.converge.store_conv_pwcutoff(convergence_context)[source]¶
Store the recommended energy from the convergence.
Vasp immigrant workchain.
- class aiida_vasp.workchains.immigrant.VaspImmigrantWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
BaseRestartWorkChain
Import a VASP run executed in the directory specified by folder_path.
- init_inputs()[source]¶
Set inputs of VaspImmigrant calculation
Initial inputs (self.ctx.inputs) AttributeDict is obtained from VaspImmigrant.get_inputs_from_folder(), where the following items are already set in respective AiiDA data types,
code metadata[‘options’] parameters structure kpoints potential (optional) remote_workdir
Master workchain.
- class aiida_vasp.workchains.master.MasterWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
WorkChain
The master workchain that selects sub workchains to perform necessary calculations.
VASP NEB workchain.
- class aiida_vasp.workchains.neb.VaspNEBWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
BaseRestartWorkChain
The NEB workchain.
Deliberately conserves most of the interface (required inputs) of the VaspNEBCalculation class, but makes it possible for a user to interact with a workchain and not a calculation.
In addition, implement restarts of calculation when the calculation is net full converged for error handling.
- handle_unconverged(node)[source]¶
Handle the problem where the NEB optimization is not converged.
Note that VASP could reach NSW before the actual convergence. Hence this check is necessary even for finished runs.
- handle_unfinished(node)[source]¶
Handle the case where the calculations is not fully finished. This checks the existing of the run_stats field in the parsed per-image misc output
- aiida_vasp.workchains.neb.get_ldau_keys(structure, mapping, utype=2, jmapping=None, felec=False)[source]¶
Setup LDAU mapping. In VASP, the U for each species has to be defined in the order that they appear in POSCAR. This is a helper to make sure the values of U are associated to each specie
- Arguments:
structure: the structure, either StructureData or ase.Atoms is fine mapping: a dictionary in the format of {“Mn”: [d, 4]…} for U utype: the type of LDA+U, default to 2, which is the one with only one parameter jmapping: a dictionary in the format of {“Mn”: [d, 4]…} but for J felec: Wether we are dealing with f electrons, will increase lmaxmix if we are.
- Returns:
dict_update: a dictionary to be used to update the raw input parameters for VASP
Relax workchain.
parameters instead of the code dependent variables.
- class aiida_vasp.workchains.relax.RelaxWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
WorkChain
Structure relaxation workchain.
- analyze_convergence()[source]¶
Analyze the convergence of the relaxation.
Compare the input and output structures of the most recent relaxation run. If volume, shape and ion positions are all within a given threshold, consider the relaxation converged.
- check_positions_convergence(delta)[source]¶
Check the convergence of the atomic positions, given a cutoff.
- check_shape_convergence(delta)[source]¶
Check the difference in cell shape before / after the last iteration against a tolerance.
VASP workchain.
Below is a copy of the error handler logic from aiida-core.
If the process is excepted or killed, the work chain will abort. Otherwise any attached handlers will be called in order of their specified priority. If the process was failed and no handler returns a report indicating that the error was handled, it is considered an unhandled process failure and the process is relaunched. If this happens twice in a row, the work chain is aborted. In the case that at least one handler returned a report the following matrix determines the logic that is followed:
Process Handler Handler Action result report? exit code —————————————– Success yes == 0 Restart Success yes != 0 Abort Failed yes == 0 Restart Failed yes != 0 Abort
If no handler returned a report and the process finished successfully, the work chain’s work is considered done and it will move on to the next step that directly follows the while conditional, if there is one defined in the outline.
This means that for a handler:
No error found - just return None
- No action taken
the error is not recoverable - return with a non-zero error code with do break
the error is not recoverable, but other handler may/maynot save it - return with a non-zero code without do break
the error is not recoverable, and the workchain should be aborted immediately - non-zero code + do break
- Action taken
the error is fixed in full - return with a zero error code with do_break=True
the error is not fixed in full - return with a report with do_break=False but has a exit_code. this mean other handlers (with lower priority) must handle it and return a zero error_code.
- class aiida_vasp.workchains.vasp.VaspWorkChain(*args: Any, **kwargs: Any)[source]¶
Bases:
BaseRestartWorkChain
The VASP workchain.
Deliberately conserves most of the interface (required inputs) of the VaspCalculation class, but makes it possible for a user to interact with a workchain and not a calculation.
This is intended to be used instead of directly submitting a VaspCalculation, so that future features like automatic restarting, error checking etc. can be propagated to higher level workchains automatically by implementing them here.
Handlers are implemented to try fix common problems and improves the robustness. Individual handlers can be enabled/disabled by setting the
handler_overrides
input port. Additional settings may be passed under the “settings” input, which is also forwarded to the calculations. The available options are:USE_WAVECAR_FOR_RESTART
wether calculation restarts should use the WAVECAR. The default isTrue
.
Usage:
from aiida.common.extendeddicts import AttributeDict from aiida.work import submit basevasp = WorkflowFactory('vasp.vasp') inputs = basevasp.get_builder() inputs = AttributeDict() ## ... set inputs submit(basevasp, **inputs)
To see a working example, including generation of input nodes from scratch, please refer to
examples/run_vasp_lean.py
.- check_electronic_converged(node)[source]¶
Check if the calculation has converged electronic structure.
- handler_always_attach_outputs(node)[source]¶
Handle the case where we attach the outputs even if underlying child calculation ends up with some exit status.
- handler_calculation_did_not_run(node)[source]¶
Handle the case where the calculation is not performed
- handler_ionic_conv_enhanced(node)[source]¶
Enhanced handling of ionic relaxation problem beyond simple restarts.
This is only used when the calculation is having difficulties reaching the convergence. This handler should be applied before the standard handler which breaks the handling cycle.
- handler_misc_not_exist(node)[source]¶
Handle the case where misc output is not available, in which case we cannot do anything for it.
- handler_unfinished_calc_generic(node)[source]¶
A generic handler for unfinished calculations, we attempt to restart it once.
- handler_unfinished_calc_generic_alt(node)[source]¶
A generic handler for unfinished calculations, we attempt to restart it once.
- handler_unfinished_calc_ionic(node)[source]¶
Handled the problem such that the calculation is not finished, e.g. did not reach the end of execution.
If WAVECAR exists, just resubmit the calculation with the restart folder.
If it is a geometry optimization, attempt to restart with output structure + WAVECAR.
- handler_unfinished_calc_ionic_alt(node)[source]¶
Handled the problem such that the calculation is not finished, e.g. did not reach the end of execution.
If WAVECAR exists, just resubmit the calculation with the restart folder.
If it is a geometry optimization, attempt to restart with output structure + WAVECAR.
- ignore_nelm_breach_relax(node)[source]¶
Not a actual handler but works as a switch to bypass checks for NELM breaches in the middle of an ionic relaxation.
- init_inputs()[source]¶
Make sure all the required inputs are there and valid, create input dictionary for calculation.
- property is_noncollinear¶
Check if the calculation is a noncollinear one
- on_terminated()[source]¶
Clean the working directories of all child calculation jobs if clean_workdir=True in the inputs and the calculation is finished without problem.
- prepare_inputs()[source]¶
Enforce some settings for the restart folder and set parameters tags for a restart. This is called because launching the sub process.
NOTE: This method should probably be refactored to give more control on what kind of restart is needed
- setup()[source]¶
Initialize context variables that are used during the logical flow of the BaseRestartWorkChain.
- aiida_vasp.workchains.vasp.list_valid_objects_in_remote(remote, path='.', size_threshold=0) list [source]¶
List non-empty objects in the remote folder
- Parameters:
remote – The RemoteFolder node to be inspected.
path – The relative path.
size_threshold – The size threshold to treat the object as a valide one.
- Returns:
A list of valid objects in the directory.