LCOV - code coverage report
Current view: top level - src - mp2_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 24 25 96.0 %
Date: 2024-12-21 06:28:57 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             :                                                             screening_method = 0, &
     312             :                                                             num_add_start_z_space = 0, &
     313             :                                                             fac_max_z_space = 0, &
     314             :                                                             num_new_t = 0, &
     315             :                                                             num_davidson_iter = 0, &
     316             :                                                             davidson_abort_cond = 0
     317             :       REAL(KIND=dp)                                      :: eps_res = 0.0_dp, &
     318             :                                                             eps_exc_en = 0.0_dp, &
     319             :                                                             eps_x = 0.0_dp, &
     320             :                                                             screening_factor = 0.0_dp, &
     321             :                                                             bse_cutoff_occ = 0.0_dp, &
     322             :                                                             bse_cutoff_empty = 0.0_dp, &
     323             :                                                             z_space_energy_cutoff = 0.0_dp
     324             :       LOGICAL                                            :: do_bse = .FALSE., &
     325             :                                                             bse_debug_print = .FALSE., &
     326             :                                                             print_directional_exc_descr = .FALSE., &
     327             :                                                             use_ks_energies = .FALSE.
     328             :       !BSE optical spectrum
     329             :       REAL(KIND=dp)                                      :: bse_spectrum_freq_step_size = 0.0_dp, &
     330             :                                                             bse_spectrum_freq_start = 0.0_dp, &
     331             :                                                             bse_spectrum_freq_end = 0.0_dp
     332             :       LOGICAL                                            :: bse_print_spectrum = .FALSE.
     333             :       REAL(KIND=dp), DIMENSION(:), POINTER               :: bse_eta_spectrum_list => NULL()
     334             : 
     335             :       !BSE NTO prints
     336             :       LOGICAL                                            :: do_nto_analysis = .FALSE., &
     337             :                                                             explicit_nto_list = .FALSE.
     338             :       REAL(KIND=dp)                                      :: eps_nto_eigval = 0.0_dp, &
     339             :                                                             eps_nto_osc_str = 0.0_dp
     340             :       INTEGER                                            :: num_print_exc_ntos = 0
     341             :       INTEGER, DIMENSION(:), POINTER                     :: bse_nto_state_list => NULL()
     342             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: bse_nto_state_list_final
     343             :    END TYPE bse_type
     344             : 
     345             :    TYPE mp2_type
     346             :       INTEGER                                            :: method = mp2_method_none
     347             :       TYPE(mp2_laplace_type)                             :: ri_laplace = mp2_laplace_type()
     348             :       TYPE(mp2_direct_type)                              :: direct_canonical = mp2_direct_type()
     349             :       TYPE(libint_potential_type)                        :: potential_parameter = libint_potential_type()
     350             :       TYPE(mp2_gpw_type)                                 :: mp2_gpw = mp2_gpw_type()
     351             :       TYPE(ri_mp2_type)                                  :: ri_mp2 = ri_mp2_type()
     352             :       TYPE(ri_rpa_type)                                  :: ri_rpa = ri_rpa_type()
     353             :       ! There is a bug with some older compilers preventing requiring an explicit initialization of allocatable components
     354             : #if defined(FTN_NO_DEFAULT_INIT)
     355             :       TYPE(ri_rpa_im_time_type)                          :: ri_rpa_im_time = ri_rpa_im_time_type(Eigenval_Gamma=NULL(), &
     356             :                                                                                                  wkp_V=NULL(), &
     357             :                                                                                                  starts_array_mc_RI=NULL(), &
     358             :                                                                                                  ends_array_mc_RI=NULL(), &
     359             :                                                                                                  starts_array_mc_block_RI=NULL(), &
     360             :                                                                                                  ends_array_mc_block_RI=NULL(), &
     361             :                                                                                      starts_array_mc=NULL(), ends_array_mc=NULL(), &
     362             :                                                                                                  starts_array_mc_block=NULL(), &
     363             :                                                                                                  ends_array_mc_block=NULL())
     364             :       TYPE(ri_g0w0_type)                                 :: ri_g0w0 = ri_g0w0_type(vec_Sigma_x_minus_vxc_gw=NULL(), &
     365             :                                                                                    xkp_special_kp=NULL(), &
     366             :                                                                                    matrix_sigma_x_minus_vxc=NULL(), &
     367             :                                                                                    matrix_ks=NULL())
     368             :       TYPE(ri_basis_opt)                                 :: ri_opt_param = ri_basis_opt(RI_nset_per_l=NULL())
     369             :       TYPE(grad_util)                                    :: ri_grad = grad_util(operator_half=NULL(), &
     370             :                                                                                 PQ_half=NULL(), &
     371             :                                                                                 Gamma_PQ=NULL(), &
     372             :                                                                                 Gamma_PQ_2=NULL(), &
     373             :                                                                                 G_P_ia=NULL(), &
     374             :                                                                                 mo_coeff_o=NULL(), &
     375             :                                                                                 mo_coeff_v=NULL(), &
     376             :                                                                                 P_mo=NULL(), W_mo=NULL(), L_jb=NULL())
     377             :       TYPE(bse_type)                                     :: bse = bse_type(bse_nto_state_list_final=NULL())
     378             : #else
     379             :       TYPE(ri_rpa_im_time_type)                          :: ri_rpa_im_time = ri_rpa_im_time_type()
     380             :       TYPE(ri_g0w0_type)                                 :: ri_g0w0 = ri_g0w0_type()
     381             :       TYPE(ri_basis_opt)                                 :: ri_opt_param = ri_basis_opt()
     382             :       TYPE(grad_util)                                    :: ri_grad = grad_util()
     383             :       TYPE(bse_type)                                     :: bse = bse_type()
     384             : #endif
     385             :       REAL(KIND=dp)                                      :: mp2_memory = 0.0_dp, &
     386             :                                                             scale_S = 0.0_dp, &
     387             :                                                             scale_T = 0.0_dp
     388             :       INTEGER                                            :: mp2_num_proc = 0
     389             :       INTEGER                                            :: block_size_row = 0
     390             :       INTEGER                                            :: block_size_col = 0
     391             :       LOGICAL                                            :: calc_PQ_cond_num = .FALSE.
     392             :       LOGICAL                                            :: hf_fail = .FALSE.
     393             :       LOGICAL                                            :: p_screen = .FALSE.
     394             :       LOGICAL                                            :: not_last_hfx = .FALSE.
     395             :       LOGICAL                                            :: do_im_time = .FALSE.
     396             :       INTEGER                                            :: eri_method = eri_default
     397             :       TYPE(cp_eri_mme_param), POINTER                    :: eri_mme_param => NULL()
     398             :       INTEGER, DIMENSION(:), POINTER                     :: eri_blksize => NULL()
     399             :       LOGICAL                                            :: do_svd = .FALSE.
     400             :       REAL(KIND=dp)                                      :: eps_range = 0.0_dp
     401             :       TYPE(libint_potential_type)                        :: ri_metric = libint_potential_type()
     402             :       TYPE(local_gemm_ctxt_type)                         :: local_gemm_ctx = local_gemm_ctxt_type()
     403             :       REAL(dp)                                           :: e_gap = 0.0_dp, &
     404             :                                                             e_range = 0.0_dp
     405             :    END TYPE mp2_type
     406             : 
     407             :    TYPE integ_mat_buffer_type
     408             :       REAL(KIND=dp), DIMENSION(:), ALLOCATABLE           :: msg
     409             :       INTEGER, DIMENSION(:), ALLOCATABLE                 :: sizes
     410             :       INTEGER, DIMENSION(:, :), ALLOCATABLE              :: indx
     411             :       INTEGER                                            :: proc = -1
     412             :       TYPE(mp_request_type)                              :: msg_req = mp_request_type()
     413             :    END TYPE integ_mat_buffer_type
     414             : 
     415             :    TYPE integ_mat_buffer_type_2D
     416             :       REAL(KIND=dp), DIMENSION(:, :), ALLOCATABLE        :: msg
     417             :       INTEGER                                            :: proc = -1
     418             :       TYPE(mp_request_type)                              :: msg_req = mp_request_type()
     419             :    END TYPE integ_mat_buffer_type_2D
     420             : 
     421             :    TYPE pair_list_type_mp2
     422             :       TYPE(pair_list_element_type), DIMENSION(:), &
     423             :          ALLOCATABLE                                     :: elements
     424             :       INTEGER                                            :: n_element = 0
     425             :    END TYPE pair_list_type_mp2
     426             : 
     427             : CONTAINS
     428             : 
     429             : ! **************************************************************************************************
     430             : !> \brief ...
     431             : !> \param mp2_env ...
     432             : ! **************************************************************************************************
     433         476 :    SUBROUTINE mp2_env_release(mp2_env)
     434             :       TYPE(mp2_type)                                     :: mp2_env
     435             : 
     436             :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'mp2_env_release'
     437             : 
     438             :       INTEGER                                            :: handle
     439             : 
     440         476 :       CALL timeset(routineN, handle)
     441             : 
     442             :       ! release the HFX section for the EXX calculation
     443         476 :       IF (.NOT. mp2_env%ri_rpa%reuse_hfx) THEN
     444         458 :          IF (ASSOCIATED(mp2_env%ri_rpa%x_data)) CALL hfx_release(mp2_env%ri_rpa%x_data)
     445             :       END IF
     446         476 :       IF (ASSOCIATED(mp2_env%ri_rpa%xc_section_aux)) CALL section_vals_release(mp2_env%ri_rpa%xc_section_aux)
     447         476 :       IF (ASSOCIATED(mp2_env%ri_rpa%xc_section_primary)) CALL section_vals_release(mp2_env%ri_rpa%xc_section_primary)
     448             : 
     449         476 :       IF (mp2_env%eri_method .EQ. do_eri_mme) CALL cp_eri_mme_finalize(mp2_env%eri_mme_param)
     450         476 :       IF (ASSOCIATED(mp2_env%eri_mme_param)) DEALLOCATE (mp2_env%eri_mme_param)
     451         476 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tau_tj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tau_tj)
     452         476 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tau_wj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tau_wj)
     453         476 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%tj)) DEALLOCATE (mp2_env%ri_rpa_im_time%tj)
     454         476 :       IF (ASSOCIATED(mp2_env%ri_rpa_im_time%wj)) DEALLOCATE (mp2_env%ri_rpa_im_time%wj)
     455         476 :       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)
     456         476 :       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)
     457             : 
     458         476 :       CALL mp2_env%local_gemm_ctx%destroy()
     459             : 
     460         476 :       CALL timestop(handle)
     461             : 
     462         476 :    END SUBROUTINE mp2_env_release
     463             : 
     464             : ! **************************************************************************************************
     465             : !> \brief ...
     466             : !> \param mp2_env ...
     467             : ! **************************************************************************************************
     468         476 :    SUBROUTINE mp2_env_create(mp2_env)
     469             :       TYPE(mp2_type), POINTER                            :: mp2_env
     470             : 
     471             :       CHARACTER(LEN=*), PARAMETER                        :: routineN = 'mp2_env_create'
     472             : 
     473             :       INTEGER                                            :: handle
     474             : 
     475         476 :       CALL timeset(routineN, handle)
     476             : 
     477         476 :       CPASSERT(.NOT. ASSOCIATED(mp2_env))
     478             : 
     479       11424 :       ALLOCATE (mp2_env)
     480             : 
     481         476 :       NULLIFY (mp2_env%ri_rpa%x_data)
     482             : 
     483         476 :       CALL timestop(handle)
     484             : 
     485         476 :    END SUBROUTINE mp2_env_create
     486             : 
     487           0 : END MODULE mp2_types

Generated by: LCOV version 1.15