aiida_vasp.utils.pmg#

Tools for using the Pymatgen library with aiida-vasp.

Module Contents#

Classes#

PymatgenAdapator

Adaptor for getting pymatgen objects from a VASP calculation/workflow This work by first exporting the calculation to a temporary folder and then parsing the files using pymmatgen.

Functions#

temporary_folder

Get a temporary folder and delete it after use.

get_vasprun

Return the Vasprun object

get_outcar

Return the OUTCAR object

get_incar

Return the INCAR object

get_kpoints

Return the Kpoints object

get_ibzkpt

Return the Kpoints object using the IBZKPT file

convert_pymatgen_potcar_folder

Convert pymatgen potcar folder to a structure used by aiida-vasp

API#

aiida_vasp.utils.pmg.temporary_folder() Generator[pathlib.Path, None, None][source]#

Get a temporary folder and delete it after use.

class aiida_vasp.utils.pmg.PymatgenAdapator(node: aiida.orm.CalcJobNode, store_cache: bool = True)[source]#

Adaptor for getting pymatgen objects from a VASP calculation/workflow This work by first exporting the calculation to a temporary folder and then parsing the files using pymmatgen.

Some of the pymatgen objects does not have the from_dict method implemented as required by MSONable. Hence, they can only be reconstructed as a dictionary.

Initialization

Adaptor for getting pymatgen objects from a VASP calculation/workflow

FILES = None#
NO_RECONSTRUCT = ['vasprun', 'outcar', 'chgcar']#
_parse_full(file_names: Optional[List[str]] = None) None[source]#

Parse all files and save to the pmg_objects attribute The assumption is that exporting the calculation folder is the slowest part of the process.

export_files(dst: str | pathlib.Path) None[source]#

Export the VASP calculation files to a destination folder

_get_pmg_object(name: str) Any[source]#

Get a pymatgen object

  1. If we can find the object in parsed object , then just return it.

  2. If it is not already parsed, try to load the cache (stored in the extras)

  3. Otherwise, try to export and parse from the files explicitly. (slow)

Parameters:

name – Name of the object to get (e.g. ‘vasprun’, ‘outcar’, ‘poscar’, ‘incar’, ‘kpoints’, ‘ibzkpt’)

_get_pmg_dict(name: str) Dict[str, Any][source]#

Get a pymatgen object as a dictionary

_flush_cache() None[source]#

Close the adaptor and save the cache

__enter__() aiida_vasp.utils.pmg.PymatgenAdapator[source]#

Enter the adaptor

__exit__(*args, **kwargs) None[source]#
property vasprun: pymatgen.io.vasp.Vasprun#

Return the Vasprun object

property vasprun_dict: Dict[str, Any]#

Return the Vasprun object as dictionary (will trigger caching)

property outcar: pymatgen.io.vasp.Outcar#

Return the Outcar object

property outcar_dict: Dict[str, Any]#

Return the Outcar object as dictionary (will trigger caching)

property poscar: pymatgen.io.vasp.Poscar#

Return the Poscar object

property poscar_dict: Dict[str, Any]#

Return the Poscar object as dictionary (will trigger caching)

property incar: pymatgen.io.vasp.Incar#

Return the Incar object

property incar_dict: Dict[str, Any]#

Return the Incar object as dictionary

property kpoints: pymatgen.io.vasp.Kpoints#

Return the Kpoints object

property kpoints_dict: Dict[str, Any]#

Return the Kpoints object as dictionary

property ibzkpt: pymatgen.io.vasp.Kpoints#

Return the IBZKPT object

property ibzkpt_dict: Dict[str, Any]#

Return the IBZKPT object as dictionary

save_msonable(name: str, obj: Any) None[source]#

Save msonable object to the node extras

load_msonable(name: str) Any[source]#

Load msonable object from the node extras

aiida_vasp.utils.pmg.get_vasprun(node: Any, store_cache: bool = True) pymatgen.io.vasp.Vasprun[source]#

Return the Vasprun object

aiida_vasp.utils.pmg.get_outcar(node: Any, store_cache: bool = True) pymatgen.io.vasp.Outcar[source]#

Return the OUTCAR object

aiida_vasp.utils.pmg.get_incar(node: Any, store_cache: bool = True) pymatgen.io.vasp.Incar[source]#

Return the INCAR object

aiida_vasp.utils.pmg.get_kpoints(node: Any, store_cache: bool = True) pymatgen.io.vasp.Kpoints[source]#

Return the Kpoints object

aiida_vasp.utils.pmg.get_ibzkpt(node: Any, store_cache: bool = True) pymatgen.io.vasp.Kpoints[source]#

Return the Kpoints object using the IBZKPT file

aiida_vasp.utils.pmg.convert_pymatgen_potcar_folder(src: pathlib.Path | str, dst: pathlib.Path | str) None[source]#

Convert pymatgen potcar folder to a structure used by aiida-vasp

Parameters:
  • src – Path to the pymatgen potcar folder

  • dst – Path to the aiida-vasp potcar folder

Returns:

None