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)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | parameter | :: | nsupcell | = | 5 |
Size of supercell (of recip cell) in which to search for k-point shells |
A reproducible maxloc function so b-vectors come in the same order each time
| Type | Intent | Optional | 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 |
Main routine to calculate the b-vectors
| Type | Intent | Optional | 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 |
Writes nnkp file (list of overlaps needed)
| Type | Intent | Optional | 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 |
Release memory from the kmesh module
| Type | Intent | Optional | 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 |
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
| Type | Intent | Optional | 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 |
Returns the b-vectors for a given shell and kpoint.
| Type | Intent | Optional | 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 |
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
| Type | Intent | Optional | 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 |
Include more shells to calculate higher-order finite difference: 2b, 3b, ... Nb shells Note: some shells are overwritten
| Type | Intent | Optional | 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) |
Find amat(coefficients to find bweight) and the numbers of x, y, z components for a given order
| Type | Intent | Optional | 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(:) |
Check if the obtained bweight satisfy the conditions for finite-difference, including (B1).
| Type | Intent | Optional | 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(:) |
Find the B1 weights for a set of shells specified by the user
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
Obtain possible permutation in ordering of b-vectors at different kpoints
| Type | Intent | Optional | 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 |