166#include "./base/base_uses.f90"
172 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_environment_types'
221 LOGICAL :: qmmm = .false., qmmm_periodic = .false.
222 LOGICAL :: mimic = .false.
223 LOGICAL :: requires_mo_derivs = .false.
224 LOGICAL :: requires_matrix_vxc = .false.
225 LOGICAL :: has_unit_metric = .false.
226 LOGICAL :: run_rtp = .false.
227 LOGICAL :: linres_run = .false.
228 LOGICAL :: calc_image_preconditioner = .false.
229 LOGICAL :: do_transport = .false.
230 LOGICAL :: single_point_run = .false.
231 LOGICAL :: given_embed_pot = .false.
232 LOGICAL :: energy_correction = .false.
233 LOGICAL :: harris_method = .false.
234 LOGICAL :: do_rixs = .false.
235 REAL(kind=
dp) :: sim_time = -1.0_dp
236 REAL(kind=
dp) :: start_time = -1.0_dp, target_time = -1.0_dp
237 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: image_matrix => null()
238 REAL(kind=
dp),
DIMENSION(:),
POINTER :: image_coeff => null()
239 INTEGER,
DIMENSION(:),
POINTER :: ipiv => null()
240 INTEGER :: sim_step = -1
246 TYPE(
cp_fm_type),
DIMENSION(:),
POINTER :: mo_loc_history => null()
269 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: outer_scf_history => null()
270 INTEGER :: outer_scf_ihistory = -1
271 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: gradient_history => null(), &
272 variable_history => null()
273 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data => null()
286 LOGICAL :: excited_state = .false.
303 REAL(kind=
dp) :: broyden_adaptive_sigma = -1.0_dp
317 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eeq => null()
319 REAL(kind=
dp),
DIMENSION(:),
POINTER :: rhs => null()
320 REAL(kind=
dp) :: total_zeff_corr = -1.0_dp, surface_dipole_moment = -1.0_dp
321 LOGICAL :: surface_dipole_switch_off = .false.
322 TYPE(
mo_set_type),
DIMENSION(:),
POINTER :: mos_last_converged => null()
501 SUBROUTINE get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, &
502 dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, &
503 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
504 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, &
505 sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, &
506 matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, &
507 matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, &
508 matrix_w_kp, matrix_s_RI_aux_kp, matrix_s, matrix_s_RI_aux, matrix_w, &
509 matrix_p_mp2, matrix_p_mp2_admm, rho, &
510 rho_xc, pw_env, ewald_env, ewald_pw, active_space, &
511 mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, &
512 vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, &
513 ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, &
514 local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, &
515 molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, &
516 task_list, task_list_soft, &
517 rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, &
518 rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, &
519 do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, &
520 mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, &
521 neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, &
522 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, &
523 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, &
524 lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, &
525 rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, &
526 WannierCentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, &
527 s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, &
528 gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, &
529 eeq, rhs, do_rixs, tb_tblite)
533 POINTER :: atomic_kind_set
535 POINTER :: qs_kind_set
536 TYPE(
cell_type),
OPTIONAL,
POINTER :: cell, super_cell, cell_ref
537 LOGICAL,
OPTIONAL :: use_ref_cell
540 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos
542 OPTIONAL,
POINTER :: sab_orb, sab_all
543 LOGICAL,
OPTIONAL :: qmmm, qmmm_periodic, mimic
545 sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, &
546 sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo
548 POINTER :: particle_set
553 POINTER :: matrix_h, matrix_h_im, matrix_ks, &
554 matrix_ks_im, matrix_vxc
555 LOGICAL,
OPTIONAL :: run_rtp
557 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: matrix_h_kp, matrix_h_im_kp, &
558 matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, &
561 POINTER :: matrix_s, matrix_s_ri_aux, matrix_w, &
562 matrix_p_mp2, matrix_p_mp2_admm
563 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho, rho_xc
589 POINTER :: molecule_kind_set
591 POINTER :: molecule_set
597 POINTER :: rho_atom_set
598 TYPE(
task_list_type),
OPTIONAL,
POINTER :: task_list, task_list_soft
600 POINTER :: rho0_atom_set
602 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
604 POINTER :: rhoz_cneo_set
611 LOGICAL,
OPTIONAL :: do_kpoints, has_unit_metric, &
615 TYPE(
cp_fm_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mo_loc_history
616 INTEGER,
OPTIONAL :: nkind, natom, nelectron_total
617 INTEGER,
DIMENSION(2),
OPTIONAL :: nelectron_spin
619 INTEGER,
OPTIONAL :: neighbor_list_id
625 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: outer_scf_history
626 INTEGER,
INTENT(out),
OPTIONAL :: outer_scf_ihistory
627 TYPE(
hfx_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: x_data
630 OPTIONAL,
POINTER :: dftb_potential
636 TYPE(
admm_type),
OPTIONAL,
POINTER :: admm_env
645 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_external
647 TYPE(
mp2_type),
OPTIONAL,
POINTER :: mp2_env
652 OPTIONAL,
POINTER :: wanniercentres
655 LOGICAL,
OPTIONAL :: do_transport
658 LOGICAL,
OPTIONAL :: s_mstruct_changed, rho_changed, &
659 potential_changed, forces_up_to_date
663 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: gradient_history, variable_history
664 TYPE(
pw_r3d_rs_type),
OPTIONAL,
POINTER :: embed_pot, spin_embed_pot
666 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos_last_converged
667 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: eeq, rhs
668 LOGICAL,
OPTIONAL :: do_rixs
674 cpassert(
ASSOCIATED(qs_env%ks_env))
676 IF (
PRESENT(outer_scf_history)) outer_scf_history => qs_env%outer_scf_history
677 IF (
PRESENT(outer_scf_ihistory)) outer_scf_ihistory = qs_env%outer_scf_ihistory
678 IF (
PRESENT(gradient_history)) gradient_history => qs_env%gradient_history
679 IF (
PRESENT(variable_history)) variable_history => qs_env%variable_history
680 IF (
PRESENT(mp2_env)) mp2_env => qs_env%mp2_env
681 IF (
PRESENT(bs_env)) bs_env => qs_env%bs_env
682 IF (
PRESENT(kg_env)) kg_env => qs_env%kg_env
683 IF (
PRESENT(super_cell)) super_cell => qs_env%super_cell
684 IF (
PRESENT(qmmm)) qmmm = qs_env%qmmm
685 IF (
PRESENT(qmmm_periodic)) qmmm_periodic = qs_env%qmmm_periodic
686 IF (
PRESENT(mimic)) mimic = qs_env%mimic
687 IF (
PRESENT(mos)) mos => qs_env%mos
688 IF (
PRESENT(mos_last_converged)) mos_last_converged => qs_env%mos_last_converged
689 IF (
PRESENT(ewald_env)) ewald_env => qs_env%ewald_env
690 IF (
PRESENT(ewald_pw)) ewald_pw => qs_env%ewald_pw
691 IF (
PRESENT(mpools)) mpools => qs_env%mpools
692 IF (
PRESENT(scf_control)) scf_control => qs_env%scf_control
693 IF (
PRESENT(rel_control)) rel_control => qs_env%rel_control
695 IF (
PRESENT(rho_external)) rho_external => qs_env%rho_external
696 IF (
PRESENT(external_vxc)) external_vxc => qs_env%external_vxc
697 IF (
PRESENT(mask)) mask => qs_env%mask
698 IF (
PRESENT(qs_charges)) qs_charges => qs_env%qs_charges
699 IF (
PRESENT(ks_env)) ks_env => qs_env%ks_env
700 IF (
PRESENT(ks_qmmm_env)) ks_qmmm_env => qs_env%ks_qmmm_env
701 IF (
PRESENT(wf_history)) wf_history => qs_env%wf_history
702 IF (
PRESENT(scf_env)) scf_env => qs_env%scf_env
703 IF (
PRESENT(oce)) oce => qs_env%oce
704 IF (
PRESENT(requires_mo_derivs)) requires_mo_derivs = qs_env%requires_mo_derivs
705 IF (
PRESENT(has_unit_metric)) has_unit_metric = qs_env%has_unit_metric
706 IF (
PRESENT(mo_derivs)) mo_derivs => qs_env%mo_derivs
707 IF (
PRESENT(mo_loc_history)) mo_loc_history => qs_env%mo_loc_history
708 IF (
PRESENT(linres_control)) linres_control => qs_env%linres_control
709 IF (
PRESENT(se_taper)) se_taper => qs_env%se_taper
710 IF (
PRESENT(se_store_int_env)) se_store_int_env => qs_env%se_store_int_env
711 IF (
PRESENT(se_nddo_mpole)) se_nddo_mpole => qs_env%se_nddo_mpole
712 IF (
PRESENT(se_nonbond_env)) se_nonbond_env => qs_env%se_nonbond_env
713 IF (
PRESENT(lri_env)) lri_env => qs_env%lri_env
714 IF (
PRESENT(lri_density)) lri_density => qs_env%lri_density
715 IF (
PRESENT(harris_env)) harris_env => qs_env%harris_env
716 IF (
PRESENT(ec_env)) ec_env => qs_env%ec_env
717 IF (
PRESENT(exstate_env)) exstate_env => qs_env%exstate_env
718 IF (
PRESENT(dispersion_env)) dispersion_env => qs_env%dispersion_env
719 IF (
PRESENT(gcp_env)) gcp_env => qs_env%gcp_env
720 IF (
PRESENT(run_rtp)) run_rtp = qs_env%run_rtp
721 IF (
PRESENT(rtp)) rtp => qs_env%rtp
722 IF (
PRESENT(ls_scf_env)) ls_scf_env => qs_env%ls_scf_env
723 IF (
PRESENT(almo_scf_env)) almo_scf_env => qs_env%almo_scf_env
724 IF (
PRESENT(do_transport)) do_transport = qs_env%do_transport
725 IF (
PRESENT(transport_env)) transport_env => qs_env%transport_env
726 IF (
PRESENT(mscfg_env)) mscfg_env => qs_env%molecular_scf_guess_env
727 IF (
PRESENT(active_space)) active_space => qs_env%active_space
728 IF (
PRESENT(admm_env)) admm_env => qs_env%admm_env
729 IF (
PRESENT(do_rixs)) do_rixs = qs_env%do_rixs
732 IF (
PRESENT(embed_pot)) embed_pot => qs_env%embed_pot
733 IF (
PRESENT(spin_embed_pot)) spin_embed_pot => qs_env%spin_embed_pot
736 IF (
PRESENT(polar_env)) polar_env => qs_env%polar_env
739 IF (
PRESENT(eeq)) eeq => qs_env%eeq
742 IF (
PRESENT(rhs)) rhs => qs_env%rhs
744 IF (
PRESENT(local_rho_set)) &
745 local_rho_set => qs_env%local_rho_set
746 IF (
PRESENT(rho_atom_set)) &
747 CALL get_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
748 IF (
PRESENT(rho0_atom_set)) &
749 CALL get_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
750 IF (
PRESENT(rho0_mpole)) &
751 CALL get_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
752 IF (
PRESENT(rhoz_set)) &
754 IF (
PRESENT(rhoz_cneo_set)) &
755 CALL get_local_rho(qs_env%local_rho_set, rhoz_cneo_set=rhoz_cneo_set)
756 IF (
PRESENT(ecoul_1c)) &
758 IF (
PRESENT(rho0_s_rs))
THEN
760 IF (
ASSOCIATED(rho0_m))
THEN
761 rho0_s_rs => rho0_m%rho0_s_rs
764 IF (
PRESENT(rho0_s_gs))
THEN
766 IF (
ASSOCIATED(rho0_m))
THEN
767 rho0_s_gs => rho0_m%rho0_s_gs
770 IF (
PRESENT(rhoz_cneo_s_rs))
THEN
772 IF (
ASSOCIATED(rho0_m))
THEN
773 rhoz_cneo_s_rs => rho0_m%rhoz_cneo_s_rs
776 IF (
PRESENT(rhoz_cneo_s_gs))
THEN
778 IF (
ASSOCIATED(rho0_m))
THEN
779 rhoz_cneo_s_gs => rho0_m%rhoz_cneo_s_gs
783 IF (
PRESENT(xas_env)) xas_env => qs_env%xas_env
784 IF (
PRESENT(input)) input => qs_env%input
785 IF (
PRESENT(cp_ddapc_env)) cp_ddapc_env => qs_env%cp_ddapc_env
786 IF (
PRESENT(cp_ddapc_ewald)) cp_ddapc_ewald => qs_env%cp_ddapc_ewald
787 IF (
PRESENT(x_data)) x_data => qs_env%x_data
789 IF (
PRESENT(dftb_potential)) dftb_potential => qs_env%dftb_potential
790 IF (
PRESENT(efield)) efield => qs_env%efield
791 IF (
PRESENT(wanniercentres)) wanniercentres => qs_env%WannierCentres
794 v_hartree_rspace=v_hartree_rspace, &
795 s_mstruct_changed=s_mstruct_changed, &
796 rho_changed=rho_changed, &
797 potential_changed=potential_changed, &
798 forces_up_to_date=forces_up_to_date, &
800 matrix_h_im=matrix_h_im, &
801 matrix_ks=matrix_ks, &
802 matrix_ks_im=matrix_ks_im, &
803 matrix_vxc=matrix_vxc, &
806 matrix_s_ri_aux=matrix_s_ri_aux, &
807 matrix_ks_im_kp=matrix_ks_im_kp, &
809 matrix_p_mp2=matrix_p_mp2, &
810 matrix_p_mp2_admm=matrix_p_mp2_admm, &
811 matrix_h_kp=matrix_h_kp, &
812 matrix_h_im_kp=matrix_h_im_kp, &
813 matrix_ks_kp=matrix_ks_kp, &
814 matrix_vxc_kp=matrix_vxc_kp, &
815 kinetic_kp=kinetic_kp, &
816 matrix_s_kp=matrix_s_kp, &
817 matrix_w_kp=matrix_w_kp, &
818 matrix_s_ri_aux_kp=matrix_s_ri_aux_kp, &
821 xcint_weights=xcint_weights, &
824 rho_nlcc_g=rho_nlcc_g, &
827 neighbor_list_id=neighbor_list_id, &
843 sab_xtb_pp=sab_xtb_pp, &
844 sab_xtb_nonbond=sab_xtb_nonbond, &
847 sab_kp_nosym=sab_kp_nosym, &
849 task_list=task_list, &
850 task_list_soft=task_list_soft, &
852 do_kpoints=do_kpoints, &
853 local_molecules=local_molecules, &
854 local_particles=local_particles, &
860 use_ref_cell=use_ref_cell, &
863 qs_kind_set=qs_kind_set, &
865 cp_subsys=cp_subsys, &
866 atomic_kind_set=atomic_kind_set, &
867 particle_set=particle_set, &
868 molecule_kind_set=molecule_kind_set, &
869 molecule_set=molecule_set, &
872 dft_control=dft_control, &
873 dbcsr_dist=dbcsr_dist, &
874 distribution_2d=distribution_2d, &
877 blacs_env=blacs_env, &
878 nelectron_total=nelectron_total, &
879 nelectron_spin=nelectron_spin)
881 IF (
PRESENT(tb_tblite)) tb_tblite => qs_env%tb_tblite
893 SUBROUTINE init_qs_env(qs_env, globenv)
898 NULLIFY (qs_env%ls_scf_env)
899 NULLIFY (qs_env%almo_scf_env)
900 NULLIFY (qs_env%transport_env)
901 NULLIFY (qs_env%image_matrix)
902 NULLIFY (qs_env%ipiv)
903 NULLIFY (qs_env%image_coeff)
904 NULLIFY (qs_env%super_cell)
906 NULLIFY (qs_env%mos_last_converged)
907 NULLIFY (qs_env%mpools)
908 NULLIFY (qs_env%ewald_env)
909 NULLIFY (qs_env%ewald_pw)
910 NULLIFY (qs_env%scf_control)
911 NULLIFY (qs_env%rel_control)
912 NULLIFY (qs_env%qs_charges)
914 NULLIFY (qs_env%rho_external)
915 NULLIFY (qs_env%external_vxc)
916 NULLIFY (qs_env%mask)
918 NULLIFY (qs_env%embed_pot)
919 NULLIFY (qs_env%spin_embed_pot)
922 NULLIFY (qs_env%polar_env)
924 NULLIFY (qs_env%ks_env)
925 NULLIFY (qs_env%ks_qmmm_env)
926 NULLIFY (qs_env%wf_history)
927 NULLIFY (qs_env%scf_env)
929 NULLIFY (qs_env%local_rho_set)
930 NULLIFY (qs_env%hartree_local)
931 NULLIFY (qs_env%input)
932 NULLIFY (qs_env%linres_control)
933 NULLIFY (qs_env%xas_env)
934 NULLIFY (qs_env%cp_ddapc_env)
935 NULLIFY (qs_env%cp_ddapc_ewald)
936 NULLIFY (qs_env%outer_scf_history)
937 NULLIFY (qs_env%gradient_history)
938 NULLIFY (qs_env%variable_history)
939 NULLIFY (qs_env%x_data)
940 NULLIFY (qs_env%et_coupling)
941 NULLIFY (qs_env%dftb_potential)
942 NULLIFY (qs_env%active_space)
944 NULLIFY (qs_env%se_taper)
945 NULLIFY (qs_env%se_store_int_env)
946 NULLIFY (qs_env%se_nddo_mpole)
947 NULLIFY (qs_env%se_nonbond_env)
948 NULLIFY (qs_env%admm_env)
949 NULLIFY (qs_env%efield)
950 NULLIFY (qs_env%lri_env)
951 NULLIFY (qs_env%harris_env)
952 NULLIFY (qs_env%ec_env)
953 NULLIFY (qs_env%exstate_env)
954 NULLIFY (qs_env%lri_density)
955 NULLIFY (qs_env%gcp_env)
957 NULLIFY (qs_env%mp2_env)
958 NULLIFY (qs_env%bs_env)
959 NULLIFY (qs_env%kg_env)
960 NULLIFY (qs_env%WannierCentres)
962 qs_env%outer_scf_ihistory = 0
963 qs_env%broyden_adaptive_sigma = -1.0_dp
967 qs_env%run_rtp = .false.
968 qs_env%linres_run = .false.
969 qs_env%single_point_run = .false.
970 qs_env%qmmm = .false.
971 qs_env%qmmm_periodic = .false.
972 qs_env%mimic = .false.
973 qs_env%requires_mo_derivs = .false.
974 qs_env%requires_matrix_vxc = .false.
975 qs_env%has_unit_metric = .false.
976 qs_env%calc_image_preconditioner = .true.
977 qs_env%do_transport = .false.
978 qs_env%given_embed_pot = .false.
979 qs_env%do_rixs = .false.
980 IF (
PRESENT(globenv))
THEN
981 qs_env%target_time = globenv%cp2k_target_time
982 qs_env%start_time = globenv%cp2k_start_time
983 qs_env%single_point_run = (globenv%run_type_id ==
energy_run .OR. &
986 qs_env%target_time = 0.0_dp
987 qs_env%start_time = 0.0_dp
990 qs_env%sim_time = 0._dp
993 qs_env%total_zeff_corr = 0.0_dp
994 qs_env%surface_dipole_moment = 0.0_dp
995 qs_env%surface_dipole_switch_off = .false.
998 NULLIFY (qs_env%mo_derivs)
999 NULLIFY (qs_env%mo_loc_history)
1001 IF (.NOT.
ASSOCIATED(qs_env%molecular_scf_guess_env))
ALLOCATE (qs_env%molecular_scf_guess_env)
1003 NULLIFY (qs_env%tb_tblite)
1005 END SUBROUTINE init_qs_env
1091 mos, qmmm, qmmm_periodic, mimic, &
1092 ewald_env, ewald_pw, mpools, &
1093 rho_external, external_vxc, mask, &
1094 scf_control, rel_control, qs_charges, ks_env, &
1095 ks_qmmm_env, wf_history, scf_env, active_space, &
1096 input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, &
1097 rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, &
1098 mo_loc_history, efield, rhoz_cneo_set, &
1099 linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, &
1100 outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, &
1101 se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, &
1102 do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, &
1103 harris_env, gcp_env, mp2_env, bs_env, kg_env, force, &
1104 kpoints, WannierCentres, almo_scf_env, gradient_history, variable_history, embed_pot, &
1105 spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
1108 TYPE(
cell_type),
OPTIONAL,
POINTER :: super_cell
1109 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos
1110 LOGICAL,
OPTIONAL :: qmmm, qmmm_periodic, mimic
1114 TYPE(
qs_rho_type),
OPTIONAL,
POINTER :: rho_external
1127 POINTER :: rho_atom_set
1129 POINTER :: rho0_atom_set
1131 LOGICAL,
OPTIONAL :: run_rtp
1133 TYPE(
rhoz_type),
DIMENSION(:),
OPTIONAL,
POINTER :: rhoz_set
1134 REAL(
dp),
OPTIONAL :: rhoz_tot
1137 LOGICAL,
OPTIONAL :: has_unit_metric, requires_mo_derivs
1139 POINTER :: mo_derivs
1140 TYPE(
cp_fm_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mo_loc_history
1143 POINTER :: rhoz_cneo_set
1148 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: outer_scf_history
1149 INTEGER,
INTENT(IN),
OPTIONAL :: outer_scf_ihistory
1150 TYPE(
hfx_type),
DIMENSION(:, :),
OPTIONAL,
POINTER :: x_data
1153 OPTIONAL,
POINTER :: dftb_potential
1158 TYPE(
admm_type),
OPTIONAL,
POINTER :: admm_env
1160 LOGICAL,
OPTIONAL :: do_transport
1167 TYPE(
harris_type),
OPTIONAL,
POINTER :: harris_env
1169 TYPE(
mp2_type),
OPTIONAL,
POINTER :: mp2_env
1177 OPTIONAL,
POINTER :: wanniercentres
1179 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: gradient_history, variable_history
1180 TYPE(
pw_r3d_rs_type),
OPTIONAL,
POINTER :: embed_pot, spin_embed_pot
1182 TYPE(
mo_set_type),
DIMENSION(:),
OPTIONAL,
POINTER :: mos_last_converged
1183 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: eeq, rhs
1184 LOGICAL,
OPTIONAL :: do_rixs
1189 IF (
PRESENT(mp2_env)) qs_env%mp2_env => mp2_env
1190 IF (
PRESENT(bs_env)) qs_env%bs_env => bs_env
1191 IF (
PRESENT(kg_env)) qs_env%kg_env => kg_env
1192 IF (
PRESENT(super_cell))
THEN
1195 qs_env%super_cell => super_cell
1198 IF (
PRESENT(qmmm)) qs_env%qmmm = qmmm
1199 IF (
PRESENT(qmmm_periodic)) qs_env%qmmm_periodic = qmmm_periodic
1200 IF (
PRESENT(mimic)) qs_env%mimic = mimic
1201 IF (
PRESENT(mos)) qs_env%mos => mos
1202 IF (
PRESENT(mos_last_converged)) qs_env%mos_last_converged => mos_last_converged
1203 IF (
PRESENT(ls_scf_env)) qs_env%ls_scf_env => ls_scf_env
1204 IF (
PRESENT(almo_scf_env)) qs_env%almo_scf_env => almo_scf_env
1205 IF (
PRESENT(do_transport)) qs_env%do_transport = do_transport
1206 IF (
PRESENT(transport_env)) qs_env%transport_env => transport_env
1209 IF (
PRESENT(oce)) qs_env%oce => oce
1210 IF (
PRESENT(outer_scf_history)) qs_env%outer_scf_history => outer_scf_history
1211 IF (
PRESENT(gradient_history)) qs_env%gradient_history => gradient_history
1212 IF (
PRESENT(variable_history)) qs_env%variable_history => variable_history
1213 IF (
PRESENT(outer_scf_ihistory)) qs_env%outer_scf_ihistory = outer_scf_ihistory
1214 IF (
PRESENT(requires_mo_derivs)) qs_env%requires_mo_derivs = requires_mo_derivs
1215 IF (
PRESENT(has_unit_metric)) qs_env%has_unit_metric = has_unit_metric
1216 IF (
PRESENT(mo_derivs)) qs_env%mo_derivs => mo_derivs
1217 IF (
PRESENT(mo_loc_history)) qs_env%mo_loc_history => mo_loc_history
1218 IF (
PRESENT(run_rtp)) qs_env%run_rtp = run_rtp
1219 IF (
PRESENT(rtp)) qs_env%rtp => rtp
1220 IF (
PRESENT(efield)) qs_env%efield => efield
1221 IF (
PRESENT(active_space)) qs_env%active_space => active_space
1222 IF (
PRESENT(do_rixs)) do_rixs = qs_env%do_rixs
1224 IF (
PRESENT(ewald_env))
THEN
1225 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1226 IF (.NOT.
ASSOCIATED(qs_env%ewald_env, ewald_env))
THEN
1228 DEALLOCATE (qs_env%ewald_env)
1231 qs_env%ewald_env => ewald_env
1233 IF (
PRESENT(ewald_pw))
THEN
1234 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1235 IF (.NOT.
ASSOCIATED(ewald_pw, qs_env%ewald_pw))
THEN
1237 DEALLOCATE (qs_env%ewald_pw)
1240 qs_env%ewald_pw => ewald_pw
1242 IF (
PRESENT(scf_control))
THEN
1243 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1244 IF (.NOT.
ASSOCIATED(qs_env%scf_control, scf_control))
THEN
1246 DEALLOCATE (qs_env%scf_control)
1249 qs_env%scf_control => scf_control
1251 IF (
PRESENT(rel_control))
THEN
1252 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1253 IF (.NOT.
ASSOCIATED(qs_env%rel_control, rel_control))
THEN
1255 DEALLOCATE (qs_env%rel_control)
1258 qs_env%rel_control => rel_control
1260 IF (
PRESENT(linres_control))
THEN
1261 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1262 IF (.NOT.
ASSOCIATED(qs_env%linres_control, linres_control))
THEN
1264 DEALLOCATE (qs_env%linres_control)
1267 qs_env%linres_control => linres_control
1270 IF (
PRESENT(rho_external))
THEN
1271 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1272 IF (.NOT.
ASSOCIATED(qs_env%rho_external, rho_external))
THEN
1274 DEALLOCATE (qs_env%rho_external)
1277 qs_env%rho_external => rho_external
1279 IF (
PRESENT(external_vxc)) qs_env%external_vxc => external_vxc
1280 IF (
PRESENT(mask)) qs_env%mask => mask
1282 IF (
PRESENT(embed_pot)) qs_env%embed_pot => embed_pot
1283 IF (
PRESENT(spin_embed_pot)) qs_env%spin_embed_pot => spin_embed_pot
1286 IF (
PRESENT(polar_env)) qs_env%polar_env => polar_env
1288 IF (
PRESENT(qs_charges))
THEN
1289 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1290 IF (.NOT.
ASSOCIATED(qs_env%qs_charges, qs_charges))
THEN
1292 DEALLOCATE (qs_env%qs_charges)
1295 qs_env%qs_charges => qs_charges
1297 IF (
PRESENT(ks_qmmm_env))
THEN
1298 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1299 IF (.NOT.
ASSOCIATED(qs_env%ks_qmmm_env, ks_qmmm_env))
THEN
1301 DEALLOCATE (qs_env%ks_qmmm_env)
1304 qs_env%ks_qmmm_env => ks_qmmm_env
1306 IF (
PRESENT(ks_env))
THEN
1307 IF (
ASSOCIATED(qs_env%ks_env))
THEN
1308 IF (.NOT.
ASSOCIATED(qs_env%ks_env, ks_env))
THEN
1310 DEALLOCATE (qs_env%ks_env)
1313 qs_env%ks_env => ks_env
1315 IF (
PRESENT(wf_history))
THEN
1318 qs_env%wf_history => wf_history
1320 IF (
PRESENT(scf_env))
THEN
1321 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1322 IF (.NOT.
ASSOCIATED(qs_env%scf_env, scf_env))
THEN
1324 DEALLOCATE (qs_env%scf_env)
1327 qs_env%scf_env => scf_env
1329 IF (
PRESENT(xas_env))
THEN
1330 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1331 IF (.NOT.
ASSOCIATED(qs_env%xas_env, xas_env))
THEN
1333 DEALLOCATE (qs_env%xas_env)
1336 qs_env%xas_env => xas_env
1338 IF (
PRESENT(mpools))
THEN
1341 qs_env%mpools => mpools
1343 IF (
PRESENT(rho_atom_set))
THEN
1344 CALL set_local_rho(qs_env%local_rho_set, rho_atom_set=rho_atom_set)
1346 IF (
PRESENT(rho0_atom_set))
THEN
1347 CALL set_local_rho(qs_env%local_rho_set, rho0_atom_set=rho0_atom_set)
1349 IF (
PRESENT(rho0_mpole))
THEN
1350 CALL set_local_rho(qs_env%local_rho_set, rho0_mpole=rho0_mpole)
1352 IF (
PRESENT(rhoz_set))
THEN
1355 IF (
PRESENT(rhoz_cneo_set))
THEN
1356 CALL set_local_rho(qs_env%local_rho_set, rhoz_cneo_set=rhoz_cneo_set)
1358 IF (
PRESENT(rhoz_tot)) qs_env%local_rho_set%rhoz_tot = rhoz_tot
1359 IF (
PRESENT(ecoul_1c))
THEN
1362 IF (
PRESENT(input))
THEN
1365 qs_env%input => input
1367 IF (
PRESENT(cp_ddapc_env))
THEN
1368 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1369 IF (.NOT.
ASSOCIATED(qs_env%cp_ddapc_env, cp_ddapc_env))
THEN
1371 DEALLOCATE (qs_env%cp_ddapc_env)
1374 qs_env%cp_ddapc_env => cp_ddapc_env
1376 IF (
PRESENT(cp_ddapc_ewald))
THEN
1377 qs_env%cp_ddapc_ewald => cp_ddapc_ewald
1379 IF (
PRESENT(x_data)) qs_env%x_data => x_data
1381 IF (
PRESENT(dftb_potential)) qs_env%dftb_potential => dftb_potential
1382 IF (
PRESENT(se_taper))
THEN
1384 qs_env%se_taper => se_taper
1386 IF (
PRESENT(se_store_int_env))
THEN
1388 qs_env%se_store_int_env => se_store_int_env
1390 IF (
PRESENT(se_nddo_mpole))
THEN
1392 qs_env%se_nddo_mpole => se_nddo_mpole
1394 IF (
PRESENT(se_nonbond_env))
THEN
1395 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1396 IF (.NOT.
ASSOCIATED(qs_env%se_nonbond_env, se_nonbond_env))
THEN
1398 DEALLOCATE (qs_env%se_nonbond_env)
1401 qs_env%se_nonbond_env => se_nonbond_env
1403 IF (
PRESENT(admm_env)) qs_env%admm_env => admm_env
1404 IF (
PRESENT(lri_env)) qs_env%lri_env => lri_env
1405 IF (
PRESENT(lri_density)) qs_env%lri_density => lri_density
1406 IF (
PRESENT(harris_env)) qs_env%harris_env => harris_env
1407 IF (
PRESENT(ec_env)) qs_env%ec_env => ec_env
1408 IF (
PRESENT(exstate_env)) qs_env%exstate_env => exstate_env
1409 IF (
PRESENT(dispersion_env)) qs_env%dispersion_env => dispersion_env
1410 IF (
PRESENT(gcp_env)) qs_env%gcp_env => gcp_env
1411 IF (
PRESENT(wanniercentres)) qs_env%WannierCentres => wanniercentres
1412 IF (
PRESENT(kpoints))
CALL set_ks_env(qs_env%ks_env, kpoints=kpoints)
1415 IF (
PRESENT(eeq)) qs_env%eeq => eeq
1418 IF (
PRESENT(rhs)) qs_env%rhs => rhs
1420 IF (
PRESENT(force))
THEN
1425 IF (
PRESENT(tb_tblite)) qs_env%tb_tblite => tb_tblite
1441 CALL init_qs_env(qs_env, globenv=globenv)
1458 IF (
ASSOCIATED(qs_env%mos))
THEN
1459 DO i = 1,
SIZE(qs_env%mos)
1462 DEALLOCATE (qs_env%mos)
1464 IF (
ASSOCIATED(qs_env%mos_last_converged))
THEN
1465 DO i = 1,
SIZE(qs_env%mos_last_converged)
1468 DEALLOCATE (qs_env%mos_last_converged)
1471 IF (
ASSOCIATED(qs_env%mo_derivs))
THEN
1472 DO i = 1,
SIZE(qs_env%mo_derivs)
1475 DEALLOCATE (qs_env%mo_derivs)
1480 IF (
ASSOCIATED(qs_env%rtp))
THEN
1482 DEALLOCATE (qs_env%rtp)
1484 IF (
ASSOCIATED(qs_env%outer_scf_history))
THEN
1485 DEALLOCATE (qs_env%outer_scf_history)
1486 qs_env%outer_scf_ihistory = 0
1488 IF (
ASSOCIATED(qs_env%gradient_history)) &
1489 DEALLOCATE (qs_env%gradient_history)
1490 IF (
ASSOCIATED(qs_env%variable_history)) &
1491 DEALLOCATE (qs_env%variable_history)
1493 IF (
ASSOCIATED(qs_env%local_rho_set))
THEN
1496 IF (
ASSOCIATED(qs_env%hartree_local))
THEN
1499 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1501 DEALLOCATE (qs_env%scf_control)
1503 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1505 DEALLOCATE (qs_env%rel_control)
1508 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1510 DEALLOCATE (qs_env%linres_control)
1513 IF (
ASSOCIATED(qs_env%almo_scf_env))
THEN
1517 IF (
ASSOCIATED(qs_env%ls_scf_env))
THEN
1520 IF (
ASSOCIATED(qs_env%molecular_scf_guess_env))
THEN
1522 DEALLOCATE (qs_env%molecular_scf_guess_env)
1525 IF (
ASSOCIATED(qs_env%transport_env))
THEN
1530 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1532 DEALLOCATE (qs_env%xas_env)
1534 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1536 DEALLOCATE (qs_env%ewald_env)
1538 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1540 DEALLOCATE (qs_env%ewald_pw)
1542 IF (
ASSOCIATED(qs_env%image_matrix))
THEN
1543 DEALLOCATE (qs_env%image_matrix)
1545 IF (
ASSOCIATED(qs_env%ipiv))
THEN
1546 DEALLOCATE (qs_env%ipiv)
1548 IF (
ASSOCIATED(qs_env%image_coeff))
THEN
1549 DEALLOCATE (qs_env%image_coeff)
1552 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1554 DEALLOCATE (qs_env%rho_external)
1556 IF (
ASSOCIATED(qs_env%external_vxc))
THEN
1557 CALL qs_env%external_vxc%release()
1558 DEALLOCATE (qs_env%external_vxc)
1560 IF (
ASSOCIATED(qs_env%mask))
THEN
1561 CALL qs_env%mask%release()
1562 DEALLOCATE (qs_env%mask)
1564 IF (
ASSOCIATED(qs_env%active_space))
THEN
1568 IF (qs_env%given_embed_pot)
THEN
1569 CALL qs_env%embed_pot%release()
1570 DEALLOCATE (qs_env%embed_pot)
1571 IF (
ASSOCIATED(qs_env%spin_embed_pot))
THEN
1572 CALL qs_env%spin_embed_pot%release()
1573 DEALLOCATE (qs_env%spin_embed_pot)
1580 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1582 DEALLOCATE (qs_env%qs_charges)
1584 IF (
ASSOCIATED(qs_env%ks_env))
THEN
1586 DEALLOCATE (qs_env%ks_env)
1588 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1590 DEALLOCATE (qs_env%ks_qmmm_env)
1593 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1595 DEALLOCATE (qs_env%scf_env)
1599 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1601 DEALLOCATE (qs_env%cp_ddapc_env)
1605 IF (
ASSOCIATED(qs_env%x_data))
THEN
1608 IF (
ASSOCIATED(qs_env%et_coupling))
THEN
1611 IF (
ASSOCIATED(qs_env%dftb_potential))
THEN
1614 IF (
ASSOCIATED(qs_env%se_taper))
THEN
1617 IF (
ASSOCIATED(qs_env%se_store_int_env))
THEN
1620 IF (
ASSOCIATED(qs_env%se_nddo_mpole))
THEN
1623 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1625 DEALLOCATE (qs_env%se_nonbond_env)
1627 IF (
ASSOCIATED(qs_env%admm_env))
THEN
1630 IF (
ASSOCIATED(qs_env%lri_env))
THEN
1632 DEALLOCATE (qs_env%lri_env)
1634 IF (
ASSOCIATED(qs_env%lri_density))
THEN
1636 DEALLOCATE (qs_env%lri_density)
1638 IF (
ASSOCIATED(qs_env%harris_env))
THEN
1641 IF (
ASSOCIATED(qs_env%ec_env))
THEN
1644 IF (
ASSOCIATED(qs_env%exstate_env))
THEN
1647 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
1649 DEALLOCATE (qs_env%mp2_env)
1650 NULLIFY (qs_env%mp2_env)
1652 IF (
ASSOCIATED(qs_env%bs_env))
THEN
1655 IF (
ASSOCIATED(qs_env%kg_env))
THEN
1662 IF (
ASSOCIATED(qs_env%gcp_env))
THEN
1666 IF (
ASSOCIATED(qs_env%WannierCentres))
THEN
1667 DO i = 1,
SIZE(qs_env%WannierCentres)
1668 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1669 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1671 DEALLOCATE (qs_env%WannierCentres)
1674 IF (
ASSOCIATED(qs_env%eeq))
DEALLOCATE (qs_env%eeq)
1676 IF (
ASSOCIATED(qs_env%rhs))
DEALLOCATE (qs_env%rhs)
1679 IF (
ASSOCIATED(qs_env%tb_tblite))
THEN
1696 IF (
ASSOCIATED(qs_env%mos_last_converged))
THEN
1697 DO i = 1,
SIZE(qs_env%mos_last_converged)
1700 DEALLOCATE (qs_env%mos_last_converged)
1703 IF (
ASSOCIATED(qs_env%mo_derivs))
THEN
1704 DO i = 1,
SIZE(qs_env%mo_derivs)
1707 DEALLOCATE (qs_env%mo_derivs)
1712 IF (
ASSOCIATED(qs_env%rtp))
THEN
1714 DEALLOCATE (qs_env%rtp)
1716 IF (
ASSOCIATED(qs_env%outer_scf_history))
THEN
1717 DEALLOCATE (qs_env%outer_scf_history)
1718 qs_env%outer_scf_ihistory = 0
1720 IF (
ASSOCIATED(qs_env%gradient_history)) &
1721 DEALLOCATE (qs_env%gradient_history)
1722 IF (
ASSOCIATED(qs_env%variable_history)) &
1723 DEALLOCATE (qs_env%variable_history)
1725 IF (
ASSOCIATED(qs_env%local_rho_set))
THEN
1728 IF (
ASSOCIATED(qs_env%hartree_local))
THEN
1731 IF (
ASSOCIATED(qs_env%scf_control))
THEN
1733 DEALLOCATE (qs_env%scf_control)
1735 IF (
ASSOCIATED(qs_env%rel_control))
THEN
1737 DEALLOCATE (qs_env%rel_control)
1740 IF (
ASSOCIATED(qs_env%linres_control))
THEN
1742 DEALLOCATE (qs_env%linres_control)
1745 IF (
ASSOCIATED(qs_env%almo_scf_env))
THEN
1749 IF (
ASSOCIATED(qs_env%ls_scf_env))
THEN
1752 IF (
ASSOCIATED(qs_env%molecular_scf_guess_env))
THEN
1754 DEALLOCATE (qs_env%molecular_scf_guess_env)
1757 IF (
ASSOCIATED(qs_env%transport_env))
THEN
1762 IF (
ASSOCIATED(qs_env%xas_env))
THEN
1764 DEALLOCATE (qs_env%xas_env)
1766 IF (
ASSOCIATED(qs_env%ewald_env))
THEN
1768 DEALLOCATE (qs_env%ewald_env)
1770 IF (
ASSOCIATED(qs_env%ewald_pw))
THEN
1772 DEALLOCATE (qs_env%ewald_pw)
1774 IF (
ASSOCIATED(qs_env%image_matrix))
THEN
1775 DEALLOCATE (qs_env%image_matrix)
1777 IF (
ASSOCIATED(qs_env%ipiv))
THEN
1778 DEALLOCATE (qs_env%ipiv)
1780 IF (
ASSOCIATED(qs_env%image_coeff))
THEN
1781 DEALLOCATE (qs_env%image_coeff)
1784 IF (
ASSOCIATED(qs_env%rho_external))
THEN
1786 DEALLOCATE (qs_env%rho_external)
1788 IF (
ASSOCIATED(qs_env%external_vxc))
THEN
1789 CALL qs_env%external_vxc%release()
1790 DEALLOCATE (qs_env%external_vxc)
1792 IF (
ASSOCIATED(qs_env%mask))
THEN
1793 CALL qs_env%mask%release()
1794 DEALLOCATE (qs_env%mask)
1796 IF (
ASSOCIATED(qs_env%active_space))
THEN
1800 IF (qs_env%given_embed_pot)
THEN
1801 CALL qs_env%embed_pot%release()
1802 DEALLOCATE (qs_env%embed_pot)
1803 IF (
ASSOCIATED(qs_env%spin_embed_pot))
THEN
1804 CALL qs_env%spin_embed_pot%release()
1805 DEALLOCATE (qs_env%spin_embed_pot)
1812 IF (
ASSOCIATED(qs_env%qs_charges))
THEN
1814 DEALLOCATE (qs_env%qs_charges)
1817 IF (
ASSOCIATED(qs_env%ks_qmmm_env))
THEN
1819 DEALLOCATE (qs_env%ks_qmmm_env)
1822 IF (
ASSOCIATED(qs_env%scf_env))
THEN
1824 DEALLOCATE (qs_env%scf_env)
1826 IF (
ASSOCIATED(qs_env%cp_ddapc_env))
THEN
1828 DEALLOCATE (qs_env%cp_ddapc_env)
1832 IF (
ASSOCIATED(qs_env%x_data))
THEN
1835 IF (
ASSOCIATED(qs_env%et_coupling))
THEN
1838 IF (
ASSOCIATED(qs_env%dftb_potential))
THEN
1841 IF (
ASSOCIATED(qs_env%se_taper))
THEN
1844 IF (
ASSOCIATED(qs_env%se_store_int_env))
THEN
1847 IF (
ASSOCIATED(qs_env%se_nddo_mpole))
THEN
1850 IF (
ASSOCIATED(qs_env%se_nonbond_env))
THEN
1852 DEALLOCATE (qs_env%se_nonbond_env)
1854 IF (
ASSOCIATED(qs_env%admm_env))
THEN
1857 IF (
ASSOCIATED(qs_env%lri_env))
THEN
1859 DEALLOCATE (qs_env%lri_env)
1861 IF (
ASSOCIATED(qs_env%lri_density))
THEN
1863 DEALLOCATE (qs_env%lri_density)
1865 IF (
ASSOCIATED(qs_env%harris_env))
THEN
1868 IF (
ASSOCIATED(qs_env%ec_env))
THEN
1871 IF (
ASSOCIATED(qs_env%exstate_env))
THEN
1874 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
1876 DEALLOCATE (qs_env%mp2_env)
1877 NULLIFY (qs_env%mp2_env)
1879 IF (
ASSOCIATED(qs_env%kg_env))
THEN
1886 IF (
ASSOCIATED(qs_env%gcp_env))
THEN
1890 IF (
ASSOCIATED(qs_env%WannierCentres))
THEN
1891 DO i = 1,
SIZE(qs_env%WannierCentres)
1892 DEALLOCATE (qs_env%WannierCentres(i)%WannierHamDiag)
1893 DEALLOCATE (qs_env%WannierCentres(i)%centres)
1895 DEALLOCATE (qs_env%WannierCentres)
1898 IF (
ASSOCIATED(qs_env%eeq))
DEALLOCATE (qs_env%eeq)
1900 IF (
ASSOCIATED(qs_env%rhs))
DEALLOCATE (qs_env%rhs)
1903 IF (
ASSOCIATED(qs_env%tb_tblite))
THEN
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, 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 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 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_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 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_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)
...
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.