aiida_vasp.workchains.v2.relax#
Relaxation workchain for VASP
Unfortunately, VASP does not check the convergence criteria properly:
it only check either force or energy convergence between the last two iterations
relaxation is performed with constant basis set, so a final singlepoint calculation is necessary if cell is to be relaxed
no check for the convergence of the atomic positions
no check about the convergence of the cell volume
Hence we have to control it externally to make sure the structures are properly relaxed, and perform additional singlepoint calculation where necessary.
In addition, using this workchain, there is no need to set the IBRION, NSW, ISIF and ALGO tags explicitly, the action can be controlled using the relax_setting input port. This will be merged with the parameters and passed downstream to the VaspBaseWorkChain which will work out the correct combinations for the three.
CHANGELOG
0.2.1 - added hybrid_calc_bootstrap options 0.3.0 - make singpoint calculation reuse the restart_folder 0.3.1 - called processes now have link labels. Added customisable settings and options for the final relaxation.
Module Contents#
Classes#
Structure relaxation workchain. |
|
Relxation with multiple stages |
Functions#
Compare two StructreData objects A, B and return a delta (A - B) of the relevant properties. |
|
Get the step structure, but assume the positions are fractional |
|
Check if the tetrahedral method is used for BZ integration. |
|
Return the maximum value of an array of forces with size (N, 3) |
Data#
API#
- aiida_vasp.workchains.v2.relax.__version__ = '0.5.0'#
- class aiida_vasp.workchains.v2.relax.VaspRelaxWorkChain(inputs: dict | None = None, logger: logging.Logger | None = None, runner: aiida.engine.runners.Runner | None = None, enable_persistence: bool = True)[source]#
Bases:
aiida.engine.WorkChain,aiida_vasp.workchains.v2.mixins.WithBuilderUpdater,aiida_vasp.protocols.ProtocolMixinStructure relaxation workchain.
Initialization
Construct a WorkChain instance.
Construct the instance only if it is a sub class of WorkChain, otherwise raise InvalidOperation.
- Parameters:
inputs – work chain inputs
logger – aiida logger
runner – work chain runner
enable_persistence – whether to persist this work chain
- _base_workchain = 'WorkflowFactory(...)'#
- option_class = None#
- classmethod get_builder_from_protocol(code: aiida.orm.AbstractCode, structure: aiida.orm.StructureData, protocol=None, overrides=None, options=None, relax_settings=None, **kwargs)[source]#
Return a builder prepopulated with inputs selected according to the chosen protocol. :param code: the
Codeinstance configured for theabacus.abacusplugin. :param structure: theStructureDatainstance to use. :param protocol: protocol to use, if not specified, the default will be used. :param overrides: optional dictionary of inputs to override the defaults of the protocol. :param options: A dictionary of options that will be recursively set for themetadata.optionsinput of allthe
CalcJobsthat are nested in this work chain.- Returns:
a process builder instance with all inputs defined ready for launch.
- _check_input_parameters() None[source]#
Validate the input parameters and detect problems before running the workchain
- _init_relax_input_additions() aiida.common.extendeddicts.AttributeDict[source]#
Initialise the relax_additions field inside the context. It is a AttributeDict that contains the inputs that should be updated while performing the relaxation.
- verify_next_workchain() None | aiida.engine.ExitCode[source]#
Verify and inherit exit status from child workchains.
- verify_last_relax() None | aiida.engine.ExitCode[source]#
Verify and inherit exit status from the last relaxation
- analyze_convergence() None | aiida.engine.ExitCode[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_shape_convergence(delta: aiida.common.extendeddicts.AttributeDict) bool[source]#
Check the difference in cell shape before / after the last iteratio against a tolerance.
- check_volume_convergence(delta: aiida.common.extendeddicts.AttributeDict) bool[source]#
Check the convergence of the volume, given a cutoff.
- check_positions_convergence(delta: aiida.common.extendeddicts.AttributeDict) bool[source]#
Check the convergence of the atomic positions, given a cutoff.
- results() None | aiida.engine.ExitCode[source]#
Attach the remaining output results. This can either be the final static calculation or the last relaxation if the former is not needed.
As a final check - check if the maximum_force is lower than the predefined value.
- finalize() None[source]#
Finalize the workchain. Clean the remote working directories of the called calcjobs
- relax_option_class() aiida_vasp.utils.opthold.RelaxOptions#
Class for relax options
- aiida_vasp.workchains.v2.relax.compare_structures(structure_a: aiida.orm.StructureData, structure_b: aiida.orm.StructureData) aiida.common.extendeddicts.AttributeDict[source]#
Compare two StructreData objects A, B and return a delta (A - B) of the relevant properties.
- aiida_vasp.workchains.v2.relax.get_step_structure(traj: aiida.orm.TrajectoryData, step: int) aiida.orm.StructureData[source]#
Get the step structure, but assume the positions are fractional
- aiida_vasp.workchains.v2.relax.detect_tetrahedral_method(input_dict: dict) bool[source]#
Check if the tetrahedral method is used for BZ integration.
- class aiida_vasp.workchains.v2.relax.VaspMultiStageRelaxWorkChain(inputs: dict | None = None, logger: logging.Logger | None = None, runner: aiida.engine.runners.Runner | None = None, enable_persistence: bool = True)[source]#
Bases:
aiida.engine.WorkChain,aiida_vasp.workchains.v2.mixins.WithBuilderUpdaterRelxation with multiple stages
This workchain allows to run multiple stages of relaxation with different parameters, options and settings. The workchain takes a structure as input and runs a series of VaspRelaxWorkChain calculations, each with updated set of parameters, options and settings as specified in <name>_stages.
The output of the final workchain is exposed.
Example:
vasp_staged_relax = VaspMultiStageRelaxWorkChain.get_builder() vasp_staged_relax.structure = structure vasp_staged_relax.relax = <usual relax inputs> # Set ismear to 0 for the first stage, -5 for the second stage vasp_staged_relax.parameters_stages = { '0': {'incar': {'ismear': 0}}, '1': {'incar': {'ismear': 1, 'gga': 'pe', 'lhfcalc': True}}, } # Switch to RMM-DIIS for the second stage vasp_staged_relax.relax_settings_stages = { '1': {'algo': 'rd'}} # Include node in the second stage of the relaxation vasp_staged_relax.settings_stages = { '1': {'parser_settings': {'inlude_node': ['dos']}}, }
Note that the index starts from 0 - e.g. ‘0’ for the first stage, ‘1’ for the second stage, etc.
Initialization
Construct a WorkChain instance.
Construct the instance only if it is a sub class of WorkChain, otherwise raise InvalidOperation.
- Parameters:
inputs – work chain inputs
logger – aiida logger
runner – work chain runner
enable_persistence – whether to persist this work chain
- _base_workchain = None#