Loads a YAML file containing calculator settings. Used for VASP calculations
and can read quacc-formatted YAMLs that are of the following format:
inputs:
xc: pbe
algo: all
setups:
Cu: Cu_pv
elemental_magmoms:
Fe: 5
Cu: 1
where
inputs
is a dictionary of ASE-style input parameters,
setups
is a
dictionary of ASE-style pseudopotentials, and and
elemental_magmoms
is a
dictionary of element-wise initial magmoms.
Parameters:
-
yaml_path
(str | Path
)
–
Path to the YAML file. This function will look in the VASP_PRESET_DIR
(default: quacc/calculators/presets/vasp) for the file, thereby assuming
that yaml_path
is a relative path within that folder.
Returns:
-
dict
–
The calculator configuration (i.e. settings).
Source code in quacc/calculators/vasp/io.py
| def load_vasp_yaml_calc(yaml_path: str | Path) -> dict[str, Any]:
"""
Loads a YAML file containing calculator settings. Used for VASP calculations
and can read quacc-formatted YAMLs that are of the following format:
```yaml
inputs:
xc: pbe
algo: all
setups:
Cu: Cu_pv
elemental_magmoms:
Fe: 5
Cu: 1
```
where `inputs` is a dictionary of ASE-style input parameters, `setups` is a
dictionary of ASE-style pseudopotentials, and and `elemental_magmoms` is a
dictionary of element-wise initial magmoms.
Parameters
----------
yaml_path
Path to the YAML file. This function will look in the `VASP_PRESET_DIR`
(default: quacc/calculators/presets/vasp) for the file, thereby assuming
that `yaml_path` is a relative path within that folder.
Returns
-------
dict
The calculator configuration (i.e. settings).
"""
config = load_yaml_calc(yaml_path)
# Allow for either "Cu_pv" and "_pv" style setups
if "inputs" in config:
config["inputs"] = {
k.lower(): v.lower() if isinstance(v, str) else v
for k, v in config["inputs"].items()
}
for k, v in config["inputs"].get("setups", {}).items():
if k in v:
config["inputs"]["setups"][k] = v.split(k)[-1]
return config
|