aiida_vasp.workchains.v2.vasp#
VASP workchain.#
Contains the VaspWorkChain class definition which uses the BaseRestartWorkChain.
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.
Module Contents#
Classes#
The VASP workchain. |
Functions#
List non-empty objects in the remote folder |
API#
- class aiida_vasp.workchains.v2.vasp.VaspWorkChain(*args, **kwargs)[source]#
Bases:
aiida.engine.processes.workchains.restart.BaseRestartWorkChain,aiida_vasp.workchains.v2.mixins.WithBuilderUpdaterThe VASP workchain.
Error handling enriched wrapper around VaspCalculation.
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_overridesinput port. Additional settings may be passed under the “settings” input, which is also forwarded to the calculations. The available options are:USE_WAVECAR_FOR_RESTARTwether 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.Initialization
Construct the instance.
- _verbose = False#
- _process_class = 'CalculationFactory(...)'#
- _algo_switching = None#
- _init_parameters()[source]#
Collect input to the workchain in the converge namespace and put that into the parameters.
- 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
- update_magmom(node=None)[source]#
Update magmom from site magnetization information if available
- Parameters:
node – Calculation node to be used, defaults to the last launched calculation.
- 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.
- 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_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_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.
- handler_unfinished_calc_generic_alt(node)[source]#
A generic handler for unfinished calculations, we attempt to restart it once.
- handler_unfinished_calc_generic(node)[source]#
A generic handler for unfinished calculations, we attempt to restart it once.
- 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.
- check_electronic_converged(node)[source]#
Check if the calculation has converged electronic structure.
- 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.
- _calculation_sanity_checks(node)[source]#
Perform additional sanity checks on successfully completed calculation. This method acts invokes the ‘check’ handlers to check the calculations and abort the workchain if any problem is found. This is useful when all of the corresponding error handlers are disabled, and allow one to avoid the default behaviour of restarting the calculation one more times regardlessly with unhandled errors.
- aiida_vasp.workchains.v2.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.