116 SUBROUTINE mixing_allocate(qs_env, mixing_method, p_mix_new, p_delta, nspins, mixing_store)
118 INTEGER :: mixing_method
120 POINTER :: p_mix_new, p_delta
121 INTEGER,
INTENT(IN) :: nspins
124 CHARACTER(LEN=*),
PARAMETER :: routinen =
'mixing_allocate'
126 INTEGER :: handle, i, ia, iat, ic, ikind, ispin, &
127 max_shell, na, natom, nbuffer, nel, &
129 LOGICAL :: charge_mixing
130 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s
138 CALL timeset(routinen, handle)
140 NULLIFY (matrix_s, dft_control, sab_orb, refmatrix, rho_atom)
143 matrix_s_kp=matrix_s, &
144 dft_control=dft_control)
146 charge_mixing = dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb &
147 .OR. dft_control%qs_control%semi_empirical
148 refmatrix => matrix_s(1, 1)%matrix
149 nimg = dft_control%nimages
152 IF (
PRESENT(p_mix_new))
THEN
153 IF (.NOT.
ASSOCIATED(p_mix_new))
THEN
157 ALLOCATE (p_mix_new(i, ic)%matrix)
158 CALL dbcsr_create(matrix=p_mix_new(i, ic)%matrix, template=refmatrix, &
159 name=
"SCF DENSITY", matrix_type=dbcsr_type_symmetric)
161 CALL dbcsr_set(p_mix_new(i, ic)%matrix, 0.0_dp)
168 IF (
PRESENT(p_delta))
THEN
170 IF (.NOT.
ASSOCIATED(p_delta))
THEN
174 ALLOCATE (p_delta(i, ic)%matrix)
175 CALL dbcsr_create(matrix=p_delta(i, ic)%matrix, template=refmatrix, &
176 name=
"SCF DENSITY", matrix_type=dbcsr_type_symmetric)
178 CALL dbcsr_set(p_delta(i, ic)%matrix, 0.0_dp)
182 cpassert(
ASSOCIATED(mixing_store))
186 IF (charge_mixing)
THEN
189 cpassert(.NOT. mixing_store%gmix_p)
190 IF (dft_control%qs_control%dftb)
THEN
191 max_shell = max_dftb_scc_vars
192 ELSE IF (dft_control%qs_control%xtb)
THEN
193 max_shell = max_xtb_scc_vars
195 cpabort(
'UNKNOWN METHOD')
197 nbuffer = mixing_store%nbuffer
198 mixing_store%ncall = 0
199 CALL get_qs_env(qs_env, local_particles=distribution_1d)
200 nkind =
SIZE(distribution_1d%n_el)
201 na = sum(distribution_1d%n_el(:))
202 IF (
ASSOCIATED(mixing_store%atlist))
DEALLOCATE (mixing_store%atlist)
203 ALLOCATE (mixing_store%atlist(na))
204 mixing_store%nat_local = na
205 mixing_store%max_shell = max_shell
208 nel = distribution_1d%n_el(ikind)
211 mixing_store%atlist(ia) = distribution_1d%list(ikind)%array(iat)
214 IF (
ASSOCIATED(mixing_store%acharge))
DEALLOCATE (mixing_store%acharge)
215 ALLOCATE (mixing_store%acharge(na, max_shell, nbuffer))
216 IF (
ASSOCIATED(mixing_store%dacharge))
DEALLOCATE (mixing_store%dacharge)
217 ALLOCATE (mixing_store%dacharge(na, max_shell, nbuffer))
220 IF (
ASSOCIATED(mixing_store%pulay_matrix))
DEALLOCATE (mixing_store%pulay_matrix)
221 ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer, nspins))
222 mixing_store%pulay_matrix = 0.0_dp
224 IF (
ASSOCIATED(mixing_store%abroy))
DEALLOCATE (mixing_store%abroy)
225 ALLOCATE (mixing_store%abroy(nbuffer, nbuffer))
226 mixing_store%abroy = 0.0_dp
227 IF (
ASSOCIATED(mixing_store%wbroy))
DEALLOCATE (mixing_store%wbroy)
228 ALLOCATE (mixing_store%wbroy(nbuffer))
229 mixing_store%wbroy = 0.0_dp
230 IF (
ASSOCIATED(mixing_store%dfbroy))
DEALLOCATE (mixing_store%dfbroy)
231 ALLOCATE (mixing_store%dfbroy(na, max_shell, nbuffer))
232 mixing_store%dfbroy = 0.0_dp
233 IF (
ASSOCIATED(mixing_store%ubroy))
DEALLOCATE (mixing_store%ubroy)
234 ALLOCATE (mixing_store%ubroy(na, max_shell, nbuffer))
235 mixing_store%ubroy = 0.0_dp
237 cpabort(
"multisecant_mixing not available")
242 nbuffer = mixing_store%nbuffer
243 mixing_store%ncall = 0
244 mixing_store%ncall_p = 0
245 IF (.NOT.
ASSOCIATED(mixing_store%rhoin))
THEN
246 ALLOCATE (mixing_store%rhoin(nspins))
248 NULLIFY (mixing_store%rhoin(ispin)%cc)
252 IF (mixing_store%gmix_p .AND. dft_control%qs_control%gapw)
THEN
253 CALL get_qs_env(qs_env=qs_env, rho_atom_set=rho_atom)
254 natom =
SIZE(rho_atom)
255 IF (.NOT.
ASSOCIATED(mixing_store%paw))
THEN
256 ALLOCATE (mixing_store%paw(natom))
257 mixing_store%paw = .false.
258 ALLOCATE (mixing_store%cpc_h_in(natom, nspins))
259 ALLOCATE (mixing_store%cpc_s_in(natom, nspins))
262 NULLIFY (mixing_store%cpc_h_in(iat, ispin)%r_coef)
263 NULLIFY (mixing_store%cpc_s_in(iat, ispin)%r_coef)
272 IF (.NOT.
ASSOCIATED(mixing_store%res_buffer))
THEN
273 ALLOCATE (mixing_store%res_buffer(nbuffer, nspins))
276 NULLIFY (mixing_store%res_buffer(i, ispin)%cc)
284 IF (.NOT.
ASSOCIATED(mixing_store%pulay_matrix))
THEN
285 ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer, nspins))
288 IF (.NOT.
ASSOCIATED(mixing_store%rhoin_buffer))
THEN
289 ALLOCATE (mixing_store%rhoin_buffer(nbuffer, nspins))
292 NULLIFY (mixing_store%rhoin_buffer(i, ispin)%cc)
296 IF (mixing_store%gmix_p)
THEN
297 IF (dft_control%qs_control%gapw)
THEN
298 IF (.NOT.
ASSOCIATED(mixing_store%cpc_h_in_buffer))
THEN
299 ALLOCATE (mixing_store%cpc_h_in_buffer(nbuffer, natom, nspins))
300 ALLOCATE (mixing_store%cpc_s_in_buffer(nbuffer, natom, nspins))
301 ALLOCATE (mixing_store%cpc_h_res_buffer(nbuffer, natom, nspins))
302 ALLOCATE (mixing_store%cpc_s_res_buffer(nbuffer, natom, nspins))
306 NULLIFY (mixing_store%cpc_h_in_buffer(i, iat, ispin)%r_coef)
307 NULLIFY (mixing_store%cpc_s_in_buffer(i, iat, ispin)%r_coef)
308 NULLIFY (mixing_store%cpc_h_res_buffer(i, iat, ispin)%r_coef)
309 NULLIFY (mixing_store%cpc_s_res_buffer(i, iat, ispin)%r_coef)
320 IF (.NOT.
ASSOCIATED(mixing_store%rhoin_old))
THEN
321 ALLOCATE (mixing_store%rhoin_old(nspins))
323 NULLIFY (mixing_store%rhoin_old(ispin)%cc)
326 IF (.NOT.
ASSOCIATED(mixing_store%drho_buffer))
THEN
327 ALLOCATE (mixing_store%drho_buffer(nbuffer, nspins))
328 ALLOCATE (mixing_store%last_res(nspins))
331 NULLIFY (mixing_store%drho_buffer(i, ispin)%cc)
333 NULLIFY (mixing_store%last_res(ispin)%cc)
337 IF (.NOT.
ASSOCIATED(mixing_store%weight))
THEN
338 ALLOCATE (mixing_store%weight(nbuffer, nspins))
340 mixing_store%weight = 0.0_dp
342 IF (mixing_store%gmix_p)
THEN
344 IF (dft_control%qs_control%gapw)
THEN
345 IF (.NOT.
ASSOCIATED(mixing_store%cpc_h_old))
THEN
346 ALLOCATE (mixing_store%cpc_h_old(natom, nspins))
347 ALLOCATE (mixing_store%cpc_s_old(natom, nspins))
350 NULLIFY (mixing_store%cpc_h_old(iat, ispin)%r_coef)
351 NULLIFY (mixing_store%cpc_s_old(iat, ispin)%r_coef)
355 IF (.NOT.
ASSOCIATED(mixing_store%dcpc_h_in))
THEN
356 ALLOCATE (mixing_store%dcpc_h_in(nbuffer, natom, nspins))
357 ALLOCATE (mixing_store%dcpc_s_in(nbuffer, natom, nspins))
358 ALLOCATE (mixing_store%cpc_h_lastres(natom, nspins))
359 ALLOCATE (mixing_store%cpc_s_lastres(natom, nspins))
363 NULLIFY (mixing_store%dcpc_h_in(i, iat, ispin)%r_coef)
364 NULLIFY (mixing_store%dcpc_s_in(i, iat, ispin)%r_coef)
366 NULLIFY (mixing_store%cpc_h_lastres(iat, ispin)%r_coef)
367 NULLIFY (mixing_store%cpc_s_lastres(iat, ispin)%r_coef)
377 IF (.NOT.
ASSOCIATED(mixing_store%norm_res_buffer))
THEN
378 ALLOCATE (mixing_store%norm_res_buffer(nbuffer, nspins))
383 IF (.NOT.
ASSOCIATED(mixing_store%rhoin_buffer))
THEN
384 ALLOCATE (mixing_store%rhoin_buffer(nbuffer, nspins))
387 NULLIFY (mixing_store%rhoin_buffer(i, ispin)%cc)
395 CALL timestop(handle)
461 SUBROUTINE mixing_init(mixing_method, rho, mixing_store, para_env, rho_atom, auxiliary)
462 INTEGER,
INTENT(IN) :: mixing_method
468 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: auxiliary(:, :)
470 CHARACTER(len=*),
PARAMETER :: routinen =
'mixing_init'
472 INTEGER :: handle, iat, ib, icoef1, icoef2, ig, ig1, ig_count, iproc, ispin, n1, n2, natom, &
473 nbuffer, ncoef_h1, ncoef_h2, ncoef_s1, ncoef_s2, ng, nimg, nspin, nvec
474 REAL(
dp) :: bconst, beta, cpc_h_tmp, cpc_s_tmp, &
475 fdamp, g2max, g2min, kmin, qk, qkappa, &
477 REAL(
dp),
DIMENSION(:),
POINTER :: g2
478 REAL(
dp),
DIMENSION(:, :),
POINTER :: g_vec
480 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
483 CALL timeset(routinen, handle)
485 NULLIFY (g2, g_vec, rho_ao_kp, rho_g)
486 CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp, rho_g=rho_g)
489 ng =
SIZE(rho_g(1)%pw_grid%gsq, 1)
490 nimg =
SIZE(rho_ao_kp, 2)
491 IF (
PRESENT(auxiliary) .OR. mixing_store%naux > 0)
THEN
492 mixing_store%ncall = 0
493 mixing_store%ncall_p = 0
495 mixing_store%naux = 0
496 IF (
PRESENT(auxiliary)) mixing_store%naux =
SIZE(auxiliary, 1)
498 IF (
ALLOCATED(mixing_store%aux_buffer))
DEALLOCATE (mixing_store%aux_buffer)
499 IF (mixing_store%naux > 0)
THEN
500 IF (para_env%mepos == 0)
THEN
501 nvec = ng + mixing_store%naux
502 ALLOCATE (mixing_store%aux_buffer(nvec, nspin))
506 mixing_store%ig_max = ng
507 g2 => rho_g(1)%pw_grid%gsq
508 g_vec => rho_g(1)%pw_grid%g
510 IF (mixing_store%max_gvec_exp > 0._dp)
THEN
512 IF (g2(ig) > mixing_store%max_g2)
THEN
513 mixing_store%ig_max = ig
519 IF (
ASSOCIATED(mixing_store%kerker_factor))
DEALLOCATE (mixing_store%kerker_factor)
520 ALLOCATE (mixing_store%kerker_factor(nvec))
521 IF (
ASSOCIATED(mixing_store%kerker_factor_mag))
DEALLOCATE (mixing_store%kerker_factor_mag)
522 ALLOCATE (mixing_store%kerker_factor_mag(nvec))
523 IF (
ASSOCIATED(mixing_store%special_metric))
DEALLOCATE (mixing_store%special_metric)
524 ALLOCATE (mixing_store%special_metric(nvec))
525 beta = mixing_store%beta
527 mixing_store%kerker_factor = 1.0_dp
528 mixing_store%kerker_factor_mag = 1.0_dp
529 mixing_store%special_metric = 1.0_dp
533 IF (rho_g(1)%pw_grid%have_g0) ig1 = 2
534 DO ig = ig1, mixing_store%ig_max
535 mixing_store%kerker_factor(ig) = max(g2(ig)/(g2(ig) + beta*beta), kmin)
536 IF (mixing_store%beta_mag > 1.0e-10_dp)
THEN
537 mixing_store%kerker_factor_mag(ig) = max(g2(ig)/(g2(ig) + mixing_store%beta_mag*mixing_store%beta_mag), kmin)
540 mixing_store%kerker_factor_mag(ig) = 1.0_dp
542 mixing_store%special_metric(ig) = &
543 1.0_dp + 50.0_dp/8.0_dp*( &
544 1.0_dp + cos(g_vec(1, ig)) + cos(g_vec(2, ig)) + cos(g_vec(3, ig)) + &
545 cos(g_vec(1, ig))*cos(g_vec(2, ig)) + &
546 cos(g_vec(2, ig))*cos(g_vec(3, ig)) + &
547 cos(g_vec(1, ig))*cos(g_vec(3, ig)) + &
548 cos(g_vec(1, ig))*cos(g_vec(2, ig))*cos(g_vec(3, ig)))
552 qkappa = mixing_store%qkappa
555 IF (rho_g(1)%pw_grid%have_g0) ig1 = 1
556 DO ig = ig1, mixing_store%ig_max
557 mixing_store%kerker_factor(ig) = (g2(ig) + qkappa*qkappa)/(g2(ig) + qkappa*qkappa + qk*qk)
558 mixing_store%special_metric(ig) = (g2(ig) + qkappa*qkappa + qm*qm)/(g2(ig) + qkappa*qkappa)
561 nbuffer = mixing_store%nbuffer
562 CALL mixing_buffer_allocate(mixing_store%rhoin, nvec, .false.)
563 IF (
ASSOCIATED(mixing_store%rhoin_buffer))
CALL mixing_buffer_allocate(mixing_store%rhoin_buffer, nvec, .false.)
564 IF (
ASSOCIATED(mixing_store%res_buffer))
CALL mixing_buffer_allocate(mixing_store%res_buffer, nvec, .false.)
566 mixing_store%rhoin(ispin)%cc = density(ispin)%cc
569 mixing_store%rhoin(1)%cc = density(1)%cc + density(2)%cc
570 mixing_store%rhoin(2)%cc = density(1)%cc - density(2)%cc
572 IF (
ASSOCIATED(mixing_store%rhoin_buffer))
THEN
574 mixing_store%rhoin_buffer(1, ispin)%cc = mixing_store%rhoin(ispin)%cc
578 IF (mixing_store%gmix_p)
THEN
579 IF (
PRESENT(rho_atom))
THEN
580 natom =
SIZE(rho_atom)
583 IF (
ASSOCIATED(rho_atom(iat)%cpc_s(ispin)%r_coef))
THEN
584 mixing_store%paw(iat) = .true.
585 n1 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 1)
586 n2 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 2)
587 IF (
ASSOCIATED(mixing_store%cpc_s_in))
THEN
588 IF (.NOT.
ASSOCIATED(mixing_store%cpc_s_in(iat, ispin)%r_coef))
THEN
589 ALLOCATE (mixing_store%cpc_s_in(iat, ispin)%r_coef(n1, n2))
590 ALLOCATE (mixing_store%cpc_h_in(iat, ispin)%r_coef(n1, n2))
592 mixing_store%cpc_h_in(iat, ispin)%r_coef = rho_atom(iat)%cpc_h(ispin)%r_coef
593 mixing_store%cpc_s_in(iat, ispin)%r_coef = rho_atom(iat)%cpc_s(ispin)%r_coef
598 IF (nspin == 2 .AND.
ASSOCIATED(mixing_store%cpc_s_in))
THEN
600 IF (mixing_store%paw(iat))
THEN
601 cpassert(
ASSOCIATED(mixing_store%cpc_h_in(iat, 1)%r_coef))
602 cpassert(
ASSOCIATED(mixing_store%cpc_h_in(iat, 2)%r_coef))
603 cpassert(
ASSOCIATED(mixing_store%cpc_s_in(iat, 1)%r_coef))
604 cpassert(
ASSOCIATED(mixing_store%cpc_s_in(iat, 2)%r_coef))
606 ncoef_h1 =
SIZE(mixing_store%cpc_h_in(iat, 1)%r_coef, 1)
607 ncoef_h2 =
SIZE(mixing_store%cpc_h_in(iat, 1)%r_coef, 2)
608 ncoef_s1 =
SIZE(mixing_store%cpc_s_in(iat, 1)%r_coef, 1)
609 ncoef_s2 =
SIZE(mixing_store%cpc_s_in(iat, 1)%r_coef, 2)
610 cpassert(ncoef_h1 ==
SIZE(mixing_store%cpc_h_in(iat, 2)%r_coef, 1))
611 cpassert(ncoef_h2 ==
SIZE(mixing_store%cpc_h_in(iat, 2)%r_coef, 2))
612 cpassert(ncoef_s1 ==
SIZE(mixing_store%cpc_s_in(iat, 2)%r_coef, 1))
613 cpassert(ncoef_s2 ==
SIZE(mixing_store%cpc_s_in(iat, 2)%r_coef, 2))
615 DO icoef2 = 1, ncoef_h2
616 DO icoef1 = 1, ncoef_h1
617 cpc_h_tmp = mixing_store%cpc_h_in(iat, 1)%r_coef(icoef1, icoef2)
618 mixing_store%cpc_h_in(iat, 1)%r_coef(icoef1, icoef2) = &
619 cpc_h_tmp + mixing_store%cpc_h_in(iat, 2)%r_coef(icoef1, icoef2)
620 mixing_store%cpc_h_in(iat, 2)%r_coef(icoef1, icoef2) = &
621 cpc_h_tmp - mixing_store%cpc_h_in(iat, 2)%r_coef(icoef1, icoef2)
625 DO icoef2 = 1, ncoef_s2
626 DO icoef1 = 1, ncoef_s1
627 cpc_s_tmp = mixing_store%cpc_s_in(iat, 1)%r_coef(icoef1, icoef2)
628 mixing_store%cpc_s_in(iat, 1)%r_coef(icoef1, icoef2) = &
629 cpc_s_tmp + mixing_store%cpc_s_in(iat, 2)%r_coef(icoef1, icoef2)
630 mixing_store%cpc_s_in(iat, 2)%r_coef(icoef1, icoef2) = &
631 cpc_s_tmp - mixing_store%cpc_s_in(iat, 2)%r_coef(icoef1, icoef2)
642 IF (mixing_store%gmix_p .AND.
PRESENT(rho_atom))
THEN
645 IF (mixing_store%paw(iat))
THEN
646 n1 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 1)
647 n2 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 2)
648 IF (.NOT.
ASSOCIATED(mixing_store%cpc_h_in_buffer(1, iat, ispin)%r_coef))
THEN
650 ALLOCATE (mixing_store%cpc_s_in_buffer(ib, iat, ispin)%r_coef(n1, n2))
651 ALLOCATE (mixing_store%cpc_h_in_buffer(ib, iat, ispin)%r_coef(n1, n2))
652 ALLOCATE (mixing_store%cpc_s_res_buffer(ib, iat, ispin)%r_coef(n1, n2))
653 ALLOCATE (mixing_store%cpc_h_res_buffer(ib, iat, ispin)%r_coef(n1, n2))
657 mixing_store%cpc_h_in_buffer(ib, iat, ispin)%r_coef = 0.0_dp
658 mixing_store%cpc_s_in_buffer(ib, iat, ispin)%r_coef = 0.0_dp
659 mixing_store%cpc_h_res_buffer(ib, iat, ispin)%r_coef = 0.0_dp
660 mixing_store%cpc_s_res_buffer(ib, iat, ispin)%r_coef = 0.0_dp
667 CALL mixing_buffer_allocate(mixing_store%rhoin_old, nvec, .true.)
668 CALL mixing_buffer_allocate(mixing_store%drho_buffer, nvec, .true.)
669 CALL mixing_buffer_allocate(mixing_store%last_res, nvec, .true.)
670 IF (mixing_store%gmix_p)
THEN
671 IF (
PRESENT(rho_atom))
THEN
674 IF (mixing_store%paw(iat))
THEN
675 n1 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 1)
676 n2 =
SIZE(rho_atom(iat)%cpc_s(ispin)%r_coef, 2)
677 IF (.NOT.
ASSOCIATED(mixing_store%cpc_s_old(iat, ispin)%r_coef))
THEN
678 ALLOCATE (mixing_store%cpc_s_old(iat, ispin)%r_coef(n1, n2))
679 ALLOCATE (mixing_store%cpc_h_old(iat, ispin)%r_coef(n1, n2))
681 mixing_store%cpc_h_old(iat, ispin)%r_coef = 0.0_dp
682 mixing_store%cpc_s_old(iat, ispin)%r_coef = 0.0_dp
683 IF (.NOT.
ASSOCIATED(mixing_store%dcpc_s_in(1, iat, ispin)%r_coef))
THEN
685 ALLOCATE (mixing_store%dcpc_h_in(ib, iat, ispin)%r_coef(n1, n2))
686 ALLOCATE (mixing_store%dcpc_s_in(ib, iat, ispin)%r_coef(n1, n2))
688 ALLOCATE (mixing_store%cpc_h_lastres(iat, ispin)%r_coef(n1, n2))
689 ALLOCATE (mixing_store%cpc_s_lastres(iat, ispin)%r_coef(n1, n2))
692 mixing_store%dcpc_h_in(ib, iat, ispin)%r_coef = 0.0_dp
693 mixing_store%dcpc_s_in(ib, iat, ispin)%r_coef = 0.0_dp
695 mixing_store%cpc_h_lastres(iat, ispin)%r_coef = 0.0_dp
696 mixing_store%cpc_s_lastres(iat, ispin)%r_coef = 0.0_dp
703 IF (
ASSOCIATED(mixing_store%p_metric))
DEALLOCATE (mixing_store%p_metric)
704 ALLOCATE (mixing_store%p_metric(nvec))
705 mixing_store%p_metric = 1.0_dp
706 bconst = mixing_store%bconst
709 IF (g2(ig) > 1.e-10_dp) g2min = min(g2min, g2(ig))
713 g2max = max(g2max, g2(ig))
715 CALL para_env%min(g2min)
716 CALL para_env%max(g2max)
720 fdamp = (bconst - 1.0_dp)*g2min*g2max/(g2max - g2min*bconst)
722 mixing_store%p_metric(ig) = (g2(ig) + fdamp)/max(g2(ig), 1.e-10_dp)
724 IF (rho_g(1)%pw_grid%have_g0) mixing_store%p_metric(1) = bconst
726 IF (nvec > ng) mixing_store%p_metric(mixing_store%ig_max + 1:ng) = 0.0_dp
728 IF (
ASSOCIATED(mixing_store%ig_global_index))
DEALLOCATE (mixing_store%ig_global_index)
729 ALLOCATE (mixing_store%ig_global_index(nvec))
730 mixing_store%ig_global_index = 0
732 DO iproc = 0, para_env%num_pe - 1
733 IF (para_env%mepos == iproc)
THEN
735 ig_count = ig_count + 1
736 mixing_store%ig_global_index(ig) = ig_count
739 CALL para_env%bcast(ig_count, iproc)
743 IF (nvec > ng) mixing_store%ig_max = nvec
744 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.