168#include "./base/base_uses.f90"
174 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_environment_types'
223 LOGICAL :: qmmm = .false., qmmm_periodic = .false.
224 LOGICAL :: mimic = .false.
225 LOGICAL :: requires_mo_derivs = .false.
226 LOGICAL :: requires_matrix_vxc = .false.
227 LOGICAL :: has_unit_metric = .false.
228 LOGICAL :: run_rtp = .false.
229 LOGICAL :: linres_run = .false.
230 LOGICAL :: calc_image_preconditioner = .false.
231 LOGICAL :: do_transport = .false.
232 LOGICAL :: single_point_run = .false.
233 LOGICAL :: given_embed_pot = .false.
234 LOGICAL :: energy_correction = .false.
235 LOGICAL :: harris_method = .false.
236 LOGICAL :: do_rixs = .false.
237 REAL(kind=
dp) :: sim_time = -1.0_dp
238 REAL(kind=
dp) :: start_time = -1.0_dp, target_time = -1.0_dp
239 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: image_matrix => null()
240 REAL(kind=
dp),
DIMENSION(:),
POINTER :: image_coeff => null()
241 INTEGER,
DIMENSION(:),
POINTER :: ipiv => null()
242 INTEGER :: sim_step = -1
248 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: mo_loc_history => null()
271 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: outer_scf_history => null()
272 INTEGER :: outer_scf_ihistory = -1
273 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: gradient_history => null(), &
274 variable_history => null()
275 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data => null()
288 LOGICAL :: excited_state = .false.
305 REAL(kind=
dp) :: broyden_adaptive_sigma = -1.0_dp
319 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eeq => null()
321 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rhs => null()
322 REAL(kind=
dp) :: total_zeff_corr = -1.0_dp, surface_dipole_moment = -1.0_dp
325 REAL(kind=
dp) :: vacuum_level_below = 0.0_dp, vacuum_level_above = 0.0_dp
327 REAL(kind=
dp) :: surface_dipole_ref_pos = 0.0_dp
328 LOGICAL :: surface_dipole_switch_off = .false.
329 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos_last_converged => null()
510 SUBROUTINE get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, &
511 dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, &
512 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
513 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, &
514 sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, &
515 matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, &
516 matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, &
517 matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, &
518 matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, &
519 rho_xc, pw_env, ewald_env, ewald_pw, active_space, &
520 mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, &
521 vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, &
522 ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, &
523 local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, &
524 molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, &
525 task_list, task_list_soft, &
526 rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, &
527 rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, &
528 do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, &
529 mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, &
530 neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, &
531 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, &
532 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, &
533 lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, &
534 rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, &
535 WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, &
536 s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, &
537 gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, &
538 eeq, rhs, do_rixs, tb_tblite)
542 POINTER :: atomic_kind_set
544 POINTER :: qs_kind_set
545 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, super_cell, cell_ref
546 LOGICAL,
OPTIONAL :: use_ref_cell
549 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos
551 OPTIONAL,
POINTER :: sab_orb, sab_all
552 LOGICAL,
OPTIONAL :: qmmm, qmmm_periodic, mimic
554 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
555 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo
557 POINTER :: particle_set
562 POINTER :: matrix_h, matrix_h_im, matrix_ks, &
563 matrix_ks_im, matrix_vxc
564 LOGICAL,
OPTIONAL :: run_rtp
566 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: matrix_h_kp, matrix_h_im_kp, &
567 matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, &
570 POINTER :: matrix_s, matrix_s_ri_aux, matrix_w, &
571 matrix_p_mp2, matrix_p_mp2_admm, &
573 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho, rho_xc
599 POINTER :: molecule_kind_set
601 POINTER :: molecule_set
607 POINTER :: rho_atom_set
608 TYPE(
task_list_type),
OPTIONAL,
POINTER :: task_list, task_list_soft
610 POINTER :: rho0_atom_set
612 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
614 POINTER :: rhoz_cneo_set
621 LOGICAL,
OPTIONAL :: do_kpoints, has_unit_metric, &
625 TYPE(
cp_fm_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mo_loc_history
626 INTEGER,
OPTIONAL :: nkind, natom, nelectron_total
627 INTEGER,
DIMENSION(2),
OPTIONAL :: nelectron_spin
629 INTEGER,
OPTIONAL :: neighbor_list_id
635 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: outer_scf_history
636 INTEGER,
INTENT(out),
OPTIONAL :: outer_scf_ihistory
637 TYPE(
hfx_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: x_data
640 OPTIONAL,
POINTER :: dftb_potential
646 TYPE(
admm_type),
OPTIONAL,
POINTER :: admm_env
655 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_external
657 TYPE(
mp2_type),
OPTIONAL,
POINTER :: mp2_env
662 OPTIONAL,
POINTER :: wanniercentres
665 LOGICAL,
OPTIONAL :: do_transport
668 LOGICAL,
OPTIONAL :: s_mstruct_changed, rho_changed, &
669 potential_changed, forces_up_to_date
673 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: gradient_history, variable_history
674 TYPE(
pw_r3d_rs_type),
OPTIONAL,
POINTER :: embed_pot, spin_embed_pot
676 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos_last_converged
677 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: eeq, rhs
678 LOGICAL,
OPTIONAL :: do_rixs
684 cpassert(
ASSOCIATED(qs_env%ks_env))
686 IF (
PRESENT(outer_scf_history)) outer_scf_history => qs_env%outer_scf_history
687 IF (
PRESENT(outer_scf_ihistory)) outer_scf_ihistory = qs_env%outer_scf_ihistory
688 IF (
PRESENT(gradient_history)) gradient_history => qs_env%gradient_history
689 IF (
PRESENT(variable_history)) variable_history => qs_env%variable_history
690 IF (
PRESENT(mp2_env)) mp2_env => qs_env%mp2_env
691 IF (
PRESENT(bs_env)) bs_env => qs_env%bs_env
692 IF (
PRESENT(kg_env)) kg_env => qs_env%kg_env
693 IF (
PRESENT(super_cell)) super_cell => qs_env%super_cell
694 IF (
PRESENT(qmmm)) qmmm = qs_env%qmmm
695 IF (
PRESENT(qmmm_periodic)) qmmm_periodic = qs_env%qmmm_periodic
696 IF (
PRESENT(mimic)) mimic = qs_env%mimic
697 IF (
PRESENT(mos)) mos => qs_env%mos
698 IF (
PRESENT(mos_last_converged)) mos_last_converged => qs_env%mos_last_converged
699 IF (
PRESENT(ewald_env)) ewald_env => qs_env%ewald_env
700 IF (
PRESENT(ewald_pw)) ewald_pw => qs_env%ewald_pw
701 IF (
PRESENT(mpools)) mpools => qs_env%mpools
702 IF (
PRESENT(scf_control)) scf_control => qs_env%scf_control
703 IF (
PRESENT(rel_control)) rel_control => qs_env%rel_control
705 IF (
PRESENT(rho_external)) rho_external => qs_env%rho_external
706 IF (
PRESENT(external_vxc)) external_vxc => qs_env%external_vxc
707 IF (
PRESENT(mask)) mask => qs_env%mask
708 IF (
PRESENT(qs_charges)) qs_charges => qs_env%qs_charges
709 IF (
PRESENT(ks_env)) ks_env => qs_env%ks_env
710 IF (
PRESENT(ks_qmmm_env)) ks_qmmm_env => qs_env%ks_qmmm_env
711 IF (
PRESENT(wf_history)) wf_history => qs_env%wf_history
712 IF (
PRESENT(scf_env)) scf_env => qs_env%scf_env
713 IF (
PRESENT(oce)) oce => qs_env%oce
714 IF (
PRESENT(requires_mo_derivs)) requires_mo_derivs = qs_env%requires_mo_derivs
715 IF (
PRESENT(has_unit_metric)) has_unit_metric = qs_env%has_unit_metric
716 IF (
PRESENT(mo_derivs)) mo_derivs => qs_env%mo_derivs
717 IF (
PRESENT(mo_loc_history)) mo_loc_history => qs_env%mo_loc_history
718 IF (
PRESENT(linres_control)) linres_control => qs_env%linres_control
719 IF (
PRESENT(se_taper)) se_taper => qs_env%se_taper
720 IF (
PRESENT(se_store_int_env)) se_store_int_env => qs_env%se_store_int_env
721 IF (
PRESENT(se_nddo_mpole)) se_nddo_mpole => qs_env%se_nddo_mpole
722 IF (
PRESENT(se_nonbond_env)) se_nonbond_env => qs_env%se_nonbond_env
723 IF (
PRESENT(lri_env)) lri_env => qs_env%lri_env
724 IF (
PRESENT(lri_density)) lri_density => qs_env%lri_density
725 IF (
PRESENT(harris_env)) harris_env => qs_env%harris_env
726 IF (
PRESENT(ec_env)) ec_env => qs_env%ec_env
727 IF (
PRESENT(exstate_env)) exstate_env => qs_env%exstate_env
728 IF (
PRESENT(dispersion_env)) dispersion_env => qs_env%dispersion_env
729 IF (
PRESENT(gcp_env)) gcp_env => qs_env%gcp_env
730 IF (
PRESENT(run_rtp)) run_rtp = qs_env%run_rtp
731 IF (
PRESENT(rtp)) rtp => qs_env%rtp
732 IF (
PRESENT(ls_scf_env)) ls_scf_env => qs_env%ls_scf_env
733 IF (
PRESENT(almo_scf_env)) almo_scf_env => qs_env%almo_scf_env
734 IF (
PRESENT(do_transport)) do_transport = qs_env%do_transport
735 IF (
PRESENT(transport_env)) transport_env => qs_env%transport_env
736 IF (
PRESENT(mscfg_env)) mscfg_env => qs_env%molecular_scf_guess_env
737 IF (
PRESENT(active_space)) active_space => qs_env%active_space
738 IF (
PRESENT(admm_env)) admm_env => qs_env%admm_env
739 IF (
PRESENT(do_rixs)) do_rixs = qs_env%do_rixs
742 IF (
PRESENT(embed_pot)) embed_pot => qs_env%embed_pot
743 IF (
PRESENT(spin_embed_pot)) spin_embed_pot => qs_env%spin_embed_pot
746 IF (
PRESENT(polar_env)) polar_env => qs_env%polar_env
749 IF (
PRESENT(eeq)) eeq => qs_env%eeq
752 IF (
PRESENT(rhs)) rhs => qs_env%rhs
754 IF (
PRESENT(local_rho_set))
THEN
755 local_rho_set => qs_env%local_rho_set
757 IF (
PRESENT(rho_atom_set))
THEN
758 CALL get_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
760 IF (
PRESENT(rho0_atom_set))
THEN
761 CALL get_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
763 IF (
PRESENT(rho0_mpole))
THEN
764 CALL get_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
766 IF (
PRESENT(rhoz_set))
THEN
769 IF (
PRESENT(rhoz_cneo_set))
THEN
770 CALL get_local_rho(qs_env%local_rho_set, rhoz_cneo_set=rhoz_cneo_set)
772 IF (
PRESENT(ecoul_1c))
THEN
775 IF (
PRESENT(rho0_s_rs))
THEN
777 IF (
ASSOCIATED(rho0_m))
THEN
778 rho0_s_rs => rho0_m%rho0_s_rs
781 IF (
PRESENT(rho0_s_gs))
THEN
783 IF (
ASSOCIATED(rho0_m))
THEN
784 rho0_s_gs => rho0_m%rho0_s_gs
787 IF (
PRESENT(rhoz_cneo_s_rs))
THEN
789 IF (
ASSOCIATED(rho0_m))
THEN
790 rhoz_cneo_s_rs => rho0_m%rhoz_cneo_s_rs
793 IF (
PRESENT(rhoz_cneo_s_gs))
THEN
795 IF (
ASSOCIATED(rho0_m))
THEN
796 rhoz_cneo_s_gs => rho0_m%rhoz_cneo_s_gs
800 IF (
PRESENT(xas_env)) xas_env => qs_env%xas_env
801 IF (
PRESENT(input)) input => qs_env%input
802 IF (
PRESENT(cp_ddapc_env)) cp_ddapc_env => qs_env%cp_ddapc_env
803 IF (
PRESENT(cp_ddapc_ewald)) cp_ddapc_ewald => qs_env%cp_ddapc_ewald
804 IF (
PRESENT(x_data)) x_data => qs_env%x_data
806 IF (
PRESENT(dftb_potential)) dftb_potential => qs_env%dftb_potential
807 IF (
PRESENT(efield)) efield => qs_env%efield
808 IF (
PRESENT(wanniercentres)) wanniercentres => qs_env%WannierCentres
811 v_hartree_rspace=v_hartree_rspace, &
812 s_mstruct_changed=s_mstruct_changed, &
813 rho_changed=rho_changed, &
814 potential_changed=potential_changed, &
815 forces_up_to_date=forces_up_to_date, &
817 matrix_h_im=matrix_h_im, &
818 matrix_ks=matrix_ks, &
819 matrix_ks_im=matrix_ks_im, &
820 matrix_vxc=matrix_vxc, &
823 matrix_s_ri_aux=matrix_s_ri_aux, &
824 matrix_ks_im_kp=matrix_ks_im_kp, &
826 matrix_p_mp2=matrix_p_mp2, &
827 matrix_p_mp2_admm=matrix_p_mp2_admm, &
828 matrix_vhxc=matrix_vhxc, &
829 matrix_h_kp=matrix_h_kp, &
830 matrix_h_im_kp=matrix_h_im_kp, &
831 matrix_ks_kp=matrix_ks_kp, &
832 matrix_vxc_kp=matrix_vxc_kp, &
833 kinetic_kp=kinetic_kp, &
834 matrix_s_kp=matrix_s_kp, &
835 matrix_w_kp=matrix_w_kp, &
836 matrix_s_ri_aux_kp=matrix_s_ri_aux_kp, &
839 xcint_weights=xcint_weights, &
842 rho_nlcc_g=rho_nlcc_g, &
845 neighbor_list_id=neighbor_list_id, &
861 sab_xtb_pp=sab_xtb_pp, &
862 sab_xtb_nonbond=sab_xtb_nonbond, &
865 sab_kp_nosym=sab_kp_nosym, &
867 task_list=task_list, &
868 task_list_soft=task_list_soft, &
870 do_kpoints=do_kpoints, &
871 local_molecules=local_molecules, &
872 local_particles=local_particles, &
878 use_ref_cell=use_ref_cell, &
881 qs_kind_set=qs_kind_set, &
883 cp_subsys=cp_subsys, &
884 atomic_kind_set=atomic_kind_set, &
885 particle_set=particle_set, &
886 molecule_kind_set=molecule_kind_set, &
887 molecule_set=molecule_set, &
890 dft_control=dft_control, &
891 dbcsr_dist=dbcsr_dist, &
892 distribution_2d=distribution_2d, &
895 blacs_env=blacs_env, &
896 nelectron_total=nelectron_total, &
897 nelectron_spin=nelectron_spin)
899 IF (
PRESENT(tb_tblite)) tb_tblite => qs_env%tb_tblite
911 SUBROUTINE init_qs_env(qs_env, globenv)
916 NULLIFY (qs_env%ls_scf_env)
917 NULLIFY (qs_env%almo_scf_env)
918 NULLIFY (qs_env%transport_env)
919 NULLIFY (qs_env%image_matrix)
920 NULLIFY (qs_env%ipiv)
921 NULLIFY (qs_env%image_coeff)
922 NULLIFY (qs_env%super_cell)
924 NULLIFY (qs_env%mos_last_converged)
925 NULLIFY (qs_env%mpools)
926 NULLIFY (qs_env%ewald_env)
927 NULLIFY (qs_env%ewald_pw)
928 NULLIFY (qs_env%scf_control)
929 NULLIFY (qs_env%rel_control)
930 NULLIFY (qs_env%qs_charges)
932 NULLIFY (qs_env%rho_external)
933 NULLIFY (qs_env%external_vxc)
934 NULLIFY (qs_env%mask)
936 NULLIFY (qs_env%embed_pot)
937 NULLIFY (qs_env%spin_embed_pot)
940 NULLIFY (qs_env%polar_env)
942 NULLIFY (qs_env%ks_env)
943 NULLIFY (qs_env%ks_qmmm_env)
944 NULLIFY (qs_env%wf_history)
945 NULLIFY (qs_env%scf_env)
947 NULLIFY (qs_env%local_rho_set)
948 NULLIFY (qs_env%hartree_local)
949 NULLIFY (qs_env%input)
950 NULLIFY (qs_env%linres_control)
951 NULLIFY (qs_env%xas_env)
952 NULLIFY (qs_env%cp_ddapc_env)
953 NULLIFY (qs_env%cp_ddapc_ewald)
954 NULLIFY (qs_env%outer_scf_history)
955 NULLIFY (qs_env%gradient_history)
956 NULLIFY (qs_env%variable_history)
957 NULLIFY (qs_env%x_data)
958 NULLIFY (qs_env%et_coupling)
959 NULLIFY (qs_env%dftb_potential)
960 NULLIFY (qs_env%active_space)
962 NULLIFY (qs_env%se_taper)
963 NULLIFY (qs_env%se_store_int_env)
964 NULLIFY (qs_env%se_nddo_mpole)
965 NULLIFY (qs_env%se_nonbond_env)
966 NULLIFY (qs_env%admm_env)
967 NULLIFY (qs_env%efield)
968 NULLIFY (qs_env%lri_env)
969 NULLIFY (qs_env%harris_env)
970 NULLIFY (qs_env%ec_env)
971 NULLIFY (qs_env%exstate_env)
972 NULLIFY (qs_env%lri_density)
973 NULLIFY (qs_env%gcp_env)
975 NULLIFY (qs_env%mp2_env)
976 NULLIFY (qs_env%bs_env)
977 NULLIFY (qs_env%kg_env)
978 NULLIFY (qs_env%WannierCentres)
980 qs_env%outer_scf_ihistory = 0
981 qs_env%broyden_adaptive_sigma = -1.0_dp
985 qs_env%run_rtp = .false.
986 qs_env%linres_run = .false.
987 qs_env%single_point_run = .false.
988 qs_env%qmmm = .false.
989 qs_env%qmmm_periodic = .false.
990 qs_env%mimic = .false.
991 qs_env%requires_mo_derivs = .false.
992 qs_env%requires_matrix_vxc = .false.
993 qs_env%has_unit_metric = .false.
994 qs_env%calc_image_preconditioner = .true.
995 qs_env%do_transport = .false.
996 qs_env%given_embed_pot = .false.
997 qs_env%do_rixs = .false.
998 IF (
PRESENT(globenv))
THEN
999 qs_env%target_time = globenv%cp2k_target_time
1000 qs_env%start_time = globenv%cp2k_start_time
1001 qs_env%single_point_run = (globenv%run_type_id ==
energy_run .OR. &
1004 qs_env%target_time = 0.0_dp
1005 qs_env%start_time = 0.0_dp
1008 qs_env%sim_time = 0._dp
1011 qs_env%total_zeff_corr = 0.0_dp
1012 qs_env%surface_dipole_moment = 0.0_dp
1013 qs_env%vacuum_level_below = 0.0_dp
1014 qs_env%vacuum_level_above = 0.0_dp
1015 qs_env%surface_dipole_ref_pos = 0.0_dp
1016 qs_env%surface_dipole_switch_off = .false.
1019 NULLIFY (qs_env%mo_derivs)
1020 NULLIFY (qs_env%mo_loc_history)
1022 IF (.NOT.
ASSOCIATED(qs_env%molecular_scf_guess_env))
ALLOCATE (qs_env%molecular_scf_guess_env)
1024 NULLIFY (qs_env%tb_tblite)
1025 NULLIFY (qs_env%gauxc_cache)
1027 END SUBROUTINE init_qs_env
1113 mos, qmmm, qmmm_periodic, mimic, &
1114 ewald_env, ewald_pw, mpools, &
1115 rho_external, external_vxc, mask, &
1116 scf_control, rel_control, qs_charges, ks_env, &
1117 ks_qmmm_env, wf_history, scf_env, active_space, &
1118 input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, &
1119 rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, &
1120 mo_loc_history, efield, rhoz_cneo_set, &
1121 linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, &
1122 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, &
1123 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, &
1124 do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, &
1125 harris_env, gcp_env, mp2_env, bs_env, kg_env, force, &
1126 kpoints, WannierCentres, almo_scf_env, gradient_history, variable_history, embed_pot, &
1127 spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
1130 TYPE(
cell_type),
OPTIONAL,
POINTER :: super_cell
1131 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos
1132 LOGICAL,
OPTIONAL :: qmmm, qmmm_periodic, mimic
1136 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_external
1149 POINTER :: rho_atom_set
1151 POINTER :: rho0_atom_set
1153 LOGICAL,
OPTIONAL :: run_rtp
1155 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
1156 REAL(
dp),
OPTIONAL :: rhoz_tot
1159 LOGICAL,
OPTIONAL :: has_unit_metric, requires_mo_derivs
1161 POINTER :: mo_derivs
1162 TYPE(
cp_fm_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mo_loc_history
1165 POINTER :: rhoz_cneo_set
1170 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: outer_scf_history
1171 INTEGER,
INTENT(IN),
OPTIONAL :: outer_scf_ihistory
1172 TYPE(
hfx_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: x_data
1175 OPTIONAL,
POINTER :: dftb_potential
1180 TYPE(
admm_type),
OPTIONAL,
POINTER :: admm_env
1182 LOGICAL,
OPTIONAL :: do_transport
1189 TYPE(
harris_type),
OPTIONAL,
POINTER :: harris_env
1191 TYPE(
mp2_type),
OPTIONAL,
POINTER :: mp2_env
1199 OPTIONAL,
POINTER :: wanniercentres
1201 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: gradient_history, variable_history
1202 TYPE(
pw_r3d_rs_type),
OPTIONAL,
POINTER :: embed_pot, spin_embed_pot
1204 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos_last_converged
1205 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: eeq, rhs
1206 LOGICAL,
OPTIONAL :: do_rixs
1211 IF (
PRESENT(mp2_env)) qs_env%mp2_env => mp2_env
1212 IF (
PRESENT(bs_env)) qs_env%bs_env => bs_env
1213 IF (
PRESENT(kg_env)) qs_env%kg_env => kg_env
1214 IF (
PRESENT(super_cell))
THEN
1217 qs_env%super_cell => super_cell
1220 IF (
PRESENT(qmmm)) qs_env%qmmm = qmmm
1221 IF (
PRESENT(qmmm_periodic)) qs_env%qmmm_periodic = qmmm_periodic
1222 IF (
PRESENT(mimic)) qs_env%mimic = mimic
1223 IF (
PRESENT(mos)) qs_env%mos => mos
1224 IF (
PRESENT(mos_last_converged)) qs_env%mos_last_converged => mos_last_converged
1225 IF (
PRESENT(ls_scf_env)) qs_env%ls_scf_env => ls_scf_env
1226 IF (
PRESENT(almo_scf_env)) qs_env%almo_scf_env => almo_scf_env
1227 IF (
PRESENT(do_transport)) qs_env%do_transport = do_transport
1228 IF (
PRESENT(transport_env)) qs_env%transport_env => transport_env
1231 IF (
PRESENT(oce)) qs_env%oce => oce
1232 IF (
PRESENT(outer_scf_history)) qs_env%outer_scf_history => outer_scf_history
1233 IF (
PRESENT(gradient_history)) qs_env%gradient_history => gradient_history
1234 IF (
PRESENT(variable_history)) qs_env%variable_history => variable_history
1235 IF (
PRESENT(outer_scf_ihistory)) qs_env%outer_scf_ihistory = outer_scf_ihistory
1236 IF (
PRESENT(requires_mo_derivs)) qs_env%requires_mo_derivs = requires_mo_derivs
1237 IF (
PRESENT(has_unit_metric)) qs_env%has_unit_metric = has_unit_metric
1238 IF (
PRESENT(mo_derivs)) qs_env%mo_derivs => mo_derivs
1239 IF (
PRESENT(mo_loc_history)) qs_env%mo_loc_history => mo_loc_history
1240 IF (
PRESENT(run_rtp)) qs_env%run_rtp = run_rtp
1241 IF (
PRESENT(rtp)) qs_env%rtp => rtp
1242 IF (
PRESENT(efield)) qs_env%efield => efield
1243 IF (
PRESENT(active_space)) qs_env%active_space => active_space
1244 IF (
PRESENT(do_rixs)) do_rixs = qs_env%do_rixs
1246 IF (
PRESENT(ewald_env))
THEN
1247 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1248 IF (.NOT.
ASSOCIATED(qs_env%ewald_env, ewald_env))
THEN
1250 DEALLOCATE (qs_env%ewald_env)
1253 qs_env%ewald_env => ewald_env
1255 IF (
PRESENT(ewald_pw))
THEN
1256 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1257 IF (.NOT.
ASSOCIATED(ewald_pw, qs_env%ewald_pw))
THEN
1259 DEALLOCATE (qs_env%ewald_pw)
1262 qs_env%ewald_pw => ewald_pw
1264 IF (
PRESENT(scf_control))
THEN
1265 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1266 IF (.NOT.
ASSOCIATED(qs_env%scf_control, scf_control))
THEN
1268 DEALLOCATE (qs_env%scf_control)
1271 qs_env%scf_control => scf_control
1273 IF (
PRESENT(rel_control))
THEN
1274 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1275 IF (.NOT.
ASSOCIATED(qs_env%rel_control, rel_control))
THEN
1277 DEALLOCATE (qs_env%rel_control)
1280 qs_env%rel_control => rel_control
1282 IF (
PRESENT(linres_control))
THEN
1283 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1284 IF (.NOT.
ASSOCIATED(qs_env%linres_control, linres_control))
THEN
1286 DEALLOCATE (qs_env%linres_control)
1289 qs_env%linres_control => linres_control
1292 IF (
PRESENT(rho_external))
THEN
1293 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1294 IF (.NOT.
ASSOCIATED(qs_env%rho_external, rho_external))
THEN
1296 DEALLOCATE (qs_env%rho_external)
1299 qs_env%rho_external => rho_external
1301 IF (
PRESENT(external_vxc)) qs_env%external_vxc => external_vxc
1302 IF (
PRESENT(mask)) qs_env%mask => mask
1304 IF (
PRESENT(embed_pot)) qs_env%embed_pot => embed_pot
1305 IF (
PRESENT(spin_embed_pot)) qs_env%spin_embed_pot => spin_embed_pot
1308 IF (
PRESENT(polar_env)) qs_env%polar_env => polar_env
1310 IF (
PRESENT(qs_charges))
THEN
1311 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1312 IF (.NOT.
ASSOCIATED(qs_env%qs_charges, qs_charges))
THEN
1314 DEALLOCATE (qs_env%qs_charges)
1317 qs_env%qs_charges => qs_charges
1319 IF (
PRESENT(ks_qmmm_env))
THEN
1320 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1321 IF (.NOT.
ASSOCIATED(qs_env%ks_qmmm_env, ks_qmmm_env))
THEN
1323 DEALLOCATE (qs_env%ks_qmmm_env)
1326 qs_env%ks_qmmm_env => ks_qmmm_env
1328 IF (
PRESENT(ks_env))
THEN
1329 IF (
ASSOCIATED(qs_env%ks_env))
THEN
1330 IF (.NOT.
ASSOCIATED(qs_env%ks_env, ks_env))
THEN
1332 DEALLOCATE (qs_env%ks_env)
1335 qs_env%ks_env => ks_env
1337 IF (
PRESENT(wf_history))
THEN
1340 qs_env%wf_history => wf_history
1342 IF (
PRESENT(scf_env))
THEN
1343 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1344 IF (.NOT.
ASSOCIATED(qs_env%scf_env, scf_env))
THEN
1346 DEALLOCATE (qs_env%scf_env)
1349 qs_env%scf_env => scf_env
1351 IF (
PRESENT(xas_env))
THEN
1352 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1353 IF (.NOT.
ASSOCIATED(qs_env%xas_env, xas_env))
THEN
1355 DEALLOCATE (qs_env%xas_env)
1358 qs_env%xas_env => xas_env
1360 IF (
PRESENT(mpools))
THEN
1363 qs_env%mpools => mpools
1365 IF (
PRESENT(rho_atom_set))
THEN
1366 CALL set_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
1368 IF (
PRESENT(rho0_atom_set))
THEN
1369 CALL set_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
1371 IF (
PRESENT(rho0_mpole))
THEN
1372 CALL set_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
1374 IF (
PRESENT(rhoz_set))
THEN
1377 IF (
PRESENT(rhoz_cneo_set))
THEN
1378 CALL set_local_rho(qs_env%local_rho_set, rhoz_cneo_set=rhoz_cneo_set)
1380 IF (
PRESENT(rhoz_tot)) qs_env%local_rho_set%rhoz_tot = rhoz_tot
1381 IF (
PRESENT(ecoul_1c))
THEN
1384 IF (
PRESENT(input))
THEN
1387 qs_env%input => input
1389 IF (
PRESENT(cp_ddapc_env))
THEN
1390 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1391 IF (.NOT.
ASSOCIATED(qs_env%cp_ddapc_env, cp_ddapc_env))
THEN
1393 DEALLOCATE (qs_env%cp_ddapc_env)
1396 qs_env%cp_ddapc_env => cp_ddapc_env
1398 IF (
PRESENT(cp_ddapc_ewald))
THEN
1399 qs_env%cp_ddapc_ewald => cp_ddapc_ewald
1401 IF (
PRESENT(x_data)) qs_env%x_data => x_data
1403 IF (
PRESENT(dftb_potential)) qs_env%dftb_potential => dftb_potential
1404 IF (
PRESENT(se_taper))
THEN
1406 qs_env%se_taper => se_taper
1408 IF (
PRESENT(se_store_int_env))
THEN
1410 qs_env%se_store_int_env => se_store_int_env
1412 IF (
PRESENT(se_nddo_mpole))
THEN
1414 qs_env%se_nddo_mpole => se_nddo_mpole
1416 IF (
PRESENT(se_nonbond_env))
THEN
1417 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1418 IF (.NOT.
ASSOCIATED(qs_env%se_nonbond_env, se_nonbond_env))
THEN
1420 DEALLOCATE (qs_env%se_nonbond_env)
1423 qs_env%se_nonbond_env => se_nonbond_env
1425 IF (
PRESENT(admm_env)) qs_env%admm_env => admm_env
1426 IF (
PRESENT(lri_env)) qs_env%lri_env => lri_env
1427 IF (
PRESENT(lri_density)) qs_env%lri_density => lri_density
1428 IF (
PRESENT(harris_env)) qs_env%harris_env => harris_env
1429 IF (
PRESENT(ec_env)) qs_env%ec_env => ec_env
1430 IF (
PRESENT(exstate_env)) qs_env%exstate_env => exstate_env
1431 IF (
PRESENT(dispersion_env)) qs_env%dispersion_env => dispersion_env
1432 IF (
PRESENT(gcp_env)) qs_env%gcp_env => gcp_env
1433 IF (
PRESENT(wanniercentres)) qs_env%WannierCentres => wanniercentres
1434 IF (
PRESENT(kpoints))
CALL set_ks_env(qs_env%ks_env, kpoints=kpoints)
1437 IF (
PRESENT(eeq)) qs_env%eeq => eeq
1440 IF (
PRESENT(rhs)) qs_env%rhs => rhs
1442 IF (
PRESENT(force))
THEN
1447 IF (
PRESENT(tb_tblite)) qs_env%tb_tblite => tb_tblite
1463 CALL init_qs_env(qs_env, globenv=globenv)
1480 IF (
ASSOCIATED(qs_env%mos))
THEN
1481 DO i = 1,
SIZE(qs_env%mos)
1484 DEALLOCATE (qs_env%mos)
1486 IF (
ASSOCIATED(qs_env%mos_last_converged))
THEN
1487 DO i = 1,
SIZE(qs_env%mos_last_converged)
1490 DEALLOCATE (qs_env%mos_last_converged)
1493 IF (
ASSOCIATED(qs_env%mo_derivs))
THEN
1494 DO i = 1,
SIZE(qs_env%mo_derivs)
1497 DEALLOCATE (qs_env%mo_derivs)
1502 IF (
ASSOCIATED(qs_env%rtp))
THEN
1504 DEALLOCATE (qs_env%rtp)
1506 IF (
ASSOCIATED(qs_env%outer_scf_history))
THEN
1507 DEALLOCATE (qs_env%outer_scf_history)
1508 qs_env%outer_scf_ihistory = 0
1510 IF (
ASSOCIATED(qs_env%gradient_history))
THEN
1511 DEALLOCATE (qs_env%gradient_history)
1513 IF (
ASSOCIATED(qs_env%variable_history))
THEN
1514 DEALLOCATE (qs_env%variable_history)
1517 IF (
ASSOCIATED(qs_env%local_rho_set))
THEN
1520 IF (
ASSOCIATED(qs_env%hartree_local))
THEN
1523 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1525 DEALLOCATE (qs_env%scf_control)
1527 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1529 DEALLOCATE (qs_env%rel_control)
1532 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1534 DEALLOCATE (qs_env%linres_control)
1537 IF (
ASSOCIATED(qs_env%almo_scf_env))
THEN
1541 IF (
ASSOCIATED(qs_env%ls_scf_env))
THEN
1544 IF (
ASSOCIATED(qs_env%molecular_scf_guess_env))
THEN
1546 DEALLOCATE (qs_env%molecular_scf_guess_env)
1549 IF (
ASSOCIATED(qs_env%transport_env))
THEN
1554 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1556 DEALLOCATE (qs_env%xas_env)
1558 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1560 DEALLOCATE (qs_env%ewald_env)
1562 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1564 DEALLOCATE (qs_env%ewald_pw)
1566 IF (
ASSOCIATED(qs_env%image_matrix))
THEN
1567 DEALLOCATE (qs_env%image_matrix)
1569 IF (
ASSOCIATED(qs_env%ipiv))
THEN
1570 DEALLOCATE (qs_env%ipiv)
1572 IF (
ASSOCIATED(qs_env%image_coeff))
THEN
1573 DEALLOCATE (qs_env%image_coeff)
1576 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1578 DEALLOCATE (qs_env%rho_external)
1580 IF (
ASSOCIATED(qs_env%external_vxc))
THEN
1581 CALL qs_env%external_vxc%release()
1582 DEALLOCATE (qs_env%external_vxc)
1584 IF (
ASSOCIATED(qs_env%mask))
THEN
1585 CALL qs_env%mask%release()
1586 DEALLOCATE (qs_env%mask)
1588 IF (
ASSOCIATED(qs_env%active_space))
THEN
1592 IF (qs_env%given_embed_pot)
THEN
1593 CALL qs_env%embed_pot%release()
1594 DEALLOCATE (qs_env%embed_pot)
1595 IF (
ASSOCIATED(qs_env%spin_embed_pot))
THEN
1596 CALL qs_env%spin_embed_pot%release()
1597 DEALLOCATE (qs_env%spin_embed_pot)
1604 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1606 DEALLOCATE (qs_env%qs_charges)
1608 IF (
ASSOCIATED(qs_env%ks_env))
THEN
1610 DEALLOCATE (qs_env%ks_env)
1612 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1614 DEALLOCATE (qs_env%ks_qmmm_env)
1617 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1619 DEALLOCATE (qs_env%scf_env)
1623 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1625 DEALLOCATE (qs_env%cp_ddapc_env)
1629 IF (
ASSOCIATED(qs_env%x_data))
THEN
1632 IF (
ASSOCIATED(qs_env%et_coupling))
THEN
1635 IF (
ASSOCIATED(qs_env%dftb_potential))
THEN
1638 IF (
ASSOCIATED(qs_env%se_taper))
THEN
1641 IF (
ASSOCIATED(qs_env%se_store_int_env))
THEN
1644 IF (
ASSOCIATED(qs_env%se_nddo_mpole))
THEN
1647 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1649 DEALLOCATE (qs_env%se_nonbond_env)
1651 IF (
ASSOCIATED(qs_env%admm_env))
THEN
1654 IF (
ASSOCIATED(qs_env%lri_env))
THEN
1656 DEALLOCATE (qs_env%lri_env)
1658 IF (
ASSOCIATED(qs_env%lri_density))
THEN
1660 DEALLOCATE (qs_env%lri_density)
1662 IF (
ASSOCIATED(qs_env%harris_env))
THEN
1665 IF (
ASSOCIATED(qs_env%ec_env))
THEN
1668 IF (
ASSOCIATED(qs_env%exstate_env))
THEN
1671 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
1673 DEALLOCATE (qs_env%mp2_env)
1674 NULLIFY (qs_env%mp2_env)
1676 IF (
ASSOCIATED(qs_env%bs_env))
THEN
1679 IF (
ASSOCIATED(qs_env%kg_env))
THEN
1686 IF (
ASSOCIATED(qs_env%gcp_env))
THEN
1690 IF (
ASSOCIATED(qs_env%WannierCentres))
THEN
1691 DO i = 1,
SIZE(qs_env%WannierCentres)
1692 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1693 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1695 DEALLOCATE (qs_env%WannierCentres)
1698 IF (
ASSOCIATED(qs_env%eeq))
DEALLOCATE (qs_env%eeq)
1700 IF (
ASSOCIATED(qs_env%rhs))
DEALLOCATE (qs_env%rhs)
1703 IF (
ASSOCIATED(qs_env%tb_tblite))
THEN
1707 IF (
ASSOCIATED(qs_env%gauxc_cache))
THEN
1709 DEALLOCATE (qs_env%gauxc_cache)
1725 IF (
ASSOCIATED(qs_env%mos_last_converged))
THEN
1726 DO i = 1,
SIZE(qs_env%mos_last_converged)
1729 DEALLOCATE (qs_env%mos_last_converged)
1732 IF (
ASSOCIATED(qs_env%mo_derivs))
THEN
1733 DO i = 1,
SIZE(qs_env%mo_derivs)
1736 DEALLOCATE (qs_env%mo_derivs)
1741 IF (
ASSOCIATED(qs_env%rtp))
THEN
1743 DEALLOCATE (qs_env%rtp)
1745 IF (
ASSOCIATED(qs_env%outer_scf_history))
THEN
1746 DEALLOCATE (qs_env%outer_scf_history)
1747 qs_env%outer_scf_ihistory = 0
1749 IF (
ASSOCIATED(qs_env%gradient_history))
THEN
1750 DEALLOCATE (qs_env%gradient_history)
1752 IF (
ASSOCIATED(qs_env%variable_history))
THEN
1753 DEALLOCATE (qs_env%variable_history)
1756 IF (
ASSOCIATED(qs_env%local_rho_set))
THEN
1759 IF (
ASSOCIATED(qs_env%hartree_local))
THEN
1762 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1764 DEALLOCATE (qs_env%scf_control)
1766 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1768 DEALLOCATE (qs_env%rel_control)
1771 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1773 DEALLOCATE (qs_env%linres_control)
1776 IF (
ASSOCIATED(qs_env%almo_scf_env))
THEN
1780 IF (
ASSOCIATED(qs_env%ls_scf_env))
THEN
1783 IF (
ASSOCIATED(qs_env%molecular_scf_guess_env))
THEN
1785 DEALLOCATE (qs_env%molecular_scf_guess_env)
1788 IF (
ASSOCIATED(qs_env%transport_env))
THEN
1793 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1795 DEALLOCATE (qs_env%xas_env)
1797 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1799 DEALLOCATE (qs_env%ewald_env)
1801 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1803 DEALLOCATE (qs_env%ewald_pw)
1805 IF (
ASSOCIATED(qs_env%image_matrix))
THEN
1806 DEALLOCATE (qs_env%image_matrix)
1808 IF (
ASSOCIATED(qs_env%ipiv))
THEN
1809 DEALLOCATE (qs_env%ipiv)
1811 IF (
ASSOCIATED(qs_env%image_coeff))
THEN
1812 DEALLOCATE (qs_env%image_coeff)
1815 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1817 DEALLOCATE (qs_env%rho_external)
1819 IF (
ASSOCIATED(qs_env%external_vxc))
THEN
1820 CALL qs_env%external_vxc%release()
1821 DEALLOCATE (qs_env%external_vxc)
1823 IF (
ASSOCIATED(qs_env%mask))
THEN
1824 CALL qs_env%mask%release()
1825 DEALLOCATE (qs_env%mask)
1827 IF (
ASSOCIATED(qs_env%active_space))
THEN
1831 IF (qs_env%given_embed_pot)
THEN
1832 CALL qs_env%embed_pot%release()
1833 DEALLOCATE (qs_env%embed_pot)
1834 IF (
ASSOCIATED(qs_env%spin_embed_pot))
THEN
1835 CALL qs_env%spin_embed_pot%release()
1836 DEALLOCATE (qs_env%spin_embed_pot)
1843 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1845 DEALLOCATE (qs_env%qs_charges)
1848 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1850 DEALLOCATE (qs_env%ks_qmmm_env)
1853 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1855 DEALLOCATE (qs_env%scf_env)
1857 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1859 DEALLOCATE (qs_env%cp_ddapc_env)
1863 IF (
ASSOCIATED(qs_env%x_data))
THEN
1866 IF (
ASSOCIATED(qs_env%et_coupling))
THEN
1869 IF (
ASSOCIATED(qs_env%dftb_potential))
THEN
1872 IF (
ASSOCIATED(qs_env%se_taper))
THEN
1875 IF (
ASSOCIATED(qs_env%se_store_int_env))
THEN
1878 IF (
ASSOCIATED(qs_env%se_nddo_mpole))
THEN
1881 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1883 DEALLOCATE (qs_env%se_nonbond_env)
1885 IF (
ASSOCIATED(qs_env%admm_env))
THEN
1888 IF (
ASSOCIATED(qs_env%lri_env))
THEN
1890 DEALLOCATE (qs_env%lri_env)
1892 IF (
ASSOCIATED(qs_env%lri_density))
THEN
1894 DEALLOCATE (qs_env%lri_density)
1896 IF (
ASSOCIATED(qs_env%harris_env))
THEN
1899 IF (
ASSOCIATED(qs_env%ec_env))
THEN
1902 IF (
ASSOCIATED(qs_env%exstate_env))
THEN
1905 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
1907 DEALLOCATE (qs_env%mp2_env)
1908 NULLIFY (qs_env%mp2_env)
1910 IF (
ASSOCIATED(qs_env%kg_env))
THEN
1917 IF (
ASSOCIATED(qs_env%gcp_env))
THEN
1921 IF (
ASSOCIATED(qs_env%WannierCentres))
THEN
1922 DO i = 1,
SIZE(qs_env%WannierCentres)
1923 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1924 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1926 DEALLOCATE (qs_env%WannierCentres)
1929 IF (
ASSOCIATED(qs_env%eeq))
DEALLOCATE (qs_env%eeq)
1931 IF (
ASSOCIATED(qs_env%rhs))
DEALLOCATE (qs_env%rhs)
1934 IF (
ASSOCIATED(qs_env%tb_tblite))
THEN
1938 IF (
ASSOCIATED(qs_env%gauxc_cache))
THEN
1940 DEALLOCATE (qs_env%gauxc_cache)
Types and set/get functions for auxiliary density matrix methods.
subroutine, public admm_env_release(admm_env)
releases the ADMM environment, cleans up all types
Types for all ALMO-based methods.
subroutine, public almo_scf_env_release(almo_scf_env)
release the almo scf envirnoment
Define the atomic kind types and their sub types.
Holds information on atomic properties.
Handles all functions related to the CELL.
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
subroutine, public cell_retain(cell)
retains the given cell (see doc/ReferenceCounting.html)
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release_p(matrix)
...
contains information regarding the decoupling/recoupling method of Bloechl
subroutine, public cp_ddapc_release(cp_ddapc_env)
...
subroutine, public cp_ddapc_ewald_release(cp_ddapc_ewald)
...
represent a full matrix distributed on many processors
set of type/routines to handle the storage of results in force_envs
types that represent a subsys, i.e. a part of the system
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
stores a mapping of 2D info (e.g. matrix) on a 2D processor distribution (i.e. blacs grid) where cpus...
Types needed for a linear scaling quickstep SCF run based on the density matrix.
subroutine, public ls_scf_release(ls_scf_env)
release the LS type.
Types needed for a for a Energy Correction.
subroutine, public ec_env_release(ec_env)
...
Definition and initialisation of the et_coupling data type.
subroutine, public et_coupling_release(et_coupling)
...
calculates the electron transfer coupling elements Wu, Van Voorhis, JCP 125, 164105 (2006)
subroutine, public ewald_env_release(ewald_env)
releases the given ewald_env (see doc/ReferenceCounting.html)
subroutine, public ewald_pw_release(ewald_pw)
releases the memory used by the ewald_pw
Types for excited states potential energies.
subroutine, public exstate_release(ex_env)
...
subroutine, public fist_nonbond_env_release(fist_nonbond_env)
releases the given fist_nonbond_env (see doc/ReferenceCounting.html)
Define type storing the global information of a run. Keep the amount of stored data small....
subroutine, public get_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public set_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public hartree_local_release(hartree_local)
...
subroutine, public hartree_local_create(hartree_local)
...
Types and set/get functions for HFX.
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
Types needed for a Kim-Gordon-like partitioning into molecular subunits.
subroutine, public kg_env_release(kg_env)
...
Defines the basic variable types.
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
subroutine, public lri_density_release(lri_density)
releases the given lri_density
subroutine, public lri_env_release(lri_env)
releases the given lri_env
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
Define the data structure for the molecule information.
Types needed for MP2 calculations.
subroutine, public mp2_env_release(mp2_env)
...
Types used to generate the molecular SCF guess.
subroutine, public molecular_scf_guess_env_destroy(env)
Destroyes both data and environment.
Define the data structure for the particle information.
subroutine, public bs_env_release(bs_env)
...
container for various plainwaves related things
The types needed for the calculation of active space Hamiltonians.
subroutine, public release_active_space_type(active_space_env)
Releases all quantities in the active space environment.
container for information about total charges on the grids
subroutine, public qs_charges_release(qs_charges)
releases the charges object (see cp2k/doc/ReferenceCounting.html)
Types used by CNEO-DFT (see J. Chem. Theory Comput. 2025, 21, 16, 7865–7877)
Definition of the DFTB parameter types.
subroutine, public qs_dftb_pairpot_release(pairpot)
...
Definition of disperson types for DFT calculations.
subroutine, public qs_dispersion_release(dispersion_env)
...
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 qs_env_release(qs_env)
releases the given qs_env (see doc/ReferenceCounting.html)
subroutine, public qs_env_part_release(qs_env)
releases part of the given qs_env in order to save memory
subroutine, public qs_env_create(qs_env, globenv)
allocates and intitializes a qs_env
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.
Definition of gCP types for DFT calculations.
subroutine, public qs_gcp_release(gcp_env)
...
Types needed for a for a Harris model calculation.
subroutine, public harris_env_release(harris_env)
...
Define the quickstep kind type and their sub types.
subroutine, public qs_ks_qmmm_release(ks_qmmm_env)
releases the ks_qmmm_env (see doc/ReferenceCounting.html)
subroutine, public set_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, vppl, xcint_weights, 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, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public qs_ks_release(ks_env)
releases the ks_env (see doc/ReferenceCounting.html)
subroutine, public qs_ks_part_release(ks_env)
releases part of the ks_env
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)
...
Type definitiona for linear response calculations.
subroutine, public polar_env_release(polar_env)
Deallocate the polar environment.
subroutine, public linres_control_release(linres_control)
...
subroutine, public local_rho_set_create(local_rho_set)
...
subroutine, public get_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set)
...
subroutine, public local_rho_set_release(local_rho_set)
...
subroutine, public set_local_rho(local_rho_set, rho_atom_set, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set)
...
wrapper for the pools of matrixes
subroutine, public mpools_release(mpools)
releases the given mpools
subroutine, public mpools_retain(mpools)
retains the given qs_matrix_pools_type
Definition and initialisation of the mo data type.
subroutine, public deallocate_mo_set(mo_set)
Deallocate a wavefunction data structure.
Define the neighbor list data types and the corresponding functionality.
subroutine, public deallocate_oce_set(oce_set)
Deallocate the matrix set of oce coefficients.
type for berry phase efield matrices. At the moment only used for cosmat and sinmat
subroutine, public efield_berry_release(efield)
...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_release(rho_struct)
releases a rho_struct by decreasing the reference count by one and deallocating if it reaches 0 (to b...
module that contains the definitions of the scf types
subroutine, public scf_env_release(scf_env)
releases an scf_env (see doc/ReferenceCounting.html)
types that represent a quickstep subsys
subroutine, public qs_subsys_set(subsys, cp_subsys, local_particles, local_molecules, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, nelectron_total, nelectron_spin)
...
interpolate the wavefunctions to speed up the convergence when doing MD
subroutine, public wfi_retain(wf_history)
retains a wf history (see doc/ReferenceCounting.html)
subroutine, public wfi_release(wf_history)
releases a wf_history of a wavefunction (see doc/ReferenceCounting.html)
parameters that control a relativistic calculation
subroutine, public rel_c_release(rel_control)
releases the given rel_control (see cp2k/doc/ReferenceCounting.html)
Types and set_get for real time propagation depending on runtype and diagonalization method different...
subroutine, public rt_prop_release(rtp)
...
parameters that control an scf iteration
subroutine, public scf_c_release(scf_control)
releases the given scf_control (see cp2k/doc/ReferenceCounting.html)
Definition of the semi empirical multipole integral expansions types.
subroutine, public nddo_mpole_release(nddo_mpole)
Deallocate NDDO multipole type.
Type to store integrals for semi-empirical calculations.
subroutine, public semi_empirical_si_release(store_int_env)
Deallocate the semi-empirical store integrals type.
Definition of the semi empirical parameter types.
subroutine, public se_taper_release(se_taper)
Releases the taper type used in SE calculations.
subroutine, public deallocate_tblite_type(tb_tblite)
...
CP2K transport environment and related C-interoperable types.
subroutine, public transport_env_release(transport_env)
releases the transport_env
defines the type needed for computing wannier states expectations
define create destroy get and put information in xas_env to calculate the x-ray absorption spectra
subroutine, public xas_env_release(xas_env)
...
subroutine, public gauxc_cache_release(cache)
Release all GauXC objects in a cache and deallocate arrays.
stores some data used in wavefunction fitting
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
contains arbitrary information which need to be stored
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
distributes pairs on a 2d grid of processors
Contains information on the energy correction functional for KG.
to build arrays of pointers
Contains information on the excited states energy.
contains the initially parsed file and the initial parallel environment
stores some data used in construction of Kohn-Sham matrix
Contains all the info needed for KG runs...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
Container for information about total charges on the grids.
Contains information on the Harris method.
Provides all information about a quickstep kind.
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
General settings for linear response calculations.
container for the pools of matrixes used by qs
keeps the density in various representations, keeping track of which ones are valid.
keeps track of the previous wavefunctions and can extrapolate them for the next step of md
contains the parameters needed by a relativistic calculation
Global Multipolar NDDO information type.
Semi-empirical store integrals type.
Taper type use in semi-empirical calculations.