spinWannier.wannier_utils

spinWannier.wannier_utils#

Utility functions for the spinWannier package.

Functions

S_xyz_expectation_values(eigvecs)

For a k-space Hamiltonian Hk (function of kx and ky), calculate the eigen-energies and expectation values of spin Sx, Sy, Sz, at all the k-points in 'kpoints'.

W_gauge_to_H_gauge(O_mn_k_W[, U_mn_k, ...])

Transform from Wannier gauge to Hamiltonian gauge, i.e., for every k-point either diagonalize Hamiltonian

band_with_spin_projection_under_threshold_for_kpoint([...])

Return the lowest band with the spin projection below the threshold for 'kpoint'.

check_file_exists(file_name)

Check if file exists. If yes, add him a number in parentheses that does not exist.

coerce_R_vectors_to_basic_supercell([R_tr, ...])

wannier90_hr.dat has sometimes the R vectors shifted (probably to facilitate the 'minimal replice' interpolation.

coerce_to_positive_angles(angles)

Coerce angles to be positive (i.e., in the range [0, 2pi]).

convert_wann_TB_model_for_QuT([folder_in, ...])

Convert the outputs of my wannier to TB to Joaquin's code.

dict_to_matrix(data_dict, num_wann[, spin_index])

Convert hr or spn dictionary to a matrix accepted by wannierBerri: first index is m, second n, third is the index of an R_vector from iRvec list.

eigenval_dict([eigenval_file, win_file])

Return the eigenvalues as a dictionary with the keys being the k-point tuples.

eigenval_for_kpoint([kpoint, band, ...])

Return the eigenvalue at 'kpoint' and 'band'.

fermi_surface_spin_texture(kpoints2D, ...[, ...])

Plot scatter points with a spin texture on a constant energy xy surface (probably at E=EF) if the energy difference of each given point is lower than some threshold.

files_wann90_to_dict_pickle([model_dir, ...])

Convert wannier90 files to pickled dictionaries files.

get_2D_kpoint_mesh(G[, limits, Nk])

Get a 2D mesh of k-points in the reciprocal space.

get_DFT_kgrid([fin])

Get the 'mp_grid' from wannier90.win file which tells the k-grid used in the DFT calculation.

get_kpoint_names([fwin])

Parse wannier90.win file to get k-point names as a list of tuples.

get_kpoint_path(kpoint_matrix, G, Nk)

Interpolate between kpoints in the kpoint_matrix to obtain a k-point path with Nk points in each segment.

get_skiprows_hr_dat([fin])

Get the number of skiprows in wannier90_hr.dat file.

hr_wann90_to_dict([fin_wannier90])

Convert wannier90 hr.dat to dictionary in the form that we are using: R vectors as keys and hopping as a complex number matrix as the values.

interpolate_operator(operator_dict, ...[, ...])

Takes operator O (Hamiltonian, spin-operator ...) evaluated on a coarse DFT k-mesh and Hamiltonian eigenstates onto 'kpoints' using the

load_dict([fin, text_file])

If not text_file, than it's binary.

load_eigenvals([eigenval_file])

Parse the wannier90 .eig file to get the k-point and band-resolved eigenvalues.

load_lattice_vectors([win_file])

Return a 3x3 matrix where 1st row is the 1st lattice vector etc.

magmom_OOP_or_IP(INCAR_path)

Return True if MAGMOM in INCAR_path lies purely OOP, else return False.

magmom_direction(INCAR_path)

Return 0 / 1 / 2 if spin is along x / y / z direction, respectively.

material_name_to_latex(material)

Convert the material name to LaTeX format.

matrix_to_dict(data_matrix, Rvecs[, ...])

Convert data matrix (e.g. the Ham_R or SS_R file from symmetrization) into a dictionary with

operator_exp_values(eigvecs, Operator)

Return the expectation values of Operator (an N x N matrix, where N is the size of the eigenvectors) for all eigenvectors.

outer(s, M)

Outer product between a 2x2 spin matrix and a general orbital nxn M matrix, so that the spin blocks are the big blocks.

outer2(s, M)

Works for s matrix of any dimension, but slower than 'outer(s, M)' Outer product between a nxn spin matrix and a general orbital nxn M matrix, so that the spin blocks are the big blocks.

parse_KPOINTS_file(KPOINTS_file_path)

Parse the KPOINTS file.

plot_bands_spin_texture(kpoints, kpath, ...)

Output a figure with Sx, Sy, and Sz-projected band structure.

read_PROCAR_lines_for_kpoint([kpoint, ...])

Get the section of PROCAR belonging to the first occurence of 'kpoint' in PROCAR_file.

real_space_grid_from_hr_dat([fname])

Get the real-space grid from the seedname_hr.dat file.

real_to_W_gauge(kpoints, O_mn_R_W)

Perform inverse Fourier transformation from real-space operator to k-space in Wannier gauge.

reciprocal_lattice_vectors(...)

Return the reciprocal lattice vectors from the real-space lattice vectors.

replace_middle_of_cmap_with_custom_color([...])

Replace the middle of the colormap with a custom color.

save_bands_and_spin_texture(kpoints_rec, ...)

Save the bands and spin texture information for given kpoints.

save_bands_and_spin_texture_old(kpoints_rec, ...)

Save the bands and spin texture information for given kpoints.

selected_band_plot([band])

split_spn_dict(spn_dict[, spin_names])

Split dictionary with keys as ((Rx, Ry, Rz), spin_component_name) to three dictionaries

spn_to_dict([model_dir, fwin, fin, ...])

Convert wannier90.spn file to a dictionary object and save as pickle.

u_to_dict([fin, fout, text_file, write_sparse])

Convert _u.mat from wannier90 to pickled python dictionary.

uniform_real_space_grid([R_mesh_ijk])

From the maxima in each direction, make a regular mesh

unite_spn_dict(spn_x_dict, spn_y_dict, ...)

Unite dictionary with keys as (Rx, Ry, Rz) to three dictionaries

wannier_energy_windows(wann_bands_lims[, ...])

Get energy window limits for wannierization.