Converters

Wien2k Converter

class dft.converters.wien2k_converter.Wien2kConverter(filename, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', parproj_subgrp='dft_parproj_input', symmpar_subgrp='dft_symmpar_input', bands_subgrp='dft_bands_input', misc_subgrp='dft_misc_input', transp_subgrp='dft_transp_input', repacking=False)[source]

Bases: dft.converters.converter_tools.ConverterTools

Conversion from Wien2k output to an hdf5 file that can be used as input for the SumkDFT class.

__init__(filename, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', parproj_subgrp='dft_parproj_input', symmpar_subgrp='dft_symmpar_input', bands_subgrp='dft_bands_input', misc_subgrp='dft_misc_input', transp_subgrp='dft_transp_input', repacking=False)[source]

Initialise the class.

Parameters:

filename : string

Base name of DFT files.

hdf_filename : string, optional

Name of hdf5 archive to be created.

dft_subgrp : string, optional

Name of subgroup storing necessary DFT data.

symmcorr_subgrp : string, optional

Name of subgroup storing correlated-shell symmetry data.

parproj_subgrp : string, optional

Name of subgroup storing partial projector data.

symmpar_subgrp : string, optional

Name of subgroup storing partial-projector symmetry data.

bands_subgrp : string, optional

Name of subgroup storing band data.

misc_subgrp : string, optional

Name of subgroup storing miscellaneous DFT data.

transp_subgrp : string, optional

Name of subgroup storing transport data.

repacking : boolean, optional

Does the hdf5 archive need to be repacked to save space?

convert_bands_input()[source]

Reads the appropriate files and stores the data for the bands_subgrp in the hdf5 archive.

convert_dft_input()[source]

Reads the appropriate files and stores the data for the

  • dft_subgrp
  • symmcorr_subgrp
  • misc_subgrp

in the hdf5 archive.

convert_misc_input()[source]

Reads additional information on:

  • the band window from case.oubwin,
  • lattice parameters from case.struct,
  • symmetries from case.outputs,

if those Wien2k files are present and stores the data in the hdf5 archive. This function is automatically called by convert_dft_input.

convert_parproj_input()[source]

Reads the appropriate files and stores the data for the

  • parproj_subgrp
  • symmpar_subgrp

in the hdf5 archive.

convert_symmetry_input(orbits, symm_file, symm_subgrp, SO, SP)[source]

Reads and stores symmetrisation data from symm_file, which can be is case.sympar or case.symqmc.

Parameters:

orbits : list of dicts

This is either shells or corr_shells depending on whether the symmetry information is for correlated shells or partial projectors.

symm_file : string

Name of the file containing symmetry data. This is case.symqmc for correlated shells and case.sympar for partial projectors.

symm_subgrp : string, optional

Name of subgroup storing symmetry data.

SO : integer

Is spin-orbit coupling considered?

SP : integer

Is the system spin-polarised?

convert_transport_input()[source]

Reads the necessary information for transport calculations on:

  • the optical band window and the velocity matrix elements from case.pmat

and stores the data in the hdf5 archive.

H(k) Converter

class dft.converters.hk_converter.HkConverter(filename, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', repacking=False)[source]

Conversion from general H(k) file to an hdf5 file that can be used as input for the SumKDFT class.

__init__(filename, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', repacking=False)[source]

Initialise the class.

Parameters:

filename : string

Name of file containing the H(k) and other relevant data.

hdf_filename : string, optional

Name of hdf5 archive to be created.

dft_subgrp : string, optional

Name of subgroup storing necessary DFT data.

symmcorr_subgrp : string, optional

Name of subgroup storing correlated-shell symmetry data. The group is actually empty; it is just included for compatibility.

repacking : boolean, optional

Does the hdf5 archive need to be repacked to save space?

convert_dft_input(first_real_part_matrix=True, only_upper_triangle=False, weights_in_file=False)[source]

Reads the appropriate files and stores the data for the dft_subgrp in the hdf5 archive.

Parameters:

first_real_part_matrix : boolean, optional

Should all the real components for given k be read in first, followed by the imaginary parts?

only_upper_triangle : boolean, optional

Should only the upper triangular part of H(k) be read in?

weights_in_file : boolean, optional

Are the k-point weights to be read in?

Wannier90 Converter

class dft.converters.wannier90_converter.Wannier90Converter(seedname, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', repacking=False)[source]

Conversion from Wannier90 output to an hdf5 file that can be used as input for the SumkDFT class.

__init__(seedname, hdf_filename=None, dft_subgrp='dft_input', symmcorr_subgrp='dft_symmcorr_input', repacking=False)[source]

Initialise the class.

Parameters:

seedname : string

Base name of Wannier90 files

hdf_filename : string, optional

Name of hdf5 archive to be created

dft_subgrp : string, optional

Name of subgroup storing necessary DFT data

symmcorr_subgrp : string, optional

Name of subgroup storing correlated-shell symmetry data

repacking : boolean, optional

Does the hdf5 archive need to be repacked to save space?

convert_dft_input()[source]

Reads the appropriate files and stores the data for the

  • dft_subgrp
  • symmcorr_subgrp

in the hdf5 archive.

find_rot_mat(n_sh, sh_lst, sh_map, ham0)[source]

Method for finding the matrices that bring from local to global coordinate systems (and viceversa), based on the eigenvalues of H(R=0)

Parameters:

n_sh : integer

number of shells

sh_lst : list of shells-type dictionaries

contains the shells (could be correlated or not)

sh_map : list of integers

mapping between shells

ham0 : numpy.array of floats

local Hamiltonian matrix elements

Returns:

istatus : integer

if 0, something failed in the construction of the matrices

rot_mat : list of numpy.array

rotation matrix for each of the shell

fourier_ham(norb, h_of_r)[source]

Method for obtaining H(k) from H(R) via Fourier transform The R vectors and k-point mesh are read from global module variables

Parameters:

norb : integer

number of orbitals

h_of_r : list of numpy.array[norb,norb]

Hamiltonian H(R) in Wannier basis

Returns:

h_of_k : list of numpy.array[norb,norb]

transformed Hamiltonian H(k) in Wannier basis

kmesh_build(msize=None, mmode=0)[source]

Method for the generation of the k-point mesh. Right now it only supports the option for generating a full grid containing k=0,0,0.

Parameters:

msize : list of 3 integers

the dimensions of the mesh

mmode : integer

mesh generation mode (right now, only full grid available)

Returns:

nkpt : integer

total number of k-points in the mesh

k_mesh : numpy.array[nkpt,3] of floats

the coordinates of all k-points

wk : numpy.array[nkpt] of floats

the weight of each k-point

read_wannier90hr(hr_filename='wannier_hr.dat')[source]

Method for reading the seedname_hr.dat file produced by Wannier90 (http://wannier.org)

Parameters:

hr_filename : string

full name of the H(R) file produced by Wannier90 (usually seedname_hr.dat)

Returns:

nrpt : integer

number of R vectors found in the file

rvec_idx : numpy.array of integers

Miller indices of the R vectors

rvec_deg : numpy.array of floats

weight of the R vectors

num_wf : integer

number of Wannier functions found

h_of_r : list of numpy.array

<w_i|H(R)|w_j> = Hamilonian matrix elements in the Wannier basis

Converter Tools

class dft.converters.converter_tools.ConverterTools[source]
det_shell_equivalence(corr_shells)

Determine the equivalence of correlated shells.

Parameters:

corr_shells : list of dicts

See documentation of necessary hdf5 elements.

Returns:

n_inequiv_shells : integer

Number of inequivalent shells.

corr_to_inequiv : list

Mapping between correlated shell index and inequivalent shell index. corr_to_inequiv(i_corr_shells) = i_inequiv_shells

inequiv_to_corr : list

Mapping between inequivalent shell index and correlated shell index. inequiv_to_corr(i_inequiv_shells) = i_corr_shells

read_fortran_file(filename, to_replace)

Returns a generator that yields all numbers in the Fortran file as float, with possible replacements.

Parameters:

filename : string

Name of Fortran-produced file.

to_replace : dict of str:str

Dictionary defining old_char:new_char.

repack()

Calls the h5repack routine in order to reduce the file size of the hdf5 archive.