aiida_vasp.protocols.pmg#
Module for using pymatgen.io.vasp.sets based input sets.
This module provides compatibility layer with various pymatgen input sets. Note that materials project’s calculations are done via custodian and some parameters may be changed during the calculation process. The user should check carefully about their compatibility with calculation run through aiida-vasp.
Module Contents#
Classes#
Generating inputs using pymatgen.io.vasp.sets. |
Functions#
Convert a pymatgen Kpoints object to an AiiDA KpointsData object. |
API#
- class aiida_vasp.protocols.pmg.PymatgenInputAdaptor(set_name: str, incar_overrides: Optional[Dict] = None, verbose: Optional[bool] = None, pmg_kwargs: Optional[Dict] = None)[source]#
Generating inputs using pymatgen.io.vasp.sets.
Provides basic compatibility with pymatgen sets for generating VASP input parameters, k-point meshes, and pseudopotential mappings.
Initialization
Instantiate a PymatgenInputSet.
- Parameters:
set_name (str) – Name of the pymatgen input set to use
overrides (dict or None) – Dictionary of parameter overrides for the input set
verbose (bool or None) – If True, print additional information during processing
pmg_kwargs (dict or None) – A dictionary containing additional keyword arguments to pass to the pymatgen input set
- Raises:
AssertionError – If set_name is not in KNOWN_SETS
- KNOWN_SETS = ('MPRelaxSet', 'MITRelaxSet', 'MPScanRelaxSet', 'MP24RelaxSet', 'MPMetalRelaxSet', 'MPHSERelaxSet', ...#
- _load_data() None[source]#
Load the pymatgen input set class.
Dynamically imports and stores the pymatgen input set class based on set_name.
- Raises:
ImportError – If pymatgen is not installed or cannot be imported
- get_incar_dict(structure: aiida.orm.StructureData, raw_python: bool = True) Union[Dict, aiida.orm.Dict][source]#
Compute the input parameters for a VASP calculation using pymatgen.io.vasp.sets.
Generates INCAR parameters by instantiating the pymatgen input set with the given structure and applying any specified overrides. Removes certain parameters that conflict with aiida-vasp’s input validation.
- get_potential_mapping(structure: aiida.orm.StructureData) Dict[str, str][source]#
Get the pseudopotential mapping used by the input set.
Returns a dictionary mapping element symbols to their corresponding pseudopotential symbols as defined by the pymatgen input set.
- Parameters:
structure (orm.StructureData) – Crystal structure for the calculation
- Returns:
Dictionary mapping element names to pseudopotential symbols
- Return type:
- get_potential_family() str[source]#
Get the POTCAR family used by the input set.
Retrieves the pseudopotential functional family from the pymatgen input set configuration. Converts underscore notation to dot notation (e.g., PBE_54 becomes PBE.54) for aiida-vasp compatibility.
- Returns:
Name of the POTCAR family
- Return type:
- get_kpoints(structure: aiida.orm.StructureData) Optional[aiida.orm.KpointsData][source]#
Return a KpointsData object for the given structure.
Converts the k-point specification from the pymatgen input set to an aiida-vasp compatible KpointsData object. Supports Gamma-centered, Monkhorst-Pack, and automatic k-point generation modes.
- Parameters:
structure (orm.StructureData) – Crystal structure for k-point generation
- Returns:
K-points data object, or None if no k-points are specified
- Return type:
orm.KpointsData or None
- get_kpoints_spacing(structure: aiida.orm.StructureData) Optional[float][source]#
Get the k-point spacing used by the input set.
Extracts the KSPACING parameter from the pymatgen input set and converts it to the format expected by aiida-vasp (dividing by 2π).
- Parameters:
structure (orm.StructureData) – Crystal structure for the calculation
- Returns:
K-point spacing value or None if not specified
- Return type:
float or None
- aiida_vasp.protocols.pmg.pmg_kpoints2kpointsdata(pmg_kpoints, structure: aiida.orm.StructureData) aiida.orm.KpointsData[source]#
Convert a pymatgen Kpoints object to an AiiDA KpointsData object.
Handles conversion between different k-point generation modes: - Gamma-centered grids - Monkhorst-Pack grids (with appropriate shift corrections) - Automatic k-point generation based on spacing
- Parameters:
pmg_kpoints (pymatgen.io.vasp.inputs.Kpoints) – Pymatgen Kpoints object to convert
structure (orm.StructureData) – AiiDA structure data for setting the unit cell
- Returns:
Converted k-points data object
- Return type:
orm.KpointsData
- Raises:
ValueError – If the k-point style is not supported