aiida_vasp.utils.aiida_utils#

Utils for AiiDA.

Utilities for making working against AiiDA a bit easier. Mostly here due to historical reasons when AiiDA was rapidly developed. In the future most routines that have now standardized in AiiDA will be removed.

Module Contents#

Functions#

querybuild

Instantiates and returns a QueryBuilder instance.

get_data_class

Provide access to the orm.data classes with deferred dbenv loading.

get_current_user

Get current user.

copy_parameter

Assemble a new Dict.

displaced_structure

compressed_structure

displace_position

Displace a position in the StructureData.

compress_cell

Apply compression or tensile forces to the unit cell.

aiida_version

cmp_version

cmp_load_verdi_data

Load the verdi data click command group for any version since 0.11.

create_authinfo

Allow the current user to use the given computer.

cmp_get_authinfo

Get an existing authinfo or None for the given computer and current user.

cmp_get_transport

ensure_node_first_arg

Decorator to load a node if it is passed as a string.

ensure_node_kwargs

Decorator to load a node if it is passed as a key word argument ends with ‘node’.

convert_dict_case

Recursively convert the keys of a dictionary to lower or upper cases, returns a new dictionary.

Data#

API#

aiida_vasp.utils.aiida_utils.BASIC_DATA_TYPES: list[str] = ['core.bool', 'core.float', 'core.int', 'core.list', 'core.str', 'core.dict']#
aiida_vasp.utils.aiida_utils.querybuild(cls: type, **kwargs: Any) aiida.orm.QueryBuilder[source]#

Instantiates and returns a QueryBuilder instance.

The QueryBuilder’s path has one vertice so far, namely this class. Additional parameters (e.g. filters or a label), can be passes as keyword arguments.

Parameters:
  • label – Label to give

  • filters – filters to apply

  • project – projections

Returns:

a QueryBuilder instance.

aiida_vasp.utils.aiida_utils.get_data_class(data_type: str) type[source]#

Provide access to the orm.data classes with deferred dbenv loading.

aiida_vasp.utils.aiida_utils.get_current_user() aiida.orm.User[source]#

Get current user.

aiida_vasp.utils.aiida_utils.copy_parameter(old_parameter: aiida.orm.Dict) aiida.orm.Dict[source]#

Assemble a new Dict.

aiida_vasp.utils.aiida_utils.displaced_structure(structure: aiida.orm.StructureData, displacement: numpy.ndarray, entry: int) aiida.orm.StructureData[source]#
aiida_vasp.utils.aiida_utils.compressed_structure(structure: aiida.orm.StructureData, volume_change: float) aiida.orm.StructureData[source]#
aiida_vasp.utils.aiida_utils.displace_position(structure: aiida.orm.StructureData, displacement: numpy.ndarray, entry: int) None[source]#

Displace a position in the StructureData.

aiida_vasp.utils.aiida_utils.compress_cell(structure: aiida.orm.StructureData, volume_change: float) None[source]#

Apply compression or tensile forces to the unit cell.

aiida_vasp.utils.aiida_utils.aiida_version() packaging.version.Version[source]#
aiida_vasp.utils.aiida_utils.cmp_version(string: str) packaging.version.Version[source]#
aiida_vasp.utils.aiida_utils.cmp_load_verdi_data() Any[source]#

Load the verdi data click command group for any version since 0.11.

aiida_vasp.utils.aiida_utils.create_authinfo(computer: aiida.orm.Computer, store: bool = False) aiida.orm.AuthInfo[source]#

Allow the current user to use the given computer.

aiida_vasp.utils.aiida_utils.cmp_get_authinfo(computer: aiida.orm.Computer) aiida.orm.AuthInfo | None[source]#

Get an existing authinfo or None for the given computer and current user.

aiida_vasp.utils.aiida_utils.cmp_get_transport(computer: aiida.orm.Computer) Any[source]#
aiida_vasp.utils.aiida_utils.ensure_node_first_arg(func: Callable[..., Any]) Callable[..., Any][source]#

Decorator to load a node if it is passed as a string.

aiida_vasp.utils.aiida_utils.ensure_node_kwargs(func: Callable[..., Any]) Callable[..., Any][source]#

Decorator to load a node if it is passed as a key word argument ends with ‘node’.

aiida_vasp.utils.aiida_utils.convert_dict_case(dict_in: dict[str, Any], recursive: bool = True, warn: bool = False, lower: bool = True, raise_convert: bool = False) dict[str, Any][source]#

Recursively convert the keys of a dictionary to lower or upper cases, returns a new dictionary.

Parameters:
  • dict_in – The input dictionary whose keys need to be converted.

  • recursive – If True, the function will recursively convert keys in nested dictionaries.

  • warn – If True, the function will print a warning if a key is converted.

  • lower – If True, convert keys to lowercase; otherwise, convert to uppercase.

  • raise_convert – If True, raise an error if a key is converted.

Returns:

A new dictionary with keys converted to the specified case.