w90_utility Module

Module contains lots of useful general routines


Uses

  • module~~w90_utility~~UsesGraph module~w90_utility w90_utility module~w90_constants w90_constants module~w90_utility->module~w90_constants

Used by


Contents


Functions

public function utility_det3(a)

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(3,3)

Return Value real(kind=dp)

public function utility_zdotu(a, b)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in), dimension(:):: a
complex(kind=dp), intent(in), dimension(:):: b

Return Value complex(kind=dp)

public function utility_strip(string)

Strips string of all blank spaces

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: string

Return Value character(len=maxlen)

public function utility_lowercase(string)

Takes a string and converts to lowercase characters

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: string

Return Value character(len=maxlen)

public function utility_rotate(mat, rot, dim)

Rotates the dim x dim matrix 'mat' according to (rot)^dagger.mat.rot, where 'rot' is a unitary matrix

Arguments

Type IntentOptional AttributesName
complex(kind=dp) :: mat(dim,dim)
complex(kind=dp) :: rot(dim,dim)
integer :: dim

Return Value complex(kind=dp) (dim,dim)

public function utility_matmul_diag(mat1, mat2, dim)

Computes the diagonal elements of the matrix mat1.mat2

Arguments

Type IntentOptional AttributesName
complex(kind=dp) :: mat1(dim,dim)
complex(kind=dp) :: mat2(dim,dim)
integer :: dim

Return Value complex(kind=dp) (dim)

public function utility_rotate_diag(mat, rot, dim)

Rotates the dim x dim matrix 'mat' according to (rot)^dagger.mat.rot, where 'rot' is a unitary matrix. Computes only the diagonal elements of rotated matrix.

Arguments

Type IntentOptional AttributesName
complex(kind=dp) :: mat(dim,dim)
complex(kind=dp) :: rot(dim,dim)
integer :: dim

Return Value complex(kind=dp) (dim)

public function utility_commutator_diag(mat1, mat2, dim)

Computes diagonal elements of [mat1,mat2]=mat1.mat2-mat2.mat1

Arguments

Type IntentOptional AttributesName
complex(kind=dp) :: mat1(dim,dim)
complex(kind=dp) :: mat2(dim,dim)
integer :: dim

Return Value complex(kind=dp) (dim)

public function utility_re_tr_prod(a, b)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in), dimension(:, :):: a
complex(kind=dp), intent(in), dimension(:, :):: b

Return Value real(kind=dp)

public function utility_im_tr_prod(a, b)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in), dimension(:, :):: a
complex(kind=dp), intent(in), dimension(:, :):: b

Return Value real(kind=dp)

public function utility_re_tr(mat)

Real part of the trace

Arguments

Type IntentOptional AttributesName
complex(kind=dp), dimension(:, :):: mat

Return Value real(kind=dp)

public function utility_im_tr(mat)

Imaginary part of the trace

Arguments

Type IntentOptional AttributesName
complex(kind=dp), dimension(:, :):: mat

Return Value real(kind=dp)

public function utility_wgauss(x, n)

this function computes the approximate theta function for the given order n, at the point x.

Read more…

Arguments

Type IntentOptional AttributesName
real(kind=dp) :: x
integer :: n

Return Value real(kind=dp)

public function utility_w0gauss(x, n)

the derivative of utility_wgauss: an approximation to the delta function

Read more…

Arguments

Type IntentOptional AttributesName
real(kind=dp) :: x
integer :: n

Return Value real(kind=dp)

public function utility_w0gauss_vec(x, n) result(res)

the derivative of utility_wgauss: an approximation to the delta function

Read more…

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: x(:)
integer :: n

Return Value real(kind=dp), allocatable, (:)

private function qe_erf(x)

Error function - computed from the rational approximations of W. J. Cody, Math. Comp. 22 (1969), pages 631-637.

Read more…

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: x

Return Value real(kind=dp)

private function qe_erfc(x)

erfc(x) = 1-erf(x) - See comments in erf

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: x

Return Value real(kind=dp)

private function gauss_freq(x)

gauss_freq(x) = (1+erf(x/sqrt(2)))/2 = erfc(-x/sqrt(2))/2 - See comments in erf

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: x

Return Value real(kind=dp)


Subroutines

public subroutine utility_zgemm(c, a, transa, b, transb, n)

Return matrix product of complex n x n matrices a and b:

Read more…

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(out) :: c(n,n)
complex(kind=dp), intent(in) :: a(n,n)
character(len=1), intent(in) :: transa
complex(kind=dp), intent(in) :: b(n,n)
character(len=1), intent(in) :: transb
integer, intent(in) :: n

public subroutine utility_zgemm_new(a, b, c, transa_opt, transb_opt)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in) :: a(:,:)
complex(kind=dp), intent(in) :: b(:,:)
complex(kind=dp), intent(out) :: c(:,:)
character(len=1), intent(in), optional :: transa_opt
character(len=1), intent(in), optional :: transb_opt

public subroutine utility_zgemmm(a, transa, b, transb, c, transc, prod1, eigval, prod2)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in), dimension(:, :):: a
character(len=1), intent(in) :: transa
complex(kind=dp), intent(in), dimension(:, :):: b
character(len=1), intent(in) :: transb
complex(kind=dp), intent(in), dimension(:, :):: c
character(len=1), intent(in) :: transc
complex(kind=dp), intent(out), optional dimension(:, :):: prod1
real(kind=dp), intent(in), optional dimension(:):: eigval
complex(kind=dp), intent(out), optional dimension(:, :):: prod2

public subroutine utility_inv3(a, b, det)

Return in b the adjoint of the 3x3 matrix a, and its determinant. The inverse is defined as the adjoind divided by the determinant, so that inverse(a) = b/det

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(3,3)
real(kind=dp), intent(out) :: b(3,3)
real(kind=dp), intent(out) :: det

public subroutine utility_inv2(a, b, det)

Return in b the adjoint of the 2x2 matrix a, together with the determinant of a. The inverse is defined as the adjoind divided by the determinant, so that inverse(a) = b/det

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(2,2)
real(kind=dp), intent(out) :: b(2,2)
real(kind=dp), intent(out) :: det

public subroutine utility_recip_lattice(real_lat, recip_lat, volume)

Calculates the reciprical lattice vectors and the cell volume

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: real_lat(3,3)
real(kind=dp), intent(out) :: recip_lat(3,3)
real(kind=dp), intent(out) :: volume

public subroutine utility_compar(a, b, ifpos, ifneg)

Compares two vectors

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(3)
real(kind=dp), intent(in) :: b(3)
integer, intent(out) :: ifpos
integer, intent(out) :: ifneg

public subroutine utility_metric(real_lat, recip_lat, real_metric, recip_metric)

Calculate the real and reciprical space metrics

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: real_lat(3,3)
real(kind=dp), intent(in) :: recip_lat(3,3)
real(kind=dp), intent(out) :: real_metric(3,3)
real(kind=dp), intent(out) :: recip_metric(3,3)

public subroutine utility_frac_to_cart(frac, cart, real_lat)

Convert from fractional to Cartesian coordinates

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: frac(3)
real(kind=dp), intent(out) :: cart(3)
real(kind=dp), intent(in) :: real_lat(3,3)

public subroutine utility_cart_to_frac(cart, frac, recip_lat)

Convert from Cartesian to fractional coordinates

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: cart(3)
real(kind=dp), intent(out) :: frac(3)
real(kind=dp), intent(in) :: recip_lat(3,3)

public subroutine utility_string_to_coord(string_tmp, outvec)

Takes a string in the form 0.0,1.0,0.5 and returns an array of the real num

Arguments

Type IntentOptional AttributesName
character(len=maxlen), intent(in) :: string_tmp
real(kind=dp), intent(out) :: outvec(3)

public subroutine utility_translate_home(vec, real_lat, recip_lat)

Translate a vector to the home unit cell

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(inout) :: vec(3)
real(kind=dp), intent(in) :: real_lat(3,3)
real(kind=dp), intent(in) :: recip_lat(3,3)

public subroutine utility_diagonalize(mat, dim, eig, rot)

Diagonalize the dim x dim hermitian matrix 'mat' and return the eigenvalues 'eig' and the unitary rotation 'rot'

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in) :: mat(dim,dim)
integer, intent(in) :: dim
real(kind=dp), intent(out) :: eig(dim)
complex(kind=dp), intent(out) :: rot(dim,dim)

public subroutine utility_rotate_new(mat, rot, N, reverse)

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(inout) :: mat(N,N)
complex(kind=dp), intent(in) :: rot(N,N)
integer, intent(in) :: N
logical, intent(in), optional :: reverse