w90_kmesh Module

Routines to analyse the regular k-point mesh and determine the overlaps neccessary for a finite difference representation of the spread operator. These overlaps are defined by a set of vectors (b-vectors) which connect the Bloch states. See Eq. B1 in Appendix B of Marzari and Vanderbilt PRB 56 12847 (1997)


Uses

  • module~~w90_kmesh~~UsesGraph module~w90_kmesh w90_kmesh module~w90_comms w90_comms module~w90_kmesh->module~w90_comms module~w90_constants w90_constants module~w90_kmesh->module~w90_constants module~w90_error w90_error module~w90_kmesh->module~w90_error module~w90_types w90_types module~w90_kmesh->module~w90_types module~w90_comms->module~w90_constants module~w90_error_base w90_error_base module~w90_comms->module~w90_error_base module~w90_error->module~w90_comms module~w90_error->module~w90_error_base module~w90_types->module~w90_constants

Used by

  • module~~w90_kmesh~~UsedByGraph module~w90_kmesh w90_kmesh proc~w90_create_kmesh w90_create_kmesh proc~w90_create_kmesh->module~w90_kmesh proc~write_kmesh write_kmesh proc~write_kmesh->module~w90_kmesh program~postw90 postw90 program~postw90->module~w90_kmesh

Variables

Type Visibility Attributes Name Initial
integer, private, parameter :: nsupcell = 5

Size of supercell (of recip cell) in which to search for k-point shells


Functions

private function internal_maxloc(dist, nsupcell)

A reproducible maxloc function so b-vectors come in the same order each time

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: dist((2*nsupcell+1)**3)

Distances from the origin of the unit cells in the supercell.

integer, intent(in) :: nsupcell

Return Value integer


Subroutines

public subroutine kmesh_get(kmesh_input, kmesh_info, print_output, kpt_latt, real_lattice, num_kpts, gamma_only, seedname, stdout, timer, error, comm)

Main routine to calculate the b-vectors

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
type(kmesh_info_type), intent(inout) :: kmesh_info
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(in) :: kpt_latt(:,:)
real(kind=dp), intent(in) :: real_lattice(3,3)
integer, intent(in) :: num_kpts
logical, intent(in) :: gamma_only
character(len=*), intent(in) :: seedname
integer, intent(in) :: stdout
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

public subroutine kmesh_write(exclude_bands, kmesh_info, lauto_proj, proj, print_output, kpt_latt, real_lattice, num_kpts, num_proj, calc_only_A, spinors, seedname, timer)

Writes nnkp file (list of overlaps needed)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), allocatable :: exclude_bands(:)
type(kmesh_info_type), intent(in) :: kmesh_info
logical, intent(in) :: lauto_proj
type(proj_type), intent(in), allocatable :: proj(:)
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(in) :: kpt_latt(:,:)
real(kind=dp), intent(in) :: real_lattice(3,3)
integer, intent(in) :: num_kpts
integer, intent(inout) :: num_proj
logical, intent(in) :: calc_only_A
logical, intent(in) :: spinors
character(len=*), intent(in) :: seedname
type(timer_list_type), intent(inout) :: timer

public subroutine kmesh_dealloc(kmesh_info, error, comm)

Release memory from the kmesh module

Arguments

Type IntentOptional Attributes Name
type(kmesh_info_type), intent(inout) :: kmesh_info
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

private subroutine kmesh_supercell_sort(print_output, recip_lattice, lmn, timer)

We look for kpoint neighbours in a large supercell of reciprocal unit cells. Done sequentially this is very slow. Here we order the cells by the distance from the origin. Doing the search in this order gives a dramatic speed up

Arguments

Type IntentOptional Attributes Name
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(in) :: recip_lattice(3,3)
integer, intent(inout) :: lmn(:,:)
type(timer_list_type), intent(inout) :: timer

private subroutine kmesh_get_bvectors(kmesh_input, print_output, bvector, kpt_cart, recip_lattice, shell_dist, lmn, kpt, multi, num_kpts, timer, error, comm)

Returns the b-vectors for a given shell and kpoint.

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(in) :: kmesh_input
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(out) :: bvector(3,multi)
real(kind=dp), intent(in) :: kpt_cart(:,:)
real(kind=dp), intent(in) :: recip_lattice(3,3)
real(kind=dp), intent(in) :: shell_dist
integer, intent(in) :: lmn(:,:)
integer, intent(in) :: kpt
integer, intent(in) :: multi
integer, intent(in) :: num_kpts
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

private subroutine kmesh_shell_automatic(kmesh_input, print_output, bweight, dnn, kpt_cart, recip_lattice, lmn, multi, num_kpts, stdout, timer, error, comm)

Find the correct set of shells to satisfy B1 The stratagy is: 1) Take the bvectors from the next shell 2) Reject them if they are parallel to exisiting b vectors 3) Test to see if we satisfy B1, if not add another shell and repeat

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(out) :: bweight(kmesh_input%max_shells_h)
real(kind=dp), intent(in) :: dnn(kmesh_input%search_shells)
real(kind=dp), intent(in) :: kpt_cart(:,:)
real(kind=dp), intent(in) :: recip_lattice(3,3)
integer, intent(in) :: lmn(:,:)
integer, intent(in) :: multi(kmesh_input%search_shells)
integer, intent(in) :: num_kpts
integer, intent(in) :: stdout
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

private subroutine kmesh_shell_reconstruct(kmesh_input, num_kpts, multi, dnn, nnshell, bweight)

Include more shells to calculate higher-order finite difference: 2b, 3b, ... Nb shells Note: some shells are overwritten

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
integer, intent(in) :: num_kpts
integer, intent(inout) :: multi(max(kmesh_input%search_shells,6*kmesh_input%higher_order_n))
real(kind=dp), intent(inout) :: dnn(max(kmesh_input%search_shells,6*kmesh_input%higher_order_n))
integer, intent(inout) :: nnshell(num_kpts,max(kmesh_input%search_shells,6*kmesh_input%higher_order_n))
real(kind=dp), intent(inout) :: bweight(kmesh_input%max_shells_h)

private subroutine kmesh_get_amat(kmesh_input, amat, bvector, multi, loop_order, num_x, num_y, num_z)

Find amat(coefficients to find bweight) and the numbers of x, y, z components for a given order

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
real(kind=dp), intent(inout) :: amat(:,:)
real(kind=dp), intent(in) :: bvector(3,maxval(multi),kmesh_input%max_shells_h)
integer, intent(in) :: multi(kmesh_input%search_shells)
integer, intent(in) :: loop_order
integer, intent(inout) :: num_x(:)
integer, intent(inout) :: num_y(:)
integer, intent(inout) :: num_z(:)

private subroutine kmesh_check_condition(kmesh_input, bsat, bvector, bweight, multi, loop_order, num_x, num_y, num_z)

Check if the obtained bweight satisfy the conditions for finite-difference, including (B1).

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
logical, intent(inout) :: bsat
real(kind=dp), intent(in) :: bvector(3,maxval(multi),kmesh_input%max_shells_h)
real(kind=dp), intent(in) :: bweight(kmesh_input%max_shells_h)
integer, intent(in) :: multi(kmesh_input%search_shells)
integer, intent(in) :: loop_order
integer, intent(inout) :: num_x(:)
integer, intent(inout) :: num_y(:)
integer, intent(inout) :: num_z(:)

private subroutine kmesh_shell_fixed(kmesh_input, print_output, bweight, dnn, kpt_cart, recip_lattice, lmn, multi, num_kpts, stdout, timer, error, comm)

Find the B1 weights for a set of shells specified by the user

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(in) :: kmesh_input
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(out) :: bweight(max_shells)
real(kind=dp), intent(in) :: dnn(kmesh_input%search_shells)
real(kind=dp), intent(in) :: kpt_cart(:,:)
real(kind=dp), intent(in) :: recip_lattice(3,3)
integer, intent(in) :: lmn(:,:)
integer, intent(in) :: multi(kmesh_input%search_shells)
integer, intent(in) :: num_kpts
integer, intent(in) :: stdout
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

private subroutine kmesh_shell_from_file(kmesh_input, print_output, bvec_inp, bweight, dnn, kpt_cart, recip_lattice, lmn, multi, num_kpts, seedname, stdout, timer, error, comm)

Find the B1 weights for a set of b-vectors given in a file. This routine is activated via kmesh_shell_from_file = T It is not intended for regular use.

Arguments

Type IntentOptional Attributes Name
type(kmesh_input_type), intent(inout) :: kmesh_input
type(print_output_type), intent(in) :: print_output
real(kind=dp), intent(inout), allocatable :: bvec_inp(:,:,:)
real(kind=dp), intent(out) :: bweight(max_shells)
real(kind=dp), intent(in) :: dnn(kmesh_input%search_shells)
real(kind=dp), intent(in) :: kpt_cart(:,:)
real(kind=dp), intent(in) :: recip_lattice(3,3)
integer, intent(in) :: lmn(:,:)
integer, intent(inout) :: multi(kmesh_input%search_shells)
integer, intent(in) :: num_kpts
character(len=50), intent(in) :: seedname
integer, intent(in) :: stdout
type(timer_list_type), intent(inout) :: timer
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm

private subroutine kmesh_bvectors_perm(bvec, bref, num_kpt, num_bvec, perm, invperm, revind, error, comm)

Obtain possible permutation in ordering of b-vectors at different kpoints

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: bvec(:,:,:)
real(kind=dp), intent(in) :: bref(:,:)
integer, intent(in) :: num_kpt
integer, intent(in) :: num_bvec
integer, intent(inout) :: perm(:,:)
integer, intent(inout) :: invperm(:,:)
integer, intent(inout) :: revind(:,:)
type(w90_error_type), intent(out), allocatable :: error
type(w90_comm_type), intent(in) :: comm