Hide code cell content
from aiida_vasp.utils.temp_profile import load_temp_profile
load_temp_profile()
Profile<uuid='24abc280613344e085bcda8dc7a0fb04' name='myprofile'>

Design principles#

The rest of the bundled workchain are designed to run VaspWorkChain as the basic unit of work. This means that they expect error-correction functionalities to be embedded in the VaspWorkChain so they doe not need to explicitly handle errors.

We use the expose_input and expose_outputs methods of the WorkChain class to expose the inputs and outputs of the VaspWorkChain.

For example, the inputs to the relax workchain looks like this:

VaspRelaxWorkChain
|
|- structure (StructureData of the input structure)
|- vasp (exposed VaspWorkChain inputs)
|- static_calc_settings (settings to override for the static calculation)
|- static_calc_options (options to override for the static calculation)
|- static_calc_parameters (parameters to override for the static calculation)
|- relax_settings (settings controlling the relaxation)
|- verbose

Where the inputs specific to the VaspWorkChain to be launched as nested inside the vasp namespace. For example, to set the parameters one can use do the following:

from aiida.plugins import WorkflowFactory
builder = WorkflowFactory('vasp.v2.relax').get_builder()
builder.vasp.parameters = Dict(dict={'incar': {'encut': 500, 'isif': 2, 'nsw': 5, 'potim': 0.01}})

while when using VaspWorkChain directly, one can use:

from aiida.plugins import WorkflowFactory
builder = WorkflowFactory('vasp.v2.vasp').get_builder()
builder.parameters = {'incar': {'encut': 500, 'isif': 2, 'nsw': 5, 'potim': 0.01}}  # This gets converted to a Dict automatically

The other options at the top level are specific to the workchain and are used to control its behavior.

The relax_settings input is a Dict that contains the settings for the relaxation. These settings are validated at the submission time using the pydantic library.

To see the available settings, one can use:

from aiida.plugins import WorkflowFactory
opt = WorkflowFactory('vasp.v2.relax').option_class
# opt.<tab> to see all available options
print(opt.aiida_description())
                             algo:  str        
                                    Default: The algorithm to use for relaxation
                    energy_cutoff:  Optional   
                                    Default: The cut off energy difference when the relaxation is stopped (e.g. EDIFF)
                     force_cutoff:  float      
                                    Default: The maximum force when the relaxation is stopped (e.g. EDIFFG)
                            steps:  int        
                                    Default: Number of relaxation steps to perform (eg. NSW)
                        positions:  bool       
                                    Default: If True, perform relaxation of the atomic positions
                            shape:  bool       
                                    Default: If True, perform relaxation of the cell shape
                           volume:  bool       
                                    Default: If True, perform relaxation of the cell volume
                   convergence_on:  bool       
                                    Default: If True, perform convergence checks within the workchain
             convergence_absolute:  bool       
                                    Default: If True, use absolute values where possible when performing convergence checks
       convergence_max_iterations:  int        
                                    Default: Maximum iterations for convergence checking
            convergence_positions:  float      
                                    Default: The cutoff value for the convergence check on positions in Angstram. A negative value by pass the check.
               convergence_volume:  float      
                                    Default: The cutoff value for the convergence check on volume between the two structures. A negative value by pass the check.
        convergence_shape_lengths:  float      
                                    Default: The cutoff value for the convergence check on the lengths of the unit cell vectors, between input and the outputs structure. A negative value by pass the check.
         convergence_shape_angles:  float      
                                    Default: The cutoff value for the convergence check on the angles of the unit cell vectors, between input and the outputs structure. A negative value by pass the check.
                 convergence_mode:  str        
                                    Default: Mode of the convergence check for positions. 'inout' for checking input/output structure, or 'last' to check only the change of the last step.
                            reuse:  bool       
                                    Default: Whether reuse the previous calculation by copying over the remote folder
                      clean_reuse:  bool       
                                    Default: Whether to perform a final cleaning of the reused calculations
                  keep_sp_workdir:  bool       
                                    Default: Whether to keep the workdir of the final singlepoint calculation
                          perform:  bool       
                                    Default: Do not perform any relaxation if set to 'False'
            hybrid_calc_bootstrap:  bool       
                                    Default: Whether to bootstrap hybrid calculation by performing standard DFT first
  hybrid_calc_bootstrap_wallclock:  int        
                                    Default: Wall time limit in second for the bootstrap calculation
               keep_magnetization:  bool       
                                    Default: Whether to keep magnetization from the previous calculation if possible

By default, every input to the workchain has to be specified in full before submission, this can be quiet tedious for daily calculation. To simplify the input, we have implemented the [BuilderUpdater] class that can automatically update the builder with default values. See this page for more information.

The user may write default values and store them in an YAML file to ensure consistent settings are used across multiple projects.

PS you can also print the input and output ports of the workchain using:

from aiida.plugins import WorkflowFactory
!verdi plugin list aiida.workflows vasp.v2.relax
Description:

    Structure relaxation workchain.

Inputs:
        relax_settings  Dict                    algo:  str
                                                Default: The algorithm to use for relaxation
                                                energy_cutoff:  Optional                                        Default:
                                                The cut off energy difference when the relaxation is stopped (e.g. EDIFF)
                                                force_cutoff:  float                                           Default: The
                                                maximum force when the relaxation is stopped (e.g. EDIFFG)
                                                steps:  int                                             Default: Number of
                                                relaxation steps to perform (eg. NSW)                         positions:
                                                bool                                            Default: If True, perform
                                                relaxation of the atomic positions                             shape:  bool
                                                Default: If True, perform relaxation of the cell shape
                                                volume:  bool                                            Default: If True,
                                                perform relaxation of the cell volume                    convergence_on:
                                                bool                                            Default: If True, perform
                                                convergence checks within the workchain              convergence_absolute:
                                                bool                                            Default: If True, use
                                                absolute values where possible when performing convergence checks
                                                convergence_max_iterations:  int
                                                Default: Maximum iterations for convergence checking
                                                convergence_positions:  float
                                                Default: The cutoff value for the convergence check on positions in
                                                Angstram. A negative value by pass the check.
                                                convergence_volume:  float
                                                Default: The cutoff value for the convergence check on volume between the
                                                two structures. A negative value by pass the check.
                                                convergence_shape_lengths:  float
                                                Default: The cutoff value for the convergence check on the lengths of the
                                                unit cell vectors, between input and the outputs structure. A negative
                                                value by pass the check.          convergence_shape_angles:  float
                                                Default: The cutoff value for the convergence check on the angles of the
                                                unit cell vectors, between input and the outputs structure. A negative
                                                value by pass the check.                  convergence_mode:  str
                                                Default: Mode of the convergence check for positions. 'inout' for checking
                                                input/output structure, or 'last' to check only the change of the last
                                                step.                             reuse:  bool
                                                Default: Whether reuse the previous calculation by copying over the remote
                                                folder                       clean_reuse:  bool
                                                Default: Whether to perform a final cleaning of the reused calculations
                                                keep_sp_workdir:  bool                                            Default:
                                                Whether to keep the workdir of the final singlepoint calculation
                                                perform:  bool                                            Default: Do not
                                                perform any relaxation if set to 'False'             hybrid_calc_bootstrap:
                                                bool                                            Default: Whether to
                                                bootstrap hybrid calculation by performing standard DFT first
                                                hybrid_calc_bootstrap_wallclock:  int
                                                Default: Wall time limit in second for the bootstrap calculation
                                                keep_magnetization:  bool
                                                Default: Whether to keep magnetization from the previous calculation if
                                                possible
             structure  StructureData, CifData
                  vasp  Data
              metadata
   static_calc_options  Dict, NoneType          The full options Dict to be used in the final static
                                                calculation.
static_calc_parameters  Dict, NoneType          The parameters (INCAR) to be used in the final static
                                                calculation.
  static_calc_settings  Dict, NoneType          The full settings Dict to be used in the final static
                                                calculation.
               verbose  Bool, NoneType          Increased verbosity.

Required inputs are displayed in bold red.

Outputs:
             misc  Dict               The output parameters containing smaller quantities that do not depend on
                                      system size.
            relax
    remote_folder  RemoteData         Input files necessary to run the process will be stored in this folder
                                      node.
        retrieved  FolderData         Files that are retrieved by the daemon will be stored in this node. By
                                      default the stdout and stderr of the scheduler will be added, but one can
                                      add more by specifying them in `CalcInfo.retrieve_list`.
           arrays  ArrayData          The output trajectory data.
            bands  BandsData          The output band structure.
     born_charges  ArrayData          The output {name} data.
           chgcar  ChargedensityData  The output charge density CHGCAR file.
      dielectrics  ArrayData          The output {name} data.
              dos  ArrayData          The output dos.
           dynmat  ArrayData          The output {name} data.
         energies  ArrayData          Energies of the calculation at each ionic/electronic step.
          hessian  ArrayData          The output {name} data.
          kpoints  KpointsData        The output k-points.
parallel_settings  Dict
       parameters  Dict               All input parameters including the default values.
       projectors  ArrayData          The projectors for the calculation.
     remote_stash  RemoteStashData    Contents of the `stash.source_list` option are stored in this remote folder
                                      after job completion.
        structure  StructureData      The output structure.
       trajectory  TrajectoryData     The output trajectory data.
          wavecar  WavefunData        The output plane wave coefficients file.

Required outputs are displayed in bold red.

Exit codes:

  0  The process finished successfully.
  0  the sun is shining
  1  The process has failed with an unspecified error.
  2  The process failed with legacy failure mode.
 10  The process returned an invalid output.
 11  The process did not register a required output.
300  the called workchain does not contain the necessary relaxed output
     structure
420  no called workchain detected
500  unknown error detected in the relax workchain
502  there was an error overriding the parameters
600  Ionic relaxation was not converged after the maximum number of iterations
     has been spent
601  The final singlepoint calculation has increased residual forces. This may
     be caused by electronic solver converging to a different solution. Care
     should be taken to investigate the results.

Exit codes that invalidate the cache are marked in bold red.