Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
the derivative of utility_wgauss: an approximation to the delta function
(n>=0) : derivative of the corresponding Methfessel-Paxton utility_wgauss
(n=-1 ): derivative of cold smearing:
1/sqrt(pi)exp(-(x-1/sqrt(2))2)(2-sqrt(2)*x)
(n=-99): derivative of Fermi-Dirac function: 0.5/(1.0+cosh(x))
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
function utility_w0gauss(x,n,error,comm)!-----------------------------------------------------------------------!!! the derivative of utility_wgauss: an approximation to the delta function!!!! (n>=0) : derivative of the corresponding Methfessel-Paxton utility_wgauss!!!! (n=-1 ): derivative of cold smearing:!! 1/sqrt(pi)*exp(-(x-1/sqrt(2))**2)*(2-sqrt(2)*x)!!!! (n=-99): derivative of Fermi-Dirac function: 0.5/(1.0+cosh(x))!use w90_constants,only:dp,piuse w90_error,only:w90_error_type,set_error_inputimplicit none! argumentsreal(kind=dp)::utility_w0gauss!! *output*: the value of the functionreal(kind=dp),intent(in)::x!! *input*: the point where to compute the functioninteger,intent(in)::n!! *input*: the order of the smearing functiontype(w90_error_type),allocatable,intent(out)::errortype(w90_comm_type),intent(in)::comm! local variablesreal(kind=dp)::a,arg,hp,hd,sqrtpm1! the coefficients a_n! the argument of the exponential! the hermite function! the hermite functioninteger::i,ni! counter on n values! counter on 2n valuesutility_w0gauss=0.d0! in case of error return! Fermi-Dirac smearingsqrtpm1=1.0_dp/sqrt(pi)if(n.eq.-99)then if(abs(x).le.36.0)thenutility_w0gauss=1.00_dp/(2.00_dp+exp(-x)+exp(+x))! in order to avoid problems for large values of x in the eelseutility_w0gauss=0.0_dpend if return end if! cold smearing (Marzari-Vanderbilt)if(n.eq.-1)thenarg=min(200.0_dp,(x-1.00_dp/sqrt(2.00_dp))**2)utility_w0gauss=sqrtpm1*exp(-arg)*(2.00_dp-sqrt(2.00_dp)*x)return end if if(n.gt.10.or.n.lt.0)then call set_error_input(error,'utility_w0gauss higher order (n>10) smearing is untested and unstable',comm)return end if! Methfessel-Paxtonarg=min(200.0_dp,x**2)utility_w0gauss=exp(-arg)*sqrtpm1if(n.eq.0)returnhd=0.00_dphp=exp(-arg)ni=0a=sqrtpm1do i=1,nhd=2.00_dp*x*hp-2.00_dp*DBLE(ni)*hdni=ni+1a=-a/(DBLE(i)*4.00_dp)hp=2.00_dp*x*hd-2.00_dp*DBLE(ni)*hpni=ni+1utility_w0gauss=utility_w0gauss+a*hpend do return end function utility_w0gauss