107 integrate_v_core_rspace
137#include "./base/base_uses.f90"
143 LOGICAL,
PARAMETER :: debug_this_module = .true.
144 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_ks_methods'
176 print_active, ext_ks_matrix)
178 LOGICAL,
INTENT(in) :: calculate_forces, just_energy
179 LOGICAL,
INTENT(IN),
OPTIONAL :: print_active
181 POINTER :: ext_ks_matrix
183 CHARACTER(LEN=*),
PARAMETER :: routinen =
'qs_ks_build_kohn_sham_matrix'
185 CHARACTER(len=default_string_length) :: name
186 INTEGER :: handle, iatom, img, ispin, nimages, &
188 LOGICAL :: do_adiabatic_rescaling, do_ddapc, do_hfx, do_ppl, dokp, gapw, gapw_xc, &
189 hfx_treat_lsd_in_core, just_energy_xc, lrigpw, my_print, rigpw, use_virial
190 REAL(kind=
dp) :: ecore_ppl, edisp, ee_ener, ekin_mol, &
191 mulliken_order_p, vscale
192 REAL(kind=
dp),
DIMENSION(3, 3) :: h_stress, pv_loc
197 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: ksmat, matrix_vxc, mo_derivs
198 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: ks_matrix, ks_matrix_im, matrix_h, &
199 matrix_h_im, matrix_s, my_rho, rho_ao
213 TYPE(
pw_r3d_rs_type),
DIMENSION(:),
POINTER :: rho_r, v_rspace_embed, v_rspace_new, &
214 v_rspace_new_aux_fit, v_tau_rspace, &
216 TYPE(
pw_r3d_rs_type),
POINTER :: rho0_s_rs, rho_nlcc, v_hartree_rspace, &
217 v_sccs_rspace, v_sic_rspace, &
218 v_spin_ddapc_rest_r, vee, vppl_rspace
221 TYPE(
qs_rho_type),
POINTER :: rho, rho_struct, rho_xc
223 hfx_sections, input, scf_section, &
227 CALL timeset(routinen, handle)
228 NULLIFY (admm_env, cell, dft_control, logger, mo_derivs, my_rho, &
229 rho_struct, para_env, pw_env, virial, vppl_rspace, &
230 adiabatic_rescaling_section, hfx_sections, &
231 input, scf_section, xc_section, matrix_h, matrix_h_im, matrix_s, &
232 auxbas_pw_pool, poisson_env, v_rspace_new, v_rspace_new_aux_fit, &
233 v_tau_rspace, v_tau_rspace_aux_fit, matrix_vxc, vee, rho_nlcc, &
234 ks_env, ks_matrix, ks_matrix_im, rho, energy, rho_xc, rho_r, rho_ao, rho_core)
236 cpassert(
ASSOCIATED(qs_env))
240 IF (
PRESENT(print_active)) my_print = print_active
244 dft_control=dft_control, &
245 matrix_h_kp=matrix_h, &
246 matrix_h_im_kp=matrix_h_im, &
247 matrix_s_kp=matrix_s, &
248 matrix_ks_kp=ks_matrix, &
249 matrix_ks_im_kp=ks_matrix_im, &
250 matrix_vxc=matrix_vxc, &
256 v_hartree_rspace=v_hartree_rspace, &
264 CALL qs_rho_get(rho, rho_r=rho_r, rho_ao_kp=rho_ao)
266 nimages = dft_control%nimages
267 nspins = dft_control%nspins
270 IF (
PRESENT(ext_ks_matrix)) ks_matrix(1:nspins, 1:1) => ext_ks_matrix(1:nspins)
272 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
281 CALL section_vals_get(adiabatic_rescaling_section, explicit=do_adiabatic_rescaling)
282 just_energy_xc = just_energy
283 IF (do_adiabatic_rescaling)
THEN
286 just_energy_xc = .true.
289 cpassert(
ASSOCIATED(matrix_h))
290 cpassert(
ASSOCIATED(matrix_s))
291 cpassert(
ASSOCIATED(rho))
292 cpassert(
ASSOCIATED(pw_env))
293 cpassert(
SIZE(ks_matrix, 1) > 0)
297 do_ddapc = dft_control%qs_control%ddapc_restraint .OR. &
298 qs_env%cp_ddapc_ewald%do_decoupling .OR. &
299 qs_env%cp_ddapc_ewald%do_qmmm_periodic_decpl .OR. &
300 qs_env%cp_ddapc_ewald%do_solvation
303 lrigpw = dft_control%qs_control%lrigpw
304 rigpw = dft_control%qs_control%rigpw
306 cpassert(nimages == 1)
308 IF (lrigpw .AND. rigpw)
THEN
309 cpabort(
" LRI and RI are not compatible")
313 gapw = dft_control%qs_control%gapw
314 gapw_xc = dft_control%qs_control%gapw_xc
315 IF (gapw_xc .AND. gapw)
THEN
316 cpabort(
" GAPW and GAPW_XC are not compatible")
318 IF ((gapw .AND. lrigpw) .OR. (gapw_xc .AND. lrigpw))
THEN
319 cpabort(
" GAPW/GAPW_XC and LRIGPW are not compatible")
321 IF ((gapw .AND. rigpw) .OR. (gapw_xc .AND. rigpw))
THEN
322 cpabort(
" GAPW/GAPW_XC and RIGPW are not compatible")
325 do_ppl = dft_control%qs_control%do_ppl_method ==
do_ppl_grid
328 CALL get_qs_env(qs_env=qs_env, vppl=vppl_rspace)
332 cpassert(
ASSOCIATED(rho_xc))
336 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool, poisson_env=poisson_env)
339 cpabort(
"The implicit Poisson solver cannot be used in conjunction with GAPW.")
343 IF (gapw .OR. gapw_xc)
THEN
348 CALL auxbas_pw_pool%create_pw(v_hartree_gspace)
349 CALL auxbas_pw_pool%create_pw(rho_tot_gspace)
353 "PRINT%DETAILED_ENERGY"), &
355 (.NOT. gapw) .AND. (.NOT. gapw_xc) .AND. &
372 IF (dft_control%do_sccs)
THEN
374 NULLIFY (v_sccs_rspace)
375 ALLOCATE (v_sccs_rspace)
376 CALL auxbas_pw_pool%create_pw(v_sccs_rspace)
379 cpabort(
"The implicit Poisson solver cannot be used together with SCCS.")
382 IF (use_virial .AND. calculate_forces)
THEN
383 CALL sccs(qs_env, rho_tot_gspace, v_hartree_gspace, v_sccs_rspace, &
385 virial%pv_ehartree = virial%pv_ehartree + h_stress/real(para_env%num_pe,
dp)
386 virial%pv_virial = virial%pv_virial + h_stress/real(para_env%num_pe,
dp)
388 CALL sccs(qs_env, rho_tot_gspace, v_hartree_gspace, v_sccs_rspace)
393 IF (use_virial .AND. calculate_forces)
THEN
394 h_stress(:, :) = 0.0_dp
396 v_hartree_gspace, h_stress=h_stress, &
398 virial%pv_ehartree = virial%pv_ehartree + h_stress/real(para_env%num_pe,
dp)
399 virial%pv_virial = virial%pv_virial + h_stress/real(para_env%num_pe,
dp)
402 v_hartree_gspace, rho_core=rho_core)
408 CALL qs_ks_ddapc(qs_env, auxbas_pw_pool, rho_tot_gspace, v_hartree_gspace, &
409 v_spin_ddapc_rest_r, energy, calculate_forces, ks_matrix, &
412 dft_control%qs_control%ddapc_explicit_potential = .false.
413 dft_control%qs_control%ddapc_restraint_is_spin = .false.
414 IF (.NOT. just_energy)
THEN
415 CALL pw_transfer(v_hartree_gspace, v_hartree_rspace)
416 CALL pw_scale(v_hartree_rspace, v_hartree_rspace%pw_grid%dvol)
419 CALL auxbas_pw_pool%give_back_pw(v_hartree_gspace)
421 IF (dft_control%correct_surf_dip)
THEN
422 IF (dft_control%surf_dip_correct_switch)
THEN
424 energy%hartree = energy%hartree + energy%surf_dipole
429 CALL calc_v_sic_rspace(v_sic_rspace, energy, qs_env, dft_control, rho, poisson_env, &
430 just_energy, calculate_forces, auxbas_pw_pool)
433 CALL get_qs_env(qs_env, ecoul_1c=ecoul_1c, local_rho_set=local_rho_set)
434 CALL vh_1c_gg_integrals(qs_env, energy%hartree_1c, ecoul_1c, local_rho_set, para_env, tddft=.false., &
442 IF (dft_control%apply_external_potential)
THEN
448 IF (.NOT. just_energy)
THEN
452 cpassert(
ASSOCIATED(rho0_s_rs))
461 IF (qs_env%qmmm)
THEN
464 v_qmmm=qs_env%ks_qmmm_env%v_qmmm_rspace, &
465 qmmm_energy=energy%qmmm_el)
466 IF (qs_env%qmmm_env_qm%image_charge)
THEN
468 rho_hartree_gspace=rho_tot_gspace, &
470 qmmm_env=qs_env%qmmm_env_qm, &
472 IF (.NOT. just_energy)
THEN
474 v_metal=qs_env%ks_qmmm_env%v_metal_rspace, &
476 IF (calculate_forces)
THEN
478 potential=v_hartree_rspace, coeff=qs_env%image_coeff, &
479 forces=qs_env%qmmm_env_qm%image_charge_pot%image_forcesMM, &
480 qmmm_env=qs_env%qmmm_env_qm, qs_env=qs_env)
483 CALL qs_env%ks_qmmm_env%v_metal_rspace%release()
484 DEALLOCATE (qs_env%ks_qmmm_env%v_metal_rspace)
486 IF (.NOT. just_energy)
THEN
488 v_qmmm=qs_env%ks_qmmm_env%v_qmmm_rspace, scale=1.0_dp)
491 CALL auxbas_pw_pool%give_back_pw(rho_tot_gspace)
494 IF (dft_control%smeagol_control%smeagol_enabled .AND. &
496 cpassert(
ASSOCIATED(dft_control%smeagol_control%aux))
498 dft_control%smeagol_control%aux%HartreeLeadsLeft, &
499 dft_control%smeagol_control%aux%HartreeLeadsRight, &
500 dft_control%smeagol_control%aux%HartreeLeadsBottom, &
501 dft_control%smeagol_control%aux%VBias, &
502 dft_control%smeagol_control%aux%minL, &
503 dft_control%smeagol_control%aux%maxR, &
504 dft_control%smeagol_control%aux%isexplicit_maxR, &
505 dft_control%smeagol_control%aux%isexplicit_HartreeLeadsBottom)
509 IF (dft_control%do_admm)
THEN
512 IF (dft_control%do_admm_mo)
THEN
513 IF (qs_env%run_rtp)
THEN
522 ELSEIF (dft_control%do_admm_dm)
THEN
528 IF (use_virial .AND. calculate_forces) virial%pv_calculate = .true.
533 IF (dft_control%do_admm)
THEN
535 xc_section => admm_env%xc_section_aux
539 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_struct, xc_section=xc_section, &
540 vxc_rho=v_rspace_new_aux_fit, vxc_tau=v_tau_rspace_aux_fit, exc=energy%exc_aux_fit, &
541 just_energy=just_energy_xc)
543 IF (admm_env%do_gapw)
THEN
545 CALL calculate_vxc_atom(qs_env, energy_only=just_energy_xc, exc1=energy%exc1_aux_fit, &
546 kind_set_external=admm_env%admm_gapw_env%admm_kind_set, &
547 xc_section_external=xc_section, &
548 rho_atom_set_external=admm_env%admm_gapw_env%local_rho_set%rho_atom_set)
554 IF (use_virial .AND. calculate_forces)
THEN
557 IF (admm_env%do_admms) vscale = admm_env%gsi(1)**(2.0_dp/3.0_dp)
558 IF (admm_env%do_admmp) vscale = admm_env%gsi(1)**2
559 virial%pv_exc = virial%pv_exc - vscale*virial%pv_xc
560 virial%pv_virial = virial%pv_virial - vscale*virial%pv_xc
563 xc_section => admm_env%xc_section_primary
569 CALL get_qs_env(qs_env=qs_env, rho_xc=rho_struct)
571 CALL get_qs_env(qs_env=qs_env, rho=rho_struct)
575 IF (dft_control%apply_external_density .OR. dft_control%apply_external_vxc)
THEN
580 IF (dft_control%apply_embed_pot)
THEN
581 NULLIFY (v_rspace_embed)
582 energy%embed_corr = 0.0_dp
584 energy%embed_corr, just_energy)
587 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_struct, xc_section=xc_section, &
588 vxc_rho=v_rspace_new, vxc_tau=v_tau_rspace, exc=energy%exc, &
589 edisp=edisp, dispersion_env=qs_env%dispersion_env, &
590 just_energy=just_energy_xc)
591 IF (edisp /= 0.0_dp) energy%dispersion = edisp
592 IF (qs_env%requires_matrix_vxc .AND.
ASSOCIATED(v_rspace_new))
THEN
594 CALL set_ks_env(ks_env, matrix_vxc=matrix_vxc)
597 IF (gapw .OR. gapw_xc)
THEN
598 CALL calculate_vxc_atom(qs_env, just_energy_xc, energy%exc1, xc_section_external=xc_section)
600 IF (use_virial .AND. calculate_forces)
THEN
601 IF (
ASSOCIATED(v_tau_rspace))
THEN
602 cpabort(
"MGGA STRESS with GAPW/GAPW_XC not implemneted")
610 IF (qs_env%harris_method)
THEN
611 CALL get_qs_env(qs_env, harris_env=harris_env)
616 IF (use_virial .AND. calculate_forces)
THEN
617 virial%pv_exc = virial%pv_exc - virial%pv_xc
618 virial%pv_virial = virial%pv_virial - virial%pv_xc
626 CALL hfx_ks_matrix(qs_env, ks_matrix, rho, energy, calculate_forces, &
627 just_energy, v_rspace_new, v_tau_rspace)
632 IF (do_ppl .AND. calculate_forces)
THEN
635 CALL integrate_ppl_rspace(rho_r(ispin), qs_env)
639 IF (
ASSOCIATED(rho_nlcc) .AND. calculate_forces)
THEN
641 CALL integrate_rho_nlcc(v_rspace_new(ispin), qs_env)
642 IF (dft_control%do_admm)
CALL integrate_rho_nlcc(v_rspace_new_aux_fit(ispin), qs_env)
647 IF (dft_control%qs_control%do_kg .AND. just_energy)
THEN
649 cpassert(.NOT. (gapw .OR. gapw_xc))
650 cpassert(nimages == 1)
651 ksmat => ks_matrix(:, 1)
652 CALL kg_ekin_subset(qs_env, ksmat, ekin_mol, calculate_forces, do_kernel=.false.)
655 energy%exc = energy%exc - ekin_mol
660 IF (.NOT. just_energy)
THEN
661 IF (calculate_forces)
THEN
664 (poisson_env%parameters%dielectric_params%dielec_core_correction))
THEN
667 CALL auxbas_pw_pool%create_pw(v_minus_veps)
668 CALL pw_copy(v_hartree_rspace, v_minus_veps)
669 CALL pw_axpy(poisson_env%implicit_env%v_eps, v_minus_veps, -v_hartree_rspace%pw_grid%dvol)
670 CALL integrate_v_core_rspace(v_minus_veps, qs_env)
671 CALL auxbas_pw_pool%give_back_pw(v_minus_veps)
674 CALL integrate_v_core_rspace(v_hartree_rspace, qs_env)
678 IF (.NOT. do_hfx)
THEN
684 CALL dbcsr_copy(ks_matrix(ispin, img)%matrix, matrix_h(1, img)%matrix, name=name)
688 IF (qs_env%run_rtp)
THEN
689 IF (dft_control%rtp_control%velocity_gauge)
THEN
690 cpassert(
ASSOCIATED(matrix_h_im))
691 cpassert(
ASSOCIATED(ks_matrix_im))
695 CALL dbcsr_copy(ks_matrix_im(ispin, img)%matrix, matrix_h_im(1, img)%matrix, name=name)
702 IF (use_virial .AND. calculate_forces)
THEN
703 pv_loc = virial%pv_virial
710 v_rspace_new, v_rspace_new_aux_fit, v_tau_rspace, v_tau_rspace_aux_fit, &
711 v_sic_rspace, v_spin_ddapc_rest_r, v_sccs_rspace, v_rspace_embed, &
712 cdft_control, calculate_forces)
714 IF (use_virial .AND. calculate_forces)
THEN
715 virial%pv_ehartree = virial%pv_ehartree + (virial%pv_virial - pv_loc)
717 IF (dft_control%qs_control%do_kg)
THEN
718 cpassert(.NOT. (gapw .OR. gapw_xc))
719 cpassert(nimages == 1)
720 ksmat => ks_matrix(:, 1)
722 IF (use_virial .AND. calculate_forces)
THEN
723 pv_loc = virial%pv_virial
726 CALL kg_ekin_subset(qs_env, ksmat, ekin_mol, calculate_forces, do_kernel=.false.)
728 energy%exc = energy%exc - ekin_mol
731 IF (use_virial .AND. calculate_forces)
THEN
734 virial%pv_ehartree = virial%pv_ehartree + (virial%pv_virial - pv_loc)
737 virial%pv_exc = virial%pv_exc + virial%pv_xc
738 virial%pv_virial = virial%pv_virial + virial%pv_xc
739 virial%pv_xc = 0.0_dp
746 cpwarn(
"KS matrix not longer correct. Check possible problems with property calculations!")
751 IF (dft_control%qs_control%ddapc_explicit_potential)
THEN
752 CALL auxbas_pw_pool%give_back_pw(v_spin_ddapc_rest_r)
753 DEALLOCATE (v_spin_ddapc_rest_r)
756 IF (calculate_forces .AND. dft_control%qs_control%cdft)
THEN
757 IF (.NOT. cdft_control%transfer_pot)
THEN
758 DO iatom = 1,
SIZE(cdft_control%group)
759 CALL auxbas_pw_pool%give_back_pw(cdft_control%group(iatom)%weight)
760 DEALLOCATE (cdft_control%group(iatom)%weight)
762 IF (cdft_control%atomic_charges)
THEN
763 DO iatom = 1, cdft_control%natoms
764 CALL auxbas_pw_pool%give_back_pw(cdft_control%charge(iatom))
766 DEALLOCATE (cdft_control%charge)
769 cdft_control%becke_control%cavity_confine)
THEN
770 IF (.NOT.
ASSOCIATED(cdft_control%becke_control%cavity_mat))
THEN
771 CALL auxbas_pw_pool%give_back_pw(cdft_control%becke_control%cavity)
773 DEALLOCATE (cdft_control%becke_control%cavity_mat)
776 IF (
ASSOCIATED(cdft_control%hirshfeld_control%hirshfeld_env%fnorm))
THEN
777 CALL auxbas_pw_pool%give_back_pw(cdft_control%hirshfeld_control%hirshfeld_env%fnorm)
780 IF (
ASSOCIATED(cdft_control%charges_fragment))
DEALLOCATE (cdft_control%charges_fragment)
781 cdft_control%save_pot = .false.
782 cdft_control%need_pot = .true.
783 cdft_control%external_control = .false.
787 IF (dft_control%do_sccs)
THEN
788 CALL auxbas_pw_pool%give_back_pw(v_sccs_rspace)
789 DEALLOCATE (v_sccs_rspace)
793 IF (dft_control%apply_external_potential)
THEN
796 v_qmmm=vee, scale=-1.0_dp)
801 IF (gapw .OR. gapw_xc)
THEN
804 IF (dft_control%do_admm)
THEN
813 ks_matrix, matrix_s, rho, mulliken_order_p)
816 IF (dft_control%dft_plus_u)
THEN
817 cpassert(nimages == 1)
818 IF (just_energy)
THEN
819 CALL plus_u(qs_env=qs_env)
821 ksmat => ks_matrix(:, 1)
822 CALL plus_u(qs_env=qs_env, matrix_h=ksmat)
825 energy%dft_plus_u = 0.0_dp
832 dft_control%qs_control%eps_filter_matrix)
837 IF (dft_control%do_admm_mo)
THEN
838 IF (qs_env%run_rtp)
THEN
843 ELSEIF (dft_control%do_admm_dm)
THEN
854 IF (qs_env%requires_mo_derivs .AND. .NOT. just_energy .AND. .NOT. qs_env%run_rtp)
THEN
856 cpassert(nimages == 1)
857 ksmat => ks_matrix(:, 1)
858 CALL calc_mo_derivatives(qs_env, ksmat, mo_derivs)
862 IF (calculate_forces .AND. dft_control%do_admm)
THEN
871 CALL low_spin_roks(energy, qs_env, dft_control, do_hfx, just_energy, &
872 calculate_forces, auxbas_pw_pool)
876 calculate_forces, auxbas_pw_pool)
883 energy, calculate_forces, just_energy)
891 energy%core = energy%core + ecore_ppl
896 CALL get_qs_env(qs_env, lri_env=lri_env, lri_density=lri_density)
897 IF (lri_env%ppl_ri)
THEN
900 lri_v_int => lri_density%lri_coefs(ispin)%lri_kinds
903 energy%core = energy%core + ecore_ppl
908 energy%total = energy%core_overlap + energy%core_self + energy%core + energy%hartree + &
909 energy%hartree_1c + energy%exc + energy%exc1 + energy%ex + &
910 energy%dispersion + energy%gcp + energy%qmmm_el + energy%mulliken + &
911 sum(energy%ddapc_restraint) + energy%s2_restraint + &
912 energy%dft_plus_u + energy%kTS + &
913 energy%efield + energy%efield_core + energy%ee + &
914 energy%ee_core + energy%exc_aux_fit + energy%image_charge + &
915 energy%sccs_pol + energy%cdft + energy%exc1_aux_fit
917 IF (dft_control%apply_embed_pot) energy%total = energy%total + energy%embed_corr
920 cpabort(
"KS energy is an abnormal value (NaN/Inf).")
927 CALL timestop(handle)
939 TYPE(pw_c1d_gs_type),
INTENT(INOUT) :: rho_tot_gspace
940 TYPE(qs_environment_type),
POINTER :: qs_env
941 TYPE(qs_rho_type),
POINTER :: rho
942 LOGICAL,
INTENT(IN),
OPTIONAL :: skip_nuclear_density
946 TYPE(dft_control_type),
POINTER :: dft_control
947 TYPE(pw_c1d_gs_type),
DIMENSION(:),
POINTER :: rho_g
948 TYPE(pw_c1d_gs_type),
POINTER :: rho0_s_gs, rho_core
949 TYPE(qs_charges_type),
POINTER :: qs_charges
952 IF (
PRESENT(skip_nuclear_density)) my_skip = skip_nuclear_density
954 CALL qs_rho_get(rho, rho_g=rho_g)
955 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
957 IF (.NOT. my_skip)
THEN
959 CALL get_qs_env(qs_env=qs_env, rho_core=rho_core)
960 IF (dft_control%qs_control%gapw)
THEN
962 CALL get_qs_env(qs_env=qs_env, rho0_s_gs=rho0_s_gs)
963 cpassert(
ASSOCIATED(rho0_s_gs))
964 CALL pw_copy(rho0_s_gs, rho_tot_gspace)
965 IF (dft_control%qs_control%gapw_control%nopaw_as_gpw)
THEN
966 CALL pw_axpy(rho_core, rho_tot_gspace)
969 CALL pw_copy(rho_core, rho_tot_gspace)
971 DO ispin = 1, dft_control%nspins
972 CALL pw_axpy(rho_g(ispin), rho_tot_gspace)
974 CALL get_qs_env(qs_env=qs_env, qs_charges=qs_charges)
975 qs_charges%total_rho_gspace = pw_integrate_function(rho_tot_gspace, isign=-1)
977 DO ispin = 1, dft_control%nspins
978 CALL pw_axpy(rho_g(ispin), rho_tot_gspace)
994 SUBROUTINE calc_mo_derivatives(qs_env, ks_matrix, mo_derivs)
995 TYPE(qs_environment_type),
POINTER :: qs_env
996 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: ks_matrix, mo_derivs
999 LOGICAL :: uniform_occupation
1000 REAL(kind=dp),
DIMENSION(:),
POINTER :: occupation_numbers
1001 TYPE(cp_fm_type),
POINTER :: mo_coeff
1002 TYPE(dbcsr_type) :: mo_derivs2_tmp1, mo_derivs2_tmp2
1003 TYPE(dbcsr_type),
POINTER :: mo_coeff_b
1004 TYPE(dft_control_type),
POINTER :: dft_control
1005 TYPE(mo_set_type),
DIMENSION(:),
POINTER :: mo_array
1007 NULLIFY (dft_control, mo_array, mo_coeff, mo_coeff_b, occupation_numbers)
1009 CALL get_qs_env(qs_env, &
1010 dft_control=dft_control, &
1013 DO ispin = 1,
SIZE(mo_derivs)
1015 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff=mo_coeff, &
1016 mo_coeff_b=mo_coeff_b, occupation_numbers=occupation_numbers)
1017 CALL dbcsr_multiply(
'n',
'n', 1.0_dp, ks_matrix(ispin)%matrix, mo_coeff_b, &
1018 0.0_dp, mo_derivs(ispin)%matrix)
1020 IF (dft_control%restricted)
THEN
1022 cpassert(ispin == 1)
1023 cpassert(
SIZE(mo_array) == 2)
1028 CALL get_mo_set(mo_set=mo_array(1), uniform_occupation=uniform_occupation)
1029 cpassert(uniform_occupation)
1030 CALL get_mo_set(mo_set=mo_array(2), uniform_occupation=uniform_occupation)
1031 cpassert(uniform_occupation)
1035 CALL get_mo_set(mo_set=mo_array(2), mo_coeff_b=mo_coeff_b)
1036 CALL dbcsr_create(mo_derivs2_tmp1, template=mo_coeff_b)
1039 CALL dbcsr_multiply(
'n',
'n', 1.0_dp, ks_matrix(2)%matrix, mo_coeff_b, 0.0_dp, mo_derivs2_tmp1)
1042 CALL dbcsr_create(mo_derivs2_tmp2, template=mo_derivs(1)%matrix)
1043 CALL dbcsr_set(mo_derivs2_tmp2, 0.0_dp)
1046 CALL dbcsr_copy_columns_hack(mo_derivs2_tmp2, mo_derivs2_tmp1, &
1047 mo_array(2)%nmo, 1, 1, &
1048 para_env=mo_array(1)%mo_coeff%matrix_struct%para_env, &
1049 blacs_env=mo_array(1)%mo_coeff%matrix_struct%context)
1052 CALL dbcsr_add(mo_derivs(1)%matrix, mo_derivs2_tmp2, 1.0_dp, 1.0_dp)
1053 CALL dbcsr_release(mo_derivs2_tmp1)
1054 CALL dbcsr_release(mo_derivs2_tmp2)
1058 IF (dft_control%do_admm_mo)
THEN
1059 CALL calc_admm_mo_derivatives(qs_env, mo_derivs)
1062 END SUBROUTINE calc_mo_derivatives
1080 TYPE(qs_environment_type),
POINTER :: qs_env
1081 LOGICAL,
INTENT(IN),
OPTIONAL :: calculate_forces, just_energy, &
1084 CHARACTER(LEN=*),
PARAMETER :: routinen =
'qs_ks_update_qs_env'
1086 INTEGER :: handle, unit_nr
1087 LOGICAL :: c_forces, do_rebuild, energy_only, &
1088 forces_up_to_date, potential_changed, &
1089 rho_changed, s_mstruct_changed
1090 TYPE(qs_ks_env_type),
POINTER :: ks_env
1093 unit_nr = cp_logger_get_default_io_unit()
1096 energy_only = .false.
1097 IF (
PRESENT(just_energy)) energy_only = just_energy
1098 IF (
PRESENT(calculate_forces)) c_forces = calculate_forces
1101 CALL timeset(routinen//
'_forces', handle)
1103 CALL timeset(routinen, handle)
1106 cpassert(
ASSOCIATED(qs_env))
1108 CALL get_qs_env(qs_env, &
1110 rho_changed=rho_changed, &
1111 s_mstruct_changed=s_mstruct_changed, &
1112 potential_changed=potential_changed, &
1113 forces_up_to_date=forces_up_to_date)
1115 do_rebuild = .false.
1116 do_rebuild = do_rebuild .OR. rho_changed
1117 do_rebuild = do_rebuild .OR. s_mstruct_changed
1118 do_rebuild = do_rebuild .OR. potential_changed
1119 do_rebuild = do_rebuild .OR. (c_forces .AND. .NOT. forces_up_to_date)
1121 IF (do_rebuild)
THEN
1122 CALL evaluate_core_matrix_traces(qs_env)
1125 CALL set_ks_env(ks_env, potential_changed=.false.)
1127 CALL rebuild_ks_matrix(qs_env, &
1128 calculate_forces=c_forces, &
1129 just_energy=energy_only, &
1130 print_active=print_active)
1132 IF (.NOT. energy_only)
THEN
1133 CALL set_ks_env(ks_env, &
1134 rho_changed=.false., &
1135 s_mstruct_changed=.false., &
1136 forces_up_to_date=forces_up_to_date .OR. c_forces)
1140 CALL timestop(handle)
1149 SUBROUTINE evaluate_core_matrix_traces(qs_env)
1150 TYPE(qs_environment_type),
POINTER :: qs_env
1152 CHARACTER(LEN=*),
PARAMETER :: routinen =
'evaluate_core_matrix_traces'
1155 REAL(kind=dp) :: energy_core_im
1156 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrixkp_h, matrixkp_t, rho_ao_kp
1157 TYPE(dft_control_type),
POINTER :: dft_control
1158 TYPE(qs_energy_type),
POINTER :: energy
1159 TYPE(qs_rho_type),
POINTER :: rho
1161 CALL timeset(routinen, handle)
1162 NULLIFY (energy, rho, dft_control, rho_ao_kp, matrixkp_t, matrixkp_h)
1164 CALL get_qs_env(qs_env, &
1167 dft_control=dft_control, &
1168 kinetic_kp=matrixkp_t, &
1169 matrix_h_kp=matrixkp_h)
1171 CALL qs_rho_get(rho, rho_ao_kp=rho_ao_kp)
1173 CALL calculate_ptrace(matrixkp_h, rho_ao_kp, energy%core, dft_control%nspins)
1176 IF (qs_env%run_rtp)
THEN
1177 IF (dft_control%rtp_control%velocity_gauge)
THEN
1178 CALL get_qs_env(qs_env, matrix_h_im_kp=matrixkp_h)
1179 CALL qs_rho_get(rho, rho_ao_im_kp=rho_ao_kp)
1180 CALL calculate_ptrace(matrixkp_h, rho_ao_kp, energy_core_im, dft_control%nspins)
1181 energy%core = energy%core - energy_core_im
1186 IF (
ASSOCIATED(matrixkp_t)) &
1187 CALL calculate_ptrace(matrixkp_t, rho_ao_kp, energy%kinetic, dft_control%nspins)
1189 CALL timestop(handle)
1190 END SUBROUTINE evaluate_core_matrix_traces
1200 SUBROUTINE rebuild_ks_matrix(qs_env, calculate_forces, just_energy, print_active)
1201 TYPE(qs_environment_type),
POINTER :: qs_env
1202 LOGICAL,
INTENT(IN) :: calculate_forces, just_energy
1203 LOGICAL,
INTENT(IN),
OPTIONAL :: print_active
1205 CHARACTER(LEN=*),
PARAMETER :: routinen =
'rebuild_ks_matrix'
1208 TYPE(dft_control_type),
POINTER :: dft_control
1210 CALL timeset(routinen, handle)
1211 NULLIFY (dft_control)
1213 CALL get_qs_env(qs_env, dft_control=dft_control)
1215 IF (dft_control%qs_control%semi_empirical)
THEN
1216 CALL build_se_fock_matrix(qs_env, &
1217 calculate_forces=calculate_forces, &
1218 just_energy=just_energy)
1220 ELSEIF (dft_control%qs_control%dftb)
THEN
1221 CALL build_dftb_ks_matrix(qs_env, &
1222 calculate_forces=calculate_forces, &
1223 just_energy=just_energy)
1225 ELSEIF (dft_control%qs_control%xtb)
THEN
1226 CALL build_xtb_ks_matrix(qs_env, &
1227 calculate_forces=calculate_forces, &
1228 just_energy=just_energy)
1232 calculate_forces=calculate_forces, &
1233 just_energy=just_energy, &
1234 print_active=print_active)
1237 CALL timestop(handle)
1239 END SUBROUTINE rebuild_ks_matrix
1251 TYPE(qs_environment_type),
POINTER :: qs_env
1252 LOGICAL,
INTENT(in) :: is_complex
1254 CHARACTER(LEN=default_string_length) :: headline
1255 INTEGER :: ic, ispin, nimages, nspins
1256 LOGICAL :: do_kpoints
1257 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_s_kp, matrixkp_im_ks, matrixkp_ks
1258 TYPE(dbcsr_type),
POINTER :: refmatrix
1259 TYPE(dft_control_type),
POINTER :: dft_control
1260 TYPE(kpoint_type),
POINTER :: kpoints
1261 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1263 TYPE(qs_ks_env_type),
POINTER :: ks_env
1265 NULLIFY (dft_control, ks_env, matrix_s_kp, sab_orb, matrixkp_ks, refmatrix, matrixkp_im_ks, kpoints)
1267 CALL get_qs_env(qs_env, &
1268 dft_control=dft_control, &
1269 matrix_s_kp=matrix_s_kp, &
1272 do_kpoints=do_kpoints, &
1273 matrix_ks_kp=matrixkp_ks, &
1274 matrix_ks_im_kp=matrixkp_im_ks)
1276 IF (do_kpoints)
THEN
1277 CALL get_kpoint_info(kpoints, sab_nl=sab_orb)
1279 CALL get_qs_env(qs_env, sab_orb=sab_orb)
1282 nspins = dft_control%nspins
1283 nimages = dft_control%nimages
1285 IF (.NOT.
ASSOCIATED(matrixkp_ks))
THEN
1286 CALL dbcsr_allocate_matrix_set(matrixkp_ks, nspins, nimages)
1287 refmatrix => matrix_s_kp(1, 1)%matrix
1288 DO ispin = 1, nspins
1290 IF (nspins > 1)
THEN
1291 IF (ispin == 1)
THEN
1292 headline =
"KOHN-SHAM MATRIX FOR ALPHA SPIN"
1294 headline =
"KOHN-SHAM MATRIX FOR BETA SPIN"
1297 headline =
"KOHN-SHAM MATRIX"
1299 ALLOCATE (matrixkp_ks(ispin, ic)%matrix)
1300 CALL dbcsr_create(matrix=matrixkp_ks(ispin, ic)%matrix, template=refmatrix, &
1301 name=trim(headline), matrix_type=dbcsr_type_symmetric)
1302 CALL cp_dbcsr_alloc_block_from_nbl(matrixkp_ks(ispin, ic)%matrix, sab_orb)
1303 CALL dbcsr_set(matrixkp_ks(ispin, ic)%matrix, 0.0_dp)
1306 CALL set_ks_env(ks_env, matrix_ks_kp=matrixkp_ks)
1309 IF (is_complex)
THEN
1310 IF (.NOT.
ASSOCIATED(matrixkp_im_ks))
THEN
1311 cpassert(nspins .EQ.
SIZE(matrixkp_ks, 1))
1312 cpassert(nimages .EQ.
SIZE(matrixkp_ks, 2))
1313 CALL dbcsr_allocate_matrix_set(matrixkp_im_ks, nspins, nimages)
1314 DO ispin = 1, nspins
1316 IF (nspins > 1)
THEN
1317 IF (ispin == 1)
THEN
1318 headline =
"IMAGINARY KOHN-SHAM MATRIX FOR ALPHA SPIN"
1320 headline =
"IMAGINARY KOHN-SHAM MATRIX FOR BETA SPIN"
1323 headline =
"IMAGINARY KOHN-SHAM MATRIX"
1325 ALLOCATE (matrixkp_im_ks(ispin, ic)%matrix)
1326 refmatrix => matrixkp_ks(ispin, ic)%matrix
1327 CALL dbcsr_create(matrix=matrixkp_im_ks(ispin, ic)%matrix, template=refmatrix, &
1328 name=trim(headline), matrix_type=dbcsr_type_antisymmetric)
1329 CALL cp_dbcsr_alloc_block_from_nbl(matrixkp_im_ks(ispin, ic)%matrix, sab_orb)
1330 CALL dbcsr_set(matrixkp_im_ks(ispin, ic)%matrix, 0.0_dp)
1333 CALL set_ks_env(ks_env, matrix_ks_im_kp=matrixkp_im_ks)
Contains ADMM methods which only require the density matrix.
subroutine, public admm_dm_merge_ks_matrix(qs_env)
Entry methods: Merges auxiliary Kohn-Sham matrix into primary one.
subroutine, public admm_dm_calc_rho_aux(qs_env)
Entry methods: Calculates auxiliary density matrix from primary one.
Contains ADMM methods which require molecular orbitals.
subroutine, public admm_mo_calc_rho_aux_kp(qs_env)
...
subroutine, public admm_mo_merge_ks_matrix(qs_env)
...
subroutine, public admm_update_ks_atom(qs_env, calculate_forces)
Adds the GAPW exchange contribution to the aux_fit ks matrices.
subroutine, public calc_admm_ovlp_forces_kp(qs_env)
Calculate the forces due to the AUX/ORB basis overlap in ADMM, in the KP case.
subroutine, public admm_mo_calc_rho_aux(qs_env)
...
subroutine, public calc_admm_ovlp_forces(qs_env)
Calculate the forces due to the AUX/ORB basis overlap in ADMM.
subroutine, public calc_admm_mo_derivatives(qs_env, mo_derivs)
Calculate the derivative of the AUX_FIT mo, based on the ORB mo_derivs.
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.
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_filter(matrix, eps)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_release(matrix)
...
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.
subroutine, public dbcsr_copy_columns_hack(matrix_b, matrix_a, ncol, source_start, target_start, para_env, blacs_env)
hack for dbcsr_copy_columns
Density Derived atomic point charges from a QM calculation (see Bloechl, J. Chem. Phys....
subroutine, public qs_ks_ddapc(qs_env, auxbas_pw_pool, rho_tot_gspace, v_hartree_gspace, v_spin_ddapc_rest_r, energy, calculate_forces, ks_matrix, just_energy)
Set of methods using DDAPC charges.
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Add the DFT+U contribution to the Hamiltonian matrix.
subroutine, public plus_u(qs_env, matrix_h, matrix_w)
Add the DFT+U contribution to the Hamiltonian matrix. Wrapper routine for all "+U" methods.
subroutine, public vh_1c_gg_integrals(qs_env, energy_hartree_1c, ecoul_1c, local_rho_set, para_env, tddft, local_rho_set_2nd, core_2nd)
Calculates one center GAPW Hartree energies and matrix elements Hartree potentials are input Takes po...
Utilities for hfx and admm methods.
subroutine, public hfx_ks_matrix(qs_env, matrix_ks, rho, energy, calculate_forces, just_energy, v_rspace_new, v_tau_rspace)
Add the hfx contributions to the Hamiltonian.
subroutine, public hfx_admm_init(qs_env, calculate_forces)
...
subroutine, public hfx_ks_matrix_kp(qs_env, matrix_ks, energy, calculate_forces)
Add the HFX K-point contribution to the real-space Hamiltonians.
Routines for a Kim-Gordon-like partitioning into molecular subunits.
subroutine, public kg_ekin_subset(qs_env, ks_matrix, ekin_mol, calc_force, do_kernel, pmat_ext)
Calculates the subsystem Hohenberg-Kohn kinetic energy and the forces.
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 v_int_ppl_energy(qs_env, lri_v_int, ecore_ppl_ri)
...
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
Collection of simple mathematical functions and subroutines.
logical function, public abnormal_value(a)
determines if a value is not normal (e.g. for Inf and Nan) based on IO to work also under optimizatio...
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
functions related to the poisson solver on regular grids
integer, parameter, public pw_poisson_implicit
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Routines for image charge calculation within QM/MM.
subroutine, public calculate_image_pot(v_hartree_rspace, rho_hartree_gspace, energy, qmmm_env, qs_env)
determines coefficients by solving image_matrix*coeff=-pot_const by Gaussian elimination or in an ite...
subroutine, public integrate_potential_devga_rspace(potential, coeff, forces, qmmm_env, qs_env)
calculates the image forces on the MM atoms
subroutine, public add_image_pot_to_hartree_pot(v_hartree, v_metal, qs_env)
Add potential of metal (image charge pot) to Hartree Potential.
Defines CDFT control structures.
container for information about total charges on the grids
Calculation of the energies concerning the core charge distribution.
Calculation of Overlap and Hamiltonian matrices in DFTB.
subroutine, public build_dftb_ks_matrix(qs_env, calculate_forces, just_energy)
...
Calculates the energy contribution and the mo_derivative of a static periodic electric field.
subroutine, public qs_efield_berry_phase(qs_env, just_energy, calculate_forces)
...
Calculates the energy contribution and the mo_derivative of a static electric field (nonperiodic)
subroutine, public qs_efield_local_operator(qs_env, just_energy, calculate_forces)
...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
subroutine, public prepare_gapw_den(qs_env, local_rho_set, do_rho0, kind_set_external, pw_env_sub)
...
Types needed for a for a Harris model calculation.
Harris method environment setup and handling.
subroutine, public harris_set_potentials(harris_env, vh_rspace, vxc_rspace)
...
Integrate single or product functions over a potential on a RS grid.
Set of routines to apply restraints to the KS hamiltonian.
subroutine, public qs_ks_s2_restraint(dft_control, qs_env, matrix_s, energy, calculate_forces, just_energy)
...
subroutine, public qs_ks_mulliken_restraint(energy, dft_control, just_energy, para_env, ks_matrix, matrix_s, rho, mulliken_order_p)
...
subroutine, public qs_ks_cdft_constraint(qs_env, auxbas_pw_pool, calculate_forces, cdft_control)
Apply a CDFT constraint.
routines that build the Kohn-Sham matrix contributions coming from local atomic densities
subroutine, public update_ks_atom(qs_env, ksmat, pmat, forces, tddft, rho_atom_external, kind_set_external, oce_external, sab_external, kscale, kintegral, kforce, fscale)
The correction to the KS matrix due to the GAPW local terms to the hartree and XC contributions is he...
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_build_kohn_sham_matrix(qs_env, calculate_forces, just_energy, print_active, ext_ks_matrix)
routine where the real calculations are made: the KS matrix is calculated
subroutine, public qs_ks_update_qs_env(qs_env, calculate_forces, just_energy, print_active)
updates the Kohn Sham matrix of the given qs_env (facility method)
subroutine, public qs_ks_allocate_basics(qs_env, is_complex)
Allocate ks_matrix if necessary, take current overlap matrix as template.
subroutine, public calc_rho_tot_gspace(rho_tot_gspace, qs_env, rho, skip_nuclear_density)
...
subroutine, public qmmm_calculate_energy(qs_env, rho, v_qmmm, qmmm_energy)
Computes the contribution to the total energy of the QM/MM electrostatic coupling.
subroutine, public qmmm_modify_hartree_pot(v_hartree, v_qmmm, scale)
Modify the hartree potential in order to include the QM/MM correction.
subroutine, public set_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, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, 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, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public print_densities(qs_env, rho)
...
subroutine, public get_embed_potential_energy(qs_env, rho, v_rspace_embed, dft_control, embed_corr, just_energy)
...
subroutine, public low_spin_roks(energy, qs_env, dft_control, do_hfx, just_energy, calculate_forces, auxbas_pw_pool)
do ROKS calculations yielding low spin states
subroutine, public sum_up_and_integrate(qs_env, ks_matrix, rho, my_rho, vppl_rspace, v_rspace_new, v_rspace_new_aux_fit, v_tau_rspace, v_tau_rspace_aux_fit, v_sic_rspace, v_spin_ddapc_rest_r, v_sccs_rspace, v_rspace_embed, cdft_control, calculate_forces)
Sum up all potentials defined on the grid and integrate.
subroutine, public print_detailed_energy(qs_env, dft_control, input, energy, mulliken_order_p)
Print detailed energies.
subroutine, public calculate_zmp_potential(qs_env, v_rspace_new, rho, exc)
Calculate the ZMP potential and energy as in Zhao, Morrison Parr PRA 50i, 2138 (1994) V_c^\lambda def...
subroutine, public calc_v_sic_rspace(v_sic_rspace, energy, qs_env, dft_control, rho, poisson_env, just_energy, calculate_forces, auxbas_pw_pool)
do sic calculations on the spin density
subroutine, public sic_explicit_orbitals(energy, qs_env, dft_control, poisson_env, just_energy, calculate_forces, auxbas_pw_pool)
do sic calculations on explicit orbitals
subroutine, public compute_matrix_vxc(qs_env, v_rspace, matrix_vxc)
compute matrix_vxc, defined via the potential created by qs_vxc_create ignores things like tau functi...
Definition and initialisation of the mo data type.
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
Define the neighbor list data types and the corresponding functionality.
subroutine, public integrate_vhg0_rspace(qs_env, v_rspace, para_env, calculate_forces, local_rho_set, local_rho_set_2nd, atener, kforce, my_pools, my_rs_descs)
...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
Self-consistent continuum solvation (SCCS) model implementation.
subroutine, public sccs(qs_env, rho_tot_gspace, v_hartree_gspace, v_sccs, h_stress)
Self-consistent continuum solvation (SCCS) model implementation.
routines that build the integrals of the Vxc potential calculated for the atomic density in the basis...
subroutine, public calculate_vxc_atom(qs_env, energy_only, exc1, gradient_atom_set, adiabatic_rescale_factor, kind_set_external, rho_atom_set_external, xc_section_external)
...
subroutine, public qs_vxc_create(ks_env, rho_struct, xc_section, vxc_rho, vxc_tau, exc, just_energy, edisp, dispersion_env, adiabatic_rescale_factor, pw_env_external)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
Utilities for rtp in combination with admm methods adapted routines from admm_method (author Manuel G...
subroutine, public rtp_admm_merge_ks_matrix(qs_env)
...
subroutine, public rtp_admm_calc_rho_aux(qs_env)
Compute the ADMM density matrix in case of rtp (complex MO's)
Calculation of the Fock matrix for SE methods.
subroutine, public build_se_fock_matrix(qs_env, calculate_forces, just_energy)
Construction of the Fock matrix for NDDO methods.
subroutine, public smeagol_shift_v_hartree(v_hartree_rspace, cell, hartreeleadsleft, hartreeleadsright, hartreeleadsbottom, vbias, zleft, zright, isexplicit_zright, isexplicit_bottom)
Align Hatree potential of semi-infinite leads to match bulk-transport calculation and apply external ...
subroutine, public calc_dipsurf_potential(qs_env, energy)
compute the surface dipole and the correction to the hartree potential
Calculation of KS matrix in xTB Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public build_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
...
stores some data used in wavefunction fitting
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
environment for the poisson solver
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Container for information about total charges on the grids.
Contains information on the Harris method.
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.