22#include "./base/base_uses.f90"
30 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_local_rho_types'
36 REAL(
dp) :: one_atom = -1.0_dp
37 REAL(
dp),
DIMENSION(:),
POINTER :: r_coef => null()
38 REAL(
dp),
DIMENSION(:),
POINTER :: dr_coef => null()
39 REAL(
dp),
DIMENSION(:),
POINTER :: vr_coef => null()
47 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set => null()
48 REAL(
dp) :: rhoz_tot = -1.0_dp
68 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set
73 IF (
ASSOCIATED(rhoz_set))
THEN
74 CALL deallocate_rhoz(rhoz_set)
77 ALLOCATE (rhoz_set(nkind))
80 NULLIFY (rhoz_set(ikind)%r_coef)
81 NULLIFY (rhoz_set(ikind)%dr_coef)
82 NULLIFY (rhoz_set(ikind)%vr_coef)
97 SUBROUTINE calculate_rhoz(rhoz, grid_atom, alpha, zeff, natom, rhoz_tot, harmonics)
101 REAL(
dp),
INTENT(IN) :: alpha
104 REAL(
dp),
INTENT(INOUT) :: rhoz_tot
107 INTEGER :: ir, na, nr
108 REAL(
dp) :: c1, c2, c3, prefactor1, prefactor2, &
112 na = grid_atom%ng_sphere
120 prefactor1 = zeff*sqrt(c2)
121 prefactor2 = -2.0_dp*alpha
122 prefactor3 = -zeff*sqrt(
fourpi)
126 c1 = -alpha*grid_atom%rad2(ir)
127 rhoz%r_coef(ir) = -exp(c1)*prefactor1
128 IF (abs(rhoz%r_coef(ir)) < 1.0e-30_dp)
THEN
129 rhoz%r_coef(ir) = 0.0_dp
130 rhoz%dr_coef(ir) = 0.0_dp
132 rhoz%dr_coef(ir) = prefactor2*rhoz%r_coef(ir)
134 rhoz%vr_coef(ir) = prefactor3*erf(grid_atom%rad(ir)*c3)/grid_atom%rad(ir)
135 sum = sum + rhoz%r_coef(ir)*grid_atom%wr(ir)
137 rhoz%one_atom = sum*harmonics%slm_int(1)
138 rhoz_tot = rhoz_tot + natom*rhoz%one_atom
146 SUBROUTINE deallocate_rhoz(rhoz_set)
148 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set
150 INTEGER :: ikind, nkind
152 nkind =
SIZE(rhoz_set)
155 DEALLOCATE (rhoz_set(ikind)%r_coef)
156 DEALLOCATE (rhoz_set(ikind)%dr_coef)
157 DEALLOCATE (rhoz_set(ikind)%vr_coef)
160 DEALLOCATE (rhoz_set)
162 END SUBROUTINE deallocate_rhoz
172 SUBROUTINE get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set)
176 POINTER :: rho_atom_set
178 POINTER :: rho0_atom_set
180 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
182 IF (
PRESENT(rho_atom_set)) rho_atom_set => local_rho_set%rho_atom_set
183 IF (
PRESENT(rho0_atom_set)) rho0_atom_set => local_rho_set%rho0_atom_set
184 IF (
PRESENT(rho0_mpole)) rho0_mpole => local_rho_set%rho0_mpole
185 IF (
PRESENT(rhoz_set)) rhoz_set => local_rho_set%rhoz_set
197 ALLOCATE (local_rho_set)
199 NULLIFY (local_rho_set%rho_atom_set)
200 NULLIFY (local_rho_set%rho0_atom_set)
201 NULLIFY (local_rho_set%rho0_mpole)
202 NULLIFY (local_rho_set%rhoz_set)
204 local_rho_set%rhoz_tot = 0.0_dp
216 IF (
ASSOCIATED(local_rho_set))
THEN
217 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
221 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
225 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
229 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
230 CALL deallocate_rhoz(local_rho_set%rhoz_set)
233 DEALLOCATE (local_rho_set)
246 SUBROUTINE set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, &
251 POINTER :: rho_atom_set
253 POINTER :: rho0_atom_set
255 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
257 IF (
PRESENT(rho_atom_set))
THEN
258 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
261 local_rho_set%rho_atom_set => rho_atom_set
264 IF (
PRESENT(rho0_atom_set))
THEN
265 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
268 local_rho_set%rho0_atom_set => rho0_atom_set
271 IF (
PRESENT(rho0_mpole))
THEN
272 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
275 local_rho_set%rho0_mpole => rho0_mpole
278 IF (
PRESENT(rhoz_set))
THEN
279 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
280 CALL deallocate_rhoz(local_rho_set%rhoz_set)
282 local_rho_set%rhoz_set => rhoz_set
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), parameter, public fourpi
Utility routines for the memory handling.
subroutine, public local_rho_set_create(local_rho_set)
...
subroutine, public allocate_rhoz(rhoz_set, nkind)
...
subroutine, public local_rho_set_release(local_rho_set)
...
subroutine, public set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set)
...
subroutine, public calculate_rhoz(rhoz, grid_atom, alpha, zeff, natom, rhoz_tot, harmonics)
...
subroutine, public get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set)
...
subroutine, public deallocate_rho0_mpole(rho0)
...
subroutine, public deallocate_rho0_atom(rho0_atom_set)
...
subroutine, public deallocate_rho_atom_set(rho_atom_set)
...