aiida_vasp.workchains.v2.bands#

Bands workchain with a more flexible input TODO:

  • Add option to use alternative pathways obtained using sumo-interface

  • Improve the hybrid workchain by performing local dryrun to extract the full kpoints
    • If running SOC, the ISYM should be turned to 0 or -1.

Module Contents#

Classes#

VaspBandsWorkChain

Workchain for running bands calculations.

VaspHybridBandsWorkChain

Bands workchain for hybrid calculations

Functions#

seekpath_structure_analysis

Primitivize the structure with SeeKpath and generate the high symmetry k-point path through its Brillouin zone. This calcfunction will take a structure and pass it through SeeKpath to get the normalized 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. The keyword arguments can be used to specify various Seekpath parameters, such as:

compose_labelled_bands

Add additional information from the kpoints allow richer informations to be stored such as band structure labels.

get_primitive_strucrture_and_scf_kpoints

This function dryruns a VASP calculation using the primitive structure obtained by performing seekpath analyses

split_kpoints

Split the kpoints into multiple one and combined with SCF kpoints

_split_kpoints

Split the kpoints into multiple one and combined with SCF kpoints

dryrun_split_kpoints

Perform a “dryrun” for splitting the kpoints

combine_bands_data

Combine splitted bands and kpoints data

_combine_bands_data

Combine bands from splitted kpoints into a single bands node.

extract_kpoints_from_calc

Extract computed kpoints from a existing calculation

extract_kpoints_from_retrieved

Extract explicity kpoints from a finished calculation

_extract_kpoints_from_retrieved

Extract explicity kpoints from a finished calculation

_is_magnetic_via_site_moment

Data#

API#

aiida_vasp.workchains.v2.bands.SITE_MAG_THRESHOLD = 0#
aiida_vasp.workchains.v2.bands.logger = 'getLogger(...)'#
class aiida_vasp.workchains.v2.bands.VaspBandsWorkChain(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.ProtocolMixin

Workchain for running bands calculations.

This workchain does the following:

  1. Relax the structure if requested (eg. inputs passed to the relax namespace).

  2. Do a SCF singlepoint calculation.

  3. Do a non-scf calculation for bands and dos.

Inputs must be passed for the SCF calculation, others are optional. The dos calculation will only run if the kpoints for DOS are passed or a full specification is given under the dos input namesace.

The SCF calculation may be skipped by passing a CHGCAR file/remote folder. In which case the SCF inputs are carried on for non-scf calculations.

The band structure calculation will run unless only_dos is set to Bool(True).

For magnetic structures, the workchain will internally create additional species for the symmetry analysis and regenerate “undecorated” structures with corresponding initial magnetic moments. This works for both FM and AFM species. Care should be taken when the MAGMOM is obtained from site projected values in case of unexpected symmetry breaking.

Input for bands and dos calculations are optional. However, if they are needed, the full list of inputs must be passed. For the parameters node, one may choose to only specify those fields that need to be updated.

For optics calculations, one should run with only_dos, set ‘NBANDS’ to a high value and set ‘LOPTICS’ to be True.

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_wk_string = 'vasp.v2.vasp'#
_base_workchain = None#
_relax_wk_string = 'vasp.v2.relax'#
_relax_workchain = None#
_protocol_tag = 'band'#
option_class = None#
classmethod define(spec: Any) None[source]#

Initialise the WorkChain class

get_appended_label(suffix)[source]#

Return a label with appended suffix

classmethod get_builder_from_protocol(code: aiida.orm.AbstractCode, structure: aiida.orm.StructureData, protocol=None, run_relax=True, overrides=None, options=None, band_settings=None, **kwargs)[source]#
select_chgcar_from_inputs() None[source]#

Setup CHGCAR from inputs

setup() None[source]#

Setup the calculation

should_do_relax() bool[source]#

Wether we should do relax or not

run_relax() Any[source]#

Run the relaxation

verify_relax() Any[source]#

Verify the relaxation

should_run_scf() bool[source]#

Wether we should run SCF calculation

should_generate_path() bool[source]#

Seekpath should only run if no explicit bands is provided or we are just running for DOS, in which case the original structure is used.

generate_path() None[source]#

Run seekpath to obtain the primitive structure and bands

run_scf() None[source]#

Run the SCF calculation

verify_scf() Any[source]#

Inspect the SCF calculation

run_bands_dos() Any[source]#

Run the bands and the DOS calculations

inspect_bands_dos() Any[source]#

Inspect the bands and dos calculations

on_terminated() None[source]#

Clean the remote directories of all called childrens

aiida_vasp.workchains.v2.bands.seekpath_structure_analysis(structure: aiida.orm.StructureData, band_settings: aiida.orm.Dict) Any[source]#

Primitivize the structure with SeeKpath and generate the high symmetry k-point path through its Brillouin zone. This calcfunction will take a structure and pass it through SeeKpath to get the normalized 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. The keyword arguments can be used to specify various Seekpath parameters, such as:

  • with_time_reversal: True

  • reference_distance: 0.025

  • recipe: ‘hpkot’

  • threshold: 1e-07

  • symprec: 1e-05

  • angle_tolerance: -1.0

Note that exact parameters that are available and their defaults will depend on your Seekpath version.

aiida_vasp.workchains.v2.bands.compose_labelled_bands(bands: aiida.orm.BandsData, kpoints: aiida.orm.KpointsData) aiida.orm.BandsData[source]#

Add additional information from the kpoints allow richer informations to be stored such as band structure labels.

aiida_vasp.workchains.v2.bands.get_primitive_strucrture_and_scf_kpoints(structure: aiida.orm.StructureData) Any[source]#

This function dryruns a VASP calculation using the primitive structure obtained by performing seekpath analyses

The input StructureData should be returned by an VaspRelaxWorkChain which will be used for dryun using local VASP and getting the explicity kpoints for SCF calculation.

class aiida_vasp.workchains.v2.bands.VaspHybridBandsWorkChain(inputs: dict | None = None, logger: logging.Logger | None = None, runner: aiida.engine.runners.Runner | None = None, enable_persistence: bool = True)[source]#

Bases: aiida_vasp.workchains.v2.bands.VaspBandsWorkChain

Bands workchain for hybrid calculations

This workchain compute the bandstructure by adding band path segments as zero-weighted kpoints for self-consistent calculations. This is mainly for hybrid calculations, but can also be used for GGA calculations, although it would be not as efficient as the non-SCF method implemented in VaspBandsWorkChain.

In contrast to VaspBandsWorkChain this workflow requires and explicitly defined kpoints set for the scf.kpoints port. This can be obtained by parsing the IBZKPT file from and existing calculation or dryrun. Or by parsing the vasprun.xml file.

If a relaxation workchain is run as part of the process, the kpoints output returned can be used for this purpose automatically.

Only the scf namespace will be used for performing the calculation

TODO:
  • Warn if the calculation is not actually a hybrid one

  • Automatic Kpoints from dryruns

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

classmethod define(spec: Any) None[source]#

Initialise the WorkChain class

setup() None[source]#
no_scf_kpoints() bool[source]#

Check if the kpoints for SCF has NOT been set

get_scf_kpoints_relax() None[source]#

Try extract SCF kpoints from relaxation workchain

get_scf_kpoints_spglib() None[source]#

Generate SCF kpoints using spglib

make_splitted_kpoints() Any[source]#

Split the kpoints

should_do_scf_for_scf_kpoints() bool[source]#

Check if one should redo a SCF run to obtain the IBZKPT

run_scf_for_kpoints() Any[source]#

Run an SCF calculation to just obtain the kpoints for the current structure Ideally we should do this in a dryrun mode @ local machine

verify_scf_for_kpoints() Any[source]#

Inspect the SCF for kpoints calculation

run_scf_multi() Any[source]#

Launch multiple SCF calculations with zero-weighted kpoints for segments of the band structure

inspect_and_combine_bands() None[source]#

Inspect that all calculations have finished OK

aiida_vasp.workchains.v2.bands.split_kpoints(scf_kpoints: aiida.orm.KpointsData, band_kpoints: aiida.orm.KpointsData, kpn_per_split: aiida.orm.Int) Any[source]#

Split the kpoints into multiple one and combined with SCF kpoints

The kpoints for band structure calculation has zero weights

aiida_vasp.workchains.v2.bands._split_kpoints(scf_kpoints: aiida.orm.KpointsData, band_kpoints: aiida.orm.KpointsData, kpn_per_split: aiida.orm.Int) Any[source]#

Split the kpoints into multiple one and combined with SCF kpoints

The kpoints for band structure calculation has zero weights

aiida_vasp.workchains.v2.bands.dryrun_split_kpoints(structure: aiida.orm.StructureData, scf_kpoints: aiida.orm.KpointsData, kpn_per_split: aiida.orm.Int, kpoints_args: Any = None, verbose: bool = True) Any[source]#

Perform a “dryrun” for splitting the kpoints

aiida_vasp.workchains.v2.bands.combine_bands_data(bs_kpoints: aiida.orm.KpointsData, **kwargs: Any) aiida.orm.BandsData[source]#

Combine splitted bands and kpoints data

The inputs should be supplied as keyword arguments like band_001, kpoint_001 for the splitted kpoints and correspdonging bands data from each calculation. The bs_kpoints is the originally generated band structure path.

Returns a BandsData by combining the zero-weighted bands from each calculation.

aiida_vasp.workchains.v2.bands._combine_bands_data(bs_kpoints: aiida.orm.KpointsData, kpoints_list: List[aiida.orm.KpointsData], bands_list: List[aiida.orm.BandsData]) aiida.orm.BandsData[source]#

Combine bands from splitted kpoints into a single bands node.

The list of kpoints and bands must be sorted in the right order.

aiida_vasp.workchains.v2.bands.extract_kpoints_from_calc(calc: Any) Any[source]#

Extract computed kpoints from a existing calculation

aiida_vasp.workchains.v2.bands.extract_kpoints_from_retrieved(retrieved: aiida.orm.FolderData) aiida.orm.KpointsData[source]#

Extract explicity kpoints from a finished calculation

aiida_vasp.workchains.v2.bands._extract_kpoints_from_retrieved(retrieved: aiida.orm.FolderData) aiida.orm.KpointsData[source]#

Extract explicity kpoints from a finished calculation

aiida_vasp.workchains.v2.bands._is_magnetic_via_site_moment(mag: Any) bool[source]#