Octopus
wannier_calc_oct_m Module Reference

Wannier90 related calculations. More...

Detailed Description

Wannier90 related calculations.

Data Types

type  wannier_calc_proj_t
 Mocks the projection type from wannier90. More...
 

Functions/Subroutines

subroutine, public wannier_calc_load_restart (namespace, mc, space, st, gr, kpoints, restart_states)
 Load Octopus restart data from disk. More...
 
subroutine, public wannier_calc_create_amn (wan_opts, band_index, space, mesh, latt, st, kpoints, spin_channel, num_proj, proj_input, projection)
 Calculation of Wannier90 Projection Matrix. More...
 
subroutine, public wannier_calc_create_mmn (band_index, mesh, st, latt, spin_channel, nnlist, nncell, overlap)
 Kohn-Sham State Overlap Matrix. More...
 
subroutine, public wannier_calc_read_centers (wan_opts, centers)
 Read wannier centers. More...
 
subroutine, public wannier_calc_read_u_matrices (wan_opts, kpoints, u_matrix, u_dis_matrix)
 Read wannier transformation matrix. More...
 
subroutine wannier_calc_get_header (header_start, header)
 Build a file header containing the current date and time. More...
 
subroutine, public wannier_calc_write_centers (dir, prefix, centers, ions)
 Write wannier centers to file. More...
 
subroutine, public wannier_calc_write_u_matrices (dir, prefix, kpoints, u_matrix, u_dis_matrix)
 Write U and U_dis matrices to file. More...
 
subroutine, public wannier_calc_write_spreads (dir, prefix, spreads)
 Write wannier spreads to file. More...
 
subroutine, public wannier_calc_write_hr_file (dir, prefix, irvec, ndegen, ham_r)
 Write H(R) in the Wannier basis to a _hr.dat file. More...
 
logical function wannier_calc_r_in_wigner_seitz_cell (rvec, real_metric, mp_grid, ws_search_size, ws_distance_tol, ndegen)
 Check whether a lattice point lies in the Wigner-Seitz cell of the superlattice. More...
 
subroutine, public wannier_calc_wigner_seitz_count (real_lattice, mp_grid, ws_search_size, ws_distance_tol, nrpts)
 Count the number of R-points in the Wigner-Seitz cell. More...
 
subroutine, public wannier_calc_wigner_seitz_fill (real_lattice, mp_grid, ws_search_size, ws_distance_tol, nrpts, irvec, ndegen)
 Calculate coordinates and degeneracies of R-points in the Wigner-Seitz cell. More...
 
subroutine, public wannier_calc_update_phase (band_index, st, dt, phase)
 Accumulate the phase picked up by the KS states in TD run. More...
 
subroutine, public wannier_calc_compute_ham_r (namespace, mesh, st, hm, kpoints, wannier_opts, u_matrix, irvec, ham_r)
 Compute the time-dependent Hamiltonian in the Wannier basis in real space. More...
 

Function/Subroutine Documentation

◆ wannier_calc_load_restart()

subroutine, public wannier_calc_oct_m::wannier_calc_load_restart ( type(namespace_t), intent(in)  namespace,
type(multicomm_t), intent(in)  mc,
class(space_t), intent(inout)  space,
type(states_elec_t), intent(inout)  st,
class(mesh_t), intent(inout)  gr,
type(kpoints_t), intent(inout)  kpoints,
integer, intent(in), optional  restart_states 
)

Load Octopus restart data from disk.

Note
Based on wannier90_output in wannier90_interface.F09

Definition at line 192 of file wannier_calc.F90.

◆ wannier_calc_create_amn()

subroutine, public wannier_calc_oct_m::wannier_calc_create_amn ( type(wannier_opts_t), intent(in)  wan_opts,
integer, dimension(:), intent(in), contiguous  band_index,
class(space_t), intent(in)  space,
class(mesh_t), intent(in)  mesh,
type(lattice_vectors_t), intent(in)  latt,
type(states_elec_t), intent(in)  st,
type(kpoints_t), intent(in)  kpoints,
integer, intent(in)  spin_channel,
integer, intent(in)  num_proj,
type(wannier_calc_proj_t), dimension(:), intent(in), contiguous  proj_input,
complex(real64), dimension(:, :, :), intent(out), contiguous  projection 
)

Calculation of Wannier90 Projection Matrix.

The projection matrix is what is stored in the .amn in the traditional workflow. It contains the projections of the Kohn_Sham states with the chosen initial guess for the wannierization.

Definition at line 244 of file wannier_calc.F90.

◆ wannier_calc_create_mmn()

subroutine, public wannier_calc_oct_m::wannier_calc_create_mmn ( integer, dimension(:), intent(in), contiguous  band_index,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(in), target  st,
type(lattice_vectors_t), intent(in)  latt,
integer, intent(in)  spin_channel,
integer, dimension(:,:), intent(in), contiguous  nnlist,
integer, dimension(:,:,:), intent(in), contiguous  nncell,
complex(real64), dimension(:, :, :, :), intent(out), contiguous  overlap 
)

Kohn-Sham State Overlap Matrix.

This is what is stored in the .mmn in the traditional workflow.

Note
Copy-pasted from wannier90_interface.F90, then modified to store full overlap in memory, rather than write out to file
Todo:
  • Implement properly for BATCH_PACKED

Definition at line 394 of file wannier_calc.F90.

◆ wannier_calc_read_centers()

subroutine, public wannier_calc_oct_m::wannier_calc_read_centers ( type(wannier_opts_t), intent(in)  wan_opts,
real(real64), dimension(:, :), intent(inout), contiguous  centers 
)

Read wannier centers.

Reads wannier centers from the _centres.xyz file produced in a prior wannierization.

Definition at line 567 of file wannier_calc.F90.

◆ wannier_calc_read_u_matrices()

subroutine, public wannier_calc_oct_m::wannier_calc_read_u_matrices ( type(wannier_opts_t), intent(in)  wan_opts,
type(kpoints_t), intent(in)  kpoints,
complex(real64), dimension(:, :, :), intent(inout), contiguous  u_matrix,
complex(real64), dimension(:, :, :), intent(inout), contiguous  u_dis_matrix 
)

Read wannier transformation matrix.

Reads wannier transformation matrices U and U:dis from the _u.mat and _u_dis.mat files produced in a prior wannierization.

Definition at line 605 of file wannier_calc.F90.

◆ wannier_calc_get_header()

subroutine wannier_calc_oct_m::wannier_calc_get_header ( character(len=*), intent(in)  header_start,
character(len=*), intent(out)  header 
)
private

Build a file header containing the current date and time.

The header starts with the given string, which varies between the output files.

Definition at line 680 of file wannier_calc.F90.

◆ wannier_calc_write_centers()

subroutine, public wannier_calc_oct_m::wannier_calc_write_centers ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  prefix,
real(real64), dimension(:, :), intent(in), contiguous  centers,
class(ions_t), intent(in)  ions 
)

Write wannier centers to file.

Uses same format as wannier90.

Definition at line 699 of file wannier_calc.F90.

◆ wannier_calc_write_u_matrices()

subroutine, public wannier_calc_oct_m::wannier_calc_write_u_matrices ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  prefix,
type(kpoints_t), intent(in)  kpoints,
complex(real64), dimension(:, :, :), intent(in), contiguous  u_matrix,
complex(real64), dimension(:, :, :), intent(in), contiguous  u_dis_matrix 
)

Write U and U_dis matrices to file.

Note
This routine was adapted from wannier90-3.1.0.

Definition at line 738 of file wannier_calc.F90.

◆ wannier_calc_write_spreads()

subroutine, public wannier_calc_oct_m::wannier_calc_write_spreads ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  prefix,
real(real64), dimension(:), intent(in), contiguous  spreads 
)

Write wannier spreads to file.

Definition at line 802 of file wannier_calc.F90.

◆ wannier_calc_write_hr_file()

subroutine, public wannier_calc_oct_m::wannier_calc_write_hr_file ( character(len=*), intent(in)  dir,
character(len=*), intent(in)  prefix,
integer, dimension(:, :), intent(in), contiguous  irvec,
integer, dimension(:), intent(in), contiguous  ndegen,
complex(real64), dimension(:, :, :), intent(in), contiguous  ham_r 
)

Write H(R) in the Wannier basis to a _hr.dat file.

Adapted from wannier90 to match the output format. ham_r is for example populated by the w90_plot call with the current state of the w90main object.

Parameters
[in]irvecR-points in the Wigner-Seitz cell, of shape (3, nrpts)
[in]ndegenDegeneracy of each R-vector, of shape (nrpts)
[in]ham_rH(R) in the Wannier basis, of shape (num_wann, num_wann, nrpts)

Definition at line 835 of file wannier_calc.F90.

◆ wannier_calc_r_in_wigner_seitz_cell()

logical function wannier_calc_oct_m::wannier_calc_r_in_wigner_seitz_cell ( integer, dimension(3), intent(in)  rvec,
real(real64), dimension(3, 3), intent(in)  real_metric,
integer, dimension(3), intent(in)  mp_grid,
integer, dimension(3), intent(in)  ws_search_size,
real(real64), intent(in)  ws_distance_tol,
integer, intent(out), optional  ndegen 
)
private

Check whether a lattice point lies in the Wigner-Seitz cell of the superlattice.

Parameters
[in]rveclattice point in reduced coordinates
[in]real_metricmetric tensor of the real-space lattice
[in]mp_gridMonkhorst-Pack grid
[in]ws_search_sizeWigner-Seitz search size
[in]ws_distance_tolWigner-Seitz distance tolerance
[out]ndegennumber of nearest superlattice points

Definition at line 881 of file wannier_calc.F90.

◆ wannier_calc_wigner_seitz_count()

subroutine, public wannier_calc_oct_m::wannier_calc_wigner_seitz_count ( real(real64), dimension(3,3), intent(in)  real_lattice,
integer, dimension(3), intent(in)  mp_grid,
integer, dimension(3), intent(in)  ws_search_size,
real(real64), intent(in)  ws_distance_tol,
integer, intent(out)  nrpts 
)

Count the number of R-points in the Wigner-Seitz cell.

This is entirely determined by the lattice and the k-point grid. Adapted from wannier90-3.1.0.

Parameters
[in]real_latticelattice vectors
[in]mp_gridMonkhorst-Pack grid
[in]ws_search_sizeWigner-Seitz search size
[in]ws_distance_tolWigner-Seitz distance tolerance
[out]nrptsNumber of R-points in Wigner-Seitz cell

Definition at line 921 of file wannier_calc.F90.

◆ wannier_calc_wigner_seitz_fill()

subroutine, public wannier_calc_oct_m::wannier_calc_wigner_seitz_fill ( real(real64), dimension(3,3), intent(in)  real_lattice,
integer, dimension(3), intent(in)  mp_grid,
integer, dimension(3), intent(in)  ws_search_size,
real(real64), intent(in)  ws_distance_tol,
integer, intent(in)  nrpts,
integer, dimension(3, nrpts), intent(out)  irvec,
integer, dimension(nrpts), intent(out)  ndegen 
)

Calculate coordinates and degeneracies of R-points in the Wigner-Seitz cell.

nrpts must be obtained beforehand from wannier_calc_wigner_seitz_count. Adapted from wannier90-3.1.0.

Parameters
[in]real_latticelattice vectors
[in]mp_gridMonkhorst-Pack grid
[in]ws_search_sizeWigner-Seitz search size
[in]ws_distance_tolWigner-Seitz distance tolerance
[in]nrptsNumber of R-points in Wigner-Seitz cell
[out]irvecR-point coordinates in the Wigner-Seitz cell, of shape (3, nrpts)
[out]ndegenDegeneracy of each R-point, of shape (nrpts)

Definition at line 954 of file wannier_calc.F90.

◆ wannier_calc_update_phase()

subroutine, public wannier_calc_oct_m::wannier_calc_update_phase ( integer, dimension(:), intent(in), contiguous  band_index,
type(states_elec_t), intent(in)  st,
real(real64), intent(in)  dt,
complex(real64), dimension(:,:), intent(inout), contiguous  phase 
)

Accumulate the phase picked up by the KS states in TD run.

Equation (4) of Phys. Rev. Research 7, 023312 . For a stationary state psi_n(t) = exp(-i eps_n t) psi_n(0). The MLWF minimum is invariant under this, and the minimizer at time t is V^dagger U(t_ref). This phase accumulation builds exactly that V^dagger.

Definition at line 1002 of file wannier_calc.F90.

◆ wannier_calc_compute_ham_r()

subroutine, public wannier_calc_oct_m::wannier_calc_compute_ham_r ( type(namespace_t), intent(in)  namespace,
class(mesh_t), intent(in)  mesh,
type(states_elec_t), intent(inout), target  st,
type(hamiltonian_elec_t), intent(in)  hm,
type(kpoints_t), intent(in)  kpoints,
type(wannier_opts_t), intent(in)  wannier_opts,
complex(real64), dimension(:, :, :), intent(in), contiguous  u_matrix,
integer, dimension(:, :), intent(in), contiguous  irvec,
complex(real64), dimension(:, :, :), intent(out), contiguous  ham_r 
)

Compute the time-dependent Hamiltonian in the Wannier basis in real space.

For each k-point, the full Hamiltonian matrix in the subspace of the current Kohn-Sham states, \(\epsilon_{i,j}(k)\) = <psi_i(k)|H|psi_j(k)>, is computed (this is generally not diagonal for time-dependent states, unlike the ground-state eigenbasis). It is then rotated into the Wannier gauge with the U matrix and Fourier transformed into real space using the Wigner-Seitz R-vectors.

Parameters
[in]u_matrixWannier transformation matrix, shape (num_wann, num_wann, nk)
[in]irvecR-points in the Wigner-Seitz cell, shape (3, nrpts)
[out]ham_rH(R) in the Wannier basis, shape (num_wann, num_wann, nrpts)

Definition at line 1028 of file wannier_calc.F90.