24#include "./base/base_uses.f90"
32 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_local_rho_types'
38 REAL(
dp) :: one_atom = -1.0_dp
39 REAL(
dp),
DIMENSION(:),
POINTER :: r_coef => null()
40 REAL(
dp),
DIMENSION(:),
POINTER :: dr_coef => null()
41 REAL(
dp),
DIMENSION(:),
POINTER :: vr_coef => null()
49 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set => null()
51 REAL(
dp) :: rhoz_tot = -1.0_dp, &
52 rhoz_cneo_tot = -1.0_dp
72 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set
77 IF (
ASSOCIATED(rhoz_set))
THEN
78 CALL deallocate_rhoz(rhoz_set)
81 ALLOCATE (rhoz_set(nkind))
84 NULLIFY (rhoz_set(ikind)%r_coef)
85 NULLIFY (rhoz_set(ikind)%dr_coef)
86 NULLIFY (rhoz_set(ikind)%vr_coef)
101 SUBROUTINE calculate_rhoz(rhoz, grid_atom, alpha, zeff, natom, rhoz_tot, harmonics)
105 REAL(
dp),
INTENT(IN) :: alpha
108 REAL(
dp),
INTENT(INOUT) :: rhoz_tot
111 INTEGER :: ir, na, nr
112 REAL(
dp) :: c1, c2, c3, prefactor1, prefactor2, &
116 na = grid_atom%ng_sphere
124 prefactor1 = zeff*sqrt(c2)
125 prefactor2 = -2.0_dp*alpha
126 prefactor3 = -zeff*sqrt(
fourpi)
130 c1 = -alpha*grid_atom%rad2(ir)
131 rhoz%r_coef(ir) = -exp(c1)*prefactor1
132 IF (abs(rhoz%r_coef(ir)) < 1.0e-30_dp)
THEN
133 rhoz%r_coef(ir) = 0.0_dp
134 rhoz%dr_coef(ir) = 0.0_dp
136 rhoz%dr_coef(ir) = prefactor2*rhoz%r_coef(ir)
138 rhoz%vr_coef(ir) = prefactor3*erf(grid_atom%rad(ir)*c3)/grid_atom%rad(ir)
139 sum = sum + rhoz%r_coef(ir)*grid_atom%wr(ir)
141 rhoz%one_atom = sum*harmonics%slm_int(1)
142 rhoz_tot = rhoz_tot + natom*rhoz%one_atom
150 SUBROUTINE deallocate_rhoz(rhoz_set)
152 TYPE(
rhoz_type),
DIMENSION(:),
POINTER :: rhoz_set
154 INTEGER :: ikind, nkind
156 nkind =
SIZE(rhoz_set)
159 IF (
ASSOCIATED(rhoz_set(ikind)%r_coef))
DEALLOCATE (rhoz_set(ikind)%r_coef)
160 IF (
ASSOCIATED(rhoz_set(ikind)%dr_coef))
DEALLOCATE (rhoz_set(ikind)%dr_coef)
161 IF (
ASSOCIATED(rhoz_set(ikind)%vr_coef))
DEALLOCATE (rhoz_set(ikind)%vr_coef)
164 DEALLOCATE (rhoz_set)
166 END SUBROUTINE deallocate_rhoz
177 SUBROUTINE get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, &
182 POINTER :: rho_atom_set
184 POINTER :: rho0_atom_set
186 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
188 POINTER :: rhoz_cneo_set
190 IF (
PRESENT(rho_atom_set)) rho_atom_set => local_rho_set%rho_atom_set
191 IF (
PRESENT(rho0_atom_set)) rho0_atom_set => local_rho_set%rho0_atom_set
192 IF (
PRESENT(rho0_mpole)) rho0_mpole => local_rho_set%rho0_mpole
193 IF (
PRESENT(rhoz_set)) rhoz_set => local_rho_set%rhoz_set
194 IF (
PRESENT(rhoz_cneo_set)) rhoz_cneo_set => local_rho_set%rhoz_cneo_set
206 ALLOCATE (local_rho_set)
208 NULLIFY (local_rho_set%rho_atom_set)
209 NULLIFY (local_rho_set%rho0_atom_set)
210 NULLIFY (local_rho_set%rho0_mpole)
211 NULLIFY (local_rho_set%rhoz_set)
212 NULLIFY (local_rho_set%rhoz_cneo_set)
214 local_rho_set%rhoz_tot = 0.0_dp
215 local_rho_set%rhoz_cneo_tot = 0.0_dp
227 IF (
ASSOCIATED(local_rho_set))
THEN
228 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
232 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
236 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
240 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
241 CALL deallocate_rhoz(local_rho_set%rhoz_set)
244 IF (
ASSOCIATED(local_rho_set%rhoz_cneo_set))
THEN
248 DEALLOCATE (local_rho_set)
262 SUBROUTINE set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, &
263 rhoz_set, rhoz_cneo_set)
267 POINTER :: rho_atom_set
269 POINTER :: rho0_atom_set
271 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
273 POINTER :: rhoz_cneo_set
275 IF (
PRESENT(rho_atom_set))
THEN
276 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
279 local_rho_set%rho_atom_set => rho_atom_set
282 IF (
PRESENT(rho0_atom_set))
THEN
283 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
286 local_rho_set%rho0_atom_set => rho0_atom_set
289 IF (
PRESENT(rho0_mpole))
THEN
290 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
293 local_rho_set%rho0_mpole => rho0_mpole
296 IF (
PRESENT(rhoz_set))
THEN
297 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
298 CALL deallocate_rhoz(local_rho_set%rhoz_set)
300 local_rho_set%rhoz_set => rhoz_set
303 IF (
PRESENT(rhoz_cneo_set))
THEN
304 IF (
ASSOCIATED(local_rho_set%rhoz_cneo_set))
THEN
307 local_rho_set%rhoz_cneo_set => rhoz_cneo_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.
Types used by CNEO-DFT (see J. Chem. Theory Comput. 2025, 21, 16, 7865–7877)
subroutine, public deallocate_rhoz_cneo_set(rhoz_cneo_set)
...
subroutine, public local_rho_set_create(local_rho_set)
...
subroutine, public allocate_rhoz(rhoz_set, nkind)
...
subroutine, public get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set)
...
subroutine, public local_rho_set_release(local_rho_set)
...
subroutine, public calculate_rhoz(rhoz, grid_atom, alpha, zeff, natom, rhoz_tot, harmonics)
...
subroutine, public set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set)
...
subroutine, public deallocate_rho0_mpole(rho0)
...
subroutine, public deallocate_rho0_atom(rho0_atom_set)
...
subroutine, public deallocate_rho_atom_set(rho_atom_set)
...