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))
THEN
144 pw_env => pw_env_external
147 nimg = dft_control%nimages
150 CALL get_admm_env(qs_env%admm_env, sab_aux_fit=sab_orb, matrix_s_aux_fit_kp=matrix_s_kp)
152 CALL get_qs_env(qs_env, matrix_s_kp=matrix_s_kp)
160 refmatrix => matrix_s_kp(1, 1)%matrix
162 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
163 nspins = dft_control%nspins
166 tot_rho_r=tot_rho_r, &
167 rho_ao_kp=rho_ao_kp, &
168 rho_ao_im_kp=rho_ao_im_kp, &
175 rho_r_sccs=rho_r_sccs, &
176 complex_rho_ao=rho_ao_is_complex)
178 IF (.NOT.
ASSOCIATED(tot_rho_r))
THEN
179 ALLOCATE (tot_rho_r(nspins))
185 IF (my_rebuild_ao .OR. (.NOT.
ASSOCIATED(rho_ao_kp)))
THEN
186 IF (
ASSOCIATED(rho_ao_kp))
THEN
196 headline =
"DENSITY MATRIX FOR ALPHA SPIN"
198 headline =
"DENSITY MATRIX FOR BETA SPIN"
201 headline =
"DENSITY MATRIX"
203 ALLOCATE (rho_ao_kp(i, ic)%matrix)
204 tmatrix => rho_ao_kp(i, ic)%matrix
205 CALL dbcsr_create(matrix=tmatrix, template=refmatrix, name=trim(headline), &
206 matrix_type=dbcsr_type_symmetric)
211 IF (rho_ao_is_complex)
THEN
212 IF (
ASSOCIATED(rho_ao_im_kp))
THEN
216 CALL qs_rho_set(rho, rho_ao_im_kp=rho_ao_im_kp)
221 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR ALPHA SPIN"
223 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR BETA SPIN"
226 headline =
"IMAGINARY PART OF DENSITY MATRIX"
228 ALLOCATE (rho_ao_im_kp(i, ic)%matrix)
229 tmatrix => rho_ao_im_kp(i, ic)%matrix
230 CALL dbcsr_create(matrix=tmatrix, template=refmatrix, name=trim(headline), &
231 matrix_type=dbcsr_type_antisymmetric)
240 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(rho_r))
THEN
241 IF (
ASSOCIATED(rho_r))
THEN
242 DO i = 1,
SIZE(rho_r)
243 CALL rho_r(i)%release()
247 ALLOCATE (rho_r(nspins))
250 CALL auxbas_pw_pool%create_pw(rho_r(i))
255 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(rho_g))
THEN
256 IF (
ASSOCIATED(rho_g))
THEN
257 DO i = 1,
SIZE(rho_g)
258 CALL rho_g(i)%release()
262 ALLOCATE (rho_g(nspins))
265 CALL auxbas_pw_pool%create_pw(rho_g(i))
270 IF (dft_control%do_sccs)
THEN
271 IF (my_rebuild_grids .OR. (.NOT.
ASSOCIATED(rho_r_sccs)))
THEN
272 IF (
ASSOCIATED(rho_r_sccs))
THEN
273 CALL rho_r_sccs%release()
274 DEALLOCATE (rho_r_sccs)
276 ALLOCATE (rho_r_sccs)
278 CALL auxbas_pw_pool%create_pw(rho_r_sccs)
284 IF (dft_control%drho_by_collocation)
THEN
286 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(drho_r))
THEN
287 IF (
ASSOCIATED(drho_r))
THEN
288 DO j = 1,
SIZE(drho_r, 2)
289 DO i = 1,
SIZE(drho_r, 1)
290 CALL drho_r(i, j)%release()
295 ALLOCATE (drho_r(3, nspins))
299 CALL auxbas_pw_pool%create_pw(drho_r(i, j))
304 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(drho_g))
THEN
305 IF (
ASSOCIATED(drho_g))
THEN
306 DO j = 1,
SIZE(drho_g, 2)
307 DO i = 1,
SIZE(drho_r, 1)
308 CALL drho_g(i, j)%release()
313 ALLOCATE (drho_g(3, nspins))
317 CALL auxbas_pw_pool%create_pw(drho_g(i, j))
324 IF (dft_control%use_kinetic_energy_density)
THEN
326 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(tau_r))
THEN
327 IF (
ASSOCIATED(tau_r))
THEN
328 DO i = 1,
SIZE(tau_r)
329 CALL tau_r(i)%release()
333 ALLOCATE (tau_r(nspins))
336 CALL auxbas_pw_pool%create_pw(tau_r(i))
341 IF (my_rebuild_grids .OR. .NOT.
ASSOCIATED(tau_g))
THEN
342 IF (
ASSOCIATED(tau_g))
THEN
343 DO i = 1,
SIZE(tau_g)
344 CALL tau_g(i)%release()
348 ALLOCATE (tau_g(nspins))
351 CALL auxbas_pw_pool%create_pw(tau_g(i))
356 CALL timestop(handle)
378 task_list_external, task_list_external_soft, &
379 pw_env_external, para_env_external)
382 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_xc_external
385 task_list_external_soft
386 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
389 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
392 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
401 CALL get_qs_env(qs_env, dft_control=dft_control, &
402 atomic_kind_set=atomic_kind_set, &
404 IF (
PRESENT(para_env_external)) para_env => para_env_external
406 IF (qs_env%harris_method)
THEN
407 CALL get_qs_env(qs_env, harris_env=harris_env)
409 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
411 ELSE IF (dft_control%qs_control%semi_empirical .OR. &
412 dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
THEN
414 CALL qs_rho_set(rho_struct, rho_r_valid=.false., rho_g_valid=.false.)
416 ELSE IF (dft_control%qs_control%lrigpw)
THEN
417 cpassert(.NOT. dft_control%use_kinetic_energy_density)
418 cpassert(.NOT. dft_control%drho_by_collocation)
419 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
421 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
423 CALL get_qs_env(qs_env, lri_env=lri_env, lri_density=lri_density)
425 lri_rho_struct=rho_struct, &
426 atomic_kind_set=atomic_kind_set, &
428 response_density=.false.)
429 CALL set_qs_env(qs_env, lri_density=lri_density)
430 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
432 ELSE IF (dft_control%qs_control%rigpw)
THEN
433 cpassert(.NOT. dft_control%use_kinetic_energy_density)
434 cpassert(.NOT. dft_control%drho_by_collocation)
438 lri_rho_struct=rho_struct, &
439 atomic_kind_set=atomic_kind_set, &
441 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
444 CALL qs_rho_update_rho_low(rho_struct=rho_struct, qs_env=qs_env, &
445 rho_xc_external=rho_xc_external, &
446 local_rho_set=local_rho_set, &
447 task_list_external=task_list_external, &
448 task_list_external_soft=task_list_external_soft, &
449 pw_env_external=pw_env_external, &
450 para_env_external=para_env_external)
472 SUBROUTINE qs_rho_update_rho_low(rho_struct, qs_env, rho_xc_external, &
473 local_rho_set, pw_env_external, &
474 task_list_external, task_list_external_soft, &
478 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_xc_external
480 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
482 task_list_external_soft
485 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_update_rho_low'
487 INTEGER :: handle, img, ispin, nimg, nspins
488 LOGICAL :: gapw, gapw_xc
490 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r, tot_rho_r_xc
493 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp, rho_xc_ao
499 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g, rho_xc_g, tau_g, tau_xc_g
500 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g, drho_xc_g
502 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r, rho_xc_r, tau_r, tau_xc_r
503 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r, drho_xc_r
504 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
510 CALL timeset(routinen, handle)
512 NULLIFY (dft_control, rho_xc, ks_env, rho_ao, rho_r, rho_g, drho_r, drho_g, tau_r, tau_g)
513 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)
514 NULLIFY (para_env, pw_env, atomic_kind_set)
518 dft_control=dft_control, &
519 atomic_kind_set=atomic_kind_set)
524 tot_rho_r=tot_rho_r, &
530 CALL get_qs_env(qs_env, task_list=task_list, &
531 para_env=para_env, pw_env=pw_env)
532 IF (
PRESENT(pw_env_external)) pw_env => pw_env_external
533 IF (
PRESENT(task_list_external)) task_list => task_list_external
534 IF (
PRESENT(para_env_external)) para_env => para_env_external
536 nspins = dft_control%nspins
537 nimg = dft_control%nimages
538 gapw = dft_control%qs_control%gapw
539 gapw_xc = dft_control%qs_control%gapw_xc
541 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
543 rho_ao => rho_ao_kp(ispin, :)
546 rho_gspace=rho_g(ispin), &
547 total_rho=tot_rho_r(ispin), &
548 ks_env=ks_env, soft_valid=gapw, &
549 task_list_external=task_list_external, &
550 pw_env_external=pw_env_external)
552 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
555 IF (
PRESENT(rho_xc_external))
THEN
556 rho_xc => rho_xc_external
561 rho_ao_kp=rho_xc_ao, &
564 tot_rho_r=tot_rho_r_xc)
568 CALL dbcsr_copy(rho_xc_ao(ispin, img)%matrix, rho_ao_kp(ispin, img)%matrix)
572 rho_ao => rho_xc_ao(ispin, :)
574 rho=rho_xc_r(ispin), &
575 rho_gspace=rho_xc_g(ispin), &
576 total_rho=tot_rho_r_xc(ispin), &
577 ks_env=ks_env, soft_valid=gapw_xc, &
578 task_list_external=task_list_external_soft, &
579 pw_env_external=pw_env_external)
581 CALL qs_rho_set(rho_xc, rho_r_valid=.true., rho_g_valid=.true.)
585 IF (gapw .OR. gapw_xc)
THEN
587 rho_atom_set=rho_atom_set, &
588 qs_kind_set=qs_kind_set, &
589 oce=oce, sab_orb=sab)
590 IF (
PRESENT(local_rho_set)) rho_atom_set => local_rho_set%rho_atom_set
591 cpassert(
ASSOCIATED(rho_atom_set))
592 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
596 IF (.NOT. gapw_xc)
THEN
598 IF (dft_control%drho_by_collocation)
THEN
599 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
600 cpassert(.NOT.
PRESENT(task_list_external))
602 rho_ao => rho_ao_kp(ispin, :)
604 drho=drho_r(:, ispin), &
605 drho_gspace=drho_g(:, ispin), &
606 qs_env=qs_env, soft_valid=gapw)
608 CALL qs_rho_set(rho_struct, drho_r_valid=.true., drho_g_valid=.true.)
611 IF (dft_control%use_kinetic_energy_density)
THEN
612 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
614 rho_ao => rho_ao_kp(ispin, :)
617 rho_gspace=tau_g(ispin), &
619 ks_env=ks_env, soft_valid=gapw, &
620 compute_tau=.true., &
621 task_list_external=task_list_external, &
622 pw_env_external=pw_env_external)
624 CALL qs_rho_set(rho_struct, tau_r_valid=.true., tau_g_valid=.true.)
633 IF (dft_control%drho_by_collocation)
THEN
634 cpassert(.NOT.
PRESENT(task_list_external))
636 rho_ao => rho_xc_ao(ispin, :)
638 drho=drho_xc_r(:, ispin), &
639 drho_gspace=drho_xc_g(:, ispin), &
640 qs_env=qs_env, soft_valid=gapw_xc)
642 CALL qs_rho_set(rho_xc, drho_r_valid=.true., drho_g_valid=.true.)
645 IF (dft_control%use_kinetic_energy_density)
THEN
647 rho_ao => rho_xc_ao(ispin, :)
649 rho=tau_xc_r(ispin), &
650 rho_gspace=tau_xc_g(ispin), &
651 ks_env=ks_env, soft_valid=gapw_xc, &
652 compute_tau=.true., &
653 task_list_external=task_list_external_soft, &
654 pw_env_external=pw_env_external)
656 CALL qs_rho_set(rho_xc, tau_r_valid=.true., tau_g_valid=.true.)
660 CALL timestop(handle)
662 END SUBROUTINE qs_rho_update_rho_low
680 para_env_external, tddfpt_lri_env, tddfpt_lri_density)
683 TYPE(
pw_env_type),
OPTIONAL,
POINTER :: pw_env_external
689 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_update_tddfpt'
691 INTEGER :: handle, ispin, nspins
692 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
693 LOGICAL :: lri_response
694 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_r
697 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp
707 CALL timeset(routinen, handle)
711 dft_control=dft_control, &
712 atomic_kind_set=atomic_kind_set, &
713 task_list=task_list, &
716 IF (
PRESENT(pw_env_external)) pw_env => pw_env_external
717 IF (
PRESENT(task_list_external)) task_list => task_list_external
718 IF (
PRESENT(para_env_external)) para_env => para_env_external
725 nspins = dft_control%nspins
727 lri_response =
PRESENT(tddfpt_lri_env)
728 IF (lri_response)
THEN
729 cpassert(
PRESENT(tddfpt_lri_density))
732 cpassert(.NOT. dft_control%drho_by_collocation)
733 cpassert(.NOT. dft_control%use_kinetic_energy_density)
734 cpassert(.NOT. dft_control%qs_control%gapw)
735 cpassert(.NOT. dft_control%qs_control%gapw_xc)
737 IF (lri_response)
THEN
738 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
740 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
742 lri_rho_struct=rho_struct, &
743 atomic_kind_set=atomic_kind_set, &
745 response_density=lri_response)
746 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
748 CALL qs_rho_get(rho_struct, rho_ao_kp=rho_ao_kp)
750 rho_ao => rho_ao_kp(ispin, :)
753 rho_gspace=rho_g(ispin), &
754 total_rho=tot_rho_r(ispin), &
756 task_list_external=task_list_external, &
757 pw_env_external=pw_env_external)
759 CALL qs_rho_set(rho_struct, rho_r_valid=.true., rho_g_valid=.true.)
762 CALL timestop(handle)
776 SUBROUTINE qs_rho_copy(rho_input, rho_output, auxbas_pw_pool, mspin)
781 INTEGER,
INTENT(IN) :: mspin
783 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_copy'
785 INTEGER :: handle, i, j, nspins
786 LOGICAL :: complex_rho_ao, drho_g_valid_in, drho_r_valid_in, rho_g_valid_in, rho_r_valid_in, &
787 soft_valid_in, tau_g_valid_in, tau_r_valid_in
788 REAL(kind=
dp) :: ospin
789 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_in, tot_rho_g_out, &
790 tot_rho_r_in, tot_rho_r_out
791 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_im_in, rho_ao_im_out, rho_ao_in, &
793 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_kp_in
794 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_in, rho_g_out, tau_g_in, tau_g_out
795 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_in, drho_g_out
796 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_in, rho_r_out, tau_r_in, tau_r_out
797 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_in, drho_r_out
800 CALL timeset(routinen, handle)
802 cpassert(mspin == 1 .OR. mspin == 2)
803 ospin = 1._dp/real(mspin, kind=
dp)
807 NULLIFY (rho_ao_in, rho_ao_kp_in, rho_ao_im_in, rho_r_in, rho_g_in, drho_r_in, &
808 drho_g_in, tau_r_in, tau_g_in, tot_rho_r_in, tot_rho_g_in, rho_r_sccs_in)
812 rho_ao_kp=rho_ao_kp_in, &
813 rho_ao_im=rho_ao_im_in, &
820 tot_rho_r=tot_rho_r_in, &
821 tot_rho_g=tot_rho_g_in, &
822 rho_g_valid=rho_g_valid_in, &
823 rho_r_valid=rho_r_valid_in, &
824 drho_g_valid=drho_g_valid_in, &
825 drho_r_valid=drho_r_valid_in, &
826 tau_r_valid=tau_r_valid_in, &
827 tau_g_valid=tau_g_valid_in, &
828 rho_r_sccs=rho_r_sccs_in, &
829 soft_valid=soft_valid_in, &
830 complex_rho_ao=complex_rho_ao)
832 NULLIFY (rho_ao_out, rho_ao_im_out, rho_r_out, rho_g_out, drho_r_out, &
833 drho_g_out, tau_r_out, tau_g_out, tot_rho_r_out, tot_rho_g_out, rho_r_sccs_out)
835 IF (
ASSOCIATED(rho_ao_in))
THEN
836 nspins =
SIZE(rho_ao_in)
837 cpassert(mspin >= nspins)
839 CALL qs_rho_set(rho_output, rho_ao=rho_ao_out)
840 IF (mspin > nspins)
THEN
842 ALLOCATE (rho_ao_out(i)%matrix)
843 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(1)%matrix, name=
"RHO copy")
848 ALLOCATE (rho_ao_out(i)%matrix)
849 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(i)%matrix, name=
"RHO copy")
861 IF (
ASSOCIATED(rho_ao_im_in))
THEN
862 nspins =
SIZE(rho_ao_im_in)
863 cpassert(mspin >= nspins)
865 CALL qs_rho_set(rho_output, rho_ao_im=rho_ao_im_out)
866 IF (mspin > nspins)
THEN
868 ALLOCATE (rho_ao_im_out(i)%matrix)
869 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(1)%matrix, name=
"RHO copy")
874 ALLOCATE (rho_ao_im_out(i)%matrix)
875 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(i)%matrix, name=
"RHO copy")
881 IF (
ASSOCIATED(rho_r_in))
THEN
882 nspins =
SIZE(rho_r_in)
883 cpassert(mspin >= nspins)
884 ALLOCATE (rho_r_out(mspin))
886 IF (mspin > nspins)
THEN
888 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
889 CALL pw_copy(rho_r_in(1), rho_r_out(i))
894 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
895 CALL pw_copy(rho_r_in(i), rho_r_out(i))
901 IF (
ASSOCIATED(rho_g_in))
THEN
902 nspins =
SIZE(rho_g_in)
903 cpassert(mspin >= nspins)
904 ALLOCATE (rho_g_out(mspin))
906 IF (mspin > nspins)
THEN
908 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
909 CALL pw_copy(rho_g_in(1), rho_g_out(i))
914 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
915 CALL pw_copy(rho_g_in(i), rho_g_out(i))
921 IF (
ASSOCIATED(rho_r_sccs_in))
THEN
922 CALL qs_rho_set(rho_output, rho_r_sccs=rho_r_sccs_out)
923 CALL auxbas_pw_pool%create_pw(rho_r_sccs_out)
924 CALL pw_copy(rho_r_sccs_in, rho_r_sccs_out)
928 IF (
ASSOCIATED(drho_r_in))
THEN
929 nspins =
SIZE(drho_r_in)
930 cpassert(mspin >= nspins)
931 ALLOCATE (drho_r_out(3, mspin))
932 CALL qs_rho_set(rho_output, drho_r=drho_r_out)
933 IF (mspin > nspins)
THEN
936 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
937 CALL pw_copy(drho_r_in(i, 1), drho_r_out(i, j))
938 CALL pw_scale(drho_r_out(i, j), ospin)
944 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
945 CALL pw_copy(drho_r_in(i, j), drho_r_out(i, j))
952 IF (
ASSOCIATED(drho_g_in))
THEN
953 nspins =
SIZE(drho_g_in)
954 cpassert(mspin >= nspins)
955 ALLOCATE (drho_g_out(3, mspin))
956 CALL qs_rho_set(rho_output, drho_g=drho_g_out)
957 IF (mspin > nspins)
THEN
960 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
961 CALL pw_copy(drho_g_in(i, 1), drho_g_out(i, j))
962 CALL pw_scale(drho_g_out(i, j), ospin)
968 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
969 CALL pw_copy(drho_g_in(i, j), drho_g_out(i, j))
976 IF (
ASSOCIATED(tau_r_in))
THEN
977 nspins =
SIZE(tau_r_in)
978 cpassert(mspin >= nspins)
979 ALLOCATE (tau_r_out(mspin))
981 IF (mspin > nspins)
THEN
983 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
984 CALL pw_copy(tau_r_in(1), tau_r_out(i))
989 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
990 CALL pw_copy(tau_r_in(i), tau_r_out(i))
996 IF (
ASSOCIATED(tau_g_in))
THEN
997 nspins =
SIZE(tau_g_in)
998 cpassert(mspin >= nspins)
999 ALLOCATE (tau_g_out(mspin))
1001 IF (mspin > nspins)
THEN
1003 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1004 CALL pw_copy(tau_g_in(1), tau_g_out(i))
1009 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1010 CALL pw_copy(tau_g_in(i), tau_g_out(i))
1016 IF (
ASSOCIATED(tot_rho_r_in))
THEN
1017 nspins =
SIZE(tot_rho_r_in)
1018 cpassert(mspin >= nspins)
1019 ALLOCATE (tot_rho_r_out(mspin))
1020 CALL qs_rho_set(rho_output, tot_rho_r=tot_rho_r_out)
1021 IF (mspin > nspins)
THEN
1023 tot_rho_r_out(i) = tot_rho_r_in(1)*ospin
1027 tot_rho_r_out(i) = tot_rho_r_in(i)
1033 IF (
ASSOCIATED(tot_rho_g_in))
THEN
1034 nspins =
SIZE(tot_rho_g_in)
1035 cpassert(mspin >= nspins)
1036 ALLOCATE (tot_rho_g_out(mspin))
1037 CALL qs_rho_set(rho_output, tot_rho_g=tot_rho_g_out)
1038 IF (mspin > nspins)
THEN
1040 tot_rho_g_out(i) = tot_rho_g_in(1)*ospin
1044 tot_rho_g_out(i) = tot_rho_g_in(i)
1050 rho_g_valid=rho_g_valid_in, &
1051 rho_r_valid=rho_r_valid_in, &
1052 drho_g_valid=drho_g_valid_in, &
1053 drho_r_valid=drho_r_valid_in, &
1054 tau_r_valid=tau_r_valid_in, &
1055 tau_g_valid=tau_g_valid_in, &
1056 soft_valid=soft_valid_in, &
1057 complex_rho_ao=complex_rho_ao)
1059 CALL timestop(handle)
1073 REAL(kind=
dp),
INTENT(IN) :: alpha, beta
1075 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_scale_and_add_b'
1078 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_a, tot_rho_g_b, tot_rho_r_a, &
1080 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_a, rho_ao_b, rho_ao_im_a, &
1082 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_a, rho_g_b, tau_g_a, tau_g_b
1083 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_a, drho_g_b
1084 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_a, rho_r_b, tau_r_a, tau_r_b
1085 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_a, drho_r_b
1088 CALL timeset(routinen, handle)
1090 NULLIFY (rho_ao_a, rho_ao_im_a, rho_r_a, rho_g_a, drho_r_a, &
1091 drho_g_a, tau_r_a, tau_g_a, tot_rho_r_a, tot_rho_g_a, rho_r_sccs_a)
1095 rho_ao_im=rho_ao_im_a, &
1102 tot_rho_r=tot_rho_r_a, &
1103 tot_rho_g=tot_rho_g_a, &
1104 rho_r_sccs=rho_r_sccs_a)
1106 NULLIFY (rho_ao_b, rho_ao_im_b, rho_r_b, rho_g_b, drho_r_b, &
1107 drho_g_b, tau_r_b, tau_g_b, tot_rho_r_b, tot_rho_g_b, rho_r_sccs_b)
1111 rho_ao_im=rho_ao_im_b, &
1118 tot_rho_r=tot_rho_r_b, &
1119 tot_rho_g=tot_rho_g_b, &
1120 rho_r_sccs=rho_r_sccs_b)
1122 IF (
ASSOCIATED(rho_ao_a) .AND.
ASSOCIATED(rho_ao_b))
THEN
1123 CALL dbcsr_add(rho_ao_a(2)%matrix, rho_ao_b(1)%matrix, alpha, beta)
1127 IF (
ASSOCIATED(rho_ao_im_a) .AND.
ASSOCIATED(rho_ao_im_b))
THEN
1128 CALL dbcsr_add(rho_ao_im_a(2)%matrix, rho_ao_im_b(1)%matrix, alpha, beta)
1132 IF (
ASSOCIATED(rho_r_a) .AND.
ASSOCIATED(rho_r_b))
THEN
1133 CALL pw_axpy(rho_r_b(1), rho_r_a(2), beta, alpha)
1137 IF (
ASSOCIATED(rho_g_a) .AND.
ASSOCIATED(rho_g_b))
THEN
1138 CALL pw_axpy(rho_g_b(1), rho_g_a(2), beta, alpha)
1142 IF (
ASSOCIATED(rho_r_sccs_a) .AND.
ASSOCIATED(rho_r_sccs_b))
THEN
1143 CALL pw_axpy(rho_r_sccs_b, rho_r_sccs_a, beta, alpha)
1147 IF (
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
THEN
1148 cpassert(
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
1152 IF (
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
THEN
1153 cpassert(
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
1157 IF (
ASSOCIATED(tau_r_a) .AND.
ASSOCIATED(tau_r_b))
THEN
1158 CALL pw_axpy(tau_r_b(1), tau_r_a(2), beta, alpha)
1162 IF (
ASSOCIATED(tau_g_a) .AND.
ASSOCIATED(tau_g_b))
THEN
1163 CALL pw_axpy(tau_g_b(1), tau_g_a(2), beta, alpha)
1167 IF (
ASSOCIATED(tot_rho_r_a) .AND.
ASSOCIATED(tot_rho_r_b))
THEN
1168 tot_rho_r_a(2) = alpha*tot_rho_r_a(2) + beta*tot_rho_r_b(1)
1172 IF (
ASSOCIATED(tot_rho_g_a) .AND.
ASSOCIATED(tot_rho_g_b))
THEN
1173 tot_rho_g_a(2) = alpha*tot_rho_g_a(2) + beta*tot_rho_g_b(1)
1176 CALL timestop(handle)
1190 REAL(kind=
dp),
INTENT(IN) :: alpha, beta
1192 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_rho_scale_and_add'
1194 INTEGER :: handle, i, j, nspina, nspinb, nspins
1195 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_a, tot_rho_g_b, tot_rho_r_a, &
1197 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_a, rho_ao_b, rho_ao_im_a, &
1199 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_a, rho_g_b, tau_g_a, tau_g_b
1200 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_a, drho_g_b
1201 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_a, rho_r_b, tau_r_a, tau_r_b
1202 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_a, drho_r_b
1205 CALL timeset(routinen, handle)
1207 NULLIFY (rho_ao_a, rho_ao_im_a, rho_r_a, rho_g_a, drho_r_a, &
1208 drho_g_a, tau_r_a, tau_g_a, tot_rho_r_a, tot_rho_g_a, rho_r_sccs_a)
1212 rho_ao_im=rho_ao_im_a, &
1219 tot_rho_r=tot_rho_r_a, &
1220 tot_rho_g=tot_rho_g_a, &
1221 rho_r_sccs=rho_r_sccs_a)
1223 NULLIFY (rho_ao_b, rho_ao_im_b, rho_r_b, rho_g_b, drho_r_b, &
1224 drho_g_b, tau_r_b, tau_g_b, tot_rho_r_b, tot_rho_g_b, rho_r_sccs_b)
1228 rho_ao_im=rho_ao_im_b, &
1235 tot_rho_r=tot_rho_r_b, &
1236 tot_rho_g=tot_rho_g_b, &
1237 rho_r_sccs=rho_r_sccs_b)
1239 IF (
ASSOCIATED(rho_ao_a) .AND.
ASSOCIATED(rho_ao_b))
THEN
1240 nspina =
SIZE(rho_ao_a)
1241 nspinb =
SIZE(rho_ao_b)
1242 nspins = min(nspina, nspinb)
1244 CALL dbcsr_add(rho_ao_a(i)%matrix, rho_ao_b(i)%matrix, alpha, beta)
1249 IF (
ASSOCIATED(rho_ao_im_a) .AND.
ASSOCIATED(rho_ao_im_b))
THEN
1250 nspina =
SIZE(rho_ao_im_a)
1251 nspinb =
SIZE(rho_ao_im_b)
1252 nspins = min(nspina, nspinb)
1254 CALL dbcsr_add(rho_ao_im_a(i)%matrix, rho_ao_im_b(i)%matrix, alpha, beta)
1259 IF (
ASSOCIATED(rho_r_a) .AND.
ASSOCIATED(rho_r_b))
THEN
1260 nspina =
SIZE(rho_ao_a)
1261 nspinb =
SIZE(rho_ao_b)
1262 nspins = min(nspina, nspinb)
1264 CALL pw_axpy(rho_r_b(i), rho_r_a(i), beta, alpha)
1269 IF (
ASSOCIATED(rho_g_a) .AND.
ASSOCIATED(rho_g_b))
THEN
1270 nspina =
SIZE(rho_ao_a)
1271 nspinb =
SIZE(rho_ao_b)
1272 nspins = min(nspina, nspinb)
1274 CALL pw_axpy(rho_g_b(i), rho_g_a(i), beta, alpha)
1279 IF (
ASSOCIATED(rho_r_sccs_a) .AND.
ASSOCIATED(rho_r_sccs_b))
THEN
1280 CALL pw_axpy(rho_r_sccs_b, rho_r_sccs_a, beta, alpha)
1284 IF (
ASSOCIATED(drho_r_a) .AND.
ASSOCIATED(drho_r_b))
THEN
1285 cpassert(all(shape(drho_r_a) == shape(drho_r_b)))
1286 DO j = 1,
SIZE(drho_r_a, 2)
1287 DO i = 1,
SIZE(drho_r_a, 1)
1288 CALL pw_axpy(drho_r_b(i, j), drho_r_a(i, j), beta, alpha)
1294 IF (
ASSOCIATED(drho_g_a) .AND.
ASSOCIATED(drho_g_b))
THEN
1295 cpassert(all(shape(drho_g_a) == shape(drho_g_b)))
1296 DO j = 1,
SIZE(drho_g_a, 2)
1297 DO i = 1,
SIZE(drho_g_a, 1)
1298 CALL pw_axpy(drho_g_b(i, j), drho_g_a(i, j), beta, alpha)
1304 IF (
ASSOCIATED(tau_r_a) .AND.
ASSOCIATED(tau_r_b))
THEN
1305 nspina =
SIZE(rho_ao_a)
1306 nspinb =
SIZE(rho_ao_b)
1307 nspins = min(nspina, nspinb)
1309 CALL pw_axpy(tau_r_b(i), tau_r_a(i), beta, alpha)
1314 IF (
ASSOCIATED(tau_g_a) .AND.
ASSOCIATED(tau_g_b))
THEN
1315 nspina =
SIZE(rho_ao_a)
1316 nspinb =
SIZE(rho_ao_b)
1317 nspins = min(nspina, nspinb)
1319 CALL pw_axpy(tau_g_b(i), tau_g_a(i), beta, alpha)
1324 IF (
ASSOCIATED(tot_rho_r_a) .AND.
ASSOCIATED(tot_rho_r_b))
THEN
1325 nspina =
SIZE(rho_ao_a)
1326 nspinb =
SIZE(rho_ao_b)
1327 nspins = min(nspina, nspinb)
1329 tot_rho_r_a(i) = alpha*tot_rho_r_a(i) + beta*tot_rho_r_b(i)
1334 IF (
ASSOCIATED(tot_rho_g_a) .AND.
ASSOCIATED(tot_rho_g_b))
THEN
1335 nspina =
SIZE(rho_ao_a)
1336 nspinb =
SIZE(rho_ao_b)
1337 nspins = min(nspina, nspinb)
1339 tot_rho_g_a(i) = alpha*tot_rho_g_a(i) + beta*tot_rho_g_b(i)
1343 CALL timestop(handle)
1361 TYPE(
qs_rho_type),
INTENT(INOUT) :: rho_input, rho_output
1364 CHARACTER(len=*),
PARAMETER :: routinen =
'duplicate_rho_type'
1366 INTEGER :: handle, i, j, nspins
1367 LOGICAL :: complex_rho_ao_in, drho_g_valid_in, drho_r_valid_in, rho_g_valid_in, &
1368 rho_r_valid_in, soft_valid_in, tau_g_valid_in, tau_r_valid_in
1369 REAL(kind=
dp),
DIMENSION(:),
POINTER :: tot_rho_g_in, tot_rho_g_out, &
1370 tot_rho_r_in, tot_rho_r_out
1371 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: rho_ao_im_in, rho_ao_im_out, rho_ao_in, &
1374 TYPE(
pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g_in, rho_g_out, tau_g_in, tau_g_out
1375 TYPE(
pw_c1d_gs_type),
DIMENSION(:, :),
POINTER :: drho_g_in, drho_g_out
1378 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r_in, rho_r_out, tau_r_in, tau_r_out
1379 TYPE(
pw_r3d_rs_type),
DIMENSION(:, :),
POINTER :: drho_r_in, drho_r_out
1382 CALL timeset(routinen, handle)
1384 NULLIFY (dft_control, pw_env, auxbas_pw_pool)
1385 NULLIFY (rho_ao_in, rho_ao_out, rho_ao_im_in, rho_ao_im_out)
1386 NULLIFY (rho_r_in, rho_r_out, rho_g_in, rho_g_out, drho_r_in, drho_r_out)
1387 NULLIFY (drho_g_in, drho_g_out, tau_r_in, tau_r_out, tau_g_in, tau_g_out)
1388 NULLIFY (tot_rho_r_in, tot_rho_r_out, tot_rho_g_in, tot_rho_g_out)
1389 NULLIFY (rho_r_sccs_in, rho_r_sccs_out)
1391 cpassert(
ASSOCIATED(qs_env))
1393 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env, dft_control=dft_control)
1394 CALL pw_env_get(pw_env=pw_env, auxbas_pw_pool=auxbas_pw_pool)
1395 nspins = dft_control%nspins
1401 rho_ao_im=rho_ao_im_in, &
1408 tot_rho_r=tot_rho_r_in, &
1409 tot_rho_g=tot_rho_g_in, &
1410 rho_g_valid=rho_g_valid_in, &
1411 rho_r_valid=rho_r_valid_in, &
1412 drho_g_valid=drho_g_valid_in, &
1413 drho_r_valid=drho_r_valid_in, &
1414 tau_r_valid=tau_r_valid_in, &
1415 tau_g_valid=tau_g_valid_in, &
1416 rho_r_sccs=rho_r_sccs_in, &
1417 soft_valid=soft_valid_in, &
1418 complex_rho_ao=complex_rho_ao_in)
1421 IF (
ASSOCIATED(rho_ao_in))
THEN
1423 CALL qs_rho_set(rho_output, rho_ao=rho_ao_out)
1425 ALLOCATE (rho_ao_out(i)%matrix)
1426 CALL dbcsr_copy(rho_ao_out(i)%matrix, rho_ao_in(i)%matrix, &
1427 name=
"myDensityMatrix_for_Spin_"//trim(adjustl(
cp_to_string(i))))
1428 CALL dbcsr_set(rho_ao_out(i)%matrix, 0.0_dp)
1433 IF (
ASSOCIATED(rho_ao_im_in))
THEN
1435 CALL qs_rho_set(rho_output, rho_ao=rho_ao_im_out)
1437 ALLOCATE (rho_ao_im_out(i)%matrix)
1438 CALL dbcsr_copy(rho_ao_im_out(i)%matrix, rho_ao_im_in(i)%matrix, &
1439 name=
"myImagDensityMatrix_for_Spin_"//trim(adjustl(
cp_to_string(i))))
1440 CALL dbcsr_set(rho_ao_im_out(i)%matrix, 0.0_dp)
1445 IF (
ASSOCIATED(rho_r_in))
THEN
1446 ALLOCATE (rho_r_out(nspins))
1449 CALL auxbas_pw_pool%create_pw(rho_r_out(i))
1450 CALL pw_copy(rho_r_in(i), rho_r_out(i))
1455 IF (
ASSOCIATED(rho_g_in))
THEN
1456 ALLOCATE (rho_g_out(nspins))
1459 CALL auxbas_pw_pool%create_pw(rho_g_out(i))
1460 CALL pw_copy(rho_g_in(i), rho_g_out(i))
1465 IF (
ASSOCIATED(rho_r_sccs_in))
THEN
1466 CALL qs_rho_set(rho_output, rho_r_sccs=rho_r_sccs_out)
1467 CALL auxbas_pw_pool%create_pw(rho_r_sccs_out)
1468 CALL pw_copy(rho_r_sccs_in, rho_r_sccs_out)
1472 IF (dft_control%drho_by_collocation)
THEN
1474 IF (
ASSOCIATED(drho_r_in))
THEN
1475 ALLOCATE (drho_r_out(3, nspins))
1476 CALL qs_rho_set(rho_output, drho_r=drho_r_out)
1479 CALL auxbas_pw_pool%create_pw(drho_r_out(i, j))
1480 CALL pw_copy(drho_r_in(i, j), drho_r_out(i, j))
1486 IF (
ASSOCIATED(drho_g_in))
THEN
1487 ALLOCATE (drho_g_out(3, nspins))
1488 CALL qs_rho_set(rho_output, drho_g=drho_g_out)
1491 CALL auxbas_pw_pool%create_pw(drho_g_out(i, j))
1492 CALL pw_copy(drho_g_in(i, j), drho_g_out(i, j))
1501 IF (dft_control%use_kinetic_energy_density)
THEN
1503 IF (
ASSOCIATED(tau_r_in))
THEN
1504 ALLOCATE (tau_r_out(nspins))
1507 CALL auxbas_pw_pool%create_pw(tau_r_out(i))
1508 CALL pw_copy(tau_r_in(i), tau_r_out(i))
1513 IF (
ASSOCIATED(tau_g_in))
THEN
1514 ALLOCATE (tau_g_out(nspins))
1517 CALL auxbas_pw_pool%create_pw(tau_g_out(i))
1518 CALL pw_copy(tau_g_in(i), tau_g_out(i))
1524 rho_g_valid=rho_g_valid_in, &
1525 rho_r_valid=rho_r_valid_in, &
1526 drho_g_valid=drho_g_valid_in, &
1527 drho_r_valid=drho_r_valid_in, &
1528 tau_r_valid=tau_r_valid_in, &
1529 tau_g_valid=tau_g_valid_in, &
1530 soft_valid=soft_valid_in, &
1531 complex_rho_ao=complex_rho_ao_in)
1534 IF (
ASSOCIATED(tot_rho_r_in))
THEN
1535 ALLOCATE (tot_rho_r_out(nspins))
1536 CALL qs_rho_set(rho_output, tot_rho_r=tot_rho_r_out)
1538 tot_rho_r_out(i) = tot_rho_r_in(i)
1543 IF (
ASSOCIATED(tot_rho_g_in))
THEN
1544 ALLOCATE (tot_rho_g_out(nspins))
1545 CALL qs_rho_set(rho_output, tot_rho_g=tot_rho_g_out)
1547 tot_rho_g_out(i) = tot_rho_g_in(i)
1552 CALL timestop(handle)
1565 CHARACTER(LEN=default_string_length) :: headline
1566 INTEGER :: i, ic, nimages, nspins
1567 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: rho_ao_im_kp, rho_ao_kp
1573 NULLIFY (rho_ao_im_kp, rho_ao_kp, dft_control, template, sab_orb)
1576 dft_control=dft_control, &
1579 CALL qs_rho_get(rho, rho_ao_im_kp=rho_ao_im_kp, rho_ao_kp=rho_ao_kp)
1581 nspins = dft_control%nspins
1582 nimages = dft_control%nimages
1584 cpassert(nspins ==
SIZE(rho_ao_kp, 1))
1585 cpassert(nimages ==
SIZE(rho_ao_kp, 2))
1588 CALL qs_rho_set(rho, rho_ao_im_kp=rho_ao_im_kp)
1591 IF (nspins > 1)
THEN
1593 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR ALPHA SPIN"
1595 headline =
"IMAGINARY PART OF DENSITY MATRIX FOR BETA SPIN"
1598 headline =
"IMAGINARY PART OF DENSITY MATRIX"
1600 ALLOCATE (rho_ao_im_kp(i, ic)%matrix)
1601 template => rho_ao_kp(i, ic)%matrix
1602 CALL dbcsr_create(matrix=rho_ao_im_kp(i, ic)%matrix, template=template, &
1603 name=trim(headline), matrix_type=dbcsr_type_antisymmetric)
1605 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, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered)
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, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, 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, exc_accint, 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_vhxc, 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, xcint_weights, 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.