Usage
The UPFDict class is the heart of upf-tools. It is an ordered dictionary with a few extra functionalities.
- class UPFDict(version, filename=None, *args, **kwargs)
Class that contains all of the information of a UPF pseudopotential file.
Note that it will usually be more convenient to create a
UPFDictobject using the class methodUPFDict.from_upf(...)i.e.from upf_tools import UPFDict psp = UPFDict.from_upf("/path/to/file.upf")
instead of direct instantiation.
- Parameters:
- property filename: Path
The filename of the pseudopotential (including the path), protected to always be a
Path.
- classmethod from_str(string)
Create a
UPFDictobject from a string (typically the contents of a.upffile).- Return type:
- to_dat()
Generate a
.datfile from aUPFDictobject.These files contain projectors that
wannier90.xcan read.- Raises:
ValueError – The pseudopotential does not contain the pseudo-wavefunctions necessary to generate a
.datfile- Return type:
- Returns:
the contents of a
.datfile
- to_oncvpsp_input()
Extract the oncvpsp.x input file used to generate the pseudopotential.
- Return type:
ONCVPSPInput
- to_str()
Serialise this
UPFDictback to UPF text.Currently only UPF v2 (the modern XML format) is supported on write. Reading is unaffected; v1 files can still be loaded but not written back out.
- Raises:
NotImplementedError – if
versionis below 2.0.- Return type:
- Returns:
the UPF file contents as a string
- property version: Version
The UPF version of the pseudopotential file, protected to always be a
Version.