galore.formats module¶
-
galore.formats.
is_complete_dos
(pdos)[source]¶ Determine whether the object is a pymatgen CompleteDos object
-
galore.formats.
is_doscar
(filename)[source]¶ Determine whether file is a DOSCAR by checking fourth line
-
galore.formats.
is_gpw
(filename)[source]¶ Determine whether file is GPAW calculation by checking extension
-
galore.formats.
is_vasp_raman
(filename)[source]¶ Determine if file is raman-sc/vasp_raman.py data by checking header
-
galore.formats.
read_csv
(filename)[source]¶ Read a txt file containing frequencies and intensities
If input file contains three columns, the first column is ignored. (It is presumed to be a vibrational mode index.)
- Parameters
filename (str) – Path to data file
- Returns
n x 2 Numpy array of frequencies and intensities
-
galore.formats.
read_doscar
(filename='DOSCAR')[source]¶ Read an x, y series of frequencies and DOS from a VASP DOSCAR file
- Parameters
filename (str) – Path to DOSCAR file
- Returns
Tuple containing x values and y values as lists
- Return type
data (2-tuple)
-
galore.formats.
read_gpaw_pdos
(filename, npts=50001, width=0.001, ref='vbm')[source]¶ Read orbital-projected DOS from GPAW with minimal broadening.
This requires GPAW to be installed and on your PYTHONPATH!
- Parameters
filename (str) – Path to GPAW calculation file. This should be a .gpw file generated with
calc.write('myfilename.gpw')
.npts (int) – Number of DOS samples
width (float) – Gaussian broadening parameter applied by GPAW. Default is minimal so that broadening is dominated by choices in Galore. Beware that there is a strong interaction between this parameter and npts; with a small npts and small width, many energy levels will be missed from the DOS!
ref (str) – Reference energy for DOS. ‘vbm’ or ‘efermi’ are accepted for the valence-band maximum or the Fermi energy, respectively. VBM is determined from calculation eigenvalues and not DOS values. If set to None, raw values are used.
- Returns
- PDOS data formatted as nestled OrderedDict of:
{element: {‘energy’: energies, ‘s’: densities, ‘p’ … }
- Return type
pdos_data (OrderedDict)
-
galore.formats.
read_gpaw_totaldos
(filename, npts=50001, width=0.001, ref='vbm')[source]¶ Read total DOS from GPAW with minimal broadening
This requires GPAW to be installed and on your PYTHONPATH!
- Parameters
filename (str) – Path to GPAW calculation file. This should be a .gpw file generated with
calc.write('myfilename.gpw')
.npts (int) – Number of DOS samples
width (float) – Gaussian broadening parameter applied by GPAW. Default is minimal so that broadening is dominated by choices in Galore. Beware that there is a strong interaction between this parameter and npts; with a small npts and small width, many energy levels will be missed from the DOS!
ref (str) – Reference energy for DOS. ‘vbm’ or ‘efermi’ are accepted for the valence-band maximum or the Fermi energy, respectively. VBM is determined from calculation eigenvalues and not DOS values. If set to None, raw values are used.
- Returns
2D array of energy and DOS values
- Return type
data (np.ndarray)
-
galore.formats.
read_pdos_txt
(filename, abs_values=True)[source]¶ Read a text file containing projected density-of-states (PDOS) data
The first row should be a header identifying the orbitals, e.g. “# Energy s p d f”. The following rows contain the corresponding energy and DOS values. Spin channels indicated by (up) or (down) suffixes will be combined.
- Parameters
filename (str) – Path to file for import
abs_values (bool, optional) – Convert intensity values to absolute numbers. This is primarily for compatibility with spin-polarised .dat files from Sumo. Set to False if negative values in spectrum are resonable.
- Returns
- Numpy structured array with named columns
corresponding to input data format.
- Return type
data (np.ndarray)
-
galore.formats.
read_txt
(filename, delimiter=None)[source]¶ Read a txt file containing frequencies and intensities
If input file contains three columns, the first column is ignored. (It is presumed to be a vibrational mode index.)
- Parameters
filename (str) – Path to data file
- Returns
n x 2 Numpy array of frequencies and intensities
-
galore.formats.
read_vasp_raman
(filename='vasp_raman.dat')[source]¶ Read output file from Vasp raman simulation
- Parameters
filename (str) – Path to formatted data file generated by https://github.com/raman-sc/VASP - Raman intensities are computed by following vibrational modes and calculating polarisability. The generated output file is named vasp_raman.dat but can be renamed if desired. The format is five space-separated columns, headed by
# mode freq(cm-1) alpha beta2 activity
.- Returns
Only the columns corresponding to frequency and activity are retained.
- Return type
2-D np.array
-
galore.formats.
read_vasprun
(filename='vasprun.xml')[source]¶ Read a VASP vasprun.xml file to obtain the density of states
Pymatgen must be present on the system to use this method
- Parameters
filename (str) – Path to vasprun.xml file
- Returns
A pymatgen Dos object
- Return type
data (pymatgen.electronic_structure.dos.Dos)
-
galore.formats.
read_vasprun_pdos
(filename='vasprun.xml')[source]¶ Read a vasprun.xml containing projected density-of-states (PDOS) data
Pymatgen must be present on the system to use this method
- Parameters
filename (str or CompleteDos) – Path to vasprun.xml file or pymatgen CompleteDos object.
- Returns
- PDOS data formatted as nestled OrderedDict of:
{element: {‘energy’: energies, ‘s’: densities, ‘p’ … }
- Return type
pdos_data (np.ndarray)
-
galore.formats.
read_vasprun_totaldos
(filename='vasprun.xml')[source]¶ Read an x, y series of energies and DOS from a VASP vasprun.xml file
Pymatgen must be present on the system to use this method
- Parameters
filename (str) – Path to vasprun.xml file
- Returns
2D array of energy and DOS values
- Return type
data (np.ndarray)
-
galore.formats.
write_csv
(x_values, y_values, filename='galore_output.csv', header=None)[source]¶ Write output to a simple space-delimited file
- Parameters
x_values (iterable) – Values to print in first column
y_value (iterable) – Values to print in second column
filename (str) – Path to output file, including extension. If None, write to standard output instead.
header (iterable) – Additional line to prepend to file. If None, no header is used.
-
galore.formats.
write_pdos
(pdos_data, filename=None, filetype='txt', flipx=False)[source]¶ Write PDOS or XPS data to CSV file
- Parameters
pdos_data (dict) –
Data for pdos plot in format:
{'el1': {'energy': values, 's': values, 'p': values ...}, 'el2': {'energy': values, 's': values, ...}, ...}
where DOS values are 1D numpy arrays. For deterministic output, use ordered dictionaries!
filename (str or None) – Filename for output. If None, write to stdout
filetype (str) – Format for output; “csv” or “txt.
flipx (bool) – Negate the x-axis (i.e. energy) values to make binding energies
-
galore.formats.
write_txt
(x_values, y_values, filename='galore_output.txt', header=None)[source]¶ Write output to a simple space-delimited file
- Parameters
x_values (iterable) – Values to print in first column
y_value (iterable) – Values to print in second column
filename (str) – Path to output file, including extension. If None, write to standard output instead.
header (str) – Additional line to prepend to file. If None, no header is used.