aiida_vasp.calcs package¶
Submodules¶
Base calculation class.
- class aiida_vasp.calcs.base.VaspCalcBase(*args: Any, **kwargs: Any)[source]¶
Bases:
CalcJob
Base class of all calculations utilizing VASP.
Defines internal parameters common to all vasp calculations.
provides a basic, extendable implementation of _prepare_for_submission
provides hooks, so subclasses can extend the behavior without having to reimplement common functionality
- classmethod define(spec)[source]¶
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters:
spec – the calculation job process spec to define.
- classmethod max_retrieve_list()[source]¶
Return a list of all possible output objects from a VASP run.
- prepare_for_submission(folder)[source]¶
Writes the four minimum outputs: INCAR, POSCAR, POTCAR, KPOINTS.
Delegates the construction and writing / copying to write_<object> methods. That way, subclasses can use any form of input nodes and just have to implement the write_xxx method accordingly. Subclasses can extend by calling the super method and if necessary modifying it’s output CalcInfo before returning it.
- remote_copy_restart_folder()[source]¶
Add all objects required for restart to the list of objects to be copied from the previous calculation.
- store(*args, **kwargs)[source]¶
Adds a _prestore subclass hook for operations that should be done just before storing.
Immigrant calculation.
- class aiida_vasp.calcs.immigrant.VaspImmigrant(*args: Any, **kwargs: Any)[source]¶
Bases:
VaspCalculation
Parse VASP output objects stored in a specified directory.
Simulate running the VaspCalculation up to the point where it can be retrieved and parsed, then hand over control to the runner for the rest.
Usage examples¶
Immigrant calculation can be perfomed as follows.
code = Code.get_from_string('vasp@local') folder = '/home/username/vasp-calc-dir' settings = {'parser_settings': {'add_energies': True, 'add_forces': True, 'electronic_step_energies': True}} VaspImmigrant = CalculationFactory('vasp.immigrant') builder = VaspImmigrant.get_builder_from_folder(code, folder, settings=settings) submit(builder)
Instead of
builder
, inputs dict is obtained similarly ascode = Code.get_from_string('vasp@local') folder = '/home/username/vasp-calc-dir' settings = {'parser_settings': {'add_energies': True, 'add_forces': True, 'electronic_step_energies': True}} VaspImmigrant = CalculationFactory('vasp.immigrant') inputs = VaspImmigrant.get_inputs_from_folder(code, folder, settings=settings) submit(VaspImmigrant, **inputs)
Note¶
The defaul metadata is set automatically as follows:
{'options': {'max_wallclock_seconds': 1, 'resources': {'num_machines': 1, 'num_mpiprocs_per_machine': 1}}}
Specific scheduler may require setting
resources
differently (e.g., sge'parallel_env'
).get_inputs_from_folder
andget_builder_from_folder
accept several kwargs, see the docstring ofget_inputs_from_folder
.- classmethod define(spec)[source]¶
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters:
spec – the calculation job process spec to define.
- classmethod get_builder_from_folder(code, remote_workdir: str, **kwargs)[source]¶
Create an immigrant builder from a code and a remote path on the associated computer. See more details in the docstring of
get_inputs_from_folder
.
- classmethod get_inputs_from_folder(code, remote_workdir: str, **kwargs)[source]¶
Create inputs to launch immigrant from a code and a remote path on the associated computer.
If POTCAR does not exist, the provided
potential_family
andpotential_mapping
are used to link potential to inputs. In this case, at leastpotential_family
has to be provided. Unlesspotential_mapping
, this mapping is generated from structure, i.e.,potential_mapping = {element: element for element in structure.get_kind_names()}
- Parameters:
code – a Code instance for the code originally used.
remote_workdir – Directory or folder name where VASP inputs and outputs are stored.
settings – dict. This is used as the input port of VaspCalculation.
potential_family – str. This will be obsolete at v3.0.
potential_mapping – dict. This will be obsolete at v3.0.
use_wavecar – bool. Try to read WAVECAR.
:param use_chgcar bool. Try to read CHGCAR.
- run()[source]¶
Run the calculation job.
This means invoking the presubmit and storing the temporary folder in the node’s repository. Then we move the process in the Wait state, waiting for the UPLOAD transport task to be started.
- Returns:
the Stop command if a dry run, int if the process has an exit status, Wait command if the calcjob is to be uploaded
- aiida_vasp.calcs.immigrant.get_incar_input(dir_path)[source]¶
Create a node that contains the INCAR content.
- aiida_vasp.calcs.immigrant.get_kpoints_input(dir_path, structure=None)[source]¶
Create a node that contains the KPOINTS content.
- aiida_vasp.calcs.immigrant.get_poscar_input(dir_path)[source]¶
Create a node that contains the POSCAR content.
- aiida_vasp.calcs.immigrant.get_potcar_input(dir_path, structure=None, potential_family=None, potential_mapping=None)[source]¶
Read potentials from POTCAR or set it up from a structure.
Module for settings up NEB calculations
- class aiida_vasp.calcs.neb.VaspNEBCalculation(*args: Any, **kwargs: Any)[source]¶
Bases:
VaspCalculation
NEB calculations using VASP
folder names 00, 01, 02… N for N-1 number of images.
- Input frames should be placed under the
neb_images
input namespace as a dictionary like:: - {
‘image_00’: structure_1, ‘image_01’: structure_2 ….
}
Output of individual frames are placed in the corresponding namespace under the same convention.
- classmethod define(spec)[source]¶
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters:
spec – the calculation job process spec to define.
- prepare_for_submission(folder)[source]¶
Add all files to the list of files to be retrieved.
Notice that we here utilize both the retrieve batch of files, which are always stored after retrieval and the temporary retrieve list which is automatically cleared after parsing.
- remote_copy_restart_folder()[source]¶
Add all files required for restart to the list of files to be copied from the previous calculation.
For NEB calculations, the CHGCAR and WAVECAR needs to be copied for each of the actual images.
- Input frames should be placed under the
- aiida_vasp.calcs.neb.ensure_structure_data(structure: StructureData | CifData) StructureData [source]¶
Get the input structure as AiiDA StructureData.
This is required in order to support CifData as input as well.
- aiida_vasp.calcs.neb.image_folder_paths(image_folders, retrieve_names)[source]¶
Return a list of folders paths to be retrieved
VASP calculation.
- class aiida_vasp.calcs.vasp.VaspCalculation(*args: Any, **kwargs: Any)[source]¶
Bases:
VaspCalcBase
General-purpose VASP calculation.
Additional retrieve objects can be specified via the
settings['ADDITIONAL_RETRIEVE_TEMPORARY_LIST']
input. In addition, if you want to keep any objects after parsing, put them insettings['ADDITIONAL_RETRIEVE_LIST']
which is empty by default.Floating point precision for writing POSCAR objects can be adjusted using
settings['poscar_precision']
, default: 10The following assumes you are familiar with the AiiDA data structures and how to set up and run an AiiDA calculation in general.
Example usage:
from aiida.orm import CalculationFactory, DataFactory from aiida.work import submit proc = CalculationFactory('vasp.vasp').process() inputs = proc.get_inputs_template() inputs.parameter = <Dict with INCAR params> inputs.structure = <StructureData> inputs.kpoints = <KpointsData> inputs.settings = <Dict with parser settings etc.> inputs.potential = DataFactory('vasp.potcar').get_potcars_from_structure(structure, ...) inputs.code = <Code representing vasp on your cluster> submit(proc, **inputs)
Which is very similar to the workchain example.
Since we do not want the content parsers to know about the AiiDA infrastructure, i.e. processes etc. we have no access to the exit codes defined on the CalcJob. We thus have to deal with failures in parsing directly in the write calls here.
- classmethod define(spec)[source]¶
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters:
spec – the calculation job process spec to define.
- classmethod immigrant(code, remote_path, **kwargs)[source]¶
Returns VaspImmigrant class and associated inputs. This method will be obsolete at v3.0
- Parameters:
code – a Code instance for the code originally used.
remote_path – The directory on the code’s computer in which the simulation was run.
metadata – dict.
settings – dict. Used for non-default parsing instructions, etc.
potential_family – str.
potential_mapping – dict.
use_wavecar – bool. Try to read WAVECAR.
:param use_chgcar bool. Try to read CHGCAR.
- prepare_for_submission(folder)[source]¶
Add all objects to the list of objects to be retrieved.
Notice that we here utilize both the retrieve batch of objects, which are always stored after retrieval and the temporary retrieve list which is automatically cleared after parsing.
- verify_inputs()[source]¶
Hook to be extended by subclasses with checks for input nodes.
Is called once before submission.
- write_incar(dst, validate_tags=True)[source]¶
Write the INCAR.
Passes the parameters node (Dict) from to the INCAR parser for preparation and writes to dst.
- Parameters:
dst – absolute path of the object to write to
- write_kpoints(dst)[source]¶
Write the KPOINTS.
Passes the kpoints node (KpointsData) to the KPOINTS parser for preparation and writes to dst.
- Parameters:
dst – absolute path of the object to write to
- write_poscar(dst)[source]¶
Write the POSCAR.
Passes the structures node (StructureData) to the POSCAR parser for preparation and writes to dst.
- Parameters:
dst – absolute path of the object to write to
- aiida_vasp.calcs.vasp.ordered_unique_list(in_list)[source]¶
List unique elements in input list, in order of first occurrence.
- aiida_vasp.calcs.vasp.ordered_unique_symbols(structure)[source]¶
Return a list of ordered unique symbols in the structure
VASP to Wannier90 calculation.
- class aiida_vasp.calcs.vasp2w90.Vasp2w90Calculation(*args: Any, **kwargs: Any)[source]¶
Bases:
VaspCalculation
General purpose Calculation for using vasp with the vasp2wannier90 interface.
- classmethod define(spec)[source]¶
Define the process specification, including its inputs, outputs and known exit codes.
Ports are added to the metadata input namespace (inherited from the base Process), and a code input Port, a remote_folder output Port and retrieved folder output Port are added.
- Parameters:
spec – the calculation job process spec to define.
Utilities for Wannier90.