w90_library Module

container type for all variables used by the Wannier90 library

prints a wide variety of simulation parameters to stdout prints a decorative summary of disentanglement/mlwf/plot timings perform disentanglement provides an MPI k-point distribution for codes that don't have one get wannier centers open a file and get the corresponding unit number get a fortran unit number corresponding to standard error get a fortran unit number corresponding to standard output get projection info (after interpreting projector specification strings) get spreads get k' indexes for finite-difference scheme get number of b-vectors (finite-difference points) get g offsets of k' number of excluded bands, for sizing array arg of w90_get_excl_bands list of indices of excluded bands (which may be possibly non-contiguous) optionally read additional input variables from .win file act upon (interpret & setup) options specified by set_option interface performs plot functions transform overlaps and initial projections setup MPI communicator in parallel case set value of Bohr/Angstrom conversion set (pointer to) eigenvalues set (pointer to) m (potentially MPI decomposed by k-points) specify options to the library; set_option is overloaded to accept arguments of various types set (pointer to) u matrix (nw,nw) set (pointer to) optimised (disentangled) u matrix (nb,nb) perform transport functions perform wannierisation


Uses

  • module~~w90_library~~UsesGraph module~w90_library w90_library iso_c_binding iso_c_binding module~w90_library->iso_c_binding module~w90_comms w90_comms module~w90_library->module~w90_comms module~w90_constants w90_constants module~w90_library->module~w90_constants module~w90_io w90_io module~w90_library->module~w90_io module~w90_types w90_types module~w90_library->module~w90_types module~w90_wannier90_types w90_wannier90_types module~w90_library->module~w90_wannier90_types module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base module~w90_io->module~w90_constants module~w90_types->module~w90_constants module~w90_wannier90_types->module~w90_constants

Used by

  • module~~w90_library~~UsedByGraph module~w90_library w90_library module~w90_library_c w90_library_c module~w90_library_c->module~w90_library module~w90_library_extra w90_library_extra module~w90_library_extra->module~w90_library program~wannier wannier program~wannier->module~w90_library program~wannier->module~w90_library_extra

Interfaces

public interface w90_set_option

  • public subroutine w90_set_option_logical(common_data, keyword, boolarg)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    logical, intent(in) :: boolarg
  • public subroutine w90_set_option_text(common_data, keyword, text)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    character(len=*), intent(in) :: text
  • public subroutine w90_set_option_int(common_data, keyword, ival)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    integer, intent(in) :: ival
  • public subroutine w90_set_option_i1d(common_data, keyword, arr)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    integer, intent(in) :: arr(:)
  • public subroutine w90_set_option_i2d(common_data, keyword, arr)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    integer, intent(in) :: arr(:,:)
  • public subroutine w90_set_option_r1d(common_data, keyword, arr)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    real(kind=dp), intent(in) :: arr(:)
  • public subroutine w90_set_option_r2d(common_data, keyword, arr)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    real(kind=dp), intent(in) :: arr(:,:)
  • public subroutine w90_set_option_c2d(common_data, keyword, arr)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    character(len=*), intent(in) :: arr(:)
  • public subroutine w90_set_option_real(common_data, keyword, rval)

    Arguments

    Type IntentOptional Attributes Name
    type(lib_common_type), intent(inout) :: common_data
    character(len=*), intent(in) :: keyword
    real(kind=dp), intent(in) :: rval

Derived Types

type, public ::  lib_common_type

Components

Type Visibility Attributes Name Initial
character(len=50), public :: seedname

base name for reading/writing of files

complex(kind=dp), public, allocatable :: ham_k(:,:,:)

KS Hamiltonian, takes size (number of WF, number of WF, number of k-points)

complex(kind=dp), public, allocatable :: ham_r(:,:,:)

RS Hamiltonian, takes size (number of WF, number of WF, number of RS-points)

complex(kind=dp), public, pointer :: a_matrix(:,:,:) => null()

pointer to matrix "a" (projections), dimensioned (number of bands, number WF, number of k-points)

complex(kind=dp), public, pointer :: m_matrix_local(:,:,:,:) => null()

pointer to rank local part of "m", dimensioned (number of bands, number of bands, FD neighbours, number of k-points on this rank)

complex(kind=dp), public, pointer :: u_matrix(:,:,:) => null()

pointer to matrix "u", dimensionsed (number of WF, number of WF, number of k-points)

complex(kind=dp), public, pointer :: u_matrix_opt(:,:,:) => null()

pointer to matrix "u_matrix_opt", dimensioned (number of bands, number of WF, number of k-points)

real(kind=dp), public, pointer :: eigval(:,:) => null()

pointer to eigenvalue array dimensioned (number of bands, number of k-points)

integer, public, allocatable :: dist_kpoints(:)

distribution of k-points; dist_kpoints(i) = rank operating on k-point i

integer, public, allocatable :: exclude_bands(:)

index of bands to exclude from the calculation: passed to DFT code to define space for overlaps, projections, etc

integer, public, allocatable :: irvec(:,:)
integer, public, allocatable :: ndegen(:)
integer, public, allocatable :: shift_vec(:,:)
integer, public :: mp_grid(3)

Dimensions of the Monkhorst-Pack grid

integer, public :: nrpts

Dimensions of the RS grid

integer, public :: num_bands

Number of bands (greater or equal to number of WFs)

integer, public :: num_kpts

Total number of k-points

integer, public :: num_proj = 0

Number of projectors defined

integer, public :: num_wann

Number of WFs

integer, public :: optimisation = 3

Algorithm control (affects memory use/speed)

integer, public :: rpt_origin
logical, public :: calc_only_A = .false.
logical, public :: gamma_only = .false.

Select gamma_only branch of some algorithms

logical, public :: have_disentangled = .false.

Flag that disentanglment has been performed

logical, public :: lhasproj = .false.

Flag that projectors are defined

logical, public :: lsitesymmetry = .false.

Flag that symmetry-adapted WFs are to be calculated

logical, public :: use_bloch_phases = .false.

Flag to bypass disentanglement

logical, public :: setup_complete = .false.

Internal flag to indicate completion of setup

real(kind=dp), public, allocatable :: fermi_energy_list(:)

Array of energies around the Fermi energy

real(kind=dp), public, allocatable :: kpt_latt(:,:)

Tabulation of k-points in crystal coordinates

real(kind=dp), public, allocatable :: wannier_centres_translated(:,:)
real(kind=dp), public :: real_lattice(3,3)
type(atom_data_type), public :: atom_data
type(band_plot_type), public :: band_plot
type(dis_control_type), public :: dis_control
type(dis_manifold_type), public :: dis_manifold
type(dis_spheres_type), public :: dis_spheres
type(fermi_surface_plot_type), public :: fermi_surface_data
type(ham_logical_type), public :: ham_logical
type(kmesh_info_type), public :: kmesh_info
type(kmesh_input_type), public :: kmesh_input
type(kpoint_path_type), public :: kpoint_path
type(output_file_type), public :: output_file
type(print_output_type), public :: print_output
type(proj_type), public, allocatable :: proj(:)
type(proj_type), public, allocatable :: proj_input(:)
type(real_space_ham_type), public :: real_space_ham
type(select_projection_type), public :: select_proj
type(settings_type), public :: settings

container for input file (.win) data and options set via library interface

type(sitesym_type), public :: sitesym
type(timer_list_type), public :: timer
type(transport_type), public :: tran
type(w90_calculation_type), public :: w90_calculation
type(w90_comm_type), public :: comm
type(w90_physical_constants_type), public :: physics
type(w90_system_type), public :: w90_system
type(wann_control_type), public :: wann_control
type(wannier_data_type), public :: wannier_data
type(wannier_plot_type), public :: wann_plot
type(wann_omega_type), public :: omega
type(wann_omega_type), public :: wann_omega
type(ws_region_type), public :: ws_region
type(wvfn_read_type), public :: wvfn_read

Subroutines

public subroutine w90_get_fortran_stdout(istdout)

fortran unit number for stdout

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: istdout

public subroutine w90_get_fortran_stderr(istdout)

fortran unit number for stderr

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: istdout

public subroutine w90_get_fortran_file(output, name)

open a (formatted) file and return the corresponding fortran unit number

Arguments

Type IntentOptional Attributes Name
integer, intent(out) :: output
character(len=*), intent(in) :: name

public subroutine w90_input_setopt(common_data, seedname, istdout, istderr, ierr)

mechanism to act upon options supplied to the library input is parsed and interpreted (any errors are identified) and the library data structure (variable common_data) is populated ready for use

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data

instance of library data object, modified here

character(len=*), intent(in) :: seedname
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_input_reader(common_data, istdout, istderr, ierr)

mechanism to act upon tokens read from the input ".win" file input is parsed and interpreted (any errors are identified) and the library data structure (variable common_data), already setup by w90_input_setopt, is modified

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_disentangle(common_data, istdout, istderr, ierr)

perform disentanglement; assumes library data object is already setup after w90_input_setopt() call no effect if number of bands == number of WF

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_project_overlap(common_data, istdout, istderr, ierr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_wannierise(common_data, istdout, istderr, ierr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_plot(common_data, istdout, istderr, ierr)

performs a variety of plotting functions

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_transport(common_data, istdout, istderr, ierr)

performs a variety of transport calculations

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_set_m_local(common_data, m_matrix_local)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
complex(kind=dp), intent(inout), target :: m_matrix_local(:,:,:,:)

public subroutine w90_set_u_matrix(common_data, u_matrix)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
complex(kind=dp), intent(inout), target :: u_matrix(:,:,:)

public subroutine w90_set_u_opt(common_data, u_matrix_opt)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
complex(kind=dp), intent(inout), target :: u_matrix_opt(:,:,:)

public subroutine w90_set_eigval(common_data, eigval)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
real(kind=dp), intent(in), target :: eigval(:,:)

public subroutine w90_set_constant_bohr_to_ang(common_data, bohr_to_angstrom)

used to set the bohr_to_angstrom value as used in the SCF code

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
real(kind=dp), intent(in) :: bohr_to_angstrom

public subroutine w90_create_kmesh(common_data, istdout, istderr, ierr)

causes w90 to calculate finite difference neighbour lists

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_get_nn(common_data, nn, istdout, istderr, ierr)

probe w90 library for number of finite difference k-point neighbours setup k-mesh (b vectors) if not already done (sets setup_complete)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data

library data object

integer, intent(out) :: nn

nn is the number of neighbours in F.D. scheme

integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

nn is the number of neighbours in F.D. scheme

public subroutine w90_get_nnkp(common_data, nnkp, istdout, istderr, ierr)

probe w90 library for finite difference k-point neighbour indices setup k-mesh (b vectors) if not already done (sets setup_complete)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data

library data object

integer, intent(out) :: nnkp(:,:)

nnkp must be dimensioned (n_neighbours, n_fbz)

integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

nnkp must be dimensioned (n_neighbours, n_fbz)

public subroutine w90_get_gkpb(common_data, gkpb, istdout, istderr, ierr)

probe w90 library for the triple of reciprocal lattice translations determining phase in k'= k+b setup k-mesh (b vectors) if not already done (sets setup_complete)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data

library data object

integer, intent(out) :: gkpb(:,:,:)

gkpb must be dimensioned (3,nk,nnb)

integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

gkpb must be dimensioned (3,nk,nnb)

public subroutine w90_get_centres(common_data, centres)

probes w90 library for (current) wannier centres

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in) :: common_data

library data object

real(kind=dp), intent(out) :: centres(:,:)

must be allocated with size >= n_wannier

public subroutine w90_get_spreads(common_data, spreads)

probes w90 library for (current) wannier spreads

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in) :: common_data

library data object

real(kind=dp), intent(out) :: spreads(:)

must be allocated with size >= n_wannier

public subroutine w90_get_num_excl_bands(common_data, num_excl_bands)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in) :: common_data

library data object

integer, intent(out) :: num_excl_bands

number of excluded bands, for sizing array arg of w90_get_excl_bands

public subroutine w90_get_excl_bands(common_data, excl_bands, istdout, istderr, ierr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in) :: common_data

library data object

integer, intent(inout), allocatable :: excl_bands(:)
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

must be allocated with size >= num_excl_bands

public subroutine w90_get_proj(common_data, n, site, l, m, s, rad, x, z, sqa, zona, istdout, istderr, ierr)

probes library data object and returns arrays describing a list of projections projectors defined either in .win file or passed (using same syntax) through w90_setopt array arguments assumed allocated at call array arguments must have length >= number of projectors (checked here)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in), target :: common_data

library data object

integer, intent(inout) :: n

number of projectors, angular, orbital and spin numbers

real(kind=dp), intent(inout) :: site(:,:)

projector origin (kind, site of kind)

integer, intent(inout) :: l(:)

number of projectors, angular, orbital and spin numbers

integer, intent(inout) :: m(:)

number of projectors, angular, orbital and spin numbers

integer, intent(inout) :: s(:)

number of projectors, angular, orbital and spin numbers

integer, intent(inout) :: rad(:)

radial function defining projector

real(kind=dp), intent(inout) :: x(:,:)

spin quantisation axis, z- an x-axes

real(kind=dp), intent(inout) :: z(:,:)

spin quantisation axis, z- an x-axes

real(kind=dp), intent(inout) :: sqa(:,:)

spin quantisation axis, z- an x-axes

real(kind=dp), intent(inout) :: zona(:)

spin quantisation axis, z- an x-axes

integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

ierr returned > 0 in case of error

public subroutine w90_set_comm(common_data, comm)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: comm

public subroutine w90_print_info(common_data, istdout, istderr, ierr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout
integer, intent(in) :: istderr
integer, intent(out) :: ierr

public subroutine w90_print_timings(common_data, istdout)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
integer, intent(in) :: istdout

public subroutine w90_set_option_text(common_data, keyword, text)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
character(len=*), intent(in) :: text

public subroutine w90_set_option_logical(common_data, keyword, boolarg)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
logical, intent(in) :: boolarg

public subroutine w90_set_option_i1d(common_data, keyword, arr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
integer, intent(in) :: arr(:)

public subroutine w90_set_option_i2d(common_data, keyword, arr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
integer, intent(in) :: arr(:,:)

public subroutine w90_set_option_int(common_data, keyword, ival)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
integer, intent(in) :: ival

public subroutine w90_set_option_r1d(common_data, keyword, arr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
real(kind=dp), intent(in) :: arr(:)

public subroutine w90_set_option_r2d(common_data, keyword, arr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
real(kind=dp), intent(in) :: arr(:,:)

public subroutine w90_set_option_c2d(common_data, keyword, arr)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
character(len=*), intent(in) :: arr(:)

public subroutine w90_set_option_real(common_data, keyword, rval)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data
character(len=*), intent(in) :: keyword
real(kind=dp), intent(in) :: rval

public subroutine w90_distribute_kpts(common_data, num_kpts, mpi_size, dist_k, istdout, istderr, ierr)

provide a distribution of num_kpts k-points across mpi_size MPI ranks

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(in) :: common_data

library object: only the communicator type is referenced

integer, intent(in) :: num_kpts

number of k-points

integer, intent(in) :: mpi_size

number of ranks in MPI communicator

integer, intent(inout), allocatable :: dist_k(:)

already allocated array assigned here such that dist_k(i) = rank handling kpt i size and allocation status are tested

integer, intent(in) :: istdout

destination for error messages

integer, intent(in) :: istderr

destination for error messages

integer, intent(out) :: ierr

return code, nonzero in case of error

public subroutine w90_free(common_data)

Arguments

Type IntentOptional Attributes Name
type(lib_common_type), intent(inout) :: common_data