19 USE dbcsr_api,
ONLY: dbcsr_p_type
24 kpoint_transitional_type,&
30 #include "./base/base_uses.f90"
35 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
36 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_rho_types'
38 PUBLIC :: qs_rho_p_type, qs_rho_type
64 TYPE(kpoint_transitional_type) :: rho_ao
65 TYPE(kpoint_transitional_type) :: rho_ao_im
66 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r => null()
67 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g => null()
68 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: tau_r => null()
69 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: tau_g => null()
70 TYPE(pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r => null()
71 TYPE(pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g => null()
73 TYPE(pw_r3d_rs_type),
POINTER :: rho_r_sccs => null()
74 LOGICAL :: rho_g_valid = .false., &
75 rho_r_valid = .false., &
76 drho_r_valid = .false., &
77 drho_g_valid = .false., &
78 tau_r_valid = .false., &
79 tau_g_valid = .false., &
80 soft_valid = .false., &
81 complex_rho_ao = .false.
82 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: tot_rho_r => null(), &
88 TYPE(qs_rho_type),
POINTER :: rho
89 END TYPE qs_rho_p_type
99 TYPE(qs_rho_type),
INTENT(OUT) :: rho
113 TYPE(qs_rho_type),
INTENT(INOUT) :: rho_struct
125 TYPE(qs_rho_type),
INTENT(INOUT) :: rho_struct
129 IF (
ASSOCIATED(rho_struct%rho_r))
THEN
130 DO i = 1,
SIZE(rho_struct%rho_r)
131 CALL rho_struct%rho_r(i)%release()
133 DEALLOCATE (rho_struct%rho_r)
135 IF (
ASSOCIATED(rho_struct%drho_r))
THEN
136 DO j = 1,
SIZE(rho_struct%drho_r, 2)
137 DO i = 1,
SIZE(rho_struct%drho_r, 1)
138 CALL rho_struct%drho_r(i, j)%release()
141 DEALLOCATE (rho_struct%drho_r)
143 IF (
ASSOCIATED(rho_struct%drho_g))
THEN
144 DO i = 1,
SIZE(rho_struct%drho_g, 2)
145 DO j = 1,
SIZE(rho_struct%drho_g, 1)
146 CALL rho_struct%drho_g(i, j)%release()
149 DEALLOCATE (rho_struct%drho_g)
151 IF (
ASSOCIATED(rho_struct%tau_r))
THEN
152 DO i = 1,
SIZE(rho_struct%tau_r)
153 CALL rho_struct%tau_r(i)%release()
155 DEALLOCATE (rho_struct%tau_r)
157 IF (
ASSOCIATED(rho_struct%rho_g))
THEN
158 DO i = 1,
SIZE(rho_struct%rho_g)
159 CALL rho_struct%rho_g(i)%release()
161 DEALLOCATE (rho_struct%rho_g)
163 IF (
ASSOCIATED(rho_struct%tau_g))
THEN
164 DO i = 1,
SIZE(rho_struct%tau_g)
165 CALL rho_struct%tau_g(i)%release()
167 DEALLOCATE (rho_struct%tau_g)
169 IF (
ASSOCIATED(rho_struct%rho_r_sccs))
THEN
170 CALL rho_struct%rho_r_sccs%release()
171 DEALLOCATE (rho_struct%rho_r_sccs)
178 IF (
ASSOCIATED(rho_struct%tot_rho_r)) &
179 DEALLOCATE (rho_struct%tot_rho_r)
180 IF (
ASSOCIATED(rho_struct%tot_rho_g)) &
181 DEALLOCATE (rho_struct%tot_rho_g)
191 TYPE(qs_rho_type),
INTENT(INOUT) :: rho_struct
193 rho_struct%rho_ao = kpoint_transitional_type()
225 SUBROUTINE qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, &
226 rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, &
227 drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, &
228 rho_r_sccs, soft_valid, complex_rho_ao)
229 TYPE(qs_rho_type),
INTENT(IN) :: rho_struct
230 TYPE(dbcsr_p_type),
DIMENSION(:),
OPTIONAL, &
231 POINTER :: rho_ao, rho_ao_im
232 TYPE(dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL, &
233 POINTER :: rho_ao_kp, rho_ao_im_kp
234 TYPE(pw_r3d_rs_type),
DIMENSION(:),
OPTIONAL, &
236 TYPE(pw_r3d_rs_type),
DIMENSION(:, :),
OPTIONAL, &
238 TYPE(pw_c1d_gs_type),
DIMENSION(:),
OPTIONAL, &
240 TYPE(pw_c1d_gs_type),
DIMENSION(:, :),
OPTIONAL, &
242 TYPE(pw_r3d_rs_type),
DIMENSION(:),
OPTIONAL, &
244 TYPE(pw_c1d_gs_type),
DIMENSION(:),
OPTIONAL, &
246 LOGICAL,
INTENT(out),
OPTIONAL :: rho_r_valid, drho_r_valid, rho_g_valid, &
247 drho_g_valid, tau_r_valid, tau_g_valid
248 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: tot_rho_r, tot_rho_g
249 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: rho_r_sccs
250 LOGICAL,
INTENT(out),
OPTIONAL :: soft_valid, complex_rho_ao
253 IF (
PRESENT(rho_ao_kp)) rho_ao_kp =>
get_2d_pointer(rho_struct%rho_ao)
255 IF (
PRESENT(rho_ao_im)) rho_ao_im =>
get_1d_pointer(rho_struct%rho_ao_im)
256 IF (
PRESENT(rho_ao_im_kp)) rho_ao_im_kp =>
get_2d_pointer(rho_struct%rho_ao_im)
258 IF (
PRESENT(rho_r)) rho_r => rho_struct%rho_r
259 IF (
PRESENT(drho_r)) drho_r => rho_struct%drho_r
260 IF (
PRESENT(rho_g)) rho_g => rho_struct%rho_g
261 IF (
PRESENT(drho_g)) drho_g => rho_struct%drho_g
262 IF (
PRESENT(tau_r)) tau_r => rho_struct%tau_r
263 IF (
PRESENT(tau_g)) tau_g => rho_struct%tau_g
264 IF (
PRESENT(rho_r_valid)) rho_r_valid = rho_struct%rho_r_valid
265 IF (
PRESENT(rho_g_valid)) rho_g_valid = rho_struct%rho_g_valid
266 IF (
PRESENT(drho_r_valid)) drho_r_valid = rho_struct%drho_r_valid
267 IF (
PRESENT(drho_g_valid)) drho_g_valid = rho_struct%drho_g_valid
268 IF (
PRESENT(tau_r_valid)) tau_r_valid = rho_struct%tau_r_valid
269 IF (
PRESENT(tau_g_valid)) tau_g_valid = rho_struct%tau_g_valid
270 IF (
PRESENT(soft_valid)) soft_valid = rho_struct%soft_valid
271 IF (
PRESENT(tot_rho_r)) tot_rho_r => rho_struct%tot_rho_r
272 IF (
PRESENT(tot_rho_g)) tot_rho_g => rho_struct%tot_rho_g
273 IF (
PRESENT(rho_r_sccs)) rho_r_sccs => rho_struct%rho_r_sccs
274 IF (
PRESENT(complex_rho_ao)) complex_rho_ao = rho_struct%complex_rho_ao
304 SUBROUTINE qs_rho_set(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, &
305 rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, &
306 drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, &
307 rho_r_sccs, soft_valid, complex_rho_ao)
308 TYPE(qs_rho_type),
INTENT(INOUT) :: rho_struct
309 TYPE(dbcsr_p_type),
DIMENSION(:),
OPTIONAL, &
310 POINTER :: rho_ao, rho_ao_im
311 TYPE(dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL, &
312 POINTER :: rho_ao_kp, rho_ao_im_kp
313 TYPE(pw_r3d_rs_type),
DIMENSION(:),
OPTIONAL, &
315 TYPE(pw_r3d_rs_type),
DIMENSION(:, :),
OPTIONAL, &
317 TYPE(pw_c1d_gs_type),
DIMENSION(:),
OPTIONAL, &
319 TYPE(pw_c1d_gs_type),
DIMENSION(:, :),
OPTIONAL, &
321 TYPE(pw_r3d_rs_type),
DIMENSION(:),
OPTIONAL, &
323 TYPE(pw_c1d_gs_type),
DIMENSION(:),
OPTIONAL, &
325 LOGICAL,
INTENT(in),
OPTIONAL :: rho_r_valid, drho_r_valid, rho_g_valid, &
326 drho_g_valid, tau_r_valid, tau_g_valid
327 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: tot_rho_r, tot_rho_g
328 TYPE(pw_r3d_rs_type),
OPTIONAL,
POINTER :: rho_r_sccs
329 LOGICAL,
INTENT(in),
OPTIONAL :: soft_valid, complex_rho_ao
331 IF (
PRESENT(rho_ao))
CALL set_1d_pointer(rho_struct%rho_ao, rho_ao)
332 IF (
PRESENT(rho_ao_kp))
CALL set_2d_pointer(rho_struct%rho_ao, rho_ao_kp)
334 IF (
PRESENT(rho_ao_im))
CALL set_1d_pointer(rho_struct%rho_ao_im, rho_ao_im)
335 IF (
PRESENT(rho_ao_im_kp))
CALL set_2d_pointer(rho_struct%rho_ao_im, rho_ao_im_kp)
337 IF (
PRESENT(rho_r)) rho_struct%rho_r => rho_r
338 IF (
PRESENT(rho_g)) rho_struct%rho_g => rho_g
339 IF (
PRESENT(drho_r)) rho_struct%drho_r => drho_r
340 IF (
PRESENT(drho_g)) rho_struct%drho_g => drho_g
341 IF (
PRESENT(tau_r)) rho_struct%tau_r => tau_r
342 IF (
PRESENT(tau_g)) rho_struct%tau_g => tau_g
343 IF (
PRESENT(rho_r_valid)) rho_struct%rho_r_valid = rho_r_valid
344 IF (
PRESENT(rho_g_valid)) rho_struct%rho_g_valid = rho_g_valid
345 IF (
PRESENT(drho_r_valid)) rho_struct%drho_r_valid = drho_r_valid
346 IF (
PRESENT(drho_g_valid)) rho_struct%drho_g_valid = drho_g_valid
347 IF (
PRESENT(tau_r_valid)) rho_struct%tau_r_valid = tau_r_valid
348 IF (
PRESENT(tau_g_valid)) rho_struct%tau_g_valid = tau_g_valid
349 IF (
PRESENT(soft_valid)) rho_struct%soft_valid = soft_valid
350 IF (
PRESENT(tot_rho_r)) rho_struct%tot_rho_r => tot_rho_r
351 IF (
PRESENT(tot_rho_g)) rho_struct%tot_rho_g => tot_rho_g
352 IF (
PRESENT(rho_r_sccs)) rho_struct%rho_r_sccs => rho_r_sccs
353 IF (
PRESENT(complex_rho_ao)) rho_struct%complex_rho_ao = complex_rho_ao
362 TYPE(qs_rho_type),
INTENT(INOUT) :: rho_struct
363 TYPE(pw_pool_type),
INTENT(IN),
POINTER :: auxbas_pw_pool
367 IF (
ASSOCIATED(rho_struct%rho_r))
THEN
368 DO i = 1,
SIZE(rho_struct%rho_r)
369 CALL auxbas_pw_pool%give_back_pw(rho_struct%rho_r(i))
371 DEALLOCATE (rho_struct%rho_r)
372 NULLIFY (rho_struct%rho_r)
374 IF (
ASSOCIATED(rho_struct%rho_g))
THEN
375 DO i = 1,
SIZE(rho_struct%rho_g)
376 CALL auxbas_pw_pool%give_back_pw(rho_struct%rho_g(i))
378 DEALLOCATE (rho_struct%rho_g)
379 NULLIFY (rho_struct%rho_g)
Defines the basic variable types.
integer, parameter, public dp
Datatype to translate between k-points (2d) and gamma-point (1d) code.
type(dbcsr_p_type) function, dimension(:), pointer, public get_1d_pointer(this)
Smart getter, raises an error when called during a k-point calculation.
type(dbcsr_p_type) function, dimension(:, :), pointer, public get_2d_pointer(this)
Simple getter, needed because of PRIVATE.
subroutine, public kpoint_transitional_release(this)
Release the matrix set, using the right pointer.
subroutine, public set_1d_pointer(this, ptr_1d)
Assigns a 1D pointer.
subroutine, public set_2d_pointer(this, ptr_2d)
Assigns a 2D pointer.
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
...
subroutine, public qs_rho_clear_pwpool(rho_struct, auxbas_pw_pool)
...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
subroutine, public qs_rho_unset_rho_ao(rho_struct)
Unsets the rho_ao / rho_ao_kp field without calling kpoint_transitional_release().
subroutine, public qs_rho_create(rho)
Allocates a new instance of rho.
subroutine, public qs_rho_clear(rho_struct)
Deallocates all components, without deallocating rho_struct itself.
subroutine, public qs_rho_release(rho_struct)
releases a rho_struct by decreasing the reference count by one and deallocating if it reaches 0 (to b...