21 dbcsr_type_antisymmetric, dbcsr_type_symmetric
64#include "./base/base_uses.f90"
69 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
70 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_rho_methods'
98 SUBROUTINE qs_rho_rebuild(rho, qs_env, rebuild_ao, rebuild_grids, admm, pw_env_external)
101 LOGICAL,
INTENT(in),
OPTIONAL :: rebuild_ao, rebuild_grids, admm
102 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
104 CHARACTER(LEN=*),
PARAMETER :: routinen =
'qs_rho_rebuild'
106 CHARACTER(LEN=default_string_length) :: headline
107 INTEGER :: handle, i, ic, j, nimg, nspins
108 LOGICAL :: do_kpoints, my_admm, my_rebuild_ao, &
109 my_rebuild_grids, rho_ao_is_complex
110 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
111 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_kp, rho_ao_im_kp, rho_ao_kp
112 TYPE(
dbcsr_type),
POINTER :: refmatrix, tmatrix
125 CALL timeset(routinen, handle)
127 NULLIFY (pw_env, auxbas_pw_pool, matrix_s_kp, dft_control)
128 NULLIFY (tot_rho_r, rho_ao_kp, rho_r, rho_g, drho_r, drho_g, tau_r, tau_g, rho_ao_im_kp)
131 my_rebuild_ao = .true.
132 my_rebuild_grids = .true.
134 IF (
PRESENT(rebuild_ao)) my_rebuild_ao = rebuild_ao
135 IF (
PRESENT(rebuild_grids)) my_rebuild_grids = rebuild_grids
136 IF (
PRESENT(admm)) my_admm = admm
140 do_kpoints=do_kpoints, &
142 dft_control=dft_control)
143 IF (
PRESENT(pw_env_external)) &
144 pw_env => pw_env_external
146 nimg = dft_control%nimages
149 CALL get_admm_env(qs_env%admm_env, sab_aux_fit=sab_orb, matrix_s_aux_fit_kp=matrix_s_kp)
151 CALL get_qs_env(qs_env, matrix_s_kp=matrix_s_kp)
159 refmatrix => matrix_s_kp(1, 1)%matrix
161 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
162 nspins = dft_control%nspins
165 tot_rho_r=tot_rho_r, &
166 rho_ao_kp=rho_ao_kp, &
167 rho_ao_im_kp=rho_ao_im_kp, &
174 rho_r_sccs=rho_r_sccs, &
175 complex_rho_ao=rho_ao_is_complex)
177 IF (.NOT.
ASSOCIATED(tot_rho_r))
THEN
178 ALLOCATE (tot_rho_r(nspins))
184 IF (my_rebuild_ao .OR. (.NOT.
ASSOCIATED(rho_ao_kp)))
THEN
185 IF (
ASSOCIATED(rho_ao_kp)) &
194 headline =
"DENSITY MATRIX FOR ALPHA SPIN"
196 headline =
"DENSITY MATRIX FOR BETA SPIN"
199 headline =
"DENSITY MATRIX"
201 ALLOCATE (rho_ao_kp(i, ic)%matrix)
202 tmatrix => rho_ao_kp(i, ic)%matrix
203 CALL dbcsr_create(matrix=tmatrix, template=refmatrix, name=trim(headline), &
204 matrix_type=dbcsr_type_symmetric)
209 IF (rho_ao_is_complex)
THEN
210 IF (
ASSOCIATED(rho_ao_im_kp))
THEN
214 CALL qs_rho_set(rho, rho_ao_im_kp=rho_ao_im_kp)
219 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR ALPHA SPIN"
221 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR BETA SPIN"
224 headline =
"IMAGINARY PART OF DENSITY MATRIX"
226 ALLOCATE (rho_ao_im_kp(i, ic)%matrix)
227 tmatrix => rho_ao_im_kp(i, ic)%matrix
228 CALL dbcsr_create(matrix=tmatrix, template=refmatrix, name=trim(headline), &
229 matrix_type=dbcsr_type_antisymmetric)
238 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(rho_r))
THEN
239 IF (
ASSOCIATED(rho_r))
THEN
240 DO i = 1,
SIZE(rho_r)
241 CALL rho_r(i)%release()
245 ALLOCATE (rho_r(nspins))
248 CALL auxbas_pw_pool%create_pw(rho_r(i))
253 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(rho_g))
THEN
254 IF (
ASSOCIATED(rho_g))
THEN
255 DO i = 1,
SIZE(rho_g)
256 CALL rho_g(i)%release()
260 ALLOCATE (rho_g(nspins))
263 CALL auxbas_pw_pool%create_pw(rho_g(i))
268 IF (dft_control%do_sccs)
THEN
269 IF (my_rebuild_grids .OR. (.NOT.
ASSOCIATED(rho_r_sccs)))
THEN
270 IF (
ASSOCIATED(rho_r_sccs))
THEN
271 CALL rho_r_sccs%release()
272 DEALLOCATE (rho_r_sccs)
274 ALLOCATE (rho_r_sccs)
276 CALL auxbas_pw_pool%create_pw(rho_r_sccs)
282 IF (dft_control%drho_by_collocation)
THEN
284 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(drho_r))
THEN
285 IF (
ASSOCIATED(drho_r))
THEN
286 DO j = 1,
SIZE(drho_r, 2)
287 DO i = 1,
SIZE(drho_r, 1)
288 CALL drho_r(i, j)%release()
293 ALLOCATE (drho_r(3, nspins))
297 CALL auxbas_pw_pool%create_pw(drho_r(i, j))
302 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(drho_g))
THEN
303 IF (
ASSOCIATED(drho_g))
THEN
304 DO j = 1,
SIZE(drho_g, 2)
305 DO i = 1,
SIZE(drho_r, 1)
306 CALL drho_g(i, j)%release()
311 ALLOCATE (drho_g(3, nspins))
315 CALL auxbas_pw_pool%create_pw(drho_g(i, j))
322 IF (dft_control%use_kinetic_energy_density)
THEN
324 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(tau_r))
THEN
325 IF (
ASSOCIATED(tau_r))
THEN
326 DO i = 1,
SIZE(tau_r)
327 CALL tau_r(i)%release()
331 ALLOCATE (tau_r(nspins))
334 CALL auxbas_pw_pool%create_pw(tau_r(i))
339 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(tau_g))
THEN
340 IF (
ASSOCIATED(tau_g))
THEN
341 DO i = 1,
SIZE(tau_g)
342 CALL tau_g(i)%release()
346 ALLOCATE (tau_g(nspins))
349 CALL auxbas_pw_pool%create_pw(tau_g(i))
354 CALL timestop(handle)
376 task_list_external, task_list_external_soft, &
377 pw_env_external, para_env_external)
380 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_xc_external
383 task_list_external_soft
384 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
387 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
390 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
399 CALL get_qs_env(qs_env, dft_control=dft_control, &
400 atomic_kind_set=atomic_kind_set, &
402 IF (
PRESENT(para_env_external)) para_env => para_env_external
404 IF (qs_env%harris_method)
THEN
405 CALL get_qs_env(qs_env, harris_env=harris_env)
407 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
409 ELSEIF (dft_control%qs_control%semi_empirical .OR. &
410 dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
THEN
412 CALL qs_rho_set(rho_struct, rho_r_valid=.false., rho_g_valid=.false.)
414 ELSEIF (dft_control%qs_control%lrigpw)
THEN
415 cpassert(.NOT. dft_control%use_kinetic_energy_density)
416 cpassert(.NOT. dft_control%drho_by_collocation)
417 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
419 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
421 CALL get_qs_env(qs_env, lri_env=lri_env, lri_density=lri_density)
423 lri_rho_struct=rho_struct, &
424 atomic_kind_set=atomic_kind_set, &
426 response_density=.false.)
427 CALL set_qs_env(qs_env, lri_density=lri_density)
428 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
430 ELSEIF (dft_control%qs_control%rigpw)
THEN
431 cpassert(.NOT. dft_control%use_kinetic_energy_density)
432 cpassert(.NOT. dft_control%drho_by_collocation)
436 lri_rho_struct=rho_struct, &
437 atomic_kind_set=atomic_kind_set, &
439 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
442 CALL qs_rho_update_rho_low(rho_struct=rho_struct, qs_env=qs_env, &
443 rho_xc_external=rho_xc_external, &
444 local_rho_set=local_rho_set, &
445 task_list_external=task_list_external, &
446 task_list_external_soft=task_list_external_soft, &
447 pw_env_external=pw_env_external, &
448 para_env_external=para_env_external)
470 SUBROUTINE qs_rho_update_rho_low(rho_struct, qs_env, rho_xc_external, &
471 local_rho_set, pw_env_external, &
472 task_list_external, task_list_external_soft, &
476 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_xc_external
478 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
480 task_list_external_soft
483 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_update_rho_low'
485 INTEGER :: handle, img, ispin, nimg, nspins
486 LOGICAL :: gapw, gapw_xc
488 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r, tot_rho_r_xc
491 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp, rho_xc_ao
497 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g, rho_xc_g, tau_g, tau_xc_g
498 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g, drho_xc_g
500 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r, rho_xc_r, tau_r, tau_xc_r
501 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r, drho_xc_r
502 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
508 CALL timeset(routinen, handle)
510 NULLIFY (dft_control, rho_xc, ks_env, rho_ao, rho_r, rho_g, drho_r, drho_g, tau_r, tau_g)
511 NULLIFY (rho_xc_ao, rho_xc_g, rho_xc_r, drho_xc_g, tau_xc_r, tau_xc_g, tot_rho_r, tot_rho_r_xc)
512 NULLIFY (para_env, pw_env, atomic_kind_set)
516 dft_control=dft_control, &
517 atomic_kind_set=atomic_kind_set)
522 tot_rho_r=tot_rho_r, &
528 CALL get_qs_env(qs_env, task_list=task_list, &
529 para_env=para_env, pw_env=pw_env)
530 IF (
PRESENT(pw_env_external)) pw_env => pw_env_external
531 IF (
PRESENT(task_list_external)) task_list => task_list_external
532 IF (
PRESENT(para_env_external)) para_env => para_env_external
534 nspins = dft_control%nspins
535 nimg = dft_control%nimages
536 gapw = dft_control%qs_control%gapw
537 gapw_xc = dft_control%qs_control%gapw_xc
539 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
541 rho_ao => rho_ao_kp(ispin, :)
544 rho_gspace=rho_g(ispin), &
545 total_rho=tot_rho_r(ispin), &
546 ks_env=ks_env, soft_valid=gapw, &
547 task_list_external=task_list_external, &
548 pw_env_external=pw_env_external)
550 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
553 IF (
PRESENT(rho_xc_external))
THEN
554 rho_xc => rho_xc_external
559 rho_ao_kp=rho_xc_ao, &
562 tot_rho_r=tot_rho_r_xc)
566 CALL dbcsr_copy(rho_xc_ao(ispin, img)%matrix, rho_ao_kp(ispin, img)%matrix)
570 rho_ao => rho_xc_ao(ispin, :)
572 rho=rho_xc_r(ispin), &
573 rho_gspace=rho_xc_g(ispin), &
574 total_rho=tot_rho_r_xc(ispin), &
575 ks_env=ks_env, soft_valid=gapw_xc, &
576 task_list_external=task_list_external_soft, &
577 pw_env_external=pw_env_external)
579 CALL qs_rho_set(rho_xc, rho_r_valid=.true., rho_g_valid=.true.)
583 IF (gapw .OR. gapw_xc)
THEN
585 rho_atom_set=rho_atom_set, &
586 qs_kind_set=qs_kind_set, &
587 oce=oce, sab_orb=sab)
588 IF (
PRESENT(local_rho_set)) rho_atom_set => local_rho_set%rho_atom_set
589 cpassert(
ASSOCIATED(rho_atom_set))
590 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
594 IF (.NOT. gapw_xc)
THEN
596 IF (dft_control%drho_by_collocation)
THEN
597 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
598 cpassert(.NOT.
PRESENT(task_list_external))
600 rho_ao => rho_ao_kp(ispin, :)
602 drho=drho_r(:, ispin), &
603 drho_gspace=drho_g(:, ispin), &
604 qs_env=qs_env, soft_valid=gapw)
606 CALL qs_rho_set(rho_struct, drho_r_valid=.true., drho_g_valid=.true.)
609 IF (dft_control%use_kinetic_energy_density)
THEN
610 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
612 rho_ao => rho_ao_kp(ispin, :)
615 rho_gspace=tau_g(ispin), &
617 ks_env=ks_env, soft_valid=gapw, &
618 compute_tau=.true., &
619 task_list_external=task_list_external, &
620 pw_env_external=pw_env_external)
622 CALL qs_rho_set(rho_struct, tau_r_valid=.true., tau_g_valid=.true.)
631 IF (dft_control%drho_by_collocation)
THEN
632 cpassert(.NOT.
PRESENT(task_list_external))
634 rho_ao => rho_xc_ao(ispin, :)
636 drho=drho_xc_r(:, ispin), &
637 drho_gspace=drho_xc_g(:, ispin), &
638 qs_env=qs_env, soft_valid=gapw_xc)
640 CALL qs_rho_set(rho_xc, drho_r_valid=.true., drho_g_valid=.true.)
643 IF (dft_control%use_kinetic_energy_density)
THEN
645 rho_ao => rho_xc_ao(ispin, :)
647 rho=tau_xc_r(ispin), &
648 rho_gspace=tau_xc_g(ispin), &
649 ks_env=ks_env, soft_valid=gapw_xc, &
650 compute_tau=.true., &
651 task_list_external=task_list_external_soft, &
652 pw_env_external=pw_env_external)
654 CALL qs_rho_set(rho_xc, tau_r_valid=.true., tau_g_valid=.true.)
658 CALL timestop(handle)
660 END SUBROUTINE qs_rho_update_rho_low
678 para_env_external, tddfpt_lri_env, tddfpt_lri_density)
681 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
687 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_update_tddfpt'
689 INTEGER :: handle, ispin, nspins
690 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
691 LOGICAL :: lri_response
692 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
695 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
705 CALL timeset(routinen, handle)
709 dft_control=dft_control, &
710 atomic_kind_set=atomic_kind_set, &
711 task_list=task_list, &
714 IF (
PRESENT(pw_env_external)) pw_env => pw_env_external
715 IF (
PRESENT(task_list_external)) task_list => task_list_external
716 IF (
PRESENT(para_env_external)) para_env => para_env_external
723 nspins = dft_control%nspins
725 lri_response =
PRESENT(tddfpt_lri_env)
726 IF (lri_response)
THEN
727 cpassert(
PRESENT(tddfpt_lri_density))
730 cpassert(.NOT. dft_control%drho_by_collocation)
731 cpassert(.NOT. dft_control%use_kinetic_energy_density)
732 cpassert(.NOT. dft_control%qs_control%gapw)
733 cpassert(.NOT. dft_control%qs_control%gapw_xc)
735 IF (lri_response)
THEN
736 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
738 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
740 lri_rho_struct=rho_struct, &
741 atomic_kind_set=atomic_kind_set, &
743 response_density=lri_response)
744 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
746 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
748 rho_ao => rho_ao_kp(ispin, :)
751 rho_gspace=rho_g(ispin), &
752 total_rho=tot_rho_r(ispin), &
754 task_list_external=task_list_external, &
755 pw_env_external=pw_env_external)
757 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
760 CALL timestop(handle)
774 SUBROUTINE qs_rho_copy(rho_input, rho_output, auxbas_pw_pool, mspin)
779 INTEGER,
INTENT(IN) :: mspin
781 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_copy'
783 INTEGER :: handle, i, j, nspins
784 LOGICAL :: complex_rho_ao, drho_g_valid_in, drho_r_valid_in, rho_g_valid_in, rho_r_valid_in, &
785 soft_valid_in, tau_g_valid_in, tau_r_valid_in
786 REAL(kind=
dp) :: ospin
787 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_in, tot_rho_g_out, &
788 tot_rho_r_in, tot_rho_r_out
789 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_im_in, rho_ao_im_out, rho_ao_in, &
791 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp_in
792 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_in, rho_g_out, tau_g_in, tau_g_out
793 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_in, drho_g_out
794 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_in, rho_r_out, tau_r_in, tau_r_out
795 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_in, drho_r_out
798 CALL timeset(routinen, handle)
800 cpassert(mspin == 1 .OR. mspin == 2)
801 ospin = 1._dp/real(mspin, kind=
dp)
805 NULLIFY (rho_ao_in, rho_ao_kp_in, rho_ao_im_in, rho_r_in, rho_g_in, drho_r_in, &
806 drho_g_in, tau_r_in, tau_g_in, tot_rho_r_in, tot_rho_g_in, rho_r_sccs_in)
810 rho_ao_kp=rho_ao_kp_in, &
811 rho_ao_im=rho_ao_im_in, &
818 tot_rho_r=tot_rho_r_in, &
819 tot_rho_g=tot_rho_g_in, &
820 rho_g_valid=rho_g_valid_in, &
821 rho_r_valid=rho_r_valid_in, &
822 drho_g_valid=drho_g_valid_in, &
823 drho_r_valid=drho_r_valid_in, &
824 tau_r_valid=tau_r_valid_in, &
825 tau_g_valid=tau_g_valid_in, &
826 rho_r_sccs=rho_r_sccs_in, &
827 soft_valid=soft_valid_in, &
828 complex_rho_ao=complex_rho_ao)
830 NULLIFY (rho_ao_out, rho_ao_im_out, rho_r_out, rho_g_out, drho_r_out, &
831 drho_g_out, tau_r_out, tau_g_out, tot_rho_r_out, tot_rho_g_out, rho_r_sccs_out)
833 IF (
ASSOCIATED(rho_ao_in))
THEN
834 nspins =
SIZE(rho_ao_in)
835 cpassert(mspin >= nspins)
837 CALL qs_rho_set(rho_output, rho_ao=rho_ao_out)
838 IF (mspin > nspins)
THEN
840 ALLOCATE (rho_ao_out(i)%matrix)
841 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(1)%matrix, name=
"RHO copy")
846 ALLOCATE (rho_ao_out(i)%matrix)
847 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(i)%matrix, name=
"RHO copy")
859 IF (
ASSOCIATED(rho_ao_im_in))
THEN
860 nspins =
SIZE(rho_ao_im_in)
861 cpassert(mspin >= nspins)
863 CALL qs_rho_set(rho_output, rho_ao_im=rho_ao_im_out)
864 IF (mspin > nspins)
THEN
866 ALLOCATE (rho_ao_im_out(i)%matrix)
867 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(1)%matrix, name=
"RHO copy")
872 ALLOCATE (rho_ao_im_out(i)%matrix)
873 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(i)%matrix, name=
"RHO copy")
879 IF (
ASSOCIATED(rho_r_in))
THEN
880 nspins =
SIZE(rho_r_in)
881 cpassert(mspin >= nspins)
882 ALLOCATE (rho_r_out(mspin))
884 IF (mspin > nspins)
THEN
886 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
887 CALL pw_copy(rho_r_in(1), rho_r_out(i))
892 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
893 CALL pw_copy(rho_r_in(i), rho_r_out(i))
899 IF (
ASSOCIATED(rho_g_in))
THEN
900 nspins =
SIZE(rho_g_in)
901 cpassert(mspin >= nspins)
902 ALLOCATE (rho_g_out(mspin))
904 IF (mspin > nspins)
THEN
906 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
907 CALL pw_copy(rho_g_in(1), rho_g_out(i))
912 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
913 CALL pw_copy(rho_g_in(i), rho_g_out(i))
919 IF (
ASSOCIATED(rho_r_sccs_in))
THEN
920 CALL qs_rho_set(rho_output, rho_r_sccs=rho_r_sccs_out)
921 CALL auxbas_pw_pool%create_pw(rho_r_sccs_out)
922 CALL pw_copy(rho_r_sccs_in, rho_r_sccs_out)
926 IF (
ASSOCIATED(drho_r_in))
THEN
927 nspins =
SIZE(drho_r_in)
928 cpassert(mspin >= nspins)
929 ALLOCATE (drho_r_out(3, mspin))
930 CALL qs_rho_set(rho_output, drho_r=drho_r_out)
931 IF (mspin > nspins)
THEN
934 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
935 CALL pw_copy(drho_r_in(i, 1), drho_r_out(i, j))
936 CALL pw_scale(drho_r_out(i, j), ospin)
942 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
943 CALL pw_copy(drho_r_in(i, j), drho_r_out(i, j))
950 IF (
ASSOCIATED(drho_g_in))
THEN
951 nspins =
SIZE(drho_g_in)
952 cpassert(mspin >= nspins)
953 ALLOCATE (drho_g_out(3, mspin))
954 CALL qs_rho_set(rho_output, drho_g=drho_g_out)
955 IF (mspin > nspins)
THEN
958 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
959 CALL pw_copy(drho_g_in(i, 1), drho_g_out(i, j))
960 CALL pw_scale(drho_g_out(i, j), ospin)
966 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
967 CALL pw_copy(drho_g_in(i, j), drho_g_out(i, j))
974 IF (
ASSOCIATED(tau_r_in))
THEN
975 nspins =
SIZE(tau_r_in)
976 cpassert(mspin >= nspins)
977 ALLOCATE (tau_r_out(mspin))
979 IF (mspin > nspins)
THEN
981 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
982 CALL pw_copy(tau_r_in(1), tau_r_out(i))
987 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
988 CALL pw_copy(tau_r_in(i), tau_r_out(i))
994 IF (
ASSOCIATED(tau_g_in))
THEN
995 nspins =
SIZE(tau_g_in)
996 cpassert(mspin >= nspins)
997 ALLOCATE (tau_g_out(mspin))
999 IF (mspin > nspins)
THEN
1001 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1002 CALL pw_copy(tau_g_in(1), tau_g_out(i))
1007 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1008 CALL pw_copy(tau_g_in(i), tau_g_out(i))
1014 IF (
ASSOCIATED(tot_rho_r_in))
THEN
1015 nspins =
SIZE(tot_rho_r_in)
1016 cpassert(mspin >= nspins)
1017 ALLOCATE (tot_rho_r_out(mspin))
1018 CALL qs_rho_set(rho_output, tot_rho_r=tot_rho_r_out)
1019 IF (mspin > nspins)
THEN
1021 tot_rho_r_out(i) = tot_rho_r_in(1)*ospin
1025 tot_rho_r_out(i) = tot_rho_r_in(i)
1031 IF (
ASSOCIATED(tot_rho_g_in))
THEN
1032 nspins =
SIZE(tot_rho_g_in)
1033 cpassert(mspin >= nspins)
1034 ALLOCATE (tot_rho_g_out(mspin))
1035 CALL qs_rho_set(rho_output, tot_rho_g=tot_rho_g_out)
1036 IF (mspin > nspins)
THEN
1038 tot_rho_g_out(i) = tot_rho_g_in(1)*ospin
1042 tot_rho_g_out(i) = tot_rho_g_in(i)
1048 rho_g_valid=rho_g_valid_in, &
1049 rho_r_valid=rho_r_valid_in, &
1050 drho_g_valid=drho_g_valid_in, &
1051 drho_r_valid=drho_r_valid_in, &
1052 tau_r_valid=tau_r_valid_in, &
1053 tau_g_valid=tau_g_valid_in, &
1054 soft_valid=soft_valid_in, &
1055 complex_rho_ao=complex_rho_ao)
1057 CALL timestop(handle)
1071 REAL(kind=
dp),
INTENT(IN) :: alpha, beta
1073 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_scale_and_add_b'
1076 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_a, tot_rho_g_b, tot_rho_r_a, &
1078 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_a, rho_ao_b, rho_ao_im_a, &
1080 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_a, rho_g_b, tau_g_a, tau_g_b
1081 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_a, drho_g_b
1082 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_a, rho_r_b, tau_r_a, tau_r_b
1083 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_a, drho_r_b
1086 CALL timeset(routinen, handle)
1088 NULLIFY (rho_ao_a, rho_ao_im_a, rho_r_a, rho_g_a, drho_r_a, &
1089 drho_g_a, tau_r_a, tau_g_a, tot_rho_r_a, tot_rho_g_a, rho_r_sccs_a)
1093 rho_ao_im=rho_ao_im_a, &
1100 tot_rho_r=tot_rho_r_a, &
1101 tot_rho_g=tot_rho_g_a, &
1102 rho_r_sccs=rho_r_sccs_a)
1104 NULLIFY (rho_ao_b, rho_ao_im_b, rho_r_b, rho_g_b, drho_r_b, &
1105 drho_g_b, tau_r_b, tau_g_b, tot_rho_r_b, tot_rho_g_b, rho_r_sccs_b)
1109 rho_ao_im=rho_ao_im_b, &
1116 tot_rho_r=tot_rho_r_b, &
1117 tot_rho_g=tot_rho_g_b, &
1118 rho_r_sccs=rho_r_sccs_b)
1120 IF (
ASSOCIATED(rho_ao_a) .AND.
ASSOCIATED(rho_ao_b))
THEN
1121 CALL dbcsr_add(rho_ao_a(2)%matrix, rho_ao_b(1)%matrix, alpha, beta)
1125 IF (
ASSOCIATED(rho_ao_im_a) .AND.
ASSOCIATED(rho_ao_im_b))
THEN
1126 CALL dbcsr_add(rho_ao_im_a(2)%matrix, rho_ao_im_b(1)%matrix, alpha, beta)
1130 IF (
ASSOCIATED(rho_r_a) .AND.
ASSOCIATED(rho_r_b))
THEN
1131 CALL pw_axpy(rho_r_b(1), rho_r_a(2), beta, alpha)
1135 IF (
ASSOCIATED(rho_g_a) .AND.
ASSOCIATED(rho_g_b))
THEN
1136 CALL pw_axpy(rho_g_b(1), rho_g_a(2), beta, alpha)
1140 IF (
ASSOCIATED(rho_r_sccs_a) .AND.
ASSOCIATED(rho_r_sccs_b))
THEN
1141 CALL pw_axpy(rho_r_sccs_b, rho_r_sccs_a, beta, alpha)
1145 IF (
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
THEN
1146 cpassert(
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
1150 IF (
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
THEN
1151 cpassert(
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
1155 IF (
ASSOCIATED(tau_r_a) .AND.
ASSOCIATED(tau_r_b))
THEN
1156 CALL pw_axpy(tau_r_b(1), tau_r_a(2), beta, alpha)
1160 IF (
ASSOCIATED(tau_g_a) .AND.
ASSOCIATED(tau_g_b))
THEN
1161 CALL pw_axpy(tau_g_b(1), tau_g_a(2), beta, alpha)
1165 IF (
ASSOCIATED(tot_rho_r_a) .AND.
ASSOCIATED(tot_rho_r_b))
THEN
1166 tot_rho_r_a(2) = alpha*tot_rho_r_a(2) + beta*tot_rho_r_b(1)
1170 IF (
ASSOCIATED(tot_rho_g_a) .AND.
ASSOCIATED(tot_rho_g_b))
THEN
1171 tot_rho_g_a(2) = alpha*tot_rho_g_a(2) + beta*tot_rho_g_b(1)
1174 CALL timestop(handle)
1188 REAL(kind=
dp),
INTENT(IN) :: alpha, beta
1190 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_scale_and_add'
1192 INTEGER :: handle, i, j, nspina, nspinb, nspins
1193 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_a, tot_rho_g_b, tot_rho_r_a, &
1195 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_a, rho_ao_b, rho_ao_im_a, &
1197 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_a, rho_g_b, tau_g_a, tau_g_b
1198 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_a, drho_g_b
1199 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_a, rho_r_b, tau_r_a, tau_r_b
1200 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_a, drho_r_b
1203 CALL timeset(routinen, handle)
1205 NULLIFY (rho_ao_a, rho_ao_im_a, rho_r_a, rho_g_a, drho_r_a, &
1206 drho_g_a, tau_r_a, tau_g_a, tot_rho_r_a, tot_rho_g_a, rho_r_sccs_a)
1210 rho_ao_im=rho_ao_im_a, &
1217 tot_rho_r=tot_rho_r_a, &
1218 tot_rho_g=tot_rho_g_a, &
1219 rho_r_sccs=rho_r_sccs_a)
1221 NULLIFY (rho_ao_b, rho_ao_im_b, rho_r_b, rho_g_b, drho_r_b, &
1222 drho_g_b, tau_r_b, tau_g_b, tot_rho_r_b, tot_rho_g_b, rho_r_sccs_b)
1226 rho_ao_im=rho_ao_im_b, &
1233 tot_rho_r=tot_rho_r_b, &
1234 tot_rho_g=tot_rho_g_b, &
1235 rho_r_sccs=rho_r_sccs_b)
1237 IF (
ASSOCIATED(rho_ao_a) .AND.
ASSOCIATED(rho_ao_b))
THEN
1238 nspina =
SIZE(rho_ao_a)
1239 nspinb =
SIZE(rho_ao_b)
1240 nspins = min(nspina, nspinb)
1242 CALL dbcsr_add(rho_ao_a(i)%matrix, rho_ao_b(i)%matrix, alpha, beta)
1247 IF (
ASSOCIATED(rho_ao_im_a) .AND.
ASSOCIATED(rho_ao_im_b))
THEN
1248 nspina =
SIZE(rho_ao_im_a)
1249 nspinb =
SIZE(rho_ao_im_b)
1250 nspins = min(nspina, nspinb)
1252 CALL dbcsr_add(rho_ao_im_a(i)%matrix, rho_ao_im_b(i)%matrix, alpha, beta)
1257 IF (
ASSOCIATED(rho_r_a) .AND.
ASSOCIATED(rho_r_b))
THEN
1258 nspina =
SIZE(rho_ao_a)
1259 nspinb =
SIZE(rho_ao_b)
1260 nspins = min(nspina, nspinb)
1262 CALL pw_axpy(rho_r_b(i), rho_r_a(i), beta, alpha)
1267 IF (
ASSOCIATED(rho_g_a) .AND.
ASSOCIATED(rho_g_b))
THEN
1268 nspina =
SIZE(rho_ao_a)
1269 nspinb =
SIZE(rho_ao_b)
1270 nspins = min(nspina, nspinb)
1272 CALL pw_axpy(rho_g_b(i), rho_g_a(i), beta, alpha)
1277 IF (
ASSOCIATED(rho_r_sccs_a) .AND.
ASSOCIATED(rho_r_sccs_b))
THEN
1278 CALL pw_axpy(rho_r_sccs_b, rho_r_sccs_a, beta, alpha)
1282 IF (
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
THEN
1283 cpassert(all(shape(drho_r_a) == shape(drho_r_b)))
1284 DO j = 1,
SIZE(drho_r_a, 2)
1285 DO i = 1,
SIZE(drho_r_a, 1)
1286 CALL pw_axpy(drho_r_b(i, j), drho_r_a(i, j), beta, alpha)
1292 IF (
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
THEN
1293 cpassert(all(shape(drho_g_a) == shape(drho_g_b)))
1294 DO j = 1,
SIZE(drho_g_a, 2)
1295 DO i = 1,
SIZE(drho_g_a, 1)
1296 CALL pw_axpy(drho_g_b(i, j), drho_g_a(i, j), beta, alpha)
1302 IF (
ASSOCIATED(tau_r_a) .AND.
ASSOCIATED(tau_r_b))
THEN
1303 nspina =
SIZE(rho_ao_a)
1304 nspinb =
SIZE(rho_ao_b)
1305 nspins = min(nspina, nspinb)
1307 CALL pw_axpy(tau_r_b(i), tau_r_a(i), beta, alpha)
1312 IF (
ASSOCIATED(tau_g_a) .AND.
ASSOCIATED(tau_g_b))
THEN
1313 nspina =
SIZE(rho_ao_a)
1314 nspinb =
SIZE(rho_ao_b)
1315 nspins = min(nspina, nspinb)
1317 CALL pw_axpy(tau_g_b(i), tau_g_a(i), beta, alpha)
1322 IF (
ASSOCIATED(tot_rho_r_a) .AND.
ASSOCIATED(tot_rho_r_b))
THEN
1323 nspina =
SIZE(rho_ao_a)
1324 nspinb =
SIZE(rho_ao_b)
1325 nspins = min(nspina, nspinb)
1327 tot_rho_r_a(i) = alpha*tot_rho_r_a(i) + beta*tot_rho_r_b(i)
1332 IF (
ASSOCIATED(tot_rho_g_a) .AND.
ASSOCIATED(tot_rho_g_b))
THEN
1333 nspina =
SIZE(rho_ao_a)
1334 nspinb =
SIZE(rho_ao_b)
1335 nspins = min(nspina, nspinb)
1337 tot_rho_g_a(i) = alpha*tot_rho_g_a(i) + beta*tot_rho_g_b(i)
1341 CALL timestop(handle)
1359 TYPE(
qs_rho_type),
INTENT(INOUT) :: rho_input, rho_output
1362 CHARACTER(len=*),
PARAMETER :: routinen =
'duplicate_rho_type'
1364 INTEGER :: handle, i, j, nspins
1365 LOGICAL :: complex_rho_ao_in, drho_g_valid_in, drho_r_valid_in, rho_g_valid_in, &
1366 rho_r_valid_in, soft_valid_in, tau_g_valid_in, tau_r_valid_in
1367 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_in, tot_rho_g_out, &
1368 tot_rho_r_in, tot_rho_r_out
1369 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_im_in, rho_ao_im_out, rho_ao_in, &
1372 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_in, rho_g_out, tau_g_in, tau_g_out
1373 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_in, drho_g_out
1376 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_in, rho_r_out, tau_r_in, tau_r_out
1377 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_in, drho_r_out
1380 CALL timeset(routinen, handle)
1382 NULLIFY (dft_control, pw_env, auxbas_pw_pool)
1383 NULLIFY (rho_ao_in, rho_ao_out, rho_ao_im_in, rho_ao_im_out)
1384 NULLIFY (rho_r_in, rho_r_out, rho_g_in, rho_g_out, drho_r_in, drho_r_out)
1385 NULLIFY (drho_g_in, drho_g_out, tau_r_in, tau_r_out, tau_g_in, tau_g_out)
1386 NULLIFY (tot_rho_r_in, tot_rho_r_out, tot_rho_g_in, tot_rho_g_out)
1387 NULLIFY (rho_r_sccs_in, rho_r_sccs_out)
1389 cpassert(
ASSOCIATED(qs_env))
1391 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env, dft_control=dft_control)
1392 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool)
1393 nspins = dft_control%nspins
1399 rho_ao_im=rho_ao_im_in, &
1406 tot_rho_r=tot_rho_r_in, &
1407 tot_rho_g=tot_rho_g_in, &
1408 rho_g_valid=rho_g_valid_in, &
1409 rho_r_valid=rho_r_valid_in, &
1410 drho_g_valid=drho_g_valid_in, &
1411 drho_r_valid=drho_r_valid_in, &
1412 tau_r_valid=tau_r_valid_in, &
1413 tau_g_valid=tau_g_valid_in, &
1414 rho_r_sccs=rho_r_sccs_in, &
1415 soft_valid=soft_valid_in, &
1416 complex_rho_ao=complex_rho_ao_in)
1419 IF (
ASSOCIATED(rho_ao_in))
THEN
1421 CALL qs_rho_set(rho_output, rho_ao=rho_ao_out)
1423 ALLOCATE (rho_ao_out(i)%matrix)
1424 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(i)%matrix, &
1425 name=
"myDensityMatrix_for_Spin_"//trim(adjustl(
cp_to_string(i))))
1426 CALL dbcsr_set(rho_ao_out(i)%matrix, 0.0_dp)
1431 IF (
ASSOCIATED(rho_ao_im_in))
THEN
1433 CALL qs_rho_set(rho_output, rho_ao=rho_ao_im_out)
1435 ALLOCATE (rho_ao_im_out(i)%matrix)
1436 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(i)%matrix, &
1437 name=
"myImagDensityMatrix_for_Spin_"//trim(adjustl(
cp_to_string(i))))
1438 CALL dbcsr_set(rho_ao_im_out(i)%matrix, 0.0_dp)
1443 IF (
ASSOCIATED(rho_r_in))
THEN
1444 ALLOCATE (rho_r_out(nspins))
1447 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
1448 CALL pw_copy(rho_r_in(i), rho_r_out(i))
1453 IF (
ASSOCIATED(rho_g_in))
THEN
1454 ALLOCATE (rho_g_out(nspins))
1457 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
1458 CALL pw_copy(rho_g_in(i), rho_g_out(i))
1463 IF (
ASSOCIATED(rho_r_sccs_in))
THEN
1464 CALL qs_rho_set(rho_output, rho_r_sccs=rho_r_sccs_out)
1465 CALL auxbas_pw_pool%create_pw(rho_r_sccs_out)
1466 CALL pw_copy(rho_r_sccs_in, rho_r_sccs_out)
1470 IF (dft_control%drho_by_collocation)
THEN
1472 IF (
ASSOCIATED(drho_r_in))
THEN
1473 ALLOCATE (drho_r_out(3, nspins))
1474 CALL qs_rho_set(rho_output, drho_r=drho_r_out)
1477 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
1478 CALL pw_copy(drho_r_in(i, j), drho_r_out(i, j))
1484 IF (
ASSOCIATED(drho_g_in))
THEN
1485 ALLOCATE (drho_g_out(3, nspins))
1486 CALL qs_rho_set(rho_output, drho_g=drho_g_out)
1489 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
1490 CALL pw_copy(drho_g_in(i, j), drho_g_out(i, j))
1499 IF (dft_control%use_kinetic_energy_density)
THEN
1501 IF (
ASSOCIATED(tau_r_in))
THEN
1502 ALLOCATE (tau_r_out(nspins))
1505 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
1506 CALL pw_copy(tau_r_in(i), tau_r_out(i))
1511 IF (
ASSOCIATED(tau_g_in))
THEN
1512 ALLOCATE (tau_g_out(nspins))
1515 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1516 CALL pw_copy(tau_g_in(i), tau_g_out(i))
1522 rho_g_valid=rho_g_valid_in, &
1523 rho_r_valid=rho_r_valid_in, &
1524 drho_g_valid=drho_g_valid_in, &
1525 drho_r_valid=drho_r_valid_in, &
1526 tau_r_valid=tau_r_valid_in, &
1527 tau_g_valid=tau_g_valid_in, &
1528 soft_valid=soft_valid_in, &
1529 complex_rho_ao=complex_rho_ao_in)
1532 IF (
ASSOCIATED(tot_rho_r_in))
THEN
1533 ALLOCATE (tot_rho_r_out(nspins))
1534 CALL qs_rho_set(rho_output, tot_rho_r=tot_rho_r_out)
1536 tot_rho_r_out(i) = tot_rho_r_in(i)
1541 IF (
ASSOCIATED(tot_rho_g_in))
THEN
1542 ALLOCATE (tot_rho_g_out(nspins))
1543 CALL qs_rho_set(rho_output, tot_rho_g=tot_rho_g_out)
1545 tot_rho_g_out(i) = tot_rho_g_in(i)
1550 CALL timestop(handle)
1563 CHARACTER(LEN=default_string_length) :: headline
1564 INTEGER :: i, ic, nimages, nspins
1565 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_im_kp, rho_ao_kp
1571 NULLIFY (rho_ao_im_kp, rho_ao_kp, dft_control, template, sab_orb)
1574 dft_control=dft_control, &
1577 CALL qs_rho_get(rho, rho_ao_im_kp=rho_ao_im_kp, rho_ao_kp=rho_ao_kp)
1579 nspins = dft_control%nspins
1580 nimages = dft_control%nimages
1582 cpassert(nspins .EQ.
SIZE(rho_ao_kp, 1))
1583 cpassert(nimages .EQ.
SIZE(rho_ao_kp, 2))
1586 CALL qs_rho_set(rho, rho_ao_im_kp=rho_ao_im_kp)
1589 IF (nspins > 1)
THEN
1591 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR ALPHA SPIN"
1593 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR BETA SPIN"
1596 headline =
"IMAGINARY PART OF DENSITY MATRIX"
1598 ALLOCATE (rho_ao_im_kp(i, ic)%matrix)
1599 template => rho_ao_kp(i, ic)%matrix
1600 CALL dbcsr_create(matrix=rho_ao_im_kp(i, ic)%matrix, template=template, &
1601 name=trim(headline), matrix_type=dbcsr_type_antisymmetric)
1603 CALL dbcsr_set(rho_ao_im_kp(i, ic)%matrix, 0.0_dp)
Types and set/get functions for auxiliary density matrix methods.
subroutine, public get_admm_env(admm_env, mo_derivs_aux_fit, mos_aux_fit, sab_aux_fit, sab_aux_fit_asymm, sab_aux_fit_vs_orb, matrix_s_aux_fit, matrix_s_aux_fit_kp, matrix_s_aux_fit_vs_orb, matrix_s_aux_fit_vs_orb_kp, task_list_aux_fit, matrix_ks_aux_fit, matrix_ks_aux_fit_kp, matrix_ks_aux_fit_im, matrix_ks_aux_fit_dft, matrix_ks_aux_fit_hfx, matrix_ks_aux_fit_dft_kp, matrix_ks_aux_fit_hfx_kp, rho_aux_fit, rho_aux_fit_buffer, admm_dm)
Get routine for the ADMM env.
Define the atomic kind types and their sub types.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
various routines to log and control the output. The idea is that decisions about where to log should ...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym)
Retrieve information from a kpoint environment.
Calculates integral matrices for LRIGPW method lri : local resolution of the identity.
subroutine, public calculate_lri_densities(lri_env, lri_density, qs_env, pmatrix, cell_to_index, lri_rho_struct, atomic_kind_set, para_env, response_density)
performs the fitting of the density and distributes the fitted density on the grid
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
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 ...
Calculate the plane wave density by collocating the primitive Gaussian functions (pgf).
subroutine, public calculate_drho_elec(matrix_p, matrix_p_kp, drho, drho_gspace, qs_env, soft_valid, basis_type)
computes the gradient of the density corresponding to a given density matrix on the grid
subroutine, public calculate_rho_elec(matrix_p, matrix_p_kp, rho, rho_gspace, total_rho, ks_env, soft_valid, compute_tau, compute_grad, basis_type, der_type, idir, task_list_external, pw_env_external)
computes the density corresponding to a given density matrix on the grid
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 set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set the QUICKSTEP environment.
Types needed for a for a Harris model calculation.
Harris method environment setup and handling.
subroutine, public calculate_harris_density(qs_env, rhoin, rho_struct)
...
Define the quickstep kind type and their sub types.
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
Define the neighbor list data types and the corresponding functionality.
subroutine, public calculate_rho_atom_coeff(qs_env, rho_ao, rho_atom_set, qs_kind_set, oce, sab, para_env)
...
methods of the rho structure (defined in qs_rho_types)
subroutine, public qs_rho_update_tddfpt(rho_struct, qs_env, pw_env_external, task_list_external, para_env_external, tddfpt_lri_env, tddfpt_lri_density)
updates rho_r and rho_g to the rhorho_ao. if use_kinetic_energy_density also computes tau_r and tau_g
subroutine, public allocate_rho_ao_imag_from_real(rho, qs_env)
(Re-)allocates rho_ao_im from real part rho_ao
subroutine, public qs_rho_update_rho(rho_struct, qs_env, rho_xc_external, local_rho_set, task_list_external, task_list_external_soft, pw_env_external, para_env_external)
updates rho_r and rho_g to the rhorho_ao. if use_kinetic_energy_density also computes tau_r and tau_g...
subroutine, public duplicate_rho_type(rho_input, rho_output, qs_env)
Duplicates a pointer physically.
subroutine, public qs_rho_scale_and_add_b(rhoa, rhob, alpha, beta)
rhoa(2) = alpha*rhoa(2)+beta*rhob(1)
subroutine, public qs_rho_copy(rho_input, rho_output, auxbas_pw_pool, mspin)
Allocate a density structure and fill it with data from an input structure SIZE(rho_input) == mspin =...
subroutine, public qs_rho_scale_and_add(rhoa, rhob, alpha, beta)
rhoa = alpha*rhoa+beta*rhob
subroutine, public qs_rho_rebuild(rho, qs_env, rebuild_ao, rebuild_grids, admm, pw_env_external)
rebuilds rho (if necessary allocating and initializing it)
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_set(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)
...
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...
subroutine, public qs_rho_clear(rho_struct)
Deallocates all components, without deallocating rho_struct itself.
Calculates integral matrices for RIGPW method.
subroutine, public calculate_ri_densities(lri_env, qs_env, pmatrix, lri_rho_struct, atomic_kind_set, para_env)
performs the fitting of the density and distributes the fitted density on the grid
Provides all information about an atomic kind.
Contains information about kpoints.
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 ...
Contains information on the Harris method.
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.