78 SUBROUTINE fgxc_atom_calc(qs_env, rho0_atom_set, rho1_atom_set, rho2_atom_set, &
79 kind_set, xc_section, is_triplet, accuracy)
82 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho0_atom_set, rho1_atom_set, &
86 LOGICAL,
INTENT(IN) :: is_triplet
87 INTEGER,
INTENT(IN) :: accuracy
89 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fgxc_atom_calc'
90 REAL(kind=
dp),
PARAMETER :: epsrho = 5.e-4_dp
92 INTEGER :: bo(2), handle, iat, iatom, ikind, ir, &
93 istep, mspins, myfun, na, natom, nf, &
94 nr, ns, nspins, nstep, num_pe, on
95 INTEGER,
DIMENSION(2, 3) :: bounds
96 INTEGER,
DIMENSION(:),
POINTER :: atom_list
97 LOGICAL :: accint, donlcc, gradient_f, lsd, nlcc, &
99 REAL(
dp) :: agr, alpha, beta, density_cut, exc_h, &
100 exc_s, gradient_cut, oeps1, oeps2, &
102 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: fw
103 REAL(
dp),
DIMENSION(1, 1, 1) :: tau_d
104 REAL(
dp),
DIMENSION(1, 1, 1, 1) :: rho_d
105 REAL(
dp),
DIMENSION(:, :),
POINTER :: rho_nlcc, weight_h, weight_s
106 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: rho0_h, rho0_s, rho1_h, rho1_s, rho_h, &
107 rho_s, tau0_h, tau0_s, tau1_h, tau1_s, &
108 tau_h, tau_s, vtau_h, vtau_s, vxc_h, &
110 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: drho0_h, drho0_s, drho1_h, drho1_s, &
111 drho_h, drho_s, vxg_h, vxg_s
112 REAL(kind=
dp),
DIMENSION(-4:4) :: ak, bl
119 TYPE(
rho_atom_coeff),
DIMENSION(:),
POINTER :: dr_h, dr_s, fint_hh, fint_ss, int_hh, &
122 TYPE(
rho_atom_type),
POINTER :: rho0_atom, rho1_atom, rho2_atom
129 CALL timeset(routinen, handle)
131 NULLIFY (vtau_h, vtau_s)
135 SELECT CASE (accuracy)
138 ak(-2:2) = [1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp]/12.0_dp
139 bl(-2:2) = [-1.0_dp, 16.0_dp, -30.0_dp, 16.0_dp, -1.0_dp]/12.0_dp
142 ak(-3:3) = [-1.0_dp, 9.0_dp, -45.0_dp, 0.0_dp, 45.0_dp, -9.0_dp, 1.0_dp]/60.0_dp
143 bl(-3:3) = [2.0_dp, -27.0_dp, 270.0_dp, -490.0_dp, 270.0_dp, -27.0_dp, 2.0_dp]/180.0_dp
146 ak(-4:4) = [1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
147 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp]/280.0_dp
148 bl(-4:4) = [-1.0_dp, 128.0_dp/9.0_dp, -112.0_dp, 896.0_dp, -14350.0_dp/9.0_dp, &
149 896.0_dp, -112.0_dp, 128.0_dp/9.0_dp, -1.0_dp]/560.0_dp
151 oeps1 = 1.0_dp/epsrho
152 oeps2 = 1.0_dp/(epsrho**2)
155 dft_control=dft_control, &
157 atomic_kind_set=atomic_kind_set)
162 accint = dft_control%qs_control%gapw_control%accurate_xcint
172 lsd = dft_control%lsd
173 nspins = dft_control%nspins
176 cpassert(nspins == 1)
181 gradient_f = (needs%drho .OR. needs%drho_spin)
182 tau_f = (needs%tau .OR. needs%tau_spin)
185 DO ikind = 1,
SIZE(atomic_kind_set)
186 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
187 CALL get_qs_kind(kind_set(ikind), paw_atom=paw_atom, &
188 harmonics=harmonics, grid_atom=grid_atom)
189 CALL get_qs_kind(kind_set(ikind), basis_set=basis_1c, basis_type=
"GAPW_1C")
191 IF (.NOT. paw_atom) cycle
194 na = grid_atom%ng_sphere
197 weight_h => grid_atom%weight
198 weight_s => grid_atom%weight
200 on = dft_control%qs_control%gapw_control%oweights
201 alpha = dft_control%qs_control%gapw_control%aw(ikind)
202 IF (
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
203 IF (grid_atom%gapw_weight_alpha /= alpha)
DEALLOCATE (grid_atom%gapw_weight_s)
205 IF (.NOT.
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
206 ALLOCATE (grid_atom%gapw_weight_s(na, nr))
210 agr = 1.0_dp - fw(ir)
211 grid_atom%gapw_weight_s(:, ir) = agr*grid_atom%weight(:, ir)
214 grid_atom%gapw_weight_alpha = alpha
216 weight_s => grid_atom%gapw_weight_s
232 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
234 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
240 ALLOCATE (rho_h(na, nr, mspins), rho_s(na, nr, mspins), &
241 rho0_h(na, nr, nspins), rho0_s(na, nr, nspins), &
242 rho1_h(na, nr, nspins), rho1_s(na, nr, nspins))
243 ALLOCATE (vxc_h(na, nr, mspins), vxc_s(na, nr, mspins))
245 ALLOCATE (drho_h(4, na, nr, mspins), drho_s(4, na, nr, mspins), &
246 drho0_h(4, na, nr, nspins), drho0_s(4, na, nr, nspins), &
247 drho1_h(4, na, nr, nspins), drho1_s(4, na, nr, nspins))
248 ALLOCATE (vxg_h(3, na, nr, mspins), vxg_s(3, na, nr, mspins))
252 ALLOCATE (tau_h(na, nr, mspins), tau_s(na, nr, mspins), &
253 tau0_h(na, nr, nspins), tau0_s(na, nr, nspins), &
254 tau1_h(na, nr, nspins), tau1_s(na, nr, nspins))
255 ALLOCATE (vtau_h(na, nr, mspins), vtau_s(na, nr, mspins))
262 rho_nlcc => kind_set(ikind)%nlcc_pot
263 IF (
ASSOCIATED(rho_nlcc)) donlcc = .true.
267 num_pe = para_env%num_pe
268 bo =
get_limit(natom, num_pe, para_env%mepos)
270 DO iat = bo(1), bo(2)
271 iatom = atom_list(iat)
273 NULLIFY (int_hh, int_ss)
274 rho0_atom => rho0_atom_set(iatom)
275 CALL get_rho_atom(rho_atom=rho0_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
276 ALLOCATE (fint_ss(nspins), fint_hh(nspins))
278 nf =
SIZE(int_ss(ns)%r_coef, 1)
279 ALLOCATE (fint_ss(ns)%r_coef(nf, nf))
280 nf =
SIZE(int_hh(ns)%r_coef, 1)
281 ALLOCATE (fint_hh(ns)%r_coef(nf, nf))
287 rho0_atom => rho0_atom_set(iatom)
289 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
290 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
291 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
296 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s)
301 ir, r_h, r_s, rho0_h, rho0_s, dr_h, dr_s, &
302 r_h_d, r_s_d, drho0_h, drho0_s)
305 ir, rho_nlcc(:, 1), rho0_h, rho0_s, rho_nlcc(:, 2), drho0_h, drho0_s)
310 CALL calc_tau_atom(tau0_h, tau0_s, rho0_atom, tau_basis_cache, nspins)
317 rho1_atom => rho1_atom_set(iatom)
319 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
320 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
321 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
326 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s)
330 ir, r_h, r_s, rho1_h, rho1_s, dr_h, dr_s, &
331 r_h_d, r_s_d, drho1_h, drho1_s)
335 CALL calc_tau_atom(tau1_h, tau1_s, rho1_atom, tau_basis_cache, nspins)
338 rho2_atom => rho2_atom_set(iatom)
340 DO istep = -nstep, nstep
342 beta = real(istep, kind=
dp)*epsrho
345 rho_h(:, :, 1) = rho0_h(:, :, 1) + beta*rho1_h(:, :, 1)
346 rho_h(:, :, 2) = rho0_h(:, :, 1)
348 rho_s(:, :, 1) = rho0_s(:, :, 1) + beta*rho1_s(:, :, 1)
349 rho_s(:, :, 2) = rho0_s(:, :, 1)
352 drho_h(:, :, :, 1) = drho0_h(:, :, :, 1) + beta*drho1_h(:, :, :, 1)
353 drho_h(:, :, :, 2) = drho0_h(:, :, :, 1)
354 drho_h = 0.5_dp*drho_h
355 drho_s(:, :, :, 1) = drho0_s(:, :, :, 1) + beta*drho1_s(:, :, :, 1)
356 drho_s(:, :, :, 2) = drho0_s(:, :, :, 1)
357 drho_s = 0.5_dp*drho_s
360 tau_h(:, :, 1) = tau0_h(:, :, 1) + beta*tau1_h(:, :, 1)
361 tau_h(:, :, 2) = tau0_h(:, :, 1)
362 tau_h = 0.5_dp*tau0_h
363 tau_s(:, :, 1) = tau0_s(:, :, 1) + beta*tau1_s(:, :, 1)
364 tau_s(:, :, 2) = tau0_s(:, :, 1)
365 tau_s = 0.5_dp*tau0_s
368 rho_h = rho0_h + beta*rho1_h
369 rho_s = rho0_s + beta*rho1_s
371 drho_h = drho0_h + beta*drho1_h
372 drho_s = drho0_s + beta*drho1_s
375 tau_h = tau0_h + beta*tau1_h
376 tau_s = tau0_s + beta*tau1_s
381 drho_h(4, :, :, :) = norm2(drho_h(1:3, :, :, :), 1)
382 drho_s(4, :, :, :) = norm2(drho_s(1:3, :, :, :), 1)
387 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, drho_h, tau_h, na, ir)
388 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, drho_s, tau_s, na, ir)
389 ELSE IF (gradient_f)
THEN
390 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, drho_h, tau_d, na, ir)
391 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, drho_s, tau_d, na, ir)
393 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, rho_d, tau_d, na, ir)
394 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, rho_d, tau_d, na, ir)
400 CALL vxc_of_r_new(xc_fun_section, rho_set_h, deriv_set, 1, needs, weight_h, &
401 lsd, na, nr, exc_h, vxc_h, vxg_h, vtau_h)
403 vxc_h(:, :, 1) = vxc_h(:, :, 1) - vxc_h(:, :, 2)
405 vxg_h(:, :, :, 1) = vxg_h(:, :, :, 1) - vxg_h(:, :, :, 2)
408 vtau_h(:, :, 1) = vtau_h(:, :, 1) - vtau_h(:, :, 2)
413 CALL vxc_of_r_new(xc_fun_section, rho_set_s, deriv_set, 1, needs, weight_s, &
414 lsd, na, nr, exc_s, vxc_s, vxg_s, vtau_s)
416 vxc_s(:, :, 1) = vxc_s(:, :, 1) - vxc_s(:, :, 2)
418 vxg_s(:, :, :, 1) = vxg_s(:, :, :, 1) - vxg_s(:, :, :, 2)
421 vtau_s(:, :, 1) = vtau_s(:, :, 1) - vtau_s(:, :, 2)
426 fint_hh(ns)%r_coef(:, :) = 0.0_dp
427 fint_ss(ns)%r_coef(:, :) = 0.0_dp
430 CALL gavxcgb_gc(vxc_h, vxc_s, vxg_h, vxg_s, fint_hh, fint_ss, &
431 grid_atom, basis_1c, harmonics, nspins)
434 grid_atom, basis_1c, harmonics, nspins)
437 CALL dgavtaudgb(vtau_h, vtau_s, fint_hh, fint_ss, &
438 tau_basis_cache, nspins)
441 NULLIFY (int_hh, int_ss)
442 CALL get_rho_atom(rho_atom=rho1_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
444 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_ss(ns)%r_coef(:, :)
445 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_hh(ns)%r_coef(:, :)
448 NULLIFY (int_hh, int_ss)
449 CALL get_rho_atom(rho_atom=rho2_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
451 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps2*bl(istep)*fint_ss(ns)%r_coef(:, :)
452 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps2*bl(istep)*fint_hh(ns)%r_coef(:, :)
457 DEALLOCATE (fint_ss(ns)%r_coef)
458 DEALLOCATE (fint_hh(ns)%r_coef)
460 DEALLOCATE (fint_ss, fint_hh)
469 DEALLOCATE (rho_h, rho_s, rho0_h, rho0_s, rho1_h, rho1_s)
470 DEALLOCATE (vxc_h, vxc_s)
472 DEALLOCATE (drho_h, drho_s, drho0_h, drho0_s, drho1_h, drho1_s)
473 DEALLOCATE (vxg_h, vxg_s)
476 DEALLOCATE (tau_h, tau_s, tau0_h, tau0_s, tau1_h, tau1_s)
477 DEALLOCATE (vtau_h, vtau_s)
484 CALL timestop(handle)
501 kind_set, xc_section, is_triplet, accuracy, epsrho)
504 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho0_atom_set, rho1_atom_set, &
508 LOGICAL,
INTENT(IN) :: is_triplet
509 INTEGER,
INTENT(IN) :: accuracy
510 REAL(kind=
dp),
INTENT(IN) :: epsrho
512 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fgxc_atom_diff'
514 INTEGER :: bo(2), handle, iat, iatom, ikind, ir, &
515 istep, mspins, myfun, na, natom, nf, &
516 nr, ns, nspins, nstep, num_pe, on
517 INTEGER,
DIMENSION(2, 3) :: bounds
518 INTEGER,
DIMENSION(:),
POINTER :: atom_list
519 LOGICAL :: accint, donlcc, gradient_f, lsd, nlcc, &
521 REAL(
dp) :: agr, alpha, beta, density_cut, &
522 gradient_cut, oeps1, tau_cut
523 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: fw
524 REAL(
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: vtau_h, vtau_s, vxc_h, vxc_s
525 REAL(
dp),
DIMENSION(1, 1, 1) :: tau_d
526 REAL(
dp),
DIMENSION(1, 1, 1, 1) :: rho_d
527 REAL(
dp),
DIMENSION(:, :),
POINTER :: rho_nlcc, weight_h, weight_s
528 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: rho0_h, rho0_s, rho1_h, rho1_s, rho_h, &
529 rho_s, tau0_h, tau0_s, tau1_h, tau1_s, &
531 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: drho0_h, drho0_s, drho1_h, drho1_s, &
532 drho_h, drho_s, vxg_h, vxg_s
533 REAL(kind=
dp),
DIMENSION(-4:4) :: ak
540 TYPE(
rho_atom_coeff),
DIMENSION(:),
POINTER :: dr_h, dr_s, fint_hh, fint_ss, int_hh, &
543 TYPE(
rho_atom_type),
POINTER :: rho0_atom, rho1_atom, rho2_atom
551 CALL timeset(routinen, handle)
553 NULLIFY (vtau_h, vtau_s)
556 SELECT CASE (accuracy)
559 ak(-2:2) = [1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp]/12.0_dp
562 ak(-3:3) = [-1.0_dp, 9.0_dp, -45.0_dp, 0.0_dp, 45.0_dp, -9.0_dp, 1.0_dp]/60.0_dp
565 ak(-4:4) = [1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
566 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp]/280.0_dp
568 oeps1 = 1.0_dp/epsrho
571 dft_control=dft_control, &
573 atomic_kind_set=atomic_kind_set)
578 accint = dft_control%qs_control%gapw_control%accurate_xcint
584 CALL fxc_atom_calc(qs_env, rho0_atom_set, rho1_atom_set, xc_section, para_env, &
585 do_triplet=is_triplet, kind_set_external=kind_set)
592 lsd = dft_control%lsd
593 nspins = dft_control%nspins
596 cpassert(nspins == 1)
601 gradient_f = (needs%drho .OR. needs%drho_spin)
602 tau_f = (needs%tau .OR. needs%tau_spin)
605 DO ikind = 1,
SIZE(atomic_kind_set)
606 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
607 CALL get_qs_kind(kind_set(ikind), paw_atom=paw_atom, &
608 harmonics=harmonics, grid_atom=grid_atom)
609 CALL get_qs_kind(kind_set(ikind), basis_set=basis_1c, basis_type=
"GAPW_1C")
611 IF (.NOT. paw_atom) cycle
614 na = grid_atom%ng_sphere
617 weight_h => grid_atom%weight
618 weight_s => grid_atom%weight
620 on = dft_control%qs_control%gapw_control%oweights
621 alpha = dft_control%qs_control%gapw_control%aw(ikind)
622 IF (
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
623 IF (grid_atom%gapw_weight_alpha /= alpha)
DEALLOCATE (grid_atom%gapw_weight_s)
625 IF (.NOT.
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
626 ALLOCATE (grid_atom%gapw_weight_s(na, nr))
630 agr = 1.0_dp - fw(ir)
631 grid_atom%gapw_weight_s(:, ir) = agr*grid_atom%weight(:, ir)
634 grid_atom%gapw_weight_alpha = alpha
636 weight_s => grid_atom%gapw_weight_s
652 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
654 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
656 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
658 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
666 ALLOCATE (rho_h(na, nr, nspins), rho_s(na, nr, nspins), &
667 rho0_h(na, nr, nspins), rho0_s(na, nr, nspins), &
668 rho1_h(na, nr, nspins), rho1_s(na, nr, nspins))
669 ALLOCATE (vxc_h(na, nr, nspins), vxc_s(na, nr, nspins))
671 ALLOCATE (drho_h(4, na, nr, nspins), drho_s(4, na, nr, nspins), &
672 drho0_h(4, na, nr, nspins), drho0_s(4, na, nr, nspins), &
673 drho1_h(4, na, nr, nspins), drho1_s(4, na, nr, nspins))
674 ALLOCATE (vxg_h(3, na, nr, nspins), vxg_s(3, na, nr, nspins))
678 ALLOCATE (tau_h(na, nr, nspins), tau_s(na, nr, nspins), &
679 tau0_h(na, nr, nspins), tau0_s(na, nr, nspins), &
680 tau1_h(na, nr, nspins), tau1_s(na, nr, nspins))
681 ALLOCATE (vtau_h(na, nr, nspins), vtau_s(na, nr, nspins))
688 rho_nlcc => kind_set(ikind)%nlcc_pot
689 IF (
ASSOCIATED(rho_nlcc)) donlcc = .true.
693 num_pe = para_env%num_pe
694 bo =
get_limit(natom, num_pe, para_env%mepos)
696 DO iat = bo(1), bo(2)
697 iatom = atom_list(iat)
699 NULLIFY (int_hh, int_ss)
700 rho0_atom => rho0_atom_set(iatom)
701 CALL get_rho_atom(rho_atom=rho0_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
702 ALLOCATE (fint_ss(nspins), fint_hh(nspins))
704 nf =
SIZE(int_ss(ns)%r_coef, 1)
705 ALLOCATE (fint_ss(ns)%r_coef(nf, nf))
706 nf =
SIZE(int_hh(ns)%r_coef, 1)
707 ALLOCATE (fint_hh(ns)%r_coef(nf, nf))
713 rho0_atom => rho0_atom_set(iatom)
715 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
716 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
717 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
722 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s)
727 ir, r_h, r_s, rho0_h, rho0_s, dr_h, dr_s, &
728 r_h_d, r_s_d, drho0_h, drho0_s)
731 ir, rho_nlcc(:, 1), rho0_h, rho0_s, rho_nlcc(:, 2), drho0_h, drho0_s)
736 CALL calc_tau_atom(tau0_h, tau0_s, rho0_atom, tau_basis_cache, nspins)
743 rho1_atom => rho1_atom_set(iatom)
745 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
746 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
747 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
752 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s)
756 ir, r_h, r_s, rho1_h, rho1_s, dr_h, dr_s, &
757 r_h_d, r_s_d, drho1_h, drho1_s)
761 CALL calc_tau_atom(tau1_h, tau1_s, rho1_atom, tau_basis_cache, nspins)
766 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, tau1_h, na, ir)
767 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, tau1_s, na, ir)
768 ELSE IF (gradient_f)
THEN
769 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, tau_d, na, ir)
770 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, tau_d, na, ir)
772 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, rho_d, tau_d, na, ir)
773 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, rho_d, tau_d, na, ir)
778 rho2_atom => rho2_atom_set(iatom)
780 DO istep = -nstep, nstep
782 beta = real(istep, kind=
dp)*epsrho
784 rho_h = rho0_h + beta*rho1_h
785 rho_s = rho0_s + beta*rho1_s
787 drho_h = drho0_h + beta*drho1_h
788 drho_s = drho0_s + beta*drho1_s
791 tau_h = tau0_h + beta*tau1_h
792 tau_s = tau0_s + beta*tau1_s
796 drho_h(4, :, :, :) = norm2(drho_h(1:3, :, :, :), 1)
797 drho_s(4, :, :, :) = norm2(drho_s(1:3, :, :, :), 1)
802 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, tau_h, na, ir)
803 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, tau_s, na, ir)
804 ELSE IF (gradient_f)
THEN
805 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, tau_d, na, ir)
806 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, tau_d, na, ir)
808 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, rho_d, tau_d, na, ir)
809 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, rho_d, tau_d, na, ir)
816 rho_set=rho_set_h, rho1_set=rho1_set_h, &
817 deriv_set=deriv_set, &
818 w=weight_h, vxc=vxc_h, vxg=vxg_h, vtau=vtau_h, &
819 do_triplet=is_triplet)
823 rho_set=rho_set_s, rho1_set=rho1_set_s, &
824 deriv_set=deriv_set, &
825 w=weight_s, vxc=vxc_s, vxg=vxg_s, vtau=vtau_s, &
826 do_triplet=is_triplet)
829 fint_hh(ns)%r_coef(:, :) = 0.0_dp
830 fint_ss(ns)%r_coef(:, :) = 0.0_dp
833 CALL gavxcgb_gc(vxc_h, vxc_s, vxg_h, vxg_s, fint_hh, fint_ss, &
834 grid_atom, basis_1c, harmonics, nspins)
837 grid_atom, basis_1c, harmonics, nspins)
840 CALL dgavtaudgb(vtau_h, vtau_s, fint_hh, fint_ss, &
841 tau_basis_cache, nspins)
844 NULLIFY (int_hh, int_ss)
845 CALL get_rho_atom(rho_atom=rho2_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
847 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_ss(ns)%r_coef(:, :)
848 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_hh(ns)%r_coef(:, :)
853 DEALLOCATE (fint_ss(ns)%r_coef)
854 DEALLOCATE (fint_hh(ns)%r_coef)
856 DEALLOCATE (fint_ss, fint_hh)
867 DEALLOCATE (rho_h, rho_s, rho0_h, rho0_s, rho1_h, rho1_s)
868 DEALLOCATE (vxc_h, vxc_s)
870 DEALLOCATE (drho_h, drho_s, drho0_h, drho0_s, drho1_h, drho1_s)
871 DEALLOCATE (vxg_h, vxg_s)
874 DEALLOCATE (tau_h, tau_s, tau0_h, tau0_s, tau1_h, tau1_s)
875 DEALLOCATE (vtau_h, vtau_s)
882 CALL timestop(handle)
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.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.