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)) &
160 DEALLOCATE (rhoz_set(ikind)%r_coef)
161 IF (
ASSOCIATED(rhoz_set(ikind)%dr_coef)) &
162 DEALLOCATE (rhoz_set(ikind)%dr_coef)
163 IF (
ASSOCIATED(rhoz_set(ikind)%vr_coef)) &
164 DEALLOCATE (rhoz_set(ikind)%vr_coef)
167 DEALLOCATE (rhoz_set)
169 END SUBROUTINE deallocate_rhoz
180 SUBROUTINE get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, &
185 POINTER :: rho_atom_set
187 POINTER :: rho0_atom_set
189 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
191 POINTER :: rhoz_cneo_set
193 IF (
PRESENT(rho_atom_set)) rho_atom_set => local_rho_set%rho_atom_set
194 IF (
PRESENT(rho0_atom_set)) rho0_atom_set => local_rho_set%rho0_atom_set
195 IF (
PRESENT(rho0_mpole)) rho0_mpole => local_rho_set%rho0_mpole
196 IF (
PRESENT(rhoz_set)) rhoz_set => local_rho_set%rhoz_set
197 IF (
PRESENT(rhoz_cneo_set)) rhoz_cneo_set => local_rho_set%rhoz_cneo_set
209 ALLOCATE (local_rho_set)
211 NULLIFY (local_rho_set%rho_atom_set)
212 NULLIFY (local_rho_set%rho0_atom_set)
213 NULLIFY (local_rho_set%rho0_mpole)
214 NULLIFY (local_rho_set%rhoz_set)
215 NULLIFY (local_rho_set%rhoz_cneo_set)
217 local_rho_set%rhoz_tot = 0.0_dp
218 local_rho_set%rhoz_cneo_tot = 0.0_dp
230 IF (
ASSOCIATED(local_rho_set))
THEN
231 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
235 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
239 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
243 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
244 CALL deallocate_rhoz(local_rho_set%rhoz_set)
247 IF (
ASSOCIATED(local_rho_set%rhoz_cneo_set))
THEN
251 DEALLOCATE (local_rho_set)
265 SUBROUTINE set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, &
266 rhoz_set, rhoz_cneo_set)
270 POINTER :: rho_atom_set
272 POINTER :: rho0_atom_set
274 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
276 POINTER :: rhoz_cneo_set
278 IF (
PRESENT(rho_atom_set))
THEN
279 IF (
ASSOCIATED(local_rho_set%rho_atom_set))
THEN
282 local_rho_set%rho_atom_set => rho_atom_set
285 IF (
PRESENT(rho0_atom_set))
THEN
286 IF (
ASSOCIATED(local_rho_set%rho0_atom_set))
THEN
289 local_rho_set%rho0_atom_set => rho0_atom_set
292 IF (
PRESENT(rho0_mpole))
THEN
293 IF (
ASSOCIATED(local_rho_set%rho0_mpole))
THEN
296 local_rho_set%rho0_mpole => rho0_mpole
299 IF (
PRESENT(rhoz_set))
THEN
300 IF (
ASSOCIATED(local_rho_set%rhoz_set))
THEN
301 CALL deallocate_rhoz(local_rho_set%rhoz_set)
303 local_rho_set%rhoz_set => rhoz_set
306 IF (
PRESENT(rhoz_cneo_set))
THEN
307 IF (
ASSOCIATED(local_rho_set%rhoz_cneo_set))
THEN
310 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)
...