LCOV - code coverage report
Current view: top level - src - mp2_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 24 25 96.0 %
Date: 2024-11-21 06:45:46 Functions: 2 37 5.4 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief Types needed for MP2 calculations
      10             : !> \par History
      11             : !>       2011.05 created [Mauro Del Ben]
      12             : !> \author MDB
      13             : ! **************************************************************************************************
      14             : MODULE mp2_types
      15             :    USE cp_dbcsr_api,                    ONLY: dbcsr_p_type,&
      16             :                                               dbcsr_type
      17             :    USE cp_eri_mme_interface,            ONLY: cp_eri_mme_finalize,&
      18             :                                               cp_eri_mme_param
      19             :    USE cp_fm_types,                     ONLY: cp_fm_type
      20             :    USE hfx_types,                       ONLY: hfx_release,&
      21             :                                               hfx_type,&
      22             :                                               pair_list_element_type
      23             :    USE input_constants,                 ONLY: &
      24             :         do_eri_mme, eri_default, gw_pade_approx, kp_weights_W_auto, mp2_method_direct, &
      25             :         mp2_method_gpw, mp2_method_none, mp2_ri_optimize_basis, ri_mp2_laplace, ri_mp2_method_gpw, &
      26             :         ri_rpa_g0w0_crossing_z_shot, ri_rpa_method_gpw, rpa_exchange_none, soc_none, &
      27             :         wfc_mm_style_gemm
      28             :    USE input_section_types,             ONLY: section_vals_release,&
      29             :                                               section_vals_type
      30             :    USE kinds,                           ONLY: dp
      31             :    USE kpoint_types,                    ONLY: kpoint_type
      32             :    USE libint_2c_3c,                    ONLY: libint_potential_type
      33             :    USE local_gemm_api,                  ONLY: local_gemm_ctxt_type
      34             :    USE message_passing,                 ONLY: mp_request_type
      35             :    USE qs_force_types,                  ONLY: qs_force_type
      36             :    USE qs_p_env_types,                  ONLY: qs_p_env_type
      37             : #include "./base/base_uses.f90"
      38             : 
      39             :    IMPLICIT NONE
      40             : 
      41             :    PRIVATE
      42             : 
      43             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'mp2_types'
      44             : 
      45             :    PUBLIC :: mp2_type, &
      46             :              integ_mat_buffer_type, &
      47             :              integ_mat_buffer_type_2D, &
      48             :              mp2_method_none, &
      49             :              mp2_method_direct, &
      50             :              mp2_method_gpw, &
      51             :              mp2_ri_optimize_basis, &
      52             :              ri_mp2_method_gpw, &
      53             :              ri_rpa_method_gpw, &
      54             :              ri_mp2_laplace, &
      55             :              init_TShPSC_lmax
      56             : 
      57             :    PUBLIC :: mp2_env_create, &
      58             :              mp2_env_release, &
      59             :              mp2_biel_type, &
      60             :              pair_list_type_mp2, &
      61             :              one_dim_int_array, &
      62             :              two_dim_int_array, &
      63             :              one_dim_real_array, &
      64             :              two_dim_real_array, &
      65             :              three_dim_real_array
      66             : 
      67             :    INTEGER, SAVE :: init_TShPSC_lmax = -1
      68             : 
      69             : ! TYPE definitions
      70             : 
      71             :    TYPE one_dim_int_array
      72             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: array
      73             :    END TYPE one_dim_int_array
      74             : 
      75             :    TYPE two_dim_int_array
      76             :       INTEGER, DIMENSION(:, :), ALLOCATABLE              :: array
      77             :    END TYPE two_dim_int_array
      78             : 
      79             :    TYPE one_dim_real_array
      80             :       REAL(KIND=dp), DIMENSION(:), ALLOCATABLE           :: array
      81             :    END TYPE one_dim_real_array
      82             : 
      83             :    TYPE two_dim_real_array
      84             :       REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE        :: array
      85             :    END TYPE two_dim_real_array
      86             : 
      87             :    TYPE three_dim_real_array
      88             :       REAL(KIND=dp), DIMENSION(:, :, :), ALLOCATABLE     :: array
      89             :    END TYPE three_dim_real_array
      90             : 
      91             :    TYPE mp2_biel_type
      92             :       INTEGER, DIMENSION(:, :), ALLOCATABLE              :: index_table
      93             :    END TYPE mp2_biel_type
      94             : 
      95             :    TYPE mp2_laplace_type
      96             :       INTEGER                                            :: n_quadrature = -1, &
      97             :                                                             num_integ_groups = -1
      98             :    END TYPE mp2_laplace_type
      99             : 
     100             :    TYPE mp2_direct_type
     101             :       LOGICAL                                            :: big_send = .FALSE.
     102             :    END TYPE
     103             : 
     104             :    TYPE mp2_gpw_type
     105             :       REAL(KIND=dp)                                      :: eps_grid = 0.0_dp, &
     106             :                                                             eps_filter = 0.0_dp, &
     107             :                                                             eps_pgf_orb_S = 0.0_dp
     108             :       INTEGER                                            :: print_level = 0
     109             :       REAL(KIND=dp)                                      :: cutoff = 0.0_dp, &
     110             :                                                             relative_cutoff = 0.0_dp
     111             :       INTEGER                                            :: size_lattice_sum = 0
     112             :    END TYPE
     113             : 
     114             :    TYPE ri_mp2_type
     115             :       INTEGER                                            :: block_size = 0, &
     116             :                                                             number_integration_groups = 0
     117             :       LOGICAL                                            :: print_dgemm_info = .FALSE.
     118             :    END TYPE ri_mp2_type
     119             : 
     120             :    TYPE ri_rpa_type
     121             :       INTEGER                                            :: rpa_num_quad_points = -1, &
     122             :                                                             rpa_num_integ_groups = -1, &
     123             :                                                             mm_style = wfc_mm_style_gemm
     124             :       TYPE(hfx_type), DIMENSION(:, :), POINTER           :: x_data => NULL()
     125             :       TYPE(section_vals_type), POINTER                   :: xc_section_primary => Null(), &
     126             :                                                             xc_section_aux => Null()
     127             :       LOGICAL                                            :: reuse_hfx = .FALSE., &
     128             :                                                             minimax_quad = .FALSE., &
     129             :                                                             do_ri_g0w0 = .FALSE., &
     130             :                                                             do_admm = .FALSE., &
     131             :                                                             do_rse = .FALSE., &
     132             :                                                             print_dgemm_info = .FALSE.
     133             : 
     134             :       ! GCC 8 has an issue with this being an ALLOCATABLE
     135             :       TYPE(dbcsr_type), DIMENSION(:), POINTER            :: mo_coeff_o => NULL(), &
     136             :                                                             mo_coeff_v => NULL()
     137             :       INTEGER                                            :: exchange_correction = rpa_exchange_none, &
     138             :                                                             exchange_block_size = -1
     139             :       LOGICAL                                            :: use_hfx_implementation = .FALSE.
     140             :       REAL(KIND=dp)                                      :: ener_exchange = 0.0_dp, &
     141             :                                                             rse_corr_diag = 0.0_dp, &
     142             :                                                             rse_corr = 0.0_dp, &
     143             :                                                             scale_rpa = 0.0_dp
     144             : 
     145             :       !LOGICAL                                            :: do_sigma = .FALSE.
     146             :       INTEGER                                            :: sigma_param = 0.0_dp
     147             :       REAL(KIND=dp)                                      :: e_sigma_corr = 0.0_dp
     148             : 
     149             :    END TYPE ri_rpa_type
     150             : 
     151             :    TYPE ri_rpa_im_time_type
     152             :       INTEGER                                            :: cut_memory = 0
     153             :       LOGICAL                                            :: memory_info = .FALSE., &
     154             :                                                             make_chi_pos_definite = .FALSE., &
     155             :                                                             make_overlap_mat_ao_pos_definite = .FALSE., &
     156             :                                                             trunc_coulomb_ri_x = .FALSE., &
     157             :                                                             keep_quad = .FALSE., &
     158             :                                                             do_kpoints_from_Gamma = .FALSE., &
     159             :                                                             do_extrapolate_kpoints = .FALSE.
     160             :       REAL(KIND=dp)                                      :: eps_filter = 0.0_dp, &
     161             :                                                             eps_filter_factor = 0.0_dp, &
     162             :                                                             eps_compress = 0.0_dp, &
     163             :                                                             exp_tailored_weights = 0.0_dp, &
     164             :                                                             regularization_RI = 0.0_dp, &
     165             :                                                             eps_eigval_S = 0.0_dp, &
     166             :                                                             eps_eigval_S_Gamma = 0.0_dp, &
     167             :                                                             rel_cutoff_trunc_coulomb_ri_x = 0.0_dp
     168             :       REAL(KIND=dp), DIMENSION(:), POINTER               :: tau_tj => NULL(), &
     169             :                                                             tau_wj => NULL(), &
     170             :                                                             tj => NULL(), &
     171             :                                                             wj => NULL()
     172             :       REAL(KIND=dp), DIMENSION(:, :), POINTER            :: weights_cos_tf_t_to_w => NULL(), &
     173             :                                                             weights_cos_tf_w_to_t => NULL()
     174             :       REAL(KIND=dp), DIMENSION(:), ALLOCATABLE           :: Eigenval_Gamma, &
     175             :                                                             wkp_V
     176             :       INTEGER                                            :: group_size_P = 0, &
     177             :                                                             group_size_3c = 0, &
     178             :                                                             kpoint_weights_W_method = kp_weights_W_auto, &
     179             :                                                             k_mesh_g_factor = 0
     180             :       INTEGER, DIMENSION(:), POINTER                     :: kp_grid => NULL()
     181             :       INTEGER, DIMENSION(3)                              :: kp_grid_extra = -1
     182             :       LOGICAL                                            :: do_im_time_kpoints = .FALSE.
     183             :       INTEGER                                            :: min_bsize = 0, &
     184             :                                                             min_bsize_mo = 0, &
     185             :                                                             nkp_orig = 0, &
     186             :                                                             nkp_extra = 0
     187             :       TYPE(kpoint_type), POINTER                         :: kpoints_G => NULL(), &
     188             :                                                             kpoints_Sigma => NULL(), &
     189             :                                                             kpoints_Sigma_no_xc => NULL()
     190             :       INTEGER, ALLOCATABLE, DIMENSION(:)                 :: starts_array_mc_RI, ends_array_mc_RI, &
     191             :                                                             starts_array_mc_block_RI, &
     192             :                                                             ends_array_mc_block_RI, &
     193             :                                                             starts_array_mc, ends_array_mc, &
     194             :                                                             starts_array_mc_block, &
     195             :                                                             ends_array_mc_block
     196             : 
     197             :    END TYPE ri_rpa_im_time_type
     198             : 
     199             :    TYPE ri_g0w0_type
     200             :       INTEGER                                            :: corr_mos_occ = 0, &
     201             :                                                             corr_mos_virt = 0, &
     202             :                                                             corr_mos_occ_beta = 0, &
     203             :                                                             corr_mos_virt_beta = 0, &
     204             :                                                             num_poles = 0, &
     205             :                                                             nparam_pade = 0, &
     206             :                                                             analytic_continuation = gw_pade_approx
     207             :       REAL(KIND=dp)                                      :: omega_max_fit = 0.0_dp
     208             :       INTEGER                                            :: crossing_search = ri_rpa_g0w0_crossing_z_shot
     209             :       REAL(KIND=dp)                                      :: fermi_level_offset = 0.0_dp
     210             :       INTEGER                                            :: iter_evGW = 0, &
     211             :                                                             iter_sc_GW0 = 0
     212             :       REAL(KIND=dp)                                      :: eps_iter = 0.0_dp
     213             :       LOGICAL                                            :: do_hedin_shift = .FALSE., &
     214             :                                                             do_ri_Sigma_x = .FALSE., &
     215             :                                                             do_periodic = .FALSE., &
     216             :                                                             print_self_energy = .FALSE.
     217             :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :)     :: vec_Sigma_x_minus_vxc_gw
     218             :       INTEGER, DIMENSION(:), POINTER                     :: kp_grid => NULL(), &
     219             :                                                             kp_grid_Sigma => NULL()
     220             :       INTEGER                                            :: num_kp_grids = 0
     221             :       REAL(KIND=dp)                                      :: eps_kpoint = 0.0_dp
     222             :       LOGICAL                                            :: do_mo_coeff_gamma = .FALSE., &
     223             :                                                             do_average_deg_levels = .FALSE.
     224             :       REAL(KIND=dp)                                      :: eps_eigenval = 0.0_dp
     225             :       LOGICAL                                            :: do_extra_kpoints = .FALSE., &
     226             :                                                             do_aux_bas_gw = .FALSE.
     227             :       REAL(KIND=dp)                                      :: frac_aux_mos = 0.0_dp
     228             :       INTEGER                                            :: num_omega_points = 0
     229             :       LOGICAL                                            :: do_ic_model = .FALSE., &
     230             :                                                             print_ic_values = .FALSE.
     231             :       REAL(KIND=dp)                                      :: eps_dist = 0.0_dp
     232             :       TYPE(one_dim_real_array), DIMENSION(2)             :: ic_corr_list = one_dim_real_array(NULL())
     233             :       INTEGER                                            :: print_exx = 0
     234             :       LOGICAL                                            :: do_gamma_only_sigma = .FALSE.
     235             :       LOGICAL                                            :: update_xc_energy = .FALSE., &
     236             :                                                             do_kpoints_Sigma = .FALSE., &
     237             :                                                             print_local_bandgap = .FALSE.
     238             :       INTEGER                                            :: n_kp_in_kp_line = 0, &
     239             :                                                             n_special_kp = 0, &
     240             :                                                             nkp_self_energy = 0, &
     241             :                                                             nkp_self_energy_special_kp = 0, &
     242             :                                                             nkp_self_energy_monkh_pack = 0, &
     243             :                                                             soc_type = soc_none
     244             :       REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :)        :: xkp_special_kp
     245             :       TYPE(dbcsr_p_type), DIMENSION(:), ALLOCATABLE      :: matrix_sigma_x_minus_vxc, &
     246             :                                                             matrix_ks
     247             :       REAL(KIND=dp)                                      :: broadening_print_loc_bandgap = 0.0_dp, &
     248             :                                                             energy_window_print_loc_bandgap = 0.0_dp, &
     249             :                                                             ldos_thresh_print_loc_bandgap = 0.0_dp, &
     250             :                                                             energy_spacing_print_loc_bandgap = 0.0_dp, &
     251             :                                                             regularization_minimax = 0.0_dp, &
     252             :                                                             soc_energy_window = 0.0_dp
     253             :       INTEGER, DIMENSION(:), POINTER                     :: stride_loc_bandgap => NULL()
     254             : 
     255             :       !GW_DOS
     256             :       REAL(KIND=dp)                                      :: dos_upper = 0.0_dp, &
     257             :                                                             dos_lower = 0.0_dp, &
     258             :                                                             dos_prec = 0.0_dp, &
     259             :                                                             dos_eta = 0.0_dp
     260             :       INTEGER                                            :: max_level_self_energy = 0, &
     261             :                                                             min_level_self_energy = 0, &
     262             :                                                             dos_min = 0, &
     263             :                                                             dos_max = 0
     264             :    END TYPE ri_g0w0_type
     265             : 
     266             :    TYPE ri_basis_opt
     267             :       REAL(KIND=dp)                                      :: DI_rel = 0.0_dp, &
     268             :                                                             DRI = 0.0_dp, &
     269             :                                                             eps_step = 0.0_dp
     270             :       INTEGER                                            :: max_num_iter = 0, &
     271             :                                                             basis_quality = 0
     272             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: RI_nset_per_l
     273             :    END TYPE ri_basis_opt
     274             : 
     275             :    TYPE grad_util
     276             :       TYPE(two_dim_real_array), DIMENSION(2)             :: P_ij = two_dim_real_array(NULL()), &
     277             :                                                             P_ab = two_dim_real_array(NULL())
     278             :       TYPE(three_dim_real_array), DIMENSION(2)           :: Gamma_P_ia = three_dim_real_array(NULL())
     279             :       REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE        :: operator_half, &
     280             :                                                             PQ_half, &
     281             :                                                             Gamma_PQ, &
     282             :                                                             Gamma_PQ_2
     283             :       TYPE(dbcsr_p_type), DIMENSION(:, :), ALLOCATABLE   :: G_P_ia
     284             :       TYPE(dbcsr_p_type), DIMENSION(:), ALLOCATABLE      :: mo_coeff_o, &
     285             :                                                             mo_coeff_v
     286             :       TYPE(cp_fm_type), ALLOCATABLE, DIMENSION(:)        :: P_mo, W_mo, L_jb
     287             :       REAL(KIND=dp)                                      :: cphf_eps_conv = 0.0_dp, &
     288             :                                                             scale_step_size = 0.0_dp
     289             :       INTEGER                                            :: cphf_max_num_iter = 0, &
     290             :                                                             z_solver_method = 0, &
     291             :                                                             cphf_restart = 0
     292             :       LOGICAL                                            :: enforce_decrease = .FALSE., &
     293             :                                                             recalc_residual = .FALSE., &
     294             :                                                             polak_ribiere = .FALSE.
     295             :       TYPE(qs_p_env_type), POINTER                       :: p_env => NULL()
     296             :       TYPE(qs_force_type), DIMENSION(:), POINTER         :: mp2_force => NULL()
     297             :       REAL(KIND=dp), DIMENSION(3, 3)                     :: mp2_virial = 0.0_dp
     298             :       REAL(dp)                                           :: eps_canonical = 0.0_dp
     299             :       LOGICAL                                            :: free_hfx_buffer = .FALSE.
     300             :       INTEGER                                            :: dot_blksize = 0
     301             :       INTEGER                                            :: max_parallel_comm = 0
     302             :    END TYPE grad_util
     303             : 
     304             :    TYPE bse_type
     305             :       INTEGER                                            :: bse_spin_config = 0, &
     306             :                                                             bse_diag_method = 0, &
     307             :                                                             flag_tda = 0, &
     308             :                                                             num_exc_en = 0, &
     309             :                                                             num_print_exc = 0, &
     310             :                                                             num_print_exc_descr = 0, &
     311             :                                                             num_add_start_z_space = 0, &
     312             :                                                             fac_max_z_space = 0, &
     313             :                                                             num_new_t = 0, &
     314             :                                                             num_davidson_iter = 0, &
     315             :                                                             davidson_abort_cond = 0
     316             :       REAL(KIND=dp)                                      :: eps_res = 0.0_dp, &
     317             :                                                             eps_exc_en = 0.0_dp, &
     318             :                                                             eps_x = 0.0_dp, &
     319             :                                                             bse_cutoff_occ = 0.0_dp, &
     320             :                                                             bse_cutoff_empty = 0.0_dp, &
     321             :                                                             z_space_energy_cutoff = 0.0_dp
     322             :       LOGICAL                                            :: do_bse = .FALSE., &
     323             :                                                             bse_debug_print = .FALSE., &
     324             :                                                             print_directional_exc_descr = .FALSE.
     325             :       !BSE optical spectrum
     326             :       REAL(KIND=dp)                                      :: bse_spectrum_freq_step_size = 0.0_dp, &
     327             :                                                             bse_spectrum_freq_start = 0.0_dp, &
     328             :                                                             bse_spectrum_freq_end = 0.0_dp
     329             :       LOGICAL                                            :: bse_print_spectrum = .FALSE.
     330             :       REAL(KIND=dp), DIMENSION(:), POINTER               :: bse_eta_spectrum_list => NULL()
     331             : 
     332             :       !BSE NTO prints
     333             :       LOGICAL                                            :: do_nto_analysis = .FALSE., &
     334             :                                                             explicit_nto_list = .FALSE.
     335             :       REAL(KIND=dp)                                      :: eps_nto_eigval = 0.0_dp, &
     336             :                                                             eps_nto_osc_str = 0.0_dp
     337             :       INTEGER                                            :: num_print_exc_ntos = 0
     338             :       INTEGER, DIMENSION(:), POINTER                     :: bse_nto_state_list => NULL()
     339             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: bse_nto_state_list_final
     340             :    END TYPE bse_type
     341             : 
     342             :    TYPE mp2_type
     343             :       INTEGER                                            :: method = mp2_method_none
     344             :       TYPE(mp2_laplace_type)                             :: ri_laplace = mp2_laplace_type()
     345             :       TYPE(mp2_direct_type)                              :: direct_canonical = mp2_direct_type()
     346             :       TYPE(libint_potential_type)                        :: potential_parameter = libint_potential_type()
     347             :       TYPE(mp2_gpw_type)                                 :: mp2_gpw = mp2_gpw_type()
     348             :       TYPE(ri_mp2_type)                                  :: ri_mp2 = ri_mp2_type()
     349             :       TYPE(ri_rpa_type)                                  :: ri_rpa = ri_rpa_type()
     350             :       ! There is a bug with some older compilers preventing requiring an explicit initialization of allocatable components
     351             : #if defined(FTN_NO_DEFAULT_INIT)
     352             :       TYPE(ri_rpa_im_time_type)                          :: ri_rpa_im_time = ri_rpa_im_time_type(Eigenval_Gamma=NULL(), &
     353             :                                                                                                  wkp_V=NULL(), &
     354             :                                                                                                  starts_array_mc_RI=NULL(), &
     355             :                                                                                                  ends_array_mc_RI=NULL(), &
     356             :                                                                                                  starts_array_mc_block_RI=NULL(), &
     357             :                                                                                                  ends_array_mc_block_RI=NULL(), &
     358             :                                                                                      starts_array_mc=NULL(), ends_array_mc=NULL(), &
     359             :                                                                                                  starts_array_mc_block=NULL(), &
     360             :                                                                                                  ends_array_mc_block=NULL())
     361             :       TYPE(ri_g0w0_type)                                 :: ri_g0w0 = ri_g0w0_type(vec_Sigma_x_minus_vxc_gw=NULL(), &
     362             :                                                                                    xkp_special_kp=NULL(), &
     363             :                                                                                    matrix_sigma_x_minus_vxc=NULL(), &
     364             :                                                                                    matrix_ks=NULL())
     365             :       TYPE(ri_basis_opt)                                 :: ri_opt_param = ri_basis_opt(RI_nset_per_l=NULL())
     366             :       TYPE(grad_util)                                    :: ri_grad = grad_util(operator_half=NULL(), &
     367             :                                                                                 PQ_half=NULL(), &
     368             :                                                                                 Gamma_PQ=NULL(), &
     369             :                                                                                 Gamma_PQ_2=NULL(), &
     370             :                                                                                 G_P_ia=NULL(), &
     371             :                                                                                 mo_coeff_o=NULL(), &
     372             :                                                                                 mo_coeff_v=NULL(), &
     373             :                                                                                 P_mo=NULL(), W_mo=NULL(), L_jb=NULL())
     374             :       TYPE(bse_type)                                     :: bse = bse_type(bse_nto_state_list_final=NULL())
     375             : #else
     376             :       TYPE(ri_rpa_im_time_type)                          :: ri_rpa_im_time = ri_rpa_im_time_type()
     377             :       TYPE(ri_g0w0_type)                                 :: ri_g0w0 = ri_g0w0_type()
     378             :       TYPE(ri_basis_opt)                                 :: ri_opt_param = ri_basis_opt()
     379             :       TYPE(grad_util)                                    :: ri_grad = grad_util()
     380             :       TYPE(bse_type)                                     :: bse = bse_type()
     381             : #endif
     382             :       REAL(KIND=dp)                                      :: mp2_memory = 0.0_dp, &
     383             :                                                             scale_S = 0.0_dp, &
     384             :                                                             scale_T = 0.0_dp
     385             :       INTEGER                                            :: mp2_num_proc = 0
     386             :       INTEGER                                            :: block_size_row = 0
     387             :       INTEGER                                            :: block_size_col = 0
     388             :       LOGICAL                                            :: calc_PQ_cond_num = .FALSE.
     389             :       LOGICAL                                            :: hf_fail = .FALSE.
     390             :       LOGICAL                                            :: p_screen = .FALSE.
     391             :       LOGICAL                                            :: not_last_hfx = .FALSE.
     392             :       LOGICAL                                            :: do_im_time = .FALSE.
     393             :       INTEGER                                            :: eri_method = eri_default
     394             :       TYPE(cp_eri_mme_param), POINTER                    :: eri_mme_param => NULL()
     395             :       INTEGER, DIMENSION(:), POINTER                     :: eri_blksize => NULL()
     396             :       LOGICAL                                            :: do_svd = .FALSE.
     397             :       REAL(KIND=dp)                                      :: eps_range = 0.0_dp
     398             :       TYPE(libint_potential_type)                        :: ri_metric = libint_potential_type()
     399             :       TYPE(local_gemm_ctxt_type)                         :: local_gemm_ctx = local_gemm_ctxt_type()
     400             :       REAL(dp)                                           :: e_gap = 0.0_dp, &
     401             :                                                             e_range = 0.0_dp
     402             :    END TYPE mp2_type
     403             : 
     404             :    TYPE integ_mat_buffer_type
     405             :       REAL(KIND=dp), DIMENSION(:), ALLOCATABLE           :: msg
     406             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: sizes
     407             :       INTEGER, DIMENSION(:, :), ALLOCATABLE              :: indx
     408             :       INTEGER                                            :: proc = -1
     409             :       TYPE(mp_request_type)                              :: msg_req = mp_request_type()
     410             :    END TYPE integ_mat_buffer_type
     411             : 
     412             :    TYPE integ_mat_buffer_type_2D
     413             :       REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE        :: msg
     414             :       INTEGER                                            :: proc = -1
     415             :       TYPE(mp_request_type)                              :: msg_req = mp_request_type()
     416             :    END TYPE integ_mat_buffer_type_2D
     417             : 
     418             :    TYPE pair_list_type_mp2
     419             :       TYPE(pair_list_element_type), DIMENSION(:), &
     420             :          ALLOCATABLE                                     :: elements
     421             :       INTEGER                                            :: n_element = 0
     422             :    END TYPE pair_list_type_mp2
     423             : 
     424             : CONTAINS
     425             : 
     426             : ! **************************************************************************************************
     427             : !> \brief ...
     428             : !> \param mp2_env ...
     429             : ! **************************************************************************************************
     430         466 :    SUBROUTINE mp2_env_release(mp2_env)
     431             :       TYPE(mp2_type)                                     :: mp2_env
     432             : 
     433             :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'mp2_env_release'
     434             : 
     435             :       INTEGER                                            :: handle
     436             : 
     437         466 :       CALL timeset(routineN, handle)
     438             : 
     439             :       ! release the HFX section for the EXX calculation
     440         466 :       IF (.NOT. mp2_env%ri_rpa%reuse_hfx) THEN
     441         448 :          IF (ASSOCIATED(mp2_env%ri_rpa%x_data)) CALL hfx_release(mp2_env%ri_rpa%x_data)
     442             :       END IF
     443         466 :       IF (ASSOCIATED(mp2_env%ri_rpa%xc_section_aux)) CALL section_vals_release(mp2_env%ri_rpa%xc_section_aux)
     444         466 :       IF (ASSOCIATED(mp2_env%ri_rpa%xc_section_primary)) CALL section_vals_release(mp2_env%ri_rpa%xc_section_primary)
     445             : 
     446         466 :       IF (mp2_env%eri_method .EQ. do_eri_mme) CALL cp_eri_mme_finalize(mp2_env%eri_mme_param)
     447         466 :       IF (ASSOCIATED(mp2_env%eri_mme_param)) DEALLOCATE (mp2_env%eri_mme_param)
     448         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tau_tj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tau_tj)
     449         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tau_wj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tau_wj)
     450         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tj)
     451         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%wj)) DEALLOCATE (mp2_env%ri_rpa_im_time%wj)
     452         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%weights_cos_tf_t_to_w)) DEALLOCATE (mp2_env%ri_rpa_im_time%weights_cos_tf_t_to_w)
     453         466 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%weights_cos_tf_w_to_t)) DEALLOCATE (mp2_env%ri_rpa_im_time%weights_cos_tf_w_to_t)
     454             : 
     455         466 :       CALL mp2_env%local_gemm_ctx%destroy()
     456             : 
     457         466 :       CALL timestop(handle)
     458             : 
     459         466 :    END SUBROUTINE mp2_env_release
     460             : 
     461             : ! **************************************************************************************************
     462             : !> \brief ...
     463             : !> \param mp2_env ...
     464             : ! **************************************************************************************************
     465         466 :    SUBROUTINE mp2_env_create(mp2_env)
     466             :       TYPE(mp2_type), POINTER                            :: mp2_env
     467             : 
     468             :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'mp2_env_create'
     469             : 
     470             :       INTEGER                                            :: handle
     471             : 
     472         466 :       CALL timeset(routineN, handle)
     473             : 
     474         466 :       CPASSERT(.NOT. ASSOCIATED(mp2_env))
     475             : 
     476       11184 :       ALLOCATE (mp2_env)
     477             : 
     478         466 :       NULLIFY (mp2_env%ri_rpa%x_data)
     479             : 
     480         466 :       CALL timestop(handle)
     481             : 
     482         466 :    END SUBROUTINE mp2_env_create
     483             : 
     484           0 : END MODULE mp2_types

Generated by: LCOV version 1.15