(git:f2099e5)
Loading...
Searching...
No Matches
accint_weights_forces.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief
10!> \author JGH (01.2026)
11! **************************************************************************************************
16 USE cell_types, ONLY: cell_type,&
17 pbc
20 USE grid_api, ONLY: grid_func_ab,&
23 USE input_constants, ONLY: sic_none,&
27 USE kinds, ONLY: dp
29 USE orbital_pointers, ONLY: coset,&
30 ncoset
32 USE pw_env_types, ONLY: pw_env_get,&
34 USE pw_grids, ONLY: pw_grid_compare
35 USE pw_methods, ONLY: pw_axpy,&
37 pw_scale,&
40 USE pw_pool_types, ONLY: pw_pool_p_type,&
42 USE pw_types, ONLY: pw_c1d_gs_type,&
47 USE qs_fxc, ONLY: qs_fxc_create
51 USE qs_rho_types, ONLY: qs_rho_get,&
63 USE virial_types, ONLY: virial_type
64 USE xc, ONLY: xc_exc_pw_create,&
68#include "./base/base_uses.f90"
69
70 IMPLICIT NONE
71
72 PRIVATE
73
74 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .false.
75
76 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'accint_weights_forces'
77
79
80CONTAINS
81
82! **************************************************************************************************
83!> \brief ...
84!> \param qs_env ...
85!> \param rho ...
86!> \param rho1 ...
87!> \param order ...
88!> \param xc_section ...
89!> \param triplet ...
90!> \param force_scale ...
91! **************************************************************************************************
92 SUBROUTINE accint_weight_force(qs_env, rho, rho1, order, xc_section, triplet, force_scale)
93 TYPE(qs_environment_type), POINTER :: qs_env
94 TYPE(qs_rho_type), POINTER :: rho, rho1
95 INTEGER, INTENT(IN) :: order
96 TYPE(section_vals_type), POINTER :: xc_section
97 LOGICAL, INTENT(IN), OPTIONAL :: triplet
98 REAL(kind=dp), INTENT(IN), OPTIONAL :: force_scale
99
100 CHARACTER(len=*), PARAMETER :: routinen = 'accint_weight_force'
101
102 INTEGER :: atom_a, handle, i, iatom, ikind, natom, &
103 natom_of_kind, nkind, ounit, oweight
104 INTEGER, DIMENSION(:), POINTER :: atom_list
105 LOGICAL :: composite_reference, lr_triplet, &
106 native_grid_diagnostics, &
107 native_skala_grid, uf_grid, use_virial
108 REAL(kind=dp) :: my_force_scale
109 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: calpha, cvalue
110 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: aforce
111 REAL(kind=dp), DIMENSION(3) :: tforce
112 REAL(kind=dp), DIMENSION(3, 3) :: avirial
113 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
114 TYPE(dft_control_type), POINTER :: dft_control
115 TYPE(mp_para_env_type), POINTER :: para_env
116 TYPE(pw_env_type), POINTER :: pw_env
117 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool, xc_pw_pool
118 TYPE(pw_r3d_rs_type) :: e_force_rspace, e_rspace
119 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
120 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
121 TYPE(qs_ks_env_type), POINTER :: ks_env
122 TYPE(virial_type), POINTER :: virial
123
124 CALL timeset(routinen, handle)
125
126 CALL get_qs_env(qs_env, dft_control=dft_control, qs_kind_set=qs_kind_set)
127
128 ! Composite references replace the PW XC quadrature and its Gaussian weight derivative.
129 ! The public selector applies only when a pseudopotential kind actually uses PAW one-center
130 ! data; it must not change all-electron GAPW integration.
131 composite_reference = native_skala_gapw_composite_reference(xc_section) .OR. &
133 IF (.NOT. composite_reference) THEN
134 composite_reference = skala_gapw_representation(xc_section) == &
137 END IF
138 IF (.NOT. composite_reference .AND. xc_section_uses_native_skala_grid(xc_section)) THEN
139 composite_reference = native_skala_uses_atom_composite_grid(xc_section)
140 END IF
141 IF (composite_reference) THEN
142 CALL timestop(handle)
143 RETURN
144 END IF
145
146 IF (dft_control%qs_control%gapw_control%accurate_xcint) THEN
147
148 CALL get_qs_env(qs_env=qs_env, force=force, virial=virial)
149 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
150
152
153 CALL get_qs_env(qs_env, natom=natom, nkind=nkind)
154 ALLOCATE (aforce(3, natom))
155 ALLOCATE (calpha(nkind), cvalue(nkind))
156 cvalue = 1.0_dp
157 calpha(1:nkind) = dft_control%qs_control%gapw_control%aw(1:nkind)
158 oweight = dft_control%qs_control%gapw_control%oweights
159
160 CALL get_qs_env(qs_env, ks_env=ks_env, pw_env=pw_env)
161 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, xc_pw_pool=xc_pw_pool)
162 uf_grid = .NOT. pw_grid_compare(auxbas_pw_pool%pw_grid, xc_pw_pool%pw_grid)
163 IF (uf_grid) THEN
164 CALL xc_pw_pool%create_pw(e_rspace)
165 ELSE
166 CALL auxbas_pw_pool%create_pw(e_rspace)
167 END IF
168
169 lr_triplet = .false.
170 IF (PRESENT(triplet)) lr_triplet = triplet
171 my_force_scale = 1.0_dp
172 IF (PRESENT(force_scale)) my_force_scale = force_scale
173
174 CALL xc_density(qs_env, rho, rho1, order, xc_section, lr_triplet, e_rspace)
175
176 IF (uf_grid) THEN
177 CALL auxbas_pw_pool%create_pw(e_force_rspace)
178 block
179 TYPE(pw_c1d_gs_type) :: e_g_aux, e_g_xc
180 CALL xc_pw_pool%create_pw(e_g_xc)
181 CALL auxbas_pw_pool%create_pw(e_g_aux)
182 CALL pw_transfer(e_rspace, e_g_xc)
183 CALL pw_transfer(e_g_xc, e_g_aux)
184 CALL pw_transfer(e_g_aux, e_force_rspace)
185 CALL auxbas_pw_pool%give_back_pw(e_g_aux)
186 CALL xc_pw_pool%give_back_pw(e_g_xc)
187 END block
188 CALL pw_scale(e_force_rspace, e_force_rspace%pw_grid%dvol)
189 ! integrate energy field to get force
190 CALL gauss_grid_force(e_force_rspace, qs_env, oweight, calpha, cvalue, aforce, avirial)
191 !
192 CALL auxbas_pw_pool%give_back_pw(e_force_rspace)
193 ELSE
194 CALL pw_scale(e_rspace, e_rspace%pw_grid%dvol)
195 CALL gauss_grid_force(e_rspace, qs_env, oweight, calpha, cvalue, aforce, avirial)
196 END IF
197
198 IF (uf_grid) THEN
199 CALL xc_pw_pool%give_back_pw(e_rspace)
200 ELSE
201 CALL auxbas_pw_pool%give_back_pw(e_rspace)
202 END IF
203
204 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set)
205 native_skala_grid = xc_section_uses_native_skala_grid(xc_section)
206 native_grid_diagnostics = .false.
207 IF (native_skala_grid) THEN
208 CALL section_vals_val_get(xc_section, "XC_FUNCTIONAL%GAUXC%NATIVE_GRID_DIAGNOSTICS", &
209 l_val=native_grid_diagnostics)
210 END IF
211 DO ikind = 1, nkind
212 CALL get_atomic_kind(atomic_kind_set(ikind), natom=natom_of_kind, atom_list=atom_list)
213 DO iatom = 1, natom_of_kind
214 atom_a = atom_list(iatom)
215 IF (native_grid_diagnostics) THEN
216 IF (ounit > 0) THEN
217 WRITE (unit=ounit, fmt="(T2,A,1X,I0,3(1X,ES20.12))") &
218 "SKALA_GPW| Accurate-XCINT atom force", atom_a, my_force_scale*aforce(:, atom_a)
219 END IF
220 END IF
221 force(ikind)%rho_elec(1:3, iatom) = &
222 force(ikind)%rho_elec(1:3, iatom) + my_force_scale*aforce(1:3, atom_a)
223 END DO
224 END DO
225 IF (use_virial) THEN
226 virial%pv_exc = virial%pv_exc + my_force_scale*avirial
227 virial%pv_virial = virial%pv_virial + my_force_scale*avirial
228 END IF
229
230 IF (debug_this_module) THEN
231 CALL get_qs_env(qs_env, para_env=para_env)
232 CALL para_env%sum(aforce)
233 IF (ounit > 0) THEN
234 WRITE (unit=ounit, fmt="(/,T2,A)") "ACCINT| Debug Accurate-XCINT atom force [a.u.]"
235 DO i = 1, 3
236 tforce(i) = my_force_scale*sum(aforce(i, :))
237 END DO
238 DO iatom = 1, natom
239 WRITE (unit=ounit, fmt="(T2,A,1X,I0,T24,3(1X,F18.12))") &
240 "ACCINT| ", iatom, my_force_scale*aforce(1:3, iatom)
241 END DO
242 WRITE (unit=ounit, fmt="(T2,A,T24,3(1X,F18.12))") &
243 "ACCINT| Total force ", tforce(1:3)
244 END IF
245 IF (use_virial) THEN
246 CALL para_env%sum(avirial)
247 IF (ounit > 0) THEN
248 WRITE (unit=ounit, fmt="(/,T2,A)") "ACCINT| Debug Accurate-XCINT virial"
249 DO i = 1, 3
250 WRITE (unit=ounit, fmt="(T2,A,T24,3(1X,F18.8))") &
251 "ACCINT| [a.u.] ", my_force_scale*avirial(i, 1:3)
252 END DO
253 END IF
254 END IF
255 END IF
256
257 DEALLOCATE (aforce, calpha, cvalue)
258
259 END IF
260
261 CALL timestop(handle)
262
263 END SUBROUTINE accint_weight_force
264
265! **************************************************************************************************
266!> \brief computes the forces/virial due to atomic centered Gaussian functions
267!> \param e_rspace Energy density
268!> \param qs_env ...
269!> \param order ...
270!> \param calpha ...
271!> \param cvalue ...
272!> \param aforce ...
273!> \param avirial ...
274! **************************************************************************************************
275 SUBROUTINE gauss_grid_force(e_rspace, qs_env, order, calpha, cvalue, aforce, avirial)
276 TYPE(pw_r3d_rs_type), INTENT(IN) :: e_rspace
277 TYPE(qs_environment_type), POINTER :: qs_env
278 INTEGER, INTENT(IN) :: order
279 REAL(kind=dp), DIMENSION(:), INTENT(IN) :: calpha, cvalue
280 REAL(kind=dp), DIMENSION(:, :), INTENT(OUT) :: aforce
281 REAL(kind=dp), DIMENSION(3, 3), INTENT(OUT) :: avirial
282
283 CHARACTER(len=*), PARAMETER :: routinen = 'gauss_grid_force'
284
285 INTEGER :: atom_a, handle, iatom, igrid, ikind, j, &
286 natom_of_kind, ni, npme, on
287 INTEGER, ALLOCATABLE, DIMENSION(:) :: cores
288 INTEGER, DIMENSION(:), POINTER :: atom_list
289 LOGICAL :: use_virial
290 REAL(kind=dp) :: alpha, eps_rho_rspace, radius
291 REAL(kind=dp), DIMENSION(3) :: force_a, force_b, ra
292 REAL(kind=dp), DIMENSION(3, 3) :: my_virial_a, my_virial_b
293 REAL(kind=dp), DIMENSION(:, :), POINTER :: hab, pab
294 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
295 TYPE(cell_type), POINTER :: cell
296 TYPE(dft_control_type), POINTER :: dft_control
297 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
298 TYPE(pw_env_type), POINTER :: pw_env
299 TYPE(pw_pool_p_type), DIMENSION(:), POINTER :: pw_pools
300 TYPE(realspace_grid_type), DIMENSION(:), POINTER :: rs_grids
301 TYPE(realspace_grid_type), POINTER :: rs_v
302
303 CALL timeset(routinen, handle)
304
305 on = 2*order
306 ni = ncoset(on)
307 ALLOCATE (hab(ni, 1))
308 ALLOCATE (pab(ni, 1))
309
310 NULLIFY (pw_pools, rs_grids, rs_v)
311
312 CALL get_qs_env(qs_env, pw_env=pw_env)
313 CALL pw_env_get(pw_env, pw_pools=pw_pools, rs_grids=rs_grids)
314 DO igrid = 1, SIZE(pw_pools)
315 IF (pw_grid_compare(e_rspace%pw_grid, pw_pools(igrid)%pool%pw_grid)) THEN
316 rs_v => rs_grids(igrid)
317 EXIT
318 END IF
319 END DO
320 IF (.NOT. ASSOCIATED(rs_v)) THEN
321 cpabort("No realspace grid for Accurate-XCINT weight force")
322 END IF
323
324 CALL transfer_pw2rs(rs_v, e_rspace)
325
326 CALL get_qs_env(qs_env, &
327 atomic_kind_set=atomic_kind_set, &
328 cell=cell, &
329 dft_control=dft_control, &
330 particle_set=particle_set)
331
332 use_virial = .true.
333 avirial = 0.0_dp
334 aforce = 0.0_dp
335
336 eps_rho_rspace = dft_control%qs_control%eps_rho_rspace
337
338 DO ikind = 1, SIZE(atomic_kind_set)
339
340 alpha = calpha(ikind)
341 IF (alpha == 0.0_dp) cycle
342
343 CALL get_atomic_kind(atomic_kind_set(ikind), natom=natom_of_kind, atom_list=atom_list)
344
345 CALL set_polynom_coefs(pab(:, 1), order, alpha)
346 pab(:, 1) = -cvalue(ikind)*pab(:, 1)
347
348 ALLOCATE (cores(natom_of_kind))
349 npme = 0
350 cores = 0
351
352 DO iatom = 1, natom_of_kind
353 atom_a = atom_list(iatom)
354 ra(:) = pbc(particle_set(atom_a)%r, cell)
355 IF (rs_v%desc%parallel .AND. .NOT. rs_v%desc%distributed) THEN
356 ! replicated realspace grid, split the atoms up between procs
357 IF (modulo(iatom, rs_v%desc%group_size) == rs_v%desc%my_pos) THEN
358 npme = npme + 1
359 cores(npme) = iatom
360 END IF
361 ELSE
362 npme = npme + 1
363 cores(npme) = iatom
364 END IF
365 END DO
366
367 DO j = 1, npme
368
369 iatom = cores(j)
370 atom_a = atom_list(iatom)
371 ra(:) = pbc(particle_set(atom_a)%r, cell)
372 hab(:, 1) = 0.0_dp
373 force_a(:) = 0.0_dp
374 force_b(:) = 0.0_dp
375 my_virial_a = 0.0_dp
376 my_virial_b = 0.0_dp
377
378 radius = exp_radius_very_extended(la_min=0, la_max=on, lb_min=0, lb_max=0, &
379 ra=ra, rb=ra, rp=ra, &
380 zetp=alpha, eps=eps_rho_rspace, &
381 pab=pab, o1=0, o2=0, &
382 prefactor=1.0_dp, cutoff=1.0_dp)
383
384 CALL integrate_pgf_product(on, alpha, 0, &
385 0, 0.0_dp, 0, ra, [0.0_dp, 0.0_dp, 0.0_dp], &
386 rs_v, hab, pab=pab, o1=0, o2=0, &
387 radius=radius, &
388 calculate_forces=.true., force_a=force_a, &
389 force_b=force_b, use_virial=use_virial, my_virial_a=my_virial_a, &
390 my_virial_b=my_virial_b, use_subpatch=.true., subpatch_pattern=0)
391
392 aforce(1:3, atom_a) = aforce(1:3, atom_a) + force_a(1:3)
393 avirial = avirial + my_virial_a
394
395 END DO
396 DEALLOCATE (cores)
397
398 END DO
399
400 DEALLOCATE (hab, pab)
401
402 CALL timestop(handle)
403
404 END SUBROUTINE gauss_grid_force
405
406! **************************************************************************************************
407!> \brief computes the weight function on the PW grid
408!> \param rho_core ...
409!> \param qs_env ...
410!> \param order ...
411!> \param calpha ...
412!> \param ccore ...
413! **************************************************************************************************
414 SUBROUTINE weight_function_pwgrid(rho_core, qs_env, order, calpha, ccore)
415 TYPE(pw_r3d_rs_type), INTENT(INOUT) :: rho_core
416 TYPE(qs_environment_type), POINTER :: qs_env
417 INTEGER, INTENT(IN) :: order
418 REAL(kind=dp), DIMENSION(:) :: calpha, ccore
419
420 CHARACTER(len=*), PARAMETER :: routinen = 'weight_function_pwgrid'
421
422 INTEGER :: atom_a, handle, iatom, ikind, ithread, &
423 j, natom, ni, npme, nthread, on, &
424 subpatch_pattern
425 INTEGER, ALLOCATABLE, DIMENSION(:) :: cores
426 INTEGER, DIMENSION(:), POINTER :: atom_list
427 REAL(kind=dp) :: alpha, eps_rho_rspace, radius
428 REAL(kind=dp), DIMENSION(3) :: ra
429 REAL(kind=dp), DIMENSION(:, :), POINTER :: pab
430 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
431 TYPE(cell_type), POINTER :: cell
432 TYPE(dft_control_type), POINTER :: dft_control
433 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
434 TYPE(pw_env_type), POINTER :: pw_env
435 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool
436 TYPE(pw_r3d_rs_type) :: rhoc_r
437 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
438 TYPE(realspace_grid_type), POINTER :: rs_rho
439
440 CALL timeset(routinen, handle)
441
442 on = 2*order
443 ni = ncoset(on)
444 ALLOCATE (pab(ni, 1))
445
446 CALL get_qs_env(qs_env=qs_env, &
447 atomic_kind_set=atomic_kind_set, &
448 qs_kind_set=qs_kind_set, &
449 cell=cell, &
450 dft_control=dft_control, &
451 particle_set=particle_set, &
452 pw_env=pw_env)
453 CALL pw_env_get(pw_env, auxbas_rs_grid=rs_rho, &
454 auxbas_pw_pool=auxbas_pw_pool)
455 ! be careful in parallel nsmax is chosen with multigrid in mind!
456 CALL rs_grid_zero(rs_rho)
457
458 eps_rho_rspace = dft_control%qs_control%eps_rho_rspace
459
460 DO ikind = 1, SIZE(atomic_kind_set)
461 alpha = calpha(ikind)
462 IF (alpha == 0.0_dp) cycle
463
464 CALL get_atomic_kind(atomic_kind_set(ikind), natom=natom, atom_list=atom_list)
465
466 CALL set_polynom_coefs(pab(:, 1), order, alpha)
467 pab(:, 1) = ccore(ikind)*pab(:, 1)
468
469 nthread = 1
470 ithread = 0
471
472 ALLOCATE (cores(natom))
473 npme = 0
474 cores = 0
475
476 DO iatom = 1, natom
477 IF (rs_rho%desc%parallel .AND. .NOT. rs_rho%desc%distributed) THEN
478 ! replicated realspace grid, split the atoms up between procs
479 IF (modulo(iatom, rs_rho%desc%group_size) == rs_rho%desc%my_pos) THEN
480 npme = npme + 1
481 cores(npme) = iatom
482 END IF
483 ELSE
484 npme = npme + 1
485 cores(npme) = iatom
486 END IF
487 END DO
488
489 IF (npme > 0) THEN
490 DO j = 1, npme
491
492 iatom = cores(j)
493 atom_a = atom_list(iatom)
494 ra(:) = pbc(particle_set(atom_a)%r, cell)
495 subpatch_pattern = 0
496 radius = exp_radius_very_extended(la_min=0, la_max=on, &
497 lb_min=0, lb_max=0, &
498 ra=ra, rb=ra, rp=ra, &
499 zetp=alpha, eps=eps_rho_rspace, &
500 pab=pab, o1=0, o2=0, & ! without map_consistent
501 prefactor=-1.0_dp, cutoff=0.0_dp)
502
503 CALL collocate_pgf_product(on, alpha, 0, 0, 0.0_dp, 0, ra, &
504 [0.0_dp, 0.0_dp, 0.0_dp], -1.0_dp, pab, 0, 0, rs_rho, &
505 radius=radius, ga_gb_function=grid_func_ab, &
506 use_subpatch=.true., subpatch_pattern=subpatch_pattern)
507
508 END DO
509 END IF
510 DEALLOCATE (cores)
511
512 END DO
513
514 DEALLOCATE (pab)
515
516 CALL auxbas_pw_pool%create_pw(rhoc_r)
517
518 CALL transfer_rs2pw(rs_rho, rhoc_r)
519
520 CALL pw_transfer(rhoc_r, rho_core)
521
522 CALL auxbas_pw_pool%give_back_pw(rhoc_r)
523
524 CALL timestop(handle)
525
526 END SUBROUTINE weight_function_pwgrid
527
528! **************************************************************************************************
529!> \brief Set the prefactor coefficients for the expansion of the radial weight function in
530!> cartesian spherical harmonics
531!> \param pf output coefficients
532!> \param order ...
533!> \param alpha ...
534! **************************************************************************************************
535 SUBROUTINE set_polynom_coefs(pf, order, alpha)
536 REAL(kind=dp), DIMENSION(:), INTENT(OUT) :: pf
537 INTEGER, INTENT(IN) :: order
538 REAL(kind=dp), INTENT(IN) :: alpha
539
540 INTEGER :: i
541 REAL(kind=dp) :: ap
542
543 pf(:) = 0.0_dp
544
545 DO i = 0, order
546 SELECT CASE (i)
547 CASE (0)
548 pf(1) = 1.0_dp
549 CASE (1)
550 ap = alpha
551 pf(coset(2, 0, 0)) = ap
552 pf(coset(0, 2, 0)) = ap
553 pf(coset(0, 0, 2)) = ap
554 CASE (2)
555 ap = alpha**2/2.0_dp
556 pf(coset(4, 0, 0)) = ap
557 pf(coset(0, 4, 0)) = ap
558 pf(coset(0, 0, 4)) = ap
559 pf(coset(2, 2, 0)) = 2._dp*ap
560 pf(coset(2, 0, 2)) = 2._dp*ap
561 pf(coset(0, 2, 2)) = 2._dp*ap
562 CASE (3)
563 ap = alpha**3/6.0_dp
564 pf(coset(6, 0, 0)) = ap
565 pf(coset(0, 6, 0)) = ap
566 pf(coset(0, 0, 6)) = ap
567 pf(coset(4, 2, 0)) = 3._dp*ap
568 pf(coset(4, 0, 2)) = 3._dp*ap
569 pf(coset(2, 4, 0)) = 3._dp*ap
570 pf(coset(2, 0, 4)) = 3._dp*ap
571 pf(coset(0, 4, 2)) = 3._dp*ap
572 pf(coset(0, 2, 4)) = 3._dp*ap
573 pf(coset(2, 2, 2)) = 6._dp*ap
574 CASE DEFAULT
575 CALL cp_abort(__location__, &
576 "Only 0, 1, 2, 3 are supported as the "// &
577 "polynomial order value in accuarte XC integration.")
578 END SELECT
579 END DO
580
581 END SUBROUTINE set_polynom_coefs
582
583! **************************************************************************************************
584!> \brief calculates the XC density:
585!> order=0: exc will contain the xc energy density E_xc(r)
586!> order=1: exc will contain V_xc(r) * rho1(r)
587!> order=2: exc will contain F_xc(r) * rho1(r) * rho1(r)
588!>
589!> Note that possible nl-vdW functionals are not included int the accurate integration scheme
590!>
591!> \param qs_env to get all the needed things
592!> \param rho_struct density
593!> \param rho1_struct response density
594!> \param order requested derivative order
595!> \param xc_section ...
596!> \param triplet ...
597!> \param exc Output energy density on working grid (!)
598!> \author JGH
599! **************************************************************************************************
600 SUBROUTINE xc_density(qs_env, rho_struct, rho1_struct, order, xc_section, triplet, exc)
601
602 TYPE(qs_environment_type), POINTER :: qs_env
603 TYPE(qs_rho_type), POINTER :: rho_struct, rho1_struct
604 INTEGER, INTENT(IN) :: order
605 TYPE(section_vals_type), POINTER :: xc_section
606 LOGICAL, INTENT(IN) :: triplet
607 TYPE(pw_r3d_rs_type) :: exc
608
609 CHARACTER(len=*), PARAMETER :: routinen = 'xc_density'
610
611 INTEGER :: handle, ispin, myfun, nspins
612 LOGICAL :: native_skala_grid, rho1_g_valid, &
613 rho_g_valid, tau1_valid, tau_valid, &
614 uf_grid
615 REAL(kind=dp) :: excint, factor
616 REAL(kind=dp), DIMENSION(3, 3) :: vdum
617 TYPE(cell_type), POINTER :: cell
618 TYPE(dft_control_type), POINTER :: dft_control
619 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
620 TYPE(pw_c1d_gs_type), DIMENSION(:), POINTER :: rho1_g, rho1_g_xc, rho_g, rho_g_xc
621 TYPE(pw_c1d_gs_type), POINTER :: rho_nlcc_g
622 TYPE(pw_env_type), POINTER :: pw_env
623 TYPE(pw_pool_type), POINTER :: auxbas_pw_pool, xc_pw_pool
624 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho1_r, rho1_r_xc, rho_r, rho_r_xc, &
625 tau1_r, tau1_r_xc, tau_r, tau_r_xc, &
626 vxc_rho, vxc_tau
627 TYPE(pw_r3d_rs_type), POINTER :: rho_nlcc, weights
628 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho0_atom_set, rho1_atom_set
629
630 CALL timeset(routinen, handle)
631
632 cpassert(ASSOCIATED(rho_struct))
633 IF (order > 0) THEN
634 cpassert(ASSOCIATED(rho1_struct))
635 END IF
636
637 ! we always get true exc (not integration weighted)
638 CALL get_qs_env(qs_env, &
639 dft_control=dft_control, &
640 pw_env=pw_env, &
641 cell=cell, &
642 particle_set=particle_set, &
643 rho_nlcc=rho_nlcc, &
644 rho_nlcc_g=rho_nlcc_g)
645
646 nspins = dft_control%nspins
647 cpassert(dft_control%sic_method_id == sic_none)
648
649 CALL section_vals_val_get(xc_section, "XC_FUNCTIONAL%_SECTION_PARAMETERS_", i_val=myfun)
650 native_skala_grid = xc_section_uses_native_skala_grid(xc_section)
651
652 CALL pw_zero(exc)
653
654 IF (myfun /= xc_none) THEN
655 NULLIFY (weights)
656
657 NULLIFY (rho_r, rho_g, tau_r)
658 CALL qs_rho_get(rho_struct, rho_r=rho_r, rho_g=rho_g, tau_r=tau_r, &
659 rho_g_valid=rho_g_valid, tau_r_valid=tau_valid)
660
661 CALL pw_env_get(pw_env, xc_pw_pool=xc_pw_pool, auxbas_pw_pool=auxbas_pw_pool)
662 uf_grid = .NOT. pw_grid_compare(auxbas_pw_pool%pw_grid, xc_pw_pool%pw_grid)
663
664 ! add the nlcc densities
665 IF (ASSOCIATED(rho_nlcc) .AND. order <= 1) THEN
666 factor = 1.0_dp
667 DO ispin = 1, nspins
668 CALL pw_axpy(rho_nlcc, rho_r(ispin), factor)
669 CALL pw_axpy(rho_nlcc_g, rho_g(ispin), factor)
670 END DO
671 END IF
672
673 NULLIFY (rho_r_xc, rho_g_xc, tau_r_xc)
674 IF (uf_grid .AND. order <= 1) THEN
675 IF (rho_g_valid) THEN
676 CALL create_density_on_pool(xc_pw_pool, rho_g, rho_r_xc, rho_g_xc)
677 ELSE
678 CALL create_density_on_pool_from_r(auxbas_pw_pool, xc_pw_pool, rho_r, rho_r_xc, rho_g_xc)
679 END IF
680 IF (tau_valid) THEN
681 CALL create_density_on_pool_from_r(auxbas_pw_pool, xc_pw_pool, tau_r, tau_r_xc)
682 END IF
683 ELSE
684 rho_r_xc => rho_r
685 rho_g_xc => rho_g
686 tau_r_xc => tau_r
687 END IF
688
689 NULLIFY (rho1_r_xc, rho1_g_xc, tau1_r_xc)
690 IF (order >= 1) THEN
691 CALL qs_rho_get(rho1_struct, rho_r=rho1_r, rho_g=rho1_g, tau_r=tau1_r, &
692 rho_g_valid=rho1_g_valid, tau_r_valid=tau1_valid)
693 IF (uf_grid) THEN
694 IF (rho1_g_valid) THEN
695 CALL create_density_on_pool(xc_pw_pool, rho1_g, rho1_r_xc, rho1_g_xc)
696 ELSE
697 CALL create_density_on_pool_from_r(auxbas_pw_pool, xc_pw_pool, rho1_r, rho1_r_xc, rho1_g_xc)
698 END IF
699 IF (tau1_valid) THEN
700 CALL create_density_on_pool_from_r(auxbas_pw_pool, xc_pw_pool, tau1_r, tau1_r_xc)
701 END IF
702 ELSE
703 rho1_r_xc => rho1_r
704 rho1_g_xc => rho1_g
705 tau1_r_xc => tau1_r
706 END IF
707 END IF
708
709 NULLIFY (vxc_rho, vxc_tau)
710 SELECT CASE (order)
711 CASE (0)
712 IF (native_skala_grid) THEN
713 CALL skala_gpw_weight_derivative(exc, rho_r, rho_g, tau_r, xc_section, weights, &
714 xc_pw_pool, particle_set, cell)
715 ELSE
716 CALL xc_exc_pw_create(rho_r_xc, rho_g_xc, tau_r_xc, xc_section, weights, xc_pw_pool, exc)
717 END IF
718 CASE (1)
719 IF (native_skala_grid) THEN
720 CALL cp_abort(__location__, &
721 "Native SKALA GAPW accurate-XCINT response forces are not implemented.")
722 ELSE
723 CALL xc_vxc_pw_create(vxc_rho, vxc_tau, exc=excint, &
724 rho_r=rho_r_xc, rho_g=rho_g_xc, tau=tau_r_xc, &
725 xc_section=xc_section, weights=weights, pw_pool=xc_pw_pool, &
726 compute_virial=.false., virial_xc=vdum)
727 END IF
728 CASE (2)
729 IF (native_skala_grid) THEN
730 CALL cp_abort(__location__, &
731 "Native SKALA GAPW accurate-XCINT response forces are not implemented.")
732 ELSE
733 CALL qs_fxc_create(qs_env, rho_struct, rho1_struct, rho0_atom_set, xc_section, .false., &
734 vxc_rho, vxc_tau, rho1_atom_set, is_triplet=triplet, &
735 no_weights=.true., uf_grid_results=uf_grid)
736 END IF
737 CASE DEFAULT
738 cpabort("Derivative order not available in xc_density")
739 END SELECT
740
741 IF (order >= 1) THEN
742 CALL pw_zero(exc)
743 IF (ASSOCIATED(vxc_rho)) THEN
744 DO ispin = 1, nspins
745 CALL pw_multiply_with(vxc_rho(ispin), rho1_r_xc(ispin))
746 CALL pw_axpy(vxc_rho(ispin), exc, 1.0_dp)
747 CALL vxc_rho(ispin)%release()
748 END DO
749 DEALLOCATE (vxc_rho)
750 END IF
751 IF (ASSOCIATED(vxc_tau)) THEN
752 DO ispin = 1, nspins
753 CALL pw_multiply_with(vxc_tau(ispin), tau1_r_xc(ispin))
754 CALL pw_axpy(vxc_tau(ispin), exc, 1.0_dp)
755 CALL vxc_tau(ispin)%release()
756 END DO
757 DEALLOCATE (vxc_tau)
758 END IF
759 END IF
760
761 IF (order == 2) THEN
762 CALL pw_scale(exc, 0.5_dp)
763 END IF
764
765 IF (uf_grid .AND. order <= 1) THEN
766 CALL give_back_density_on_pool(xc_pw_pool, rho_r_xc, rho_g_xc)
767 IF (tau_valid) THEN
768 CALL give_back_density_on_pool(xc_pw_pool, tau_r_xc)
769 END IF
770 END IF
771
772 IF (uf_grid .AND. order >= 1) THEN
773 CALL give_back_density_on_pool(xc_pw_pool, rho1_r_xc, rho1_g_xc)
774 IF (tau1_valid) THEN
775 CALL give_back_density_on_pool(xc_pw_pool, tau1_r_xc)
776 END IF
777 END IF
778
779 ! romove the nlcc densities
780 IF (ASSOCIATED(rho_nlcc) .AND. order <= 1) THEN
781 factor = -1.0_dp
782 DO ispin = 1, nspins
783 CALL pw_axpy(rho_nlcc, rho_r(ispin), factor)
784 CALL pw_axpy(rho_nlcc_g, rho_g(ispin), factor)
785 END DO
786 END IF
787
788 END IF
789
790 CALL timestop(handle)
791
792 END SUBROUTINE xc_density
793! **************************************************************************************************
794!> \brief transfers a g-space density to a given PW pool and creates its r-space representation
795!> \param pw_pool ...
796!> \param rho_g_in ...
797!> \param rho_r_out ...
798!> \param rho_g_out ...
799! **************************************************************************************************
800 SUBROUTINE create_density_on_pool(pw_pool, rho_g_in, rho_r_out, rho_g_out)
801 TYPE(pw_pool_type), POINTER :: pw_pool
802 TYPE(pw_c1d_gs_type), DIMENSION(:), POINTER :: rho_g_in
803 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho_r_out
804 TYPE(pw_c1d_gs_type), DIMENSION(:), POINTER :: rho_g_out
805
806 INTEGER :: ispin, nspins
807
808 cpassert(ASSOCIATED(pw_pool))
809 cpassert(ASSOCIATED(rho_g_in))
810
811 nspins = SIZE(rho_g_in)
812 ALLOCATE (rho_r_out(nspins), rho_g_out(nspins))
813 DO ispin = 1, nspins
814 CALL pw_pool%create_pw(rho_g_out(ispin))
815 CALL pw_pool%create_pw(rho_r_out(ispin))
816 CALL pw_transfer(rho_g_in(ispin), rho_g_out(ispin))
817 CALL pw_transfer(rho_g_out(ispin), rho_r_out(ispin))
818 END DO
819
820 END SUBROUTINE create_density_on_pool
821
822! **************************************************************************************************
823!> \brief transfers an r-space density to a given PW pool and creates its g-space representation
824!> \param source_pw_pool ...
825!> \param target_pw_pool ...
826!> \param rho_r_in ...
827!> \param rho_r_out ...
828!> \param rho_g_out ...
829! **************************************************************************************************
830 SUBROUTINE create_density_on_pool_from_r(source_pw_pool, target_pw_pool, rho_r_in, rho_r_out, rho_g_out)
831 TYPE(pw_pool_type), POINTER :: source_pw_pool, target_pw_pool
832 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho_r_in, rho_r_out
833 TYPE(pw_c1d_gs_type), DIMENSION(:), OPTIONAL, &
834 POINTER :: rho_g_out
835
836 INTEGER :: ispin, nspins
837 TYPE(pw_c1d_gs_type) :: rho_g_aux, rho_g_in
838
839 cpassert(ASSOCIATED(source_pw_pool))
840 cpassert(ASSOCIATED(target_pw_pool))
841 cpassert(ASSOCIATED(rho_r_in))
842
843 nspins = SIZE(rho_r_in)
844 IF (PRESENT(rho_g_out)) THEN
845 ALLOCATE (rho_r_out(nspins), rho_g_out(nspins))
846 DO ispin = 1, nspins
847 CALL source_pw_pool%create_pw(rho_g_in)
848 CALL target_pw_pool%create_pw(rho_g_out(ispin))
849 CALL target_pw_pool%create_pw(rho_r_out(ispin))
850 CALL pw_transfer(rho_r_in(ispin), rho_g_in)
851 CALL pw_transfer(rho_g_in, rho_g_out(ispin))
852 CALL pw_transfer(rho_g_out(ispin), rho_r_out(ispin))
853 CALL source_pw_pool%give_back_pw(rho_g_in)
854 END DO
855 ELSE
856 ALLOCATE (rho_r_out(nspins))
857 DO ispin = 1, nspins
858 CALL source_pw_pool%create_pw(rho_g_in)
859 CALL target_pw_pool%create_pw(rho_g_aux)
860 CALL target_pw_pool%create_pw(rho_r_out(ispin))
861 CALL pw_transfer(rho_r_in(ispin), rho_g_in)
862 CALL pw_transfer(rho_g_in, rho_g_aux)
863 CALL pw_transfer(rho_g_aux, rho_r_out(ispin))
864 CALL source_pw_pool%give_back_pw(rho_g_in)
865 CALL source_pw_pool%give_back_pw(rho_g_aux)
866 END DO
867 END IF
868
869 END SUBROUTINE create_density_on_pool_from_r
870
871! **************************************************************************************************
872!> \brief returns temporary density arrays to the given PW pool
873!> \param pw_pool ...
874!> \param rho_r ...
875!> \param rho_g ...
876! **************************************************************************************************
877 SUBROUTINE give_back_density_on_pool(pw_pool, rho_r, rho_g)
878 TYPE(pw_pool_type), POINTER :: pw_pool
879 TYPE(pw_r3d_rs_type), DIMENSION(:), POINTER :: rho_r
880 TYPE(pw_c1d_gs_type), DIMENSION(:), OPTIONAL, &
881 POINTER :: rho_g
882
883 INTEGER :: ispin
884
885 cpassert(ASSOCIATED(pw_pool))
886
887 IF (ASSOCIATED(rho_r)) THEN
888 DO ispin = 1, SIZE(rho_r)
889 CALL pw_pool%give_back_pw(rho_r(ispin))
890 END DO
891 DEALLOCATE (rho_r)
892 END IF
893 IF (PRESENT(rho_g)) THEN
894 IF (ASSOCIATED(rho_g)) THEN
895 DO ispin = 1, SIZE(rho_g)
896 CALL pw_pool%give_back_pw(rho_g(ispin))
897 END DO
898 DEALLOCATE (rho_g)
899 END IF
900 END IF
901
902 END SUBROUTINE give_back_density_on_pool
903
904END MODULE accint_weights_forces
static GRID_HOST_DEVICE int coset(int lx, int ly, int lz)
Maps three angular momentum components to a single zero based index.
Definition grid_common.h:95
static GRID_HOST_DEVICE int ncoset(const int l)
Number of Cartesian orbitals up to given angular momentum quantum.
Definition grid_common.h:81
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
subroutine, public weight_function_pwgrid(rho_core, qs_env, order, calpha, ccore)
computes the weight function on the PW grid
subroutine, public accint_weight_force(qs_env, rho, rho1, order, xc_section, triplet, force_scale)
...
All kind of helpful little routines.
Definition ao_util.F:14
real(kind=dp) function, public exp_radius_very_extended(la_min, la_max, lb_min, lb_max, pab, o1, o2, ra, rb, rp, zetp, eps, prefactor, cutoff, epsabs)
computes the radius of the Gaussian outside of which it is smaller than eps
Definition ao_util.F:208
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Handles all functions related to the CELL.
Definition cell_types.F:15
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
Fortran API for the grid package, which is written in C.
Definition grid_api.F:12
integer, parameter, public grid_func_ab
Definition grid_api.F:27
subroutine, public integrate_pgf_product(la_max, zeta, la_min, lb_max, zetb, lb_min, ra, rab, rsgrid, hab, pab, o1, o2, radius, calculate_forces, force_a, force_b, compute_tau, use_virial, my_virial_a, my_virial_b, hdab, hadb, a_hdab, use_subpatch, subpatch_pattern)
low level function to compute matrix elements of primitive gaussian functions
Definition grid_api.F:274
subroutine, public collocate_pgf_product(la_max, zeta, la_min, lb_max, zetb, lb_min, ra, rab, scale, pab, o1, o2, rsgrid, ga_gb_function, radius, use_subpatch, subpatch_pattern)
low level collocation of primitive gaussian functions
Definition grid_api.F:116
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public sic_none
integer, parameter, public xc_none
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :, :), allocatable, public coset
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
This module defines the grid data type and some basic operations on it.
Definition pw_grids.F:36
logical function, public pw_grid_compare(grida, gridb)
Check if two pw_grids are equal.
Definition pw_grids.F:148
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Setup Routine for Fxc Potentials.
Definition qs_fxc.F:15
subroutine, public qs_fxc_create(qs_env, rho0_struct, rho1_struct, rho0_atom_set, xc_section, do_onecenter, fxc_rho, fxc_tau, rho1_atom_set, do_scale, is_triplet, spinflip, no_weights, uf_grid_results, pw_env_ext, kind_set_external, para_env_external, dispersion_env, compute_virial, virial_xc)
...
Definition qs_fxc.F:109
Define the quickstep kind type and their sub types.
superstucture that hold various representations of the density and keeps track of which ones are vali...
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 transfer_pw2rs(rs, pw)
...
subroutine, public transfer_rs2pw(rs, pw)
...
subroutine, public rs_grid_zero(rs)
Initialize grid to zero.
Experimental CP2K-native GPW real-space-grid path for SKALA TorchScript models.
subroutine, public skala_gpw_weight_derivative(weight_deriv_r, rho_r, rho_g, tau, xc_section, weights, pw_pool, particle_set, cell)
Evaluate the derivative of native SKALA XC energy with respect to CP2K's external real-space integrat...
logical function, public native_skala_uses_atom_composite_grid(xc_section)
Return true when native Skala uses atom-centered grids.
integer function, public skala_gapw_representation(xc_section)
Return the pseudopotential GAPW representation selected for an active model.
logical function, public native_skala_gapw_atom_composite_requested(xc_section)
Return true when the explicit atom-centered composite reference is requested.
logical function, public native_skala_gapw_composite_reference(xc_section)
Return true if native SKALA should use the full GAPW ORB density on one common grid.
logical function, public xc_section_uses_native_skala_grid(xc_section)
Return true if the GAUXC subsection requests the CP2K-native GPW grid path.
logical function, public gauxc_gapw_has_paw_pseudopotentials(qs_kind_set)
Return whether GauXC GAPW mode sees pseudopotential one-center GAPW kinds.
input constants for xc
integer, parameter, public skala_gapw_paw_one_center
Exchange and Correlation functional calculations.
Definition xc.F:17
subroutine, public xc_vxc_pw_create(vxc_rho, vxc_tau, exc, rho_r, rho_g, tau, xc_section, weights, pw_pool, compute_virial, virial_xc, exc_r)
Exchange and Correlation functional calculations.
Definition xc.F:483
subroutine, public xc_exc_pw_create(rho_r, rho_g, tau, xc_section, weights, pw_pool, exc)
calculates just the exchange and correlation energy density
Definition xc.F:866
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
stores all the informations relevant to an mpi environment
contained for different pw related things
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.