File¶
- class py4vasp.raw.File(filename=None)¶
Bases:
contextlib.AbstractContextManager
Extract raw data from the HDF5 file.
This class opens a given HDF5 file and its functions then provide access to the raw data via dataclasses. When you request the dataclass for a certain quantity, this class will generate the necessary pointers to the relevant HDF5 datasets, which can then be accessed like numpy arrays.
This class also extends a context manager so it can be used to automatically deal with closing the HDF5 file. You cannot access the data in the dataclasses after you closed the HDF5 file.
- Parameters
filename (str or Path) – Name of the file from which the data is read (defaults to default_filename).
Notes
Except for scalars this class does not actually load the data from file. It only creates a pointer to the correct position in the HDF5 file. So you need to extract the data before closing the file. This lazy loading significantly enhances the performance if you are only interested in a subset of the data.
Attributes Summary
Read all the band structures generated by Vasp.
Read the Born effective charges from a linear response calculation.
Read all the unit cell information of the crystal.
Name of the HDF5 file Vasp creates.
Read the charge and potentially magnetization density.
Read the dielectric functions.
Read the dielectric tensor from a linear response calculation.
Read all the electronic density of states (Dos) information.
Read the elastic modulus from a linear response calculation.
Read all the energies during the ionic convergence.
Read the forces for all ionic steps.
Read the force constants from a linear response calculation.
Read the internal strain from a linear response calculation.
Read all the k points at which Vasp evaluated the orbitals and eigenvalues.
Read all the magnetization data of the crystal.
Read the piezoelectric tensor from a linear response calculation.
Read the electronic and ionic dipole moments from a linear response calculation.
Read all the information about projectors if present.
Read the stress for all ionic steps.
Read all the structural information.
Read the system tag provided in the INCAR file.
Read all the topology data used in the Vasp calculation.
Read the version number of Vasp.
Methods Summary
close
()Close the associated HDF5 file (automatically if used as context manager).
Attributes Documentation
- band¶
Read all the band structures generated by Vasp.
- Returns
The key of the dictionary specifies the kind of the band structure. The value contains the raw electronic eigenvalues at the specific k points. These values need to be manually aligned to the Fermi energy if desired. If available the projections on a set of projectors are included.
- Return type
- born_effective_charge¶
Read the Born effective charges from a linear response calculation.
- Returns
The key identifies the nature of the Born effective charges, the value provides the raw data and structural information.
- Return type
DataDict[str, RawBornEffectiveCharges]
- cell¶
Read all the unit cell information of the crystal.
- default_filename = 'vaspout.h5'¶
Name of the HDF5 file Vasp creates.
- density¶
Read the charge and potentially magnetization density.
- Returns
The key informs about the kind of density reported. The value represents the density on the Fourier grid in the unit cell. Structural information is added for convenient plotting.
- Return type
DataDict[str, RawDensity]
- dielectric_function¶
Read the dielectric functions.
- Returns
The key specifies, which dielectric function is contained. The value represents the energy-resolved dielectric tensor.
- Return type
- dielectric_tensor¶
Read the dielectric tensor from a linear response calculation.
- Returns
The key specifies which dielectric tensor is contained. The value describes the contributions to the dielectric tensor and the generating methodology.
- Return type
DataDict[str, RawDielectricTensor]
- dos¶
Read all the electronic density of states (Dos) information.
- Returns
The key of the dictionary specifies the kind of the Dos. The value contains list of energies E and the associated raw electronic Dos D(E). The energies need to be manually shifted to the Fermi energy. If available, the projections on a set of projectors are included.
- Return type
- elastic_modulus¶
Read the elastic modulus from a linear response calculation.
- Returns
The key identifies the source of the elastic modulus, the value provides the raw data for relaxed ion and clamped ion elastic modulus.
- Return type
DataDict[str, RawElasticModulus]
- energy¶
Read all the energies during the ionic convergence.
- force¶
Read the forces for all ionic steps.
- force_constant¶
Read the force constants from a linear response calculation.
- Returns
The key specifies how the force constants are obtained. The value represents information about the structure and the force constants matrix.
- Return type
DataDict[str, RawForceConstant]
- internal_strain¶
Read the internal strain from a linear response calculation.
- Returns
The key identifies the source of the internal strain, the value provides the raw data and structural information.
- Return type
DataDict[str, RawInternalStrain]
- kpoint¶
Read all the k points at which Vasp evaluated the orbitals and eigenvalues.
- Returns
The key of the dictionary specifies the kind of the k point grid. For the value, the coordinates of the k points and the cell information is returned. Added is some information given in the input file about the generation and labels of the k points, which may be useful for band structures.
- Return type
- magnetism¶
Read all the magnetization data of the crystal.
- Returns
The key specifies the kind of magnetization data and the value containes the magnetic moments and charges on every atom in orbital resolved representation. Structural information is added for convenient plotting.
- Return type
DataDict[str, RawMagnetism]
- path¶
- piezoelectric_tensor¶
Read the piezoelectric tensor from a linear response calculation.
- Returns
The key identifies the source of the piezoelectric tensor, the value provides the raw data for electronic and ionic contribution to the piezoelectric tensor.
- Return type
- polarization¶
Read the electronic and ionic dipole moments from a linear response calculation.
- Returns
The key identifies the source of the polarization, the value provides the raw data for electronic and ionic contribution to the dipole moment.
- Return type
DataDict[str, RawPolarization]
- projector¶
Read all the information about projectors if present.
- Returns
If Vasp was set to produce the orbital decomposition of the bands the associated projector information is returned. The key specifies which kind of projectors are returned, the value lists the topology, the orbital types and the number of spins.
- Return type
DataDict[str, RawProjector or None]
- stress¶
Read the stress for all ionic steps.
- structure¶
Read all the structural information.
- Returns
The key of the dictionary specifies the kind of the structure. The value contains the unit cell and the position of all the atoms.
- Return type
DataDict[str, RawStructure]
- system¶
Read the system tag provided in the INCAR file.
- topology¶
Read all the topology data used in the Vasp calculation.
- Returns
The key of the dictionary contains information about the kind of the topology. The value contains the information which ion types were used and how many ions of each type there are.
- Return type
DataDict[str, RawTopology]
- version¶
Read the version number of Vasp.
- Returns
The major, minor, and patch number of Vasp.
- Return type
Methods Documentation
- close()¶
Close the associated HDF5 file (automatically if used as context manager).