38#include "./base/base_uses.f90"
44 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_gspace_mixing'
65 SUBROUTINE gspace_mixing(qs_env, mixing_method, mixing_store, rho, para_env, iter_count)
67 INTEGER :: mixing_method
73 CHARACTER(len=*),
PARAMETER :: routinen =
'gspace_mixing'
75 INTEGER :: handle, iatom, ig, ispin, natom, ng, &
79 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
88 CALL timeset(routinen, handle)
90 CALL get_qs_env(qs_env, dft_control=dft_control, pw_env=pw_env)
91 IF (.NOT. (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb .OR. &
92 dft_control%qs_control%semi_empirical))
THEN
94 cpassert(
ASSOCIATED(mixing_store))
95 NULLIFY (auxbas_pw_pool, rho_atom, rho_g, rho_r, tot_rho_r)
96 CALL qs_rho_get(rho, rho_g=rho_g, rho_r=rho_r, tot_rho_r=tot_rho_r)
98 nspin =
SIZE(rho_g, 1)
99 nimg = dft_control%nimages
100 ng =
SIZE(rho_g(1)%pw_grid%gsq)
101 cpassert(ng ==
SIZE(mixing_store%rhoin(1)%cc))
103 alpha = mixing_store%alpha
104 gapw = dft_control%qs_control%gapw
107 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool)
108 CALL auxbas_pw_pool%create_pw(rho_tmp)
110 CALL pw_copy(rho_g(1), rho_tmp)
111 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
112 CALL pw_axpy(rho_tmp, rho_g(2), -1.0_dp)
116 IF (iter_count + 1 <= mixing_store%nskip_mixing)
THEN
120 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
123 IF (mixing_store%gmix_p .AND. gapw)
THEN
124 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
125 natom =
SIZE(rho_atom)
128 IF (mixing_store%paw(iatom))
THEN
129 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
130 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
136 mixing_store%iter_method =
"NoMix"
138 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
140 CALL pw_axpy(rho_g(1), rho_g(2), -1.0_dp)
142 CALL auxbas_pw_pool%give_back_pw(rho_tmp)
144 CALL timestop(handle)
148 IF ((iter_count + 1 - mixing_store%nskip_mixing) <= mixing_store%n_simple_mix)
THEN
149 CALL gmix_potential_only(qs_env, mixing_store, rho)
150 mixing_store%iter_method =
"Kerker"
152 CALL gmix_potential_only(qs_env, mixing_store, rho)
153 mixing_store%iter_method =
"Kerker"
155 CALL pulay_mixing(qs_env, mixing_store, rho, para_env)
156 mixing_store%iter_method =
"Pulay"
158 CALL broyden_mixing(qs_env, mixing_store, rho, para_env)
159 mixing_store%iter_method =
"Broy."
162 CALL multisecant_mixing(mixing_store, rho, para_env)
163 mixing_store%iter_method =
"MSec."
167 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
169 CALL pw_axpy(rho_g(1), rho_g(2), -1.0_dp)
171 CALL auxbas_pw_pool%give_back_pw(rho_tmp)
180 CALL timestop(handle)
195 SUBROUTINE gmix_potential_only(qs_env, mixing_store, rho)
201 CHARACTER(len=*),
PARAMETER :: routinen =
'gmix_potential_only'
203 COMPLEX(dp),
DIMENSION(:),
POINTER :: cc_new
204 INTEGER :: handle, iatom, ig, ispin, natom, ng, &
207 REAL(
dp) :: alpha, f_mix
212 cpassert(
ASSOCIATED(mixing_store%rhoin))
213 cpassert(
ASSOCIATED(mixing_store%kerker_factor))
215 CALL timeset(routinen, handle)
216 NULLIFY (cc_new, dft_control, rho_atom, rho_g)
218 CALL get_qs_env(qs_env, dft_control=dft_control)
221 nspin =
SIZE(rho_g, 1)
222 ng =
SIZE(rho_g(1)%pw_grid%gsq)
224 gapw = dft_control%qs_control%gapw
225 alpha = mixing_store%alpha
228 cc_new => rho_g(ispin)%array
229 DO ig = 1, mixing_store%ig_max
230 f_mix = mixing_store%alpha*mixing_store%kerker_factor(ig)
231 cc_new(ig) = (1.0_dp - f_mix)*mixing_store%rhoin(ispin)%cc(ig) + f_mix*cc_new(ig)
232 mixing_store%rhoin(ispin)%cc(ig) = cc_new(ig)
234 DO ig = mixing_store%ig_max + 1, ng
235 f_mix = mixing_store%alpha
236 cc_new(ig) = (1.0_dp - f_mix)*mixing_store%rhoin(ispin)%cc(ig) + f_mix*cc_new(ig)
237 mixing_store%rhoin(ispin)%cc(ig) = cc_new(ig)
242 IF (mixing_store%gmix_p .AND. gapw)
THEN
244 rho_atom_set=rho_atom)
245 natom =
SIZE(rho_atom)
248 IF (mixing_store%paw(iatom))
THEN
249 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
250 mixing_store%cpc_h_in(iatom, ispin)%r_coef*(1._dp - alpha)
251 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
252 mixing_store%cpc_s_in(iatom, ispin)%r_coef*(1._dp - alpha)
253 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
254 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
260 CALL timestop(handle)
262 END SUBROUTINE gmix_potential_only
278 SUBROUTINE pulay_mixing(qs_env, mixing_store, rho, para_env)
285 CHARACTER(len=*),
PARAMETER :: routinen =
'pulay_mixing'
287 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: cc_mix
288 INTEGER :: handle, i, iatom, ib, ibb, ig, ispin, &
289 jb, n1, n2, natom, nb, nb1, nbuffer, &
292 REAL(
dp) :: alpha_kerker, alpha_pulay, beta, f_mix, &
293 inv_err, norm, norm_c_inv, res_norm, &
295 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: alpha_c, ev
296 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: b, c, c_inv, cpc_h_mix, cpc_s_mix
301 cpassert(
ASSOCIATED(mixing_store%res_buffer))
302 cpassert(
ASSOCIATED(mixing_store%rhoin_buffer))
303 NULLIFY (dft_control, rho_atom, rho_g)
304 CALL timeset(routinen, handle)
306 CALL get_qs_env(qs_env, dft_control=dft_control)
308 nspin =
SIZE(rho_g, 1)
309 ng =
SIZE(mixing_store%res_buffer(1, 1)%cc)
310 vol = rho_g(1)%pw_grid%vol
312 alpha_kerker = mixing_store%alpha
313 beta = mixing_store%pulay_beta
314 alpha_pulay = mixing_store%pulay_alpha
315 nbuffer = mixing_store%nbuffer
316 gapw = dft_control%qs_control%gapw
318 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
319 natom =
SIZE(rho_atom)
322 ALLOCATE (cc_mix(ng))
325 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
327 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
329 IF (gapw .AND. mixing_store%gmix_p)
THEN
331 IF (mixing_store%paw(iatom))
THEN
332 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
333 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
334 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
335 mixing_store%cpc_h_in(iatom, 2)%r_coef
336 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
337 mixing_store%cpc_s_in(iatom, 2)%r_coef
344 ib =
modulo(mixing_store%ncall_p(ispin), nbuffer) + 1
346 mixing_store%ncall_p(ispin) = mixing_store%ncall_p(ispin) + 1
347 nb = min(mixing_store%ncall_p(ispin), nbuffer)
348 ibb =
modulo(mixing_store%ncall_p(ispin), nbuffer) + 1
350 mixing_store%res_buffer(ib, ispin)%cc(:) = cmplx(0._dp, 0._dp, kind=
dp)
352 IF (nb == 1) mixing_store%rhoin_buffer(1, ispin)%cc = mixing_store%rhoin(ispin)%cc
355 f_mix = mixing_store%kerker_factor(ig)
356 mixing_store%res_buffer(ib, ispin)%cc(ig) = f_mix*(rho_g(ispin)%array(ig) - &
357 mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
358 res_norm = res_norm + &
359 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp)*
REAL(mixing_store%res_buffer(ib, ispin)%cc(ig), dp) + &
360 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))*aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))
363 CALL para_env%sum(res_norm)
364 res_norm = sqrt(res_norm)
366 IF (res_norm < 1.e-14_dp)
THEN
367 mixing_store%ncall_p(ispin) = mixing_store%ncall_p(ispin) - 1
370 IF (
ALLOCATED(b))
DEALLOCATE (b)
371 ALLOCATE (b(nb1, nb1))
373 IF (
ALLOCATED(c))
DEALLOCATE (c)
376 IF (
ALLOCATED(c_inv))
DEALLOCATE (c_inv)
377 ALLOCATE (c_inv(nb, nb))
379 IF (
ALLOCATED(alpha_c))
DEALLOCATE (alpha_c)
380 ALLOCATE (alpha_c(nb))
383 IF (
ALLOCATED(ev))
DEALLOCATE (ev)
390 mixing_store%pulay_matrix(jb, ib, ispin) = 0.0_dp
392 f_mix = mixing_store%special_metric(ig)
393 mixing_store%pulay_matrix(jb, ib, ispin) = mixing_store%pulay_matrix(jb, ib, ispin) + &
394 f_mix*(real(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp) &
395 *real(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp) + &
396 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))* &
397 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig)))
399 CALL para_env%sum(mixing_store%pulay_matrix(jb, ib, ispin))
400 mixing_store%pulay_matrix(jb, ib, ispin) = mixing_store%pulay_matrix(jb, ib, ispin)*vol*vol
401 mixing_store%pulay_matrix(ib, jb, ispin) = mixing_store%pulay_matrix(jb, ib, ispin)
404 IF (nb == 1 .OR. res_norm < 1.e-14_dp)
THEN
406 f_mix = alpha_kerker*mixing_store%kerker_factor(ig)
407 cc_mix(ig) = rho_g(ispin)%array(ig) - &
408 mixing_store%rhoin_buffer(ib, ispin)%cc(ig)
409 rho_g(ispin)%array(ig) = f_mix*cc_mix(ig) + &
410 mixing_store%rhoin_buffer(ib, ispin)%cc(ig)
411 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
413 IF (mixing_store%gmix_p)
THEN
416 IF (mixing_store%paw(iatom))
THEN
417 mixing_store%cpc_h_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
418 mixing_store%cpc_h_in(iatom, ispin)%r_coef
419 mixing_store%cpc_s_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
420 mixing_store%cpc_s_in(iatom, ispin)%r_coef
422 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha_kerker*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
423 (1.0_dp - alpha_kerker)*mixing_store%cpc_h_in(iatom, ispin)%r_coef
424 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha_kerker*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
425 (1.0_dp - alpha_kerker)*mixing_store%cpc_s_in(iatom, ispin)%r_coef
427 mixing_store%cpc_h_in_buffer(ib, iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
428 mixing_store%cpc_s_in_buffer(ib, iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
430 mixing_store%cpc_h_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
431 mixing_store%cpc_s_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
438 b(1:nb, 1:nb) = mixing_store%pulay_matrix(1:nb, 1:nb, ispin)
439 c(1:nb, 1:nb) = b(1:nb, 1:nb)
440 b(nb1, 1:nb) = -1.0_dp
441 b(1:nb, nb1) = -1.0_dp
448 alpha_c(i) = alpha_c(i) + c_inv(jb, i)
449 norm_c_inv = norm_c_inv + c_inv(jb, i)
452 alpha_c(1:nb) = alpha_c(1:nb)/norm_c_inv
453 cc_mix = cmplx(0._dp, 0._dp, kind=
dp)
456 cc_mix(ig) = cc_mix(ig) + &
457 alpha_c(jb)*(mixing_store%rhoin_buffer(jb, ispin)%cc(ig) + &
458 mixing_store%pulay_beta*mixing_store%res_buffer(jb, ispin)%cc(ig))
461 mixing_store%rhoin_buffer(ibb, ispin)%cc = cmplx(0._dp, 0._dp, kind=
dp)
462 IF (alpha_pulay > 0.0_dp)
THEN
464 f_mix = alpha_pulay*mixing_store%kerker_factor(ig)
465 rho_g(ispin)%array(ig) = f_mix*rho_g(ispin)%array(ig) + &
466 (1.0_dp - f_mix)*cc_mix(ig)
467 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
471 rho_g(ispin)%array(ig) = cc_mix(ig)
472 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
476 IF (mixing_store%gmix_p .AND. gapw)
THEN
477 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
479 IF (mixing_store%paw(iatom))
THEN
480 n1 =
SIZE(rho_atom(iatom)%cpc_h(ispin)%r_coef, 1)
481 n2 =
SIZE(rho_atom(iatom)%cpc_h(ispin)%r_coef, 2)
482 ALLOCATE (cpc_h_mix(n1, n2))
483 ALLOCATE (cpc_s_mix(n1, n2))
485 mixing_store%cpc_h_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
486 mixing_store%cpc_h_in_buffer(ib, iatom, ispin)%r_coef
487 mixing_store%cpc_s_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
488 mixing_store%cpc_s_in_buffer(ib, iatom, ispin)%r_coef
492 cpc_h_mix(:, :) = cpc_h_mix(:, :) + &
493 alpha_c(jb)*mixing_store%cpc_h_in_buffer(jb, iatom, ispin)%r_coef(:, :) + &
494 alpha_c(jb)*beta*mixing_store%cpc_h_res_buffer(jb, iatom, ispin)%r_coef(:, :)
495 cpc_s_mix(:, :) = cpc_s_mix(:, :) + &
496 alpha_c(jb)*mixing_store%cpc_s_in_buffer(jb, iatom, ispin)%r_coef(:, :) + &
497 alpha_c(jb)*beta*mixing_store%cpc_s_res_buffer(jb, iatom, ispin)%r_coef(:, :)
499 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha_pulay*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
500 (1.0_dp - alpha_pulay)*cpc_h_mix
501 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha_pulay*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
502 (1.0_dp - alpha_pulay)*cpc_s_mix
503 mixing_store%cpc_h_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
504 mixing_store%cpc_s_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
505 DEALLOCATE (cpc_h_mix)
506 DEALLOCATE (cpc_s_mix)
512 IF (res_norm > 1.e-14_dp)
THEN
515 DEALLOCATE (c, c_inv, alpha_c)
523 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
525 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
527 IF (gapw .AND. mixing_store%gmix_p)
THEN
529 IF (mixing_store%paw(iatom))
THEN
530 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
531 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
532 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
533 mixing_store%cpc_h_in(iatom, 2)%r_coef
534 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
535 mixing_store%cpc_s_in(iatom, 2)%r_coef
542 CALL timestop(handle)
544 END SUBROUTINE pulay_mixing
558 SUBROUTINE broyden_mixing(qs_env, mixing_store, rho, para_env)
565 CHARACTER(len=*),
PARAMETER :: routinen =
'broyden_mixing'
567 COMPLEX(dp) :: cc_mix
568 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: res_rho
569 INTEGER :: handle, i, iatom, ib, ig, ispin, j, jb, &
570 kb, n1, n2, natom, nb, nbuffer, ng, &
572 LOGICAL :: gapw, only_kerker
573 REAL(
dp) :: alpha, dcpc_h_res, dcpc_s_res, &
574 delta_norm, f_mix, inv_err, res_norm, &
575 rho_norm, valh, vals, w0
576 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: c, g
577 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: a, b
582 cpassert(
ASSOCIATED(mixing_store%res_buffer))
583 cpassert(
ASSOCIATED(mixing_store%rhoin))
584 cpassert(
ASSOCIATED(mixing_store%rhoin_old))
585 cpassert(
ASSOCIATED(mixing_store%drho_buffer))
586 NULLIFY (dft_control, rho_atom, rho_g)
587 CALL timeset(routinen, handle)
589 CALL get_qs_env(qs_env, dft_control=dft_control)
592 nspin =
SIZE(rho_g, 1)
593 ng =
SIZE(mixing_store%res_buffer(1, 1)%cc)
595 alpha = mixing_store%alpha
596 w0 = mixing_store%broy_w0
597 nbuffer = mixing_store%nbuffer
598 gapw = dft_control%qs_control%gapw
600 ALLOCATE (res_rho(ng))
602 mixing_store%ncall = mixing_store%ncall + 1
603 IF (mixing_store%ncall == 1)
THEN
606 only_kerker = .false.
607 nb = min(mixing_store%ncall - 1, nbuffer)
608 ib =
modulo(mixing_store%ncall - 2, nbuffer) + 1
612 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
613 natom =
SIZE(rho_atom)
619 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
621 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
623 IF (gapw .AND. mixing_store%gmix_p)
THEN
625 IF (mixing_store%paw(iatom))
THEN
626 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
627 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
628 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
629 mixing_store%cpc_h_in(iatom, 2)%r_coef
630 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
631 mixing_store%cpc_s_in(iatom, 2)%r_coef
640 res_rho(ig) = rho_g(ispin)%array(ig) - mixing_store%rhoin(ispin)%cc(ig)
643 IF (only_kerker)
THEN
645 mixing_store%last_res(ispin)%cc(ig) = res_rho(ig)
646 f_mix = alpha*mixing_store%kerker_factor(ig)
647 rho_g(ispin)%array(ig) = mixing_store%rhoin(ispin)%cc(ig) + f_mix*res_rho(ig)
648 mixing_store%rhoin_old(ispin)%cc(ig) = mixing_store%rhoin(ispin)%cc(ig)
649 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
652 IF (mixing_store%gmix_p)
THEN
655 IF (mixing_store%paw(iatom))
THEN
656 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
657 mixing_store%cpc_h_in(iatom, ispin)%r_coef
658 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
659 mixing_store%cpc_s_in(iatom, ispin)%r_coef
661 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
662 mixing_store%cpc_h_in(iatom, ispin)%r_coef*(1._dp - alpha)
663 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
664 mixing_store%cpc_s_in(iatom, ispin)%r_coef*(1._dp - alpha)
666 mixing_store%cpc_h_old(iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
667 mixing_store%cpc_s_old(iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
668 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
669 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
689 mixing_store%res_buffer(ib, ispin)%cc(ig) = res_rho(ig) - mixing_store%last_res(ispin)%cc(ig)
690 mixing_store%last_res(ispin)%cc(ig) = res_rho(ig)
691 res_norm = res_norm + &
692 REAL(res_rho(ig),
dp)*
REAL(res_rho(ig), dp) + &
693 aimag(res_rho(ig))*aimag(res_rho(ig))
694 delta_norm = delta_norm + &
695 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp)* &
696 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig), dp) + &
697 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))* &
698 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))
699 rho_norm = rho_norm + &
700 REAL(rho_g(ispin)%array(ig),
dp)*
REAL(rho_g(ispin)%array(ig), dp) + &
701 aimag(rho_g(ispin)%array(ig))*aimag(rho_g(ispin)%array(ig))
704 mixing_store%drho_buffer(ib, ispin)%cc(ig) = &
705 mixing_store%rhoin(ispin)%cc(ig) - &
706 mixing_store%rhoin_old(ispin)%cc(ig)
708 CALL para_env%sum(delta_norm)
709 delta_norm = sqrt(delta_norm)
710 CALL para_env%sum(res_norm)
711 res_norm = sqrt(res_norm)
712 CALL para_env%sum(rho_norm)
713 rho_norm = sqrt(rho_norm)
715 IF (res_norm > 1.e-14_dp)
THEN
716 mixing_store%res_buffer(ib, ispin)%cc(:) = mixing_store%res_buffer(ib, ispin)%cc(:)/delta_norm
717 mixing_store%drho_buffer(ib, ispin)%cc(:) = mixing_store%drho_buffer(ib, ispin)%cc(:)/delta_norm
719 IF (mixing_store%gmix_p .AND. gapw)
THEN
721 IF (mixing_store%paw(iatom))
THEN
722 n1 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 1)
723 n2 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 2)
726 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i) = &
727 (mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i) - &
728 mixing_store%cpc_h_old(iatom, ispin)%r_coef(j, i))/delta_norm
729 dcpc_h_res = ((rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) - &
730 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)) - &
731 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef(j, i))/delta_norm
732 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef(j, i) = rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) - &
733 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)
735 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i) = &
736 (mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i) - &
737 mixing_store%cpc_s_old(iatom, ispin)%r_coef(j, i))/delta_norm
738 dcpc_s_res = ((rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) - &
739 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)) - &
740 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef(j, i))/delta_norm
741 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef(j, i) = rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) - &
742 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)
744 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i) = &
746 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i)
747 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i) = &
749 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i)
758 f_mix = alpha*mixing_store%kerker_factor(ig)
759 mixing_store%drho_buffer(ib, ispin)%cc(ig) = &
760 f_mix*mixing_store%res_buffer(ib, ispin)%cc(ig) + &
761 mixing_store%drho_buffer(ib, ispin)%cc(ig)
765 DO ig = 1, mixing_store%ig_max
766 a(kb, jb) = a(kb, jb) + mixing_store%p_metric(ig)*( &
767 REAL(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp)* &
768 REAL(mixing_store%res_buffer(kb, ispin)%cc(ig), dp) + &
769 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))* &
770 aimag(mixing_store%res_buffer(kb, ispin)%cc(ig)))
772 a(jb, kb) = a(kb, jb)
779 a(jb, jb) = w0 + a(jb, jb)
780 DO ig = 1, mixing_store%ig_max
781 c(jb) = c(jb) + mixing_store%p_metric(ig)*( &
782 REAL(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp)*
REAL(res_rho(ig), dp) + &
783 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))*aimag(res_rho(ig)))
789 CALL dgemv(
'T', nb, nb, 1.0_dp, b, nb, c, 1, 0.0_dp, g, 1)
797 cc_mix = cc_mix - g(jb)*mixing_store%drho_buffer(jb, ispin)%cc(ig)
799 f_mix = alpha*mixing_store%kerker_factor(ig)
801 IF (res_norm > 1.e-14_dp) rho_g(ispin)%array(ig) = mixing_store%rhoin(ispin)%cc(ig) + &
802 f_mix*res_rho(ig) + cc_mix
803 mixing_store%rhoin_old(ispin)%cc(ig) = mixing_store%rhoin(ispin)%cc(ig)
804 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
807 IF (mixing_store%gmix_p)
THEN
810 IF (mixing_store%paw(iatom))
THEN
811 n1 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 1)
812 n2 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 2)
818 valh = valh - g(jb)*mixing_store%dcpc_h_in(jb, iatom, ispin)%r_coef(j, i)
819 vals = vals - g(jb)*mixing_store%dcpc_s_in(jb, iatom, ispin)%r_coef(j, i)
821 IF (res_norm > 1.e-14_dp)
THEN
822 rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) = &
823 alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) + &
824 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)*(1._dp - alpha) + valh
825 rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) = &
826 alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) + &
827 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)*(1._dp - alpha) + vals
832 mixing_store%cpc_h_old(iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
833 mixing_store%cpc_s_old(iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
834 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
835 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
841 DEALLOCATE (a, b, c, g)
846 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
848 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
850 IF (gapw .AND. mixing_store%gmix_p)
THEN
852 IF (mixing_store%paw(iatom))
THEN
853 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
854 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
855 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
856 mixing_store%cpc_h_in(iatom, 2)%r_coef
857 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
858 mixing_store%cpc_s_in(iatom, 2)%r_coef
867 CALL timestop(handle)
869 END SUBROUTINE broyden_mixing
884 SUBROUTINE multisecant_mixing(mixing_store, rho, para_env)
890 CHARACTER(len=*),
PARAMETER :: routinen =
'multisecant_mixing'
891 COMPLEX(KIND=dp),
PARAMETER :: cmone = (-1.0_dp, 0.0_dp), &
892 cone = (1.0_dp, 0.0_dp), &
893 czero = (0.0_dp, 0.0_dp)
895 COMPLEX(dp) :: saa, yaa
896 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: gn_global, pgn, res_matrix_global, &
898 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:, :) :: a_matrix, res_matrix, sa, step_matrix, ya
899 COMPLEX(dp),
DIMENSION(:),
POINTER :: gn
900 INTEGER :: handle, ib, ib_next, ib_prev, ig, &
901 ig_global, iig, ispin, jb, kb, nb, &
902 nbuffer, ng, ng_global, nspin
903 LOGICAL :: use_zgemm, use_zgemm_rev
904 REAL(
dp) :: alpha, f_mix, gn_norm, gn_norm_old, inv_err, n_low, n_up, pgn_norm, prec, &
905 r_step, reg_par, sigma_max, sigma_tilde, step_size
906 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: norm_res, norm_res_low, norm_res_up
907 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: b_matrix, binv_matrix
908 REAL(
dp),
DIMENSION(:),
POINTER :: g2
909 REAL(
dp),
SAVE :: sigma_old = 1.0_dp
912 cpassert(
ASSOCIATED(mixing_store))
914 CALL timeset(routinen, handle)
919 use_zgemm_rev = .true.
924 nspin =
SIZE(rho_g, 1)
926 cpassert(rho_g(1)%pw_grid%ngpts < huge(ng_global))
927 ng_global = int(rho_g(1)%pw_grid%ngpts)
928 ng =
SIZE(mixing_store%rhoin_buffer(1, 1)%cc)
929 alpha = mixing_store%alpha
931 sigma_max = mixing_store%sigma_max
932 reg_par = mixing_store%reg_par
933 r_step = mixing_store%r_step
934 nbuffer = mixing_store%nbuffer
937 nb = min(mixing_store%ncall, nbuffer - 1)
938 ib =
modulo(mixing_store%ncall, nbuffer) + 1
939 IF (mixing_store%ncall > 0)
THEN
940 ib_prev =
modulo(mixing_store%ncall - 1, nbuffer) + 1
944 mixing_store%ncall = mixing_store%ncall + 1
945 ib_next =
modulo(mixing_store%ncall, nbuffer) + 1
949 gn => mixing_store%res_buffer(ib, ispin)%cc
952 gn(ig) = (rho_g(ispin)%array(ig) - mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
953 gn_norm = gn_norm + &
954 REAL(gn(ig),
dp)*
REAL(gn(ig), dp) + aimag(gn(ig))*aimag(gn(ig))
956 CALL para_env%sum(gn_norm)
957 gn_norm = sqrt(gn_norm)
958 mixing_store%norm_res_buffer(ib, ispin) = gn_norm
965 f_mix = alpha*mixing_store%kerker_factor(ig)
966 rho_g(ispin)%array(ig) = mixing_store%rhoin_buffer(1, ispin)%cc(ig) + &
967 f_mix*mixing_store%res_buffer(1, ispin)%cc(ig)
968 mixing_store%rhoin_buffer(ib_next, ispin)%cc(ig) = rho_g(ispin)%array(ig)
971 CALL timestop(handle)
977 ALLOCATE (step_matrix(ng, nb))
979 ALLOCATE (res_matrix(ng, nb))
981 ALLOCATE (a_matrix(nb, ng_global))
983 ALLOCATE (norm_res(nb))
984 ALLOCATE (norm_res_low(nb))
985 ALLOCATE (norm_res_up(nb))
988 ALLOCATE (b_matrix(nb, nb))
990 ALLOCATE (binv_matrix(nb, nb))
992 ALLOCATE (gn_global(ng_global))
993 ALLOCATE (res_matrix_global(ng_global))
995 ALLOCATE (sa(ng, ng_global))
996 ALLOCATE (ya(ng, ng_global))
998 IF (use_zgemm_rev)
THEN
999 ALLOCATE (tmp_vec(nb))
1006 gn => mixing_store%res_buffer(ib, ispin)%cc
1009 ig_global = mixing_store%ig_global_index(ig)
1010 gn_global(ig_global) = gn(ig)
1012 CALL para_env%sum(gn_global)
1019 g2 => rho_g(1)%pw_grid%gsq
1024 ELSEIF (jb > ib)
THEN
1029 norm_res(kb) = 0.0_dp
1030 norm_res_low(kb) = 0.0_dp
1031 norm_res_up(kb) = 0.0_dp
1036 step_matrix(ig, kb) = prec*(mixing_store%rhoin_buffer(jb, ispin)%cc(ig) - &
1037 mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
1038 res_matrix(ig, kb) = (mixing_store%res_buffer(jb, ispin)%cc(ig) - &
1039 mixing_store%res_buffer(ib, ispin)%cc(ig))
1040 norm_res(kb) = norm_res(kb) + real(res_matrix(ig, kb),
dp)*real(res_matrix(ig, kb),
dp) + &
1041 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1042 IF (g2(ig) < 4.0_dp)
THEN
1043 norm_res_low(kb) = norm_res_low(kb) + &
1044 REAL(res_matrix(ig, kb),
dp)*
REAL(res_matrix(ig, kb), dp) + &
1045 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1047 norm_res_up(kb) = norm_res_up(kb) + &
1048 REAL(res_matrix(ig, kb),
dp)*
REAL(res_matrix(ig, kb), dp) + &
1049 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1051 res_matrix(ig, kb) = prec*res_matrix(ig, kb)
1056 CALL para_env%sum(norm_res)
1057 CALL para_env%sum(norm_res_up)
1058 CALL para_env%sum(norm_res_low)
1059 norm_res(1:nb) = 1.0_dp/sqrt(norm_res(1:nb))
1063 n_low = n_low + norm_res_low(jb)/norm_res(jb)
1064 n_up = n_up + norm_res_up(jb)/norm_res(jb)
1067 IF (g2(ig) > 4.0_dp)
THEN
1068 step_matrix(ig, 1:nb) = step_matrix(ig, 1:nb)*sqrt(n_low/n_up)
1069 res_matrix(ig, 1:nb) = res_matrix(ig, 1:nb)*sqrt(n_low/n_up)
1073 step_matrix(1:ng, kb) = step_matrix(1:ng, kb)*norm_res(kb)
1074 res_matrix(1:ng, kb) = res_matrix(1:ng, kb)*norm_res(kb)
1081 b_matrix(kb, jb) = 0.0_dp
1085 b_matrix(kb, jb) = b_matrix(kb, jb) + real(res_matrix(ig, kb)*res_matrix(ig, jb),
dp)
1090 CALL para_env%sum(b_matrix)
1092 b_matrix(jb, jb) = b_matrix(jb, jb) + reg_par
1100 res_matrix_global =
z_zero
1102 ig_global = mixing_store%ig_global_index(ig)
1103 res_matrix_global(ig_global) = res_matrix(ig, kb)
1105 CALL para_env%sum(res_matrix_global)
1109 ig_global = mixing_store%ig_global_index(ig)
1110 a_matrix(jb, ig_global) = a_matrix(jb, ig_global) + &
1111 binv_matrix(jb, kb)*res_matrix_global(ig_global)
1115 CALL para_env%sum(a_matrix)
1118 gn => mixing_store%res_buffer(ib, ispin)%cc
1123 CALL zgemm(
"N",
"N", ng, ng_global, nb, cmone, step_matrix(1, 1), ng, &
1124 a_matrix(1, 1), nb, czero, sa(1, 1), ng)
1125 CALL zgemm(
"N",
"N", ng, ng_global, nb, cmone, res_matrix(1, 1), ng, &
1126 a_matrix(1, 1), nb, czero, ya(1, 1), ng)
1128 ig_global = mixing_store%ig_global_index(ig)
1129 ya(ig, ig_global) = ya(ig, ig_global) +
z_one
1132 CALL zgemv(
"N", ng, ng_global, cone, sa(1, 1), &
1133 ng, gn_global(1), 1, czero, pgn(1), 1)
1134 CALL zgemv(
"N", ng, ng_global, cone, ya(1, 1), &
1135 ng, gn_global(1), 1, czero, ugn(1), 1)
1138 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1139 aimag(pgn(ig))*aimag(pgn(ig))
1141 CALL para_env%sum(pgn_norm)
1142 ELSEIF (use_zgemm_rev)
THEN
1144 CALL zgemv(
"N", nb, ng_global, cone, a_matrix(1, 1), &
1145 nb, gn_global(1), 1, czero, tmp_vec(1), 1)
1147 CALL zgemv(
"N", ng, nb, cmone, step_matrix(1, 1), ng, &
1148 tmp_vec(1), 1, czero, pgn(1), 1)
1150 CALL zgemv(
"N", ng, nb, cmone, res_matrix(1, 1), ng, &
1151 tmp_vec(1), 1, czero, ugn(1), 1)
1154 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1155 aimag(pgn(ig))*aimag(pgn(ig))
1156 ugn(ig) = ugn(ig) + gn(ig)
1158 CALL para_env%sum(pgn_norm)
1164 ig_global = mixing_store%ig_global_index(ig)
1165 DO iig = 1, ng_global
1169 IF (ig_global == iig) yaa =
z_one
1172 saa = saa - step_matrix(ig, jb)*a_matrix(jb, iig)
1173 yaa = yaa - res_matrix(ig, jb)*a_matrix(jb, iig)
1175 pgn(ig) = pgn(ig) + saa*gn_global(iig)
1176 ugn(ig) = ugn(ig) + yaa*gn_global(iig)
1180 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1181 aimag(pgn(ig))*aimag(pgn(ig))
1183 CALL para_env%sum(pgn_norm)
1186 gn_norm = mixing_store%norm_res_buffer(ib, ispin)
1187 gn_norm_old = mixing_store%norm_res_buffer(ib_prev, ispin)
1188 IF (ib_prev /= 0)
THEN
1189 sigma_tilde = sigma_old*max(0.5_dp, min(2.0_dp, gn_norm_old/gn_norm))
1191 sigma_tilde = 0.5_dp
1193 sigma_tilde = 0.1_dp
1195 step_size = min(sigma_tilde, r_step*pgn_norm/gn_norm, sigma_max)
1196 sigma_old = step_size
1200 prec = mixing_store%kerker_factor(ig)
1201 rho_g(ispin)%array(ig) = mixing_store%rhoin_buffer(ib, ispin)%cc(ig) &
1202 - prec*step_size*ugn(ig) + prec*pgn(ig)
1203 mixing_store%rhoin_buffer(ib_next, ispin)%cc(ig) = rho_g(ispin)%array(ig)
1209 DEALLOCATE (step_matrix, res_matrix)
1210 DEALLOCATE (norm_res)
1211 DEALLOCATE (norm_res_up)
1212 DEALLOCATE (norm_res_low)
1213 DEALLOCATE (a_matrix, b_matrix, binv_matrix)
1214 DEALLOCATE (ugn, pgn)
1218 IF (use_zgemm_rev)
THEN
1219 DEALLOCATE (tmp_vec)
1221 DEALLOCATE (gn_global, res_matrix_global)
1223 CALL timestop(handle)
1225 END SUBROUTINE multisecant_mixing
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public z_zero
Collection of simple mathematical functions and subroutines.
Interface to the message passing library MPI.
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
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
module that contains the definitions of the scf types
integer, parameter, public broyden_mixing_nr
integer, parameter, public multisecant_mixing_nr
integer, parameter, public pulay_mixing_nr
integer, parameter, public gspace_mixing_nr
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, 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, 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, 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 gspace_mixing(qs_env, mixing_method, mixing_store, rho, para_env, iter_count)
Driver for the g-space mixing, calls the proper routine given the requested method.
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...
stores all the informations relevant to an mpi environment
contained for different pw related things
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
keeps the density in various representations, keeping track of which ones are valid.