77 SUBROUTINE fgxc_atom_calc(qs_env, rho0_atom_set, rho1_atom_set, rho2_atom_set, &
78 kind_set, xc_section, is_triplet, accuracy)
81 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho0_atom_set, rho1_atom_set, &
85 LOGICAL,
INTENT(IN) :: is_triplet
86 INTEGER,
INTENT(IN) :: accuracy
88 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fgxc_atom_calc'
89 REAL(kind=
dp),
PARAMETER :: epsrho = 5.e-4_dp
91 INTEGER :: bo(2), handle, iat, iatom, ikind, ir, &
92 istep, mspins, myfun, na, natom, nf, &
93 nr, ns, nspins, nstep, num_pe
94 INTEGER,
DIMENSION(2, 3) :: bounds
95 INTEGER,
DIMENSION(:),
POINTER :: atom_list
96 LOGICAL :: accint, donlcc, gradient_f, lsd, nlcc, &
98 REAL(
dp) :: agr, alpha, beta, density_cut, exc_h, &
99 exc_s, gradient_cut, oeps1, oeps2, &
101 REAL(
dp),
DIMENSION(1, 1, 1) :: tau_d
102 REAL(
dp),
DIMENSION(1, 1, 1, 1) :: rho_d
103 REAL(
dp),
DIMENSION(:, :),
POINTER :: rho_nlcc, weight_h, weight_s
104 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: rho0_h, rho0_s, rho1_h, rho1_s, rho_h, &
105 rho_s, tau0_h, tau0_s, tau1_h, tau1_s, &
106 tau_h, tau_s, vtau_h, vtau_s, vxc_h, &
108 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: drho0_h, drho0_s, drho1_h, drho1_s, &
109 drho_h, drho_s, vxg_h, vxg_s
110 REAL(kind=
dp),
DIMENSION(-4:4) :: ak, bl
117 TYPE(
rho_atom_coeff),
DIMENSION(:),
POINTER :: dr_h, dr_s, fint_hh, fint_ss, int_hh, &
120 TYPE(
rho_atom_type),
POINTER :: rho0_atom, rho1_atom, rho2_atom
127 CALL timeset(routinen, handle)
129 NULLIFY (vtau_h, vtau_s)
133 SELECT CASE (accuracy)
136 ak(-2:2) = [1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp]/12.0_dp
137 bl(-2:2) = [-1.0_dp, 16.0_dp, -30.0_dp, 16.0_dp, -1.0_dp]/12.0_dp
140 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
141 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
144 ak(-4:4) = [1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
145 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp]/280.0_dp
146 bl(-4:4) = [-1.0_dp, 128.0_dp/9.0_dp, -112.0_dp, 896.0_dp, -14350.0_dp/9.0_dp, &
147 896.0_dp, -112.0_dp, 128.0_dp/9.0_dp, -1.0_dp]/560.0_dp
149 oeps1 = 1.0_dp/epsrho
150 oeps2 = 1.0_dp/(epsrho**2)
153 dft_control=dft_control, &
155 atomic_kind_set=atomic_kind_set)
160 accint = dft_control%qs_control%gapw_control%accurate_xcint
170 lsd = dft_control%lsd
171 nspins = dft_control%nspins
174 cpassert(nspins == 1)
179 gradient_f = (needs%drho .OR. needs%drho_spin)
180 tau_f = (needs%tau .OR. needs%tau_spin)
183 DO ikind = 1,
SIZE(atomic_kind_set)
184 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
185 CALL get_qs_kind(kind_set(ikind), paw_atom=paw_atom, &
186 harmonics=harmonics, grid_atom=grid_atom)
187 CALL get_qs_kind(kind_set(ikind), basis_set=basis_1c, basis_type=
"GAPW_1C")
189 IF (.NOT. paw_atom) cycle
192 na = grid_atom%ng_sphere
196 weight_h => grid_atom%weight
197 alpha = dft_control%qs_control%gapw_control%aw(ikind)
198 IF (
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
199 IF (grid_atom%gapw_weight_alpha /= alpha)
DEALLOCATE (grid_atom%gapw_weight_s)
201 IF (.NOT.
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
202 ALLOCATE (grid_atom%gapw_weight_s(na, nr))
204 agr = 1.0_dp - exp(-alpha*grid_atom%rad2(ir))
205 grid_atom%gapw_weight_s(:, ir) = grid_atom%weight(:, ir)*agr
207 grid_atom%gapw_weight_alpha = alpha
209 weight_s => grid_atom%gapw_weight_s
211 weight_h => grid_atom%weight
212 weight_s => grid_atom%weight
228 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
230 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
236 ALLOCATE (rho_h(na, nr, mspins), rho_s(na, nr, mspins), &
237 rho0_h(na, nr, nspins), rho0_s(na, nr, nspins), &
238 rho1_h(na, nr, nspins), rho1_s(na, nr, nspins))
239 ALLOCATE (vxc_h(na, nr, mspins), vxc_s(na, nr, mspins))
241 ALLOCATE (drho_h(4, na, nr, mspins), drho_s(4, na, nr, mspins), &
242 drho0_h(4, na, nr, nspins), drho0_s(4, na, nr, nspins), &
243 drho1_h(4, na, nr, nspins), drho1_s(4, na, nr, nspins))
244 ALLOCATE (vxg_h(3, na, nr, mspins), vxg_s(3, na, nr, mspins))
248 ALLOCATE (tau_h(na, nr, mspins), tau_s(na, nr, mspins), &
249 tau0_h(na, nr, nspins), tau0_s(na, nr, nspins), &
250 tau1_h(na, nr, nspins), tau1_s(na, nr, nspins))
251 ALLOCATE (vtau_h(na, nr, mspins), vtau_s(na, nr, mspins))
258 rho_nlcc => kind_set(ikind)%nlcc_pot
259 IF (
ASSOCIATED(rho_nlcc)) donlcc = .true.
263 num_pe = para_env%num_pe
264 bo =
get_limit(natom, num_pe, para_env%mepos)
266 DO iat = bo(1), bo(2)
267 iatom = atom_list(iat)
269 NULLIFY (int_hh, int_ss)
270 rho0_atom => rho0_atom_set(iatom)
271 CALL get_rho_atom(rho_atom=rho0_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
272 ALLOCATE (fint_ss(nspins), fint_hh(nspins))
274 nf =
SIZE(int_ss(ns)%r_coef, 1)
275 ALLOCATE (fint_ss(ns)%r_coef(nf, nf))
276 nf =
SIZE(int_hh(ns)%r_coef, 1)
277 ALLOCATE (fint_hh(ns)%r_coef(nf, nf))
283 rho0_atom => rho0_atom_set(iatom)
285 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
286 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
287 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
292 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s)
297 ir, r_h, r_s, rho0_h, rho0_s, dr_h, dr_s, &
298 r_h_d, r_s_d, drho0_h, drho0_s)
301 ir, rho_nlcc(:, 1), rho0_h, rho0_s, rho_nlcc(:, 2), drho0_h, drho0_s)
306 CALL calc_tau_atom(tau0_h, tau0_s, rho0_atom, tau_basis_cache, nspins)
313 rho1_atom => rho1_atom_set(iatom)
315 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
316 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
317 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
322 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s)
326 ir, r_h, r_s, rho1_h, rho1_s, dr_h, dr_s, &
327 r_h_d, r_s_d, drho1_h, drho1_s)
331 CALL calc_tau_atom(tau1_h, tau1_s, rho1_atom, tau_basis_cache, nspins)
334 rho2_atom => rho2_atom_set(iatom)
336 DO istep = -nstep, nstep
338 beta = real(istep, kind=
dp)*epsrho
341 rho_h(:, :, 1) = rho0_h(:, :, 1) + beta*rho1_h(:, :, 1)
342 rho_h(:, :, 2) = rho0_h(:, :, 1)
344 rho_s(:, :, 1) = rho0_s(:, :, 1) + beta*rho1_s(:, :, 1)
345 rho_s(:, :, 2) = rho0_s(:, :, 1)
348 drho_h(:, :, :, 1) = drho0_h(:, :, :, 1) + beta*drho1_h(:, :, :, 1)
349 drho_h(:, :, :, 2) = drho0_h(:, :, :, 1)
350 drho_h = 0.5_dp*drho_h
351 drho_s(:, :, :, 1) = drho0_s(:, :, :, 1) + beta*drho1_s(:, :, :, 1)
352 drho_s(:, :, :, 2) = drho0_s(:, :, :, 1)
353 drho_s = 0.5_dp*drho_s
356 tau_h(:, :, 1) = tau0_h(:, :, 1) + beta*tau1_h(:, :, 1)
357 tau_h(:, :, 2) = tau0_h(:, :, 1)
358 tau_h = 0.5_dp*tau0_h
359 tau_s(:, :, 1) = tau0_s(:, :, 1) + beta*tau1_s(:, :, 1)
360 tau_s(:, :, 2) = tau0_s(:, :, 1)
361 tau_s = 0.5_dp*tau0_s
364 rho_h = rho0_h + beta*rho1_h
365 rho_s = rho0_s + beta*rho1_s
367 drho_h = drho0_h + beta*drho1_h
368 drho_s = drho0_s + beta*drho1_s
371 tau_h = tau0_h + beta*tau1_h
372 tau_s = tau0_s + beta*tau1_s
377 drho_h(4, :, :, :) = norm2(drho_h(1:3, :, :, :), 1)
378 drho_s(4, :, :, :) = norm2(drho_s(1:3, :, :, :), 1)
383 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, drho_h, tau_h, na, ir)
384 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, drho_s, tau_s, na, ir)
385 ELSE IF (gradient_f)
THEN
386 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, drho_h, tau_d, na, ir)
387 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, drho_s, tau_d, na, ir)
389 CALL fill_rho_set(rho_set_h, lsd, mspins, needs, rho_h, rho_d, tau_d, na, ir)
390 CALL fill_rho_set(rho_set_s, lsd, mspins, needs, rho_s, rho_d, tau_d, na, ir)
396 CALL vxc_of_r_new(xc_fun_section, rho_set_h, deriv_set, 1, needs, weight_h, &
397 lsd, na, nr, exc_h, vxc_h, vxg_h, vtau_h)
399 vxc_h(:, :, 1) = vxc_h(:, :, 1) - vxc_h(:, :, 2)
401 vxg_h(:, :, :, 1) = vxg_h(:, :, :, 1) - vxg_h(:, :, :, 2)
404 vtau_h(:, :, 1) = vtau_h(:, :, 1) - vtau_h(:, :, 2)
409 CALL vxc_of_r_new(xc_fun_section, rho_set_s, deriv_set, 1, needs, weight_s, &
410 lsd, na, nr, exc_s, vxc_s, vxg_s, vtau_s)
412 vxc_s(:, :, 1) = vxc_s(:, :, 1) - vxc_s(:, :, 2)
414 vxg_s(:, :, :, 1) = vxg_s(:, :, :, 1) - vxg_s(:, :, :, 2)
417 vtau_s(:, :, 1) = vtau_s(:, :, 1) - vtau_s(:, :, 2)
422 fint_hh(ns)%r_coef(:, :) = 0.0_dp
423 fint_ss(ns)%r_coef(:, :) = 0.0_dp
426 CALL gavxcgb_gc(vxc_h, vxc_s, vxg_h, vxg_s, fint_hh, fint_ss, &
427 grid_atom, basis_1c, harmonics, nspins)
430 grid_atom, basis_1c, harmonics, nspins)
433 CALL dgavtaudgb(vtau_h, vtau_s, fint_hh, fint_ss, &
434 tau_basis_cache, nspins)
437 NULLIFY (int_hh, int_ss)
438 CALL get_rho_atom(rho_atom=rho1_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
440 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_ss(ns)%r_coef(:, :)
441 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_hh(ns)%r_coef(:, :)
444 NULLIFY (int_hh, int_ss)
445 CALL get_rho_atom(rho_atom=rho2_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
447 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps2*bl(istep)*fint_ss(ns)%r_coef(:, :)
448 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps2*bl(istep)*fint_hh(ns)%r_coef(:, :)
453 DEALLOCATE (fint_ss(ns)%r_coef)
454 DEALLOCATE (fint_hh(ns)%r_coef)
456 DEALLOCATE (fint_ss, fint_hh)
465 DEALLOCATE (rho_h, rho_s, rho0_h, rho0_s, rho1_h, rho1_s)
466 DEALLOCATE (vxc_h, vxc_s)
468 DEALLOCATE (drho_h, drho_s, drho0_h, drho0_s, drho1_h, drho1_s)
469 DEALLOCATE (vxg_h, vxg_s)
472 DEALLOCATE (tau_h, tau_s, tau0_h, tau0_s, tau1_h, tau1_s)
473 DEALLOCATE (vtau_h, vtau_s)
480 CALL timestop(handle)
497 kind_set, xc_section, is_triplet, accuracy, epsrho)
500 TYPE(
rho_atom_type),
DIMENSION(:),
POINTER :: rho0_atom_set, rho1_atom_set, &
504 LOGICAL,
INTENT(IN) :: is_triplet
505 INTEGER,
INTENT(IN) :: accuracy
506 REAL(kind=
dp),
INTENT(IN) :: epsrho
508 CHARACTER(LEN=*),
PARAMETER :: routinen =
'fgxc_atom_diff'
510 INTEGER :: bo(2), handle, iat, iatom, ikind, ir, &
511 istep, mspins, myfun, na, natom, nf, &
512 nr, ns, nspins, nstep, num_pe
513 INTEGER,
DIMENSION(2, 3) :: bounds
514 INTEGER,
DIMENSION(:),
POINTER :: atom_list
515 LOGICAL :: accint, donlcc, gradient_f, lsd, nlcc, &
517 REAL(
dp) :: agr, alpha, beta, density_cut, &
518 gradient_cut, oeps1, tau_cut
519 REAL(
dp),
CONTIGUOUS,
DIMENSION(:, :, :),
POINTER :: vtau_h, vtau_s, vxc_h, vxc_s
520 REAL(
dp),
DIMENSION(1, 1, 1) :: tau_d
521 REAL(
dp),
DIMENSION(1, 1, 1, 1) :: rho_d
522 REAL(
dp),
DIMENSION(:, :),
POINTER :: rho_nlcc, weight_h, weight_s
523 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: rho0_h, rho0_s, rho1_h, rho1_s, rho_h, &
524 rho_s, tau0_h, tau0_s, tau1_h, tau1_s, &
526 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: drho0_h, drho0_s, drho1_h, drho1_s, &
527 drho_h, drho_s, vxg_h, vxg_s
528 REAL(kind=
dp),
DIMENSION(-4:4) :: ak
535 TYPE(
rho_atom_coeff),
DIMENSION(:),
POINTER :: dr_h, dr_s, fint_hh, fint_ss, int_hh, &
538 TYPE(
rho_atom_type),
POINTER :: rho0_atom, rho1_atom, rho2_atom
546 CALL timeset(routinen, handle)
548 NULLIFY (vtau_h, vtau_s)
551 SELECT CASE (accuracy)
554 ak(-2:2) = [1.0_dp, -8.0_dp, 0.0_dp, 8.0_dp, -1.0_dp]/12.0_dp
557 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
560 ak(-4:4) = [1.0_dp, -32.0_dp/3.0_dp, 56.0_dp, -224.0_dp, 0.0_dp, &
561 224.0_dp, -56.0_dp, 32.0_dp/3.0_dp, -1.0_dp]/280.0_dp
563 oeps1 = 1.0_dp/epsrho
566 dft_control=dft_control, &
568 atomic_kind_set=atomic_kind_set)
573 accint = dft_control%qs_control%gapw_control%accurate_xcint
579 CALL fxc_atom_calc(qs_env, rho0_atom_set, rho1_atom_set, xc_section, para_env, &
580 do_triplet=is_triplet, kind_set_external=kind_set)
587 lsd = dft_control%lsd
588 nspins = dft_control%nspins
591 cpassert(nspins == 1)
596 gradient_f = (needs%drho .OR. needs%drho_spin)
597 tau_f = (needs%tau .OR. needs%tau_spin)
600 DO ikind = 1,
SIZE(atomic_kind_set)
601 CALL get_atomic_kind(atomic_kind_set(ikind), atom_list=atom_list, natom=natom)
602 CALL get_qs_kind(kind_set(ikind), paw_atom=paw_atom, &
603 harmonics=harmonics, grid_atom=grid_atom)
604 CALL get_qs_kind(kind_set(ikind), basis_set=basis_1c, basis_type=
"GAPW_1C")
606 IF (.NOT. paw_atom) cycle
609 na = grid_atom%ng_sphere
613 weight_h => grid_atom%weight
614 alpha = dft_control%qs_control%gapw_control%aw(ikind)
615 IF (
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
616 IF (grid_atom%gapw_weight_alpha /= alpha)
DEALLOCATE (grid_atom%gapw_weight_s)
618 IF (.NOT.
ASSOCIATED(grid_atom%gapw_weight_s))
THEN
619 ALLOCATE (grid_atom%gapw_weight_s(na, nr))
621 agr = 1.0_dp - exp(-alpha*grid_atom%rad2(ir))
622 grid_atom%gapw_weight_s(:, ir) = grid_atom%weight(:, ir)*agr
624 grid_atom%gapw_weight_alpha = alpha
626 weight_s => grid_atom%gapw_weight_s
628 weight_h => grid_atom%weight
629 weight_s => grid_atom%weight
645 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
647 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
649 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
651 drho_cutoff=gradient_cut, tau_cutoff=tau_cut)
659 ALLOCATE (rho_h(na, nr, nspins), rho_s(na, nr, nspins), &
660 rho0_h(na, nr, nspins), rho0_s(na, nr, nspins), &
661 rho1_h(na, nr, nspins), rho1_s(na, nr, nspins))
662 ALLOCATE (vxc_h(na, nr, nspins), vxc_s(na, nr, nspins))
664 ALLOCATE (drho_h(4, na, nr, nspins), drho_s(4, na, nr, nspins), &
665 drho0_h(4, na, nr, nspins), drho0_s(4, na, nr, nspins), &
666 drho1_h(4, na, nr, nspins), drho1_s(4, na, nr, nspins))
667 ALLOCATE (vxg_h(3, na, nr, nspins), vxg_s(3, na, nr, nspins))
671 ALLOCATE (tau_h(na, nr, nspins), tau_s(na, nr, nspins), &
672 tau0_h(na, nr, nspins), tau0_s(na, nr, nspins), &
673 tau1_h(na, nr, nspins), tau1_s(na, nr, nspins))
674 ALLOCATE (vtau_h(na, nr, nspins), vtau_s(na, nr, nspins))
681 rho_nlcc => kind_set(ikind)%nlcc_pot
682 IF (
ASSOCIATED(rho_nlcc)) donlcc = .true.
686 num_pe = para_env%num_pe
687 bo =
get_limit(natom, num_pe, para_env%mepos)
689 DO iat = bo(1), bo(2)
690 iatom = atom_list(iat)
692 NULLIFY (int_hh, int_ss)
693 rho0_atom => rho0_atom_set(iatom)
694 CALL get_rho_atom(rho_atom=rho0_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
695 ALLOCATE (fint_ss(nspins), fint_hh(nspins))
697 nf =
SIZE(int_ss(ns)%r_coef, 1)
698 ALLOCATE (fint_ss(ns)%r_coef(nf, nf))
699 nf =
SIZE(int_hh(ns)%r_coef, 1)
700 ALLOCATE (fint_hh(ns)%r_coef(nf, nf))
706 rho0_atom => rho0_atom_set(iatom)
708 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
709 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
710 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
715 CALL get_rho_atom(rho_atom=rho0_atom, rho_rad_h=r_h, rho_rad_s=r_s)
720 ir, r_h, r_s, rho0_h, rho0_s, dr_h, dr_s, &
721 r_h_d, r_s_d, drho0_h, drho0_s)
724 ir, rho_nlcc(:, 1), rho0_h, rho0_s, rho_nlcc(:, 2), drho0_h, drho0_s)
729 CALL calc_tau_atom(tau0_h, tau0_s, rho0_atom, tau_basis_cache, nspins)
736 rho1_atom => rho1_atom_set(iatom)
738 NULLIFY (r_h, r_s, dr_h, dr_s, r_h_d, r_s_d)
739 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s, drho_rad_h=dr_h, &
740 drho_rad_s=dr_s, rho_rad_h_d=r_h_d, rho_rad_s_d=r_s_d)
745 CALL get_rho_atom(rho_atom=rho1_atom, rho_rad_h=r_h, rho_rad_s=r_s)
749 ir, r_h, r_s, rho1_h, rho1_s, dr_h, dr_s, &
750 r_h_d, r_s_d, drho1_h, drho1_s)
754 CALL calc_tau_atom(tau1_h, tau1_s, rho1_atom, tau_basis_cache, nspins)
759 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, tau1_h, na, ir)
760 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, tau1_s, na, ir)
761 ELSE IF (gradient_f)
THEN
762 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, drho1_h, tau_d, na, ir)
763 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, drho1_s, tau_d, na, ir)
765 CALL fill_rho_set(rho1_set_h, lsd, nspins, needs, rho1_h, rho_d, tau_d, na, ir)
766 CALL fill_rho_set(rho1_set_s, lsd, nspins, needs, rho1_s, rho_d, tau_d, na, ir)
771 rho2_atom => rho2_atom_set(iatom)
773 DO istep = -nstep, nstep
775 beta = real(istep, kind=
dp)*epsrho
777 rho_h = rho0_h + beta*rho1_h
778 rho_s = rho0_s + beta*rho1_s
780 drho_h = drho0_h + beta*drho1_h
781 drho_s = drho0_s + beta*drho1_s
784 tau_h = tau0_h + beta*tau1_h
785 tau_s = tau0_s + beta*tau1_s
789 drho_h(4, :, :, :) = norm2(drho_h(1:3, :, :, :), 1)
790 drho_s(4, :, :, :) = norm2(drho_s(1:3, :, :, :), 1)
795 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, tau_h, na, ir)
796 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, tau_s, na, ir)
797 ELSE IF (gradient_f)
THEN
798 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, drho_h, tau_d, na, ir)
799 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, drho_s, tau_d, na, ir)
801 CALL fill_rho_set(rho_set_h, lsd, nspins, needs, rho_h, rho_d, tau_d, na, ir)
802 CALL fill_rho_set(rho_set_s, lsd, nspins, needs, rho_s, rho_d, tau_d, na, ir)
809 rho_set=rho_set_h, rho1_set=rho1_set_h, &
810 deriv_set=deriv_set, &
811 w=weight_h, vxc=vxc_h, vxg=vxg_h, vtau=vtau_h, &
812 do_triplet=is_triplet)
816 rho_set=rho_set_s, rho1_set=rho1_set_s, &
817 deriv_set=deriv_set, &
818 w=weight_s, vxc=vxc_s, vxg=vxg_s, vtau=vtau_s, &
819 do_triplet=is_triplet)
822 fint_hh(ns)%r_coef(:, :) = 0.0_dp
823 fint_ss(ns)%r_coef(:, :) = 0.0_dp
826 CALL gavxcgb_gc(vxc_h, vxc_s, vxg_h, vxg_s, fint_hh, fint_ss, &
827 grid_atom, basis_1c, harmonics, nspins)
830 grid_atom, basis_1c, harmonics, nspins)
833 CALL dgavtaudgb(vtau_h, vtau_s, fint_hh, fint_ss, &
834 tau_basis_cache, nspins)
837 NULLIFY (int_hh, int_ss)
838 CALL get_rho_atom(rho_atom=rho2_atom, ga_vlocal_gb_h=int_hh, ga_vlocal_gb_s=int_ss)
840 int_ss(ns)%r_coef(:, :) = int_ss(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_ss(ns)%r_coef(:, :)
841 int_hh(ns)%r_coef(:, :) = int_hh(ns)%r_coef(:, :) + oeps1*ak(istep)*fint_hh(ns)%r_coef(:, :)
846 DEALLOCATE (fint_ss(ns)%r_coef)
847 DEALLOCATE (fint_hh(ns)%r_coef)
849 DEALLOCATE (fint_ss, fint_hh)
860 DEALLOCATE (rho_h, rho_s, rho0_h, rho0_s, rho1_h, rho1_s)
861 DEALLOCATE (vxc_h, vxc_s)
863 DEALLOCATE (drho_h, drho_s, drho0_h, drho0_s, drho1_h, drho1_s)
864 DEALLOCATE (vxg_h, vxg_s)
867 DEALLOCATE (tau_h, tau_s, tau0_h, tau0_s, tau1_h, tau1_s)
868 DEALLOCATE (vtau_h, vtau_s)
875 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.