36#include "./base/base_uses.f90"
42 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_gspace_mixing'
63 SUBROUTINE gspace_mixing(qs_env, mixing_method, mixing_store, rho, para_env, iter_count)
65 INTEGER :: mixing_method
71 CHARACTER(len=*),
PARAMETER :: routinen =
'gspace_mixing'
73 INTEGER :: handle, iatom, ig, ispin, natom, ng, &
77 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
86 CALL timeset(routinen, handle)
88 CALL get_qs_env(qs_env, dft_control=dft_control, pw_env=pw_env)
89 IF (.NOT. (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb .OR. &
90 dft_control%qs_control%semi_empirical))
THEN
92 cpassert(
ASSOCIATED(mixing_store))
93 NULLIFY (auxbas_pw_pool, rho_atom, rho_g, rho_r, tot_rho_r)
94 CALL qs_rho_get(rho, rho_g=rho_g, rho_r=rho_r, tot_rho_r=tot_rho_r)
96 nspin =
SIZE(rho_g, 1)
97 nimg = dft_control%nimages
98 ng =
SIZE(rho_g(1)%pw_grid%gsq)
99 cpassert(ng ==
SIZE(mixing_store%rhoin(1)%cc))
101 alpha = mixing_store%alpha
102 gapw = dft_control%qs_control%gapw
105 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool)
106 CALL auxbas_pw_pool%create_pw(rho_tmp)
108 CALL pw_copy(rho_g(1), rho_tmp)
109 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
110 CALL pw_axpy(rho_tmp, rho_g(2), -1.0_dp)
114 IF (iter_count + 1 <= mixing_store%nskip_mixing)
THEN
118 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
121 IF (mixing_store%gmix_p .AND. gapw)
THEN
122 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
123 natom =
SIZE(rho_atom)
126 IF (mixing_store%paw(iatom))
THEN
127 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
128 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
134 mixing_store%iter_method =
"NoMix"
136 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
138 CALL pw_axpy(rho_g(1), rho_g(2), -1.0_dp)
140 CALL auxbas_pw_pool%give_back_pw(rho_tmp)
142 CALL timestop(handle)
146 IF ((iter_count + 1 - mixing_store%nskip_mixing) <= mixing_store%n_simple_mix)
THEN
147 CALL gmix_potential_only(qs_env, mixing_store, rho)
148 mixing_store%iter_method =
"Kerker"
150 CALL gmix_potential_only(qs_env, mixing_store, rho)
151 mixing_store%iter_method =
"Kerker"
153 CALL pulay_mixing(qs_env, mixing_store, rho, para_env)
154 mixing_store%iter_method =
"Pulay"
156 CALL broyden_mixing(qs_env, mixing_store, rho, para_env)
157 mixing_store%iter_method =
"Broy."
160 CALL multisecant_mixing(mixing_store, rho, para_env)
161 mixing_store%iter_method =
"MSec."
165 CALL pw_axpy(rho_g(2), rho_g(1), 1.0_dp)
167 CALL pw_axpy(rho_g(1), rho_g(2), -1.0_dp)
169 CALL auxbas_pw_pool%give_back_pw(rho_tmp)
178 CALL timestop(handle)
193 SUBROUTINE gmix_potential_only(qs_env, mixing_store, rho)
199 CHARACTER(len=*),
PARAMETER :: routinen =
'gmix_potential_only'
201 COMPLEX(dp),
DIMENSION(:),
POINTER :: cc_new
202 INTEGER :: handle, iatom, ig, ispin, natom, ng, &
205 REAL(
dp) :: alpha, f_mix
210 cpassert(
ASSOCIATED(mixing_store%rhoin))
211 cpassert(
ASSOCIATED(mixing_store%kerker_factor))
213 CALL timeset(routinen, handle)
214 NULLIFY (cc_new, dft_control, rho_atom, rho_g)
216 CALL get_qs_env(qs_env, dft_control=dft_control)
219 nspin =
SIZE(rho_g, 1)
220 ng =
SIZE(rho_g(1)%pw_grid%gsq)
222 gapw = dft_control%qs_control%gapw
223 alpha = mixing_store%alpha
226 cc_new => rho_g(ispin)%array
227 DO ig = 1, mixing_store%ig_max
228 f_mix = mixing_store%alpha*mixing_store%kerker_factor(ig)
229 cc_new(ig) = (1.0_dp - f_mix)*mixing_store%rhoin(ispin)%cc(ig) + f_mix*cc_new(ig)
230 mixing_store%rhoin(ispin)%cc(ig) = cc_new(ig)
232 DO ig = mixing_store%ig_max + 1, ng
233 f_mix = mixing_store%alpha
234 cc_new(ig) = (1.0_dp - f_mix)*mixing_store%rhoin(ispin)%cc(ig) + f_mix*cc_new(ig)
235 mixing_store%rhoin(ispin)%cc(ig) = cc_new(ig)
240 IF (mixing_store%gmix_p .AND. gapw)
THEN
242 rho_atom_set=rho_atom)
243 natom =
SIZE(rho_atom)
246 IF (mixing_store%paw(iatom))
THEN
247 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
248 mixing_store%cpc_h_in(iatom, ispin)%r_coef*(1._dp - alpha)
249 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
250 mixing_store%cpc_s_in(iatom, ispin)%r_coef*(1._dp - alpha)
251 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
252 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
258 CALL timestop(handle)
260 END SUBROUTINE gmix_potential_only
276 SUBROUTINE pulay_mixing(qs_env, mixing_store, rho, para_env)
283 CHARACTER(len=*),
PARAMETER :: routinen =
'pulay_mixing'
285 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: cc_mix
286 INTEGER :: handle, i, iatom, ib, ibb, ig, ispin, &
287 jb, n1, n2, natom, nb, nb1, nbuffer, &
290 REAL(
dp) :: alpha_kerker, alpha_pulay, beta, f_mix, &
291 inv_err, norm, norm_c_inv, res_norm, &
293 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: alpha_c, ev
294 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: b, c, c_inv, cpc_h_mix, cpc_s_mix
299 cpassert(
ASSOCIATED(mixing_store%res_buffer))
300 cpassert(
ASSOCIATED(mixing_store%rhoin_buffer))
301 NULLIFY (dft_control, rho_atom, rho_g)
302 CALL timeset(routinen, handle)
304 CALL get_qs_env(qs_env, dft_control=dft_control)
306 nspin =
SIZE(rho_g, 1)
307 ng =
SIZE(mixing_store%res_buffer(1, 1)%cc)
308 vol = rho_g(1)%pw_grid%vol
310 alpha_kerker = mixing_store%alpha
311 beta = mixing_store%pulay_beta
312 alpha_pulay = mixing_store%pulay_alpha
313 nbuffer = mixing_store%nbuffer
314 gapw = dft_control%qs_control%gapw
316 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
317 natom =
SIZE(rho_atom)
320 ALLOCATE (cc_mix(ng))
323 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
325 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
327 IF (gapw .AND. mixing_store%gmix_p)
THEN
329 IF (mixing_store%paw(iatom))
THEN
330 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
331 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
332 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
333 mixing_store%cpc_h_in(iatom, 2)%r_coef
334 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
335 mixing_store%cpc_s_in(iatom, 2)%r_coef
342 ib =
modulo(mixing_store%ncall_p(ispin), nbuffer) + 1
344 mixing_store%ncall_p(ispin) = mixing_store%ncall_p(ispin) + 1
345 nb = min(mixing_store%ncall_p(ispin), nbuffer)
346 ibb =
modulo(mixing_store%ncall_p(ispin), nbuffer) + 1
348 mixing_store%res_buffer(ib, ispin)%cc(:) = cmplx(0._dp, 0._dp, kind=
dp)
350 IF (nb == 1) mixing_store%rhoin_buffer(1, ispin)%cc = mixing_store%rhoin(ispin)%cc
353 f_mix = mixing_store%kerker_factor(ig)
354 mixing_store%res_buffer(ib, ispin)%cc(ig) = f_mix*(rho_g(ispin)%array(ig) - &
355 mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
356 res_norm = res_norm + &
357 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp)*
REAL(mixing_store%res_buffer(ib, ispin)%cc(ig), dp) + &
358 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))*aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))
361 CALL para_env%sum(res_norm)
362 res_norm = sqrt(res_norm)
364 IF (res_norm < 1.e-14_dp)
THEN
365 mixing_store%ncall_p(ispin) = mixing_store%ncall_p(ispin) - 1
368 IF (
ALLOCATED(b))
DEALLOCATE (b)
369 ALLOCATE (b(nb1, nb1))
371 IF (
ALLOCATED(c))
DEALLOCATE (c)
374 IF (
ALLOCATED(c_inv))
DEALLOCATE (c_inv)
375 ALLOCATE (c_inv(nb, nb))
377 IF (
ALLOCATED(alpha_c))
DEALLOCATE (alpha_c)
378 ALLOCATE (alpha_c(nb))
381 IF (
ALLOCATED(ev))
DEALLOCATE (ev)
388 mixing_store%pulay_matrix(jb, ib, ispin) = 0.0_dp
390 f_mix = mixing_store%special_metric(ig)
391 mixing_store%pulay_matrix(jb, ib, ispin) = mixing_store%pulay_matrix(jb, ib, ispin) + &
392 f_mix*(real(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp) &
393 *real(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp) + &
394 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))* &
395 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig)))
397 CALL para_env%sum(mixing_store%pulay_matrix(jb, ib, ispin))
398 mixing_store%pulay_matrix(jb, ib, ispin) = mixing_store%pulay_matrix(jb, ib, ispin)*vol*vol
399 mixing_store%pulay_matrix(ib, jb, ispin) = mixing_store%pulay_matrix(jb, ib, ispin)
402 IF (nb == 1 .OR. res_norm < 1.e-14_dp)
THEN
404 f_mix = alpha_kerker*mixing_store%kerker_factor(ig)
405 cc_mix(ig) = rho_g(ispin)%array(ig) - &
406 mixing_store%rhoin_buffer(ib, ispin)%cc(ig)
407 rho_g(ispin)%array(ig) = f_mix*cc_mix(ig) + &
408 mixing_store%rhoin_buffer(ib, ispin)%cc(ig)
409 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
411 IF (mixing_store%gmix_p)
THEN
414 IF (mixing_store%paw(iatom))
THEN
415 mixing_store%cpc_h_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
416 mixing_store%cpc_h_in(iatom, ispin)%r_coef
417 mixing_store%cpc_s_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
418 mixing_store%cpc_s_in(iatom, ispin)%r_coef
420 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha_kerker*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
421 (1.0_dp - alpha_kerker)*mixing_store%cpc_h_in(iatom, ispin)%r_coef
422 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha_kerker*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
423 (1.0_dp - alpha_kerker)*mixing_store%cpc_s_in(iatom, ispin)%r_coef
425 mixing_store%cpc_h_in_buffer(ib, iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
426 mixing_store%cpc_s_in_buffer(ib, iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
428 mixing_store%cpc_h_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
429 mixing_store%cpc_s_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
436 b(1:nb, 1:nb) = mixing_store%pulay_matrix(1:nb, 1:nb, ispin)
437 c(1:nb, 1:nb) = b(1:nb, 1:nb)
438 b(nb1, 1:nb) = -1.0_dp
439 b(1:nb, nb1) = -1.0_dp
446 alpha_c(i) = alpha_c(i) + c_inv(jb, i)
447 norm_c_inv = norm_c_inv + c_inv(jb, i)
450 alpha_c(1:nb) = alpha_c(1:nb)/norm_c_inv
451 cc_mix = cmplx(0._dp, 0._dp, kind=
dp)
454 cc_mix(ig) = cc_mix(ig) + &
455 alpha_c(jb)*(mixing_store%rhoin_buffer(jb, ispin)%cc(ig) + &
456 mixing_store%pulay_beta*mixing_store%res_buffer(jb, ispin)%cc(ig))
459 mixing_store%rhoin_buffer(ibb, ispin)%cc = cmplx(0._dp, 0._dp, kind=
dp)
460 IF (alpha_pulay > 0.0_dp)
THEN
462 f_mix = alpha_pulay*mixing_store%kerker_factor(ig)
463 rho_g(ispin)%array(ig) = f_mix*rho_g(ispin)%array(ig) + &
464 (1.0_dp - f_mix)*cc_mix(ig)
465 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
469 rho_g(ispin)%array(ig) = cc_mix(ig)
470 mixing_store%rhoin_buffer(ibb, ispin)%cc(ig) = rho_g(ispin)%array(ig)
474 IF (mixing_store%gmix_p .AND. gapw)
THEN
475 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
477 IF (mixing_store%paw(iatom))
THEN
478 n1 =
SIZE(rho_atom(iatom)%cpc_h(ispin)%r_coef, 1)
479 n2 =
SIZE(rho_atom(iatom)%cpc_h(ispin)%r_coef, 2)
480 ALLOCATE (cpc_h_mix(n1, n2))
481 ALLOCATE (cpc_s_mix(n1, n2))
483 mixing_store%cpc_h_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
484 mixing_store%cpc_h_in_buffer(ib, iatom, ispin)%r_coef
485 mixing_store%cpc_s_res_buffer(ib, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
486 mixing_store%cpc_s_in_buffer(ib, iatom, ispin)%r_coef
490 cpc_h_mix(:, :) = cpc_h_mix(:, :) + &
491 alpha_c(jb)*mixing_store%cpc_h_in_buffer(jb, iatom, ispin)%r_coef(:, :) + &
492 alpha_c(jb)*beta*mixing_store%cpc_h_res_buffer(jb, iatom, ispin)%r_coef(:, :)
493 cpc_s_mix(:, :) = cpc_s_mix(:, :) + &
494 alpha_c(jb)*mixing_store%cpc_s_in_buffer(jb, iatom, ispin)%r_coef(:, :) + &
495 alpha_c(jb)*beta*mixing_store%cpc_s_res_buffer(jb, iatom, ispin)%r_coef(:, :)
497 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha_pulay*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
498 (1.0_dp - alpha_pulay)*cpc_h_mix
499 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha_pulay*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
500 (1.0_dp - alpha_pulay)*cpc_s_mix
501 mixing_store%cpc_h_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
502 mixing_store%cpc_s_in_buffer(ibb, iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
503 DEALLOCATE (cpc_h_mix)
504 DEALLOCATE (cpc_s_mix)
510 IF (res_norm > 1.e-14_dp)
THEN
513 DEALLOCATE (c, c_inv, alpha_c)
521 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
523 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
525 IF (gapw .AND. mixing_store%gmix_p)
THEN
527 IF (mixing_store%paw(iatom))
THEN
528 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
529 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
530 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
531 mixing_store%cpc_h_in(iatom, 2)%r_coef
532 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
533 mixing_store%cpc_s_in(iatom, 2)%r_coef
540 CALL timestop(handle)
542 END SUBROUTINE pulay_mixing
556 SUBROUTINE broyden_mixing(qs_env, mixing_store, rho, para_env)
563 CHARACTER(len=*),
PARAMETER :: routinen =
'broyden_mixing'
565 COMPLEX(dp) :: cc_mix
566 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: res_rho
567 INTEGER :: handle, i, iatom, ib, ig, ispin, j, jb, &
568 kb, n1, n2, natom, nb, nbuffer, ng, &
570 LOGICAL :: gapw, only_kerker
571 REAL(
dp) :: alpha, dcpc_h_res, dcpc_s_res, &
572 delta_norm, f_mix, inv_err, res_norm, &
573 rho_norm, valh, vals, w0
574 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: c, g
575 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: a, b
580 cpassert(
ASSOCIATED(mixing_store%res_buffer))
581 cpassert(
ASSOCIATED(mixing_store%rhoin))
582 cpassert(
ASSOCIATED(mixing_store%rhoin_old))
583 cpassert(
ASSOCIATED(mixing_store%drho_buffer))
584 NULLIFY (dft_control, rho_atom, rho_g)
585 CALL timeset(routinen, handle)
587 CALL get_qs_env(qs_env, dft_control=dft_control)
590 nspin =
SIZE(rho_g, 1)
591 ng =
SIZE(mixing_store%res_buffer(1, 1)%cc)
593 alpha = mixing_store%alpha
594 w0 = mixing_store%broy_w0
595 nbuffer = mixing_store%nbuffer
596 gapw = dft_control%qs_control%gapw
598 ALLOCATE (res_rho(ng))
600 mixing_store%ncall = mixing_store%ncall + 1
601 IF (mixing_store%ncall == 1)
THEN
604 only_kerker = .false.
605 nb = min(mixing_store%ncall - 1, nbuffer)
606 ib =
modulo(mixing_store%ncall - 2, nbuffer) + 1
610 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
611 natom =
SIZE(rho_atom)
617 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
619 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
621 IF (gapw .AND. mixing_store%gmix_p)
THEN
623 IF (mixing_store%paw(iatom))
THEN
624 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
625 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
626 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
627 mixing_store%cpc_h_in(iatom, 2)%r_coef
628 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
629 mixing_store%cpc_s_in(iatom, 2)%r_coef
636 res_rho = cmplx(0.0_dp, 0.0_dp, kind=
dp)
638 res_rho(ig) = rho_g(ispin)%array(ig) - mixing_store%rhoin(ispin)%cc(ig)
641 IF (only_kerker)
THEN
643 mixing_store%last_res(ispin)%cc(ig) = res_rho(ig)
644 f_mix = alpha*mixing_store%kerker_factor(ig)
645 rho_g(ispin)%array(ig) = mixing_store%rhoin(ispin)%cc(ig) + f_mix*res_rho(ig)
646 mixing_store%rhoin_old(ispin)%cc(ig) = mixing_store%rhoin(ispin)%cc(ig)
647 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
650 IF (mixing_store%gmix_p)
THEN
653 IF (mixing_store%paw(iatom))
THEN
654 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef - &
655 mixing_store%cpc_h_in(iatom, ispin)%r_coef
656 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef - &
657 mixing_store%cpc_s_in(iatom, ispin)%r_coef
659 rho_atom(iatom)%cpc_h(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef + &
660 mixing_store%cpc_h_in(iatom, ispin)%r_coef*(1._dp - alpha)
661 rho_atom(iatom)%cpc_s(ispin)%r_coef = alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef + &
662 mixing_store%cpc_s_in(iatom, ispin)%r_coef*(1._dp - alpha)
664 mixing_store%cpc_h_old(iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
665 mixing_store%cpc_s_old(iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
666 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
667 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
687 mixing_store%res_buffer(ib, ispin)%cc(ig) = res_rho(ig) - mixing_store%last_res(ispin)%cc(ig)
688 mixing_store%last_res(ispin)%cc(ig) = res_rho(ig)
689 res_norm = res_norm + &
690 REAL(res_rho(ig),
dp)*
REAL(res_rho(ig), dp) + &
691 aimag(res_rho(ig))*aimag(res_rho(ig))
692 delta_norm = delta_norm + &
693 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig),
dp)* &
694 REAL(mixing_store%res_buffer(ib, ispin)%cc(ig), dp) + &
695 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))* &
696 aimag(mixing_store%res_buffer(ib, ispin)%cc(ig))
697 rho_norm = rho_norm + &
698 REAL(rho_g(ispin)%array(ig),
dp)*
REAL(rho_g(ispin)%array(ig), dp) + &
699 aimag(rho_g(ispin)%array(ig))*aimag(rho_g(ispin)%array(ig))
702 mixing_store%drho_buffer(ib, ispin)%cc(ig) = &
703 mixing_store%rhoin(ispin)%cc(ig) - &
704 mixing_store%rhoin_old(ispin)%cc(ig)
706 CALL para_env%sum(delta_norm)
707 delta_norm = sqrt(delta_norm)
708 CALL para_env%sum(res_norm)
709 res_norm = sqrt(res_norm)
710 CALL para_env%sum(rho_norm)
711 rho_norm = sqrt(rho_norm)
713 IF (res_norm > 1.e-14_dp)
THEN
714 mixing_store%res_buffer(ib, ispin)%cc(:) = mixing_store%res_buffer(ib, ispin)%cc(:)/delta_norm
715 mixing_store%drho_buffer(ib, ispin)%cc(:) = mixing_store%drho_buffer(ib, ispin)%cc(:)/delta_norm
717 IF (mixing_store%gmix_p .AND. gapw)
THEN
719 IF (mixing_store%paw(iatom))
THEN
720 n1 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 1)
721 n2 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 2)
724 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i) = &
725 (mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i) - &
726 mixing_store%cpc_h_old(iatom, ispin)%r_coef(j, i))/delta_norm
727 dcpc_h_res = ((rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) - &
728 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)) - &
729 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef(j, i))/delta_norm
730 mixing_store%cpc_h_lastres(iatom, ispin)%r_coef(j, i) = rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) - &
731 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)
733 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i) = &
734 (mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i) - &
735 mixing_store%cpc_s_old(iatom, ispin)%r_coef(j, i))/delta_norm
736 dcpc_s_res = ((rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) - &
737 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)) - &
738 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef(j, i))/delta_norm
739 mixing_store%cpc_s_lastres(iatom, ispin)%r_coef(j, i) = rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) - &
740 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)
742 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i) = &
744 mixing_store%dcpc_h_in(ib, iatom, ispin)%r_coef(j, i)
745 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i) = &
747 mixing_store%dcpc_s_in(ib, iatom, ispin)%r_coef(j, i)
756 f_mix = alpha*mixing_store%kerker_factor(ig)
757 mixing_store%drho_buffer(ib, ispin)%cc(ig) = &
758 f_mix*mixing_store%res_buffer(ib, ispin)%cc(ig) + &
759 mixing_store%drho_buffer(ib, ispin)%cc(ig)
763 DO ig = 1, mixing_store%ig_max
764 a(kb, jb) = a(kb, jb) + mixing_store%p_metric(ig)*( &
765 REAL(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp)* &
766 REAL(mixing_store%res_buffer(kb, ispin)%cc(ig), dp) + &
767 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))* &
768 aimag(mixing_store%res_buffer(kb, ispin)%cc(ig)))
770 a(jb, kb) = a(kb, jb)
777 a(jb, jb) = w0 + a(jb, jb)
778 DO ig = 1, mixing_store%ig_max
779 c(jb) = c(jb) + mixing_store%p_metric(ig)*( &
780 REAL(mixing_store%res_buffer(jb, ispin)%cc(ig),
dp)*
REAL(res_rho(ig), dp) + &
781 aimag(mixing_store%res_buffer(jb, ispin)%cc(ig))*aimag(res_rho(ig)))
787 CALL dgemv(
'T', nb, nb, 1.0_dp, b, nb, c, 1, 0.0_dp, g, 1)
793 cc_mix = cmplx(0.0_dp, 0.0_dp, kind=
dp)
795 cc_mix = cc_mix - g(jb)*mixing_store%drho_buffer(jb, ispin)%cc(ig)
797 f_mix = alpha*mixing_store%kerker_factor(ig)
799 IF (res_norm > 1.e-14_dp) rho_g(ispin)%array(ig) = mixing_store%rhoin(ispin)%cc(ig) + &
800 f_mix*res_rho(ig) + cc_mix
801 mixing_store%rhoin_old(ispin)%cc(ig) = mixing_store%rhoin(ispin)%cc(ig)
802 mixing_store%rhoin(ispin)%cc(ig) = rho_g(ispin)%array(ig)
805 IF (mixing_store%gmix_p)
THEN
808 IF (mixing_store%paw(iatom))
THEN
809 n1 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 1)
810 n2 =
SIZE(mixing_store%cpc_s_in(iatom, ispin)%r_coef, 2)
816 valh = valh - g(jb)*mixing_store%dcpc_h_in(jb, iatom, ispin)%r_coef(j, i)
817 vals = vals - g(jb)*mixing_store%dcpc_s_in(jb, iatom, ispin)%r_coef(j, i)
819 IF (res_norm > 1.e-14_dp)
THEN
820 rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) = &
821 alpha*rho_atom(iatom)%cpc_h(ispin)%r_coef(j, i) + &
822 mixing_store%cpc_h_in(iatom, ispin)%r_coef(j, i)*(1._dp - alpha) + valh
823 rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) = &
824 alpha*rho_atom(iatom)%cpc_s(ispin)%r_coef(j, i) + &
825 mixing_store%cpc_s_in(iatom, ispin)%r_coef(j, i)*(1._dp - alpha) + vals
830 mixing_store%cpc_h_old(iatom, ispin)%r_coef = mixing_store%cpc_h_in(iatom, ispin)%r_coef
831 mixing_store%cpc_s_old(iatom, ispin)%r_coef = mixing_store%cpc_s_in(iatom, ispin)%r_coef
832 mixing_store%cpc_h_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_h(ispin)%r_coef
833 mixing_store%cpc_s_in(iatom, ispin)%r_coef = rho_atom(iatom)%cpc_s(ispin)%r_coef
839 DEALLOCATE (a, b, c, g)
844 CALL pw_axpy(rho_g(1), rho_g(2), 1.0_dp, -1.0_dp)
846 mixing_store%rhoin(2)%cc(ig) = mixing_store%rhoin(1)%cc(ig) - mixing_store%rhoin(2)%cc(ig)
848 IF (gapw .AND. mixing_store%gmix_p)
THEN
850 IF (mixing_store%paw(iatom))
THEN
851 rho_atom(iatom)%cpc_h(2)%r_coef = rho_atom(iatom)%cpc_h(1)%r_coef - rho_atom(iatom)%cpc_h(2)%r_coef
852 rho_atom(iatom)%cpc_s(2)%r_coef = rho_atom(iatom)%cpc_s(1)%r_coef - rho_atom(iatom)%cpc_s(2)%r_coef
853 mixing_store%cpc_h_in(iatom, 2)%r_coef = mixing_store%cpc_h_in(iatom, 1)%r_coef - &
854 mixing_store%cpc_h_in(iatom, 2)%r_coef
855 mixing_store%cpc_s_in(iatom, 2)%r_coef = mixing_store%cpc_s_in(iatom, 1)%r_coef - &
856 mixing_store%cpc_s_in(iatom, 2)%r_coef
865 CALL timestop(handle)
867 END SUBROUTINE broyden_mixing
882 SUBROUTINE multisecant_mixing(mixing_store, rho, para_env)
888 CHARACTER(len=*),
PARAMETER :: routinen =
'multisecant_mixing'
889 COMPLEX(KIND=dp),
PARAMETER :: cmone = (-1.0_dp, 0.0_dp), &
890 cone = (1.0_dp, 0.0_dp), &
891 czero = (0.0_dp, 0.0_dp)
893 COMPLEX(dp) :: saa, yaa
894 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:) :: gn_global, pgn, res_matrix_global, &
896 COMPLEX(dp),
ALLOCATABLE,
DIMENSION(:, :) :: a_matrix, res_matrix, sa, step_matrix, ya
897 COMPLEX(dp),
DIMENSION(:),
POINTER :: gn
898 INTEGER :: handle, ib, ib_next, ib_prev, ig, &
899 ig_global, iig, ispin, jb, kb, nb, &
900 nbuffer, ng, ng_global, nspin
901 LOGICAL :: use_zgemm, use_zgemm_rev
902 REAL(
dp) :: alpha, f_mix, gn_norm, gn_norm_old, inv_err, n_low, n_up, pgn_norm, prec, &
903 r_step, reg_par, sigma_max, sigma_tilde, step_size
904 REAL(
dp),
ALLOCATABLE,
DIMENSION(:) :: norm_res, norm_res_low, norm_res_up
905 REAL(
dp),
ALLOCATABLE,
DIMENSION(:, :) :: b_matrix, binv_matrix
906 REAL(
dp),
DIMENSION(:),
POINTER :: g2
907 REAL(
dp),
SAVE :: sigma_old = 1.0_dp
910 cpassert(
ASSOCIATED(mixing_store))
912 CALL timeset(routinen, handle)
917 use_zgemm_rev = .true.
922 nspin =
SIZE(rho_g, 1)
924 cpassert(rho_g(1)%pw_grid%ngpts < huge(ng_global))
925 ng_global = int(rho_g(1)%pw_grid%ngpts)
926 ng =
SIZE(mixing_store%rhoin_buffer(1, 1)%cc)
927 alpha = mixing_store%alpha
929 sigma_max = mixing_store%sigma_max
930 reg_par = mixing_store%reg_par
931 r_step = mixing_store%r_step
932 nbuffer = mixing_store%nbuffer
935 nb = min(mixing_store%ncall, nbuffer - 1)
936 ib =
modulo(mixing_store%ncall, nbuffer) + 1
937 IF (mixing_store%ncall > 0)
THEN
938 ib_prev =
modulo(mixing_store%ncall - 1, nbuffer) + 1
942 mixing_store%ncall = mixing_store%ncall + 1
943 ib_next =
modulo(mixing_store%ncall, nbuffer) + 1
947 gn => mixing_store%res_buffer(ib, ispin)%cc
950 gn(ig) = (rho_g(ispin)%array(ig) - mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
951 gn_norm = gn_norm + &
952 REAL(gn(ig),
dp)*
REAL(gn(ig), dp) + aimag(gn(ig))*aimag(gn(ig))
954 CALL para_env%sum(gn_norm)
955 gn_norm = sqrt(gn_norm)
956 mixing_store%norm_res_buffer(ib, ispin) = gn_norm
963 f_mix = alpha*mixing_store%kerker_factor(ig)
964 rho_g(ispin)%array(ig) = mixing_store%rhoin_buffer(1, ispin)%cc(ig) + &
965 f_mix*mixing_store%res_buffer(1, ispin)%cc(ig)
966 mixing_store%rhoin_buffer(ib_next, ispin)%cc(ig) = rho_g(ispin)%array(ig)
969 CALL timestop(handle)
975 ALLOCATE (step_matrix(ng, nb))
977 ALLOCATE (res_matrix(ng, nb))
979 ALLOCATE (a_matrix(nb, ng_global))
981 ALLOCATE (norm_res(nb))
982 ALLOCATE (norm_res_low(nb))
983 ALLOCATE (norm_res_up(nb))
986 ALLOCATE (b_matrix(nb, nb))
988 ALLOCATE (binv_matrix(nb, nb))
990 ALLOCATE (gn_global(ng_global))
991 ALLOCATE (res_matrix_global(ng_global))
993 ALLOCATE (sa(ng, ng_global))
994 ALLOCATE (ya(ng, ng_global))
996 IF (use_zgemm_rev)
THEN
997 ALLOCATE (tmp_vec(nb))
1004 gn => mixing_store%res_buffer(ib, ispin)%cc
1005 gn_global = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1007 ig_global = mixing_store%ig_global_index(ig)
1008 gn_global(ig_global) = gn(ig)
1010 CALL para_env%sum(gn_global)
1017 g2 => rho_g(1)%pw_grid%gsq
1022 ELSEIF (jb > ib)
THEN
1027 norm_res(kb) = 0.0_dp
1028 norm_res_low(kb) = 0.0_dp
1029 norm_res_up(kb) = 0.0_dp
1034 step_matrix(ig, kb) = prec*(mixing_store%rhoin_buffer(jb, ispin)%cc(ig) - &
1035 mixing_store%rhoin_buffer(ib, ispin)%cc(ig))
1036 res_matrix(ig, kb) = (mixing_store%res_buffer(jb, ispin)%cc(ig) - &
1037 mixing_store%res_buffer(ib, ispin)%cc(ig))
1038 norm_res(kb) = norm_res(kb) + real(res_matrix(ig, kb),
dp)*real(res_matrix(ig, kb),
dp) + &
1039 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1040 IF (g2(ig) < 4.0_dp)
THEN
1041 norm_res_low(kb) = norm_res_low(kb) + &
1042 REAL(res_matrix(ig, kb),
dp)*
REAL(res_matrix(ig, kb), dp) + &
1043 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1045 norm_res_up(kb) = norm_res_up(kb) + &
1046 REAL(res_matrix(ig, kb),
dp)*
REAL(res_matrix(ig, kb), dp) + &
1047 aimag(res_matrix(ig, kb))*aimag(res_matrix(ig, kb))
1049 res_matrix(ig, kb) = prec*res_matrix(ig, kb)
1054 CALL para_env%sum(norm_res)
1055 CALL para_env%sum(norm_res_up)
1056 CALL para_env%sum(norm_res_low)
1057 norm_res(1:nb) = 1.0_dp/sqrt(norm_res(1:nb))
1061 n_low = n_low + norm_res_low(jb)/norm_res(jb)
1062 n_up = n_up + norm_res_up(jb)/norm_res(jb)
1065 IF (g2(ig) > 4.0_dp)
THEN
1066 step_matrix(ig, 1:nb) = step_matrix(ig, 1:nb)*sqrt(n_low/n_up)
1067 res_matrix(ig, 1:nb) = res_matrix(ig, 1:nb)*sqrt(n_low/n_up)
1071 step_matrix(1:ng, kb) = step_matrix(1:ng, kb)*norm_res(kb)
1072 res_matrix(1:ng, kb) = res_matrix(1:ng, kb)*norm_res(kb)
1079 b_matrix(kb, jb) = 0.0_dp
1083 b_matrix(kb, jb) = b_matrix(kb, jb) + real(res_matrix(ig, kb)*res_matrix(ig, jb),
dp)
1088 CALL para_env%sum(b_matrix)
1090 b_matrix(jb, jb) = b_matrix(jb, jb) + reg_par
1096 a_matrix = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1098 res_matrix_global = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1100 ig_global = mixing_store%ig_global_index(ig)
1101 res_matrix_global(ig_global) = res_matrix(ig, kb)
1103 CALL para_env%sum(res_matrix_global)
1107 ig_global = mixing_store%ig_global_index(ig)
1108 a_matrix(jb, ig_global) = a_matrix(jb, ig_global) + &
1109 binv_matrix(jb, kb)*res_matrix_global(ig_global)
1113 CALL para_env%sum(a_matrix)
1116 gn => mixing_store%res_buffer(ib, ispin)%cc
1121 CALL zgemm(
"N",
"N", ng, ng_global, nb, cmone, step_matrix(1, 1), ng, &
1122 a_matrix(1, 1), nb, czero, sa(1, 1), ng)
1123 CALL zgemm(
"N",
"N", ng, ng_global, nb, cmone, res_matrix(1, 1), ng, &
1124 a_matrix(1, 1), nb, czero, ya(1, 1), ng)
1126 ig_global = mixing_store%ig_global_index(ig)
1127 ya(ig, ig_global) = ya(ig, ig_global) + cmplx(1.0_dp, 0.0_dp, kind=
dp)
1130 CALL zgemv(
"N", ng, ng_global, cone, sa(1, 1), &
1131 ng, gn_global(1), 1, czero, pgn(1), 1)
1132 CALL zgemv(
"N", ng, ng_global, cone, ya(1, 1), &
1133 ng, gn_global(1), 1, czero, ugn(1), 1)
1136 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1137 aimag(pgn(ig))*aimag(pgn(ig))
1139 CALL para_env%sum(pgn_norm)
1140 ELSEIF (use_zgemm_rev)
THEN
1142 CALL zgemv(
"N", nb, ng_global, cone, a_matrix(1, 1), &
1143 nb, gn_global(1), 1, czero, tmp_vec(1), 1)
1145 CALL zgemv(
"N", ng, nb, cmone, step_matrix(1, 1), ng, &
1146 tmp_vec(1), 1, czero, pgn(1), 1)
1148 CALL zgemv(
"N", ng, nb, cmone, res_matrix(1, 1), ng, &
1149 tmp_vec(1), 1, czero, ugn(1), 1)
1152 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1153 aimag(pgn(ig))*aimag(pgn(ig))
1154 ugn(ig) = ugn(ig) + gn(ig)
1156 CALL para_env%sum(pgn_norm)
1160 pgn(ig) = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1161 ugn(ig) = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1162 ig_global = mixing_store%ig_global_index(ig)
1163 DO iig = 1, ng_global
1164 saa = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1165 yaa = cmplx(0.0_dp, 0.0_dp, kind=
dp)
1167 IF (ig_global == iig) yaa = cmplx(1.0_dp, 0.0_dp, kind=
dp)
1170 saa = saa - step_matrix(ig, jb)*a_matrix(jb, iig)
1171 yaa = yaa - res_matrix(ig, jb)*a_matrix(jb, iig)
1173 pgn(ig) = pgn(ig) + saa*gn_global(iig)
1174 ugn(ig) = ugn(ig) + yaa*gn_global(iig)
1178 pgn_norm = pgn_norm + real(pgn(ig),
dp)*real(pgn(ig),
dp) + &
1179 aimag(pgn(ig))*aimag(pgn(ig))
1181 CALL para_env%sum(pgn_norm)
1184 gn_norm = mixing_store%norm_res_buffer(ib, ispin)
1185 gn_norm_old = mixing_store%norm_res_buffer(ib_prev, ispin)
1186 IF (ib_prev /= 0)
THEN
1187 sigma_tilde = sigma_old*max(0.5_dp, min(2.0_dp, gn_norm_old/gn_norm))
1189 sigma_tilde = 0.5_dp
1191 sigma_tilde = 0.1_dp
1193 step_size = min(sigma_tilde, r_step*pgn_norm/gn_norm, sigma_max)
1194 sigma_old = step_size
1198 prec = mixing_store%kerker_factor(ig)
1199 rho_g(ispin)%array(ig) = mixing_store%rhoin_buffer(ib, ispin)%cc(ig) &
1200 - prec*step_size*ugn(ig) + prec*pgn(ig)
1201 mixing_store%rhoin_buffer(ib_next, ispin)%cc(ig) = rho_g(ispin)%array(ig)
1207 DEALLOCATE (step_matrix, res_matrix)
1208 DEALLOCATE (norm_res)
1209 DEALLOCATE (norm_res_up)
1210 DEALLOCATE (norm_res_low)
1211 DEALLOCATE (a_matrix, b_matrix, binv_matrix)
1212 DEALLOCATE (ugn, pgn)
1216 IF (use_zgemm_rev)
THEN
1217 DEALLOCATE (tmp_vec)
1219 DEALLOCATE (gn_global, res_matrix_global)
1221 CALL timestop(handle)
1223 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
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, 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, ecoul_1c, rho0_s_rs, rho0_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)
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.