Skip to content

Commit

Permalink
separate internal filter for low-scaling methods; adapt GW regtest (#828
Browse files Browse the repository at this point in the history
)

* separate internal filter for low-scaling methods; adapt GW regtest with 30 minimax points to have a larger minimax range and print warning in case minimax range is small (with all-electron GAPW calculations and large basis sets, the minimax range is large in every case)

* update references
  • Loading branch information
JWilhelm committed Mar 13, 2020
1 parent 40b9ef4 commit 4755e83
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 77 deletions.
26 changes: 15 additions & 11 deletions src/common/bibliography.F
Original file line number Diff line number Diff line change
Expand Up @@ -4355,16 +4355,17 @@ SUBROUTINE add_all_references()
" Del Ben, Mauro", &
" Hutter, Juerg", &
"TI GW in the Gaussian and plane waves scheme with application to linear acenes", &
"JO J. Chem. Theory Comput.", &
"SP 3623", &
"SO JOURNAL OF CHEMICAL THEORY AND COMPUTATION", &
"PD FEB", &
"BP 3623", &
"EP 3635", &
"PY 2016", &
"VL 12", &
"DI 10.1021/acs.jctc.6b00380", &
"ER"), &
DOI="10.1021/acs.jctc.6b00380")

CALL add_reference(key=Wilhelm2016a, ISI_record=s2a( &
CALL add_reference(key=Wilhelm2016b, ISI_record=s2a( &
"PT J", &
"AU Wilhelm, J", &
" Seewald, P", &
Expand All @@ -4376,31 +4377,33 @@ SUBROUTINE add_all_references()
" Hutter, Juerg", &
"TI Large-Scale Cubic-Scaling Random Phase Approximation Correlation", &
"Energy Calculations Using a Gaussian Basis", &
"JO J. Chem. Theory Comput.", &
"SP 5851", &
"SO JOURNAL OF CHEMICAL THEORY AND COMPUTATION", &
"PD FEB", &
"BP 5851", &
"EP 5859", &
"PY 2016", &
"VL 12", &
"DI 10.1021/acs.jctc.6b00840", &
"ER"), &
DOI="10.1021/acs.jctc.6b00840")

CALL add_reference(key=Wilhelm2016a, ISI_record=s2a( &
CALL add_reference(key=Wilhelm2017, ISI_record=s2a( &
"PT J", &
"AU Wilhelm, J", &
" Hutter, J", &
"AF Wilhelm, Jan", &
" Hutter, Juerg", &
"TI Periodic GW calculations in the Gaussian and plane-waves scheme", &
"JO Phys. Rev. B", &
"SP 235123", &
"SO PHYSICAL REVIEW B", &
"PD FEB", &
"BP 235123", &
"PY 2017", &
"VL 95", &
"DI 10.1103/PhysRevB.95.235123", &
"ER"), &
DOI="10.1103/PhysRevB.95.235123")

CALL add_reference(key=Wilhelm2016a, ISI_record=s2a( &
CALL add_reference(key=Wilhelm2018, ISI_record=s2a( &
"PT J", &
"AU Wilhelm, J", &
" Golze, D", &
Expand All @@ -4413,8 +4416,9 @@ SUBROUTINE add_all_references()
" Hutter, Juerg", &
" Pignedoli, Carlo A.", &
"TI Toward GW calculations on thousands of atoms", &
"JO J. Phys. Chem. Lett.", &
"SP 306", &
"SO JOURNAL OF PHYSICAL CHEMISTRY LETTERS", &
"PD FEB", &
"BP 306", &
"EP 312", &
"PY 2018", &
"VL 9", &
Expand Down
12 changes: 5 additions & 7 deletions src/input_cp2k_mp2.F
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
!> \author MDB
! **************************************************************************************************
MODULE input_cp2k_mp2
USE bibliography, ONLY: Bates2013,&
DelBen2012,&
DelBen2013,&
DelBen2015,&
DelBen2015b,&
Rybkin2016
USE bibliography, ONLY: &
Bates2013, DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, Wilhelm2016a, &
Wilhelm2016b, Wilhelm2017, Wilhelm2018
USE cp_eri_mme_interface, ONLY: create_eri_mme_section
USE cp_output_handling, ONLY: add_last_numeric,&
cp_print_key_section_create,&
Expand Down Expand Up @@ -76,7 +73,8 @@ SUBROUTINE create_mp2_section(section)
description="Sets up the wavefunction-based correlation methods as MP2, "// &
"RI-MP2, RI-SOS-MP2, RI-RPA and GW (inside RI-RPA). ", &
n_keywords=4, n_subsections=7, repeats=.TRUE., &
citations=(/DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016/))
citations=(/DelBen2012, DelBen2013, DelBen2015, DelBen2015b, Rybkin2016, &
Wilhelm2016a, Wilhelm2016b, Wilhelm2017, Wilhelm2018/))

NULLIFY (keyword, subsection)

Expand Down
5 changes: 2 additions & 3 deletions src/mp2_gpw.F
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T
t_3c_M, t_3c_O, &
starts_array_mc, ends_array_mc, &
starts_array_mc_block, ends_array_mc_block, &
mp2_env%mp2_gpw%eps_filter, BIb_C_beta, homo_beta, Eigenval_beta, &
BIb_C_beta, homo_beta, Eigenval_beta, &
gd_B_virtual_beta, &
mo_coeff_beta, BIb_C_gw_beta, gw_corr_lev_occ_beta, gw_corr_lev_virt_beta)

Expand All @@ -572,8 +572,7 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T
mat_P_global, &
t_3c_M, t_3c_O, &
starts_array_mc, ends_array_mc, &
starts_array_mc_block, ends_array_mc_block, &
mp2_env%mp2_gpw%eps_filter)
starts_array_mc_block, ends_array_mc_block)

IF (mp2_env%ri_rpa%do_rse) &
CALL rse_energy(qs_env, mp2_env, para_env, dft_control, &
Expand Down
11 changes: 6 additions & 5 deletions src/mp2_integrals.F
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd
CALL mp_sync(para_env%group) ! sync to see memory output
! in case we do imaginary time, we need the overlap matrix (alpha beta P)
! in case we do imaginary time, we need the overlap tensor (alpha beta P) or trunc. Coulomb tensor
IF (.NOT. do_im_time) THEN
ALLOCATE (sub_proc_map(-para_env_sub%num_pe:2*para_env_sub%num_pe - 1))
Expand Down Expand Up @@ -722,6 +722,7 @@ SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd
DEALLOCATE (sub_proc_map)
! imag. time = low-scaling SOS-MP2, RPA, GW
ELSE
impose_split = .NOT. qs_env%mp2_env%ri_rpa_im_time%group_size_internal
Expand Down Expand Up @@ -854,7 +855,7 @@ SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd
DO cm = 1, cut_memory
CALL build_3c_integrals(t_3c_overl_int, &
qs_env%mp2_env%mp2_gpw%eps_filter/2, &
qs_env%mp2_env%ri_rpa_im_time%eps_filter/2, &
qs_env, &
nl_3c, &
basis_i=basis_set_ri_aux, &
Expand All @@ -870,7 +871,7 @@ SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd
CALL dbcsr_t_copy(t_3c_overl_int(i, j), t_3c_O(i, j), order=[1, 3, 2], &
summation=.TRUE., move_data=.TRUE.)
CALL dbcsr_t_clear(t_3c_overl_int(i, j))
CALL dbcsr_t_filter(t_3c_O(i, j), qs_env%mp2_env%mp2_gpw%eps_filter/2)
CALL dbcsr_t_filter(t_3c_O(i, j), qs_env%mp2_env%ri_rpa_im_time%eps_filter/2)
ENDDO
ENDDO
Expand All @@ -891,14 +892,14 @@ SUBROUTINE mp2_ri_gpw_compute_in(BIb_C, BIb_C_gw, BIb_C_bse_ij, BIb_C_bse_ab, gd
DO kcell = 1, jcell
CALL dbcsr_t_copy(t_3c_O(jcell, kcell), t_3c_tmp)
CALL dbcsr_t_copy(t_3c_tmp, t_3c_O(kcell, jcell), order=[1, 3, 2], summation=.TRUE., move_data=.TRUE.)
CALL dbcsr_t_filter(t_3c_O(kcell, jcell), qs_env%mp2_env%mp2_gpw%eps_filter)
CALL dbcsr_t_filter(t_3c_O(kcell, jcell), qs_env%mp2_env%ri_rpa_im_time%eps_filter)
ENDDO
ENDDO
DO jcell = 1, nimg
DO kcell = jcell + 1, nimg
CALL dbcsr_t_copy(t_3c_O(jcell, kcell), t_3c_tmp)
CALL dbcsr_t_copy(t_3c_tmp, t_3c_O(kcell, jcell), order=[1, 3, 2], summation=.FALSE., move_data=.TRUE.)
CALL dbcsr_t_filter(t_3c_O(kcell, jcell), qs_env%mp2_env%mp2_gpw%eps_filter)
CALL dbcsr_t_filter(t_3c_O(kcell, jcell), qs_env%mp2_env%ri_rpa_im_time%eps_filter)
ENDDO
ENDDO
CALL dbcsr_t_destroy(t_3c_tmp)
Expand Down
15 changes: 5 additions & 10 deletions src/mp2_setup.F
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ SUBROUTINE read_mp2_section(input, mp2_env)
INTEGER, DIMENSION(:), POINTER :: tmplist
LOGICAL :: do_mp2, do_opt_ri_basis, do_ri_mp2, &
do_ri_sos_mp2, do_rpa
REAL(dp) :: eps_filter_factor, rc_ang
REAL(dp) :: rc_ang
TYPE(cp_logger_type), POINTER :: logger
TYPE(section_vals_type), POINTER :: eri_mme_section, gw_section, &
im_time_test_section, &
Expand Down Expand Up @@ -187,15 +187,10 @@ SUBROUTINE read_mp2_section(input, mp2_env)
CALL section_vals_val_get(low_scaling_section, "_SECTION_PARAMETERS_", &
l_val=mp2_env%do_im_time)

CALL section_vals_val_get(low_scaling_section, "MEMORY_CUT", &
i_val=mp2_env%ri_rpa_im_time%cut_memory)
CALL section_vals_val_get(low_scaling_section, "MEMORY_INFO", &
l_val=mp2_env%ri_rpa_im_time%memory_info)
IF (mp2_env%do_im_time) CALL section_vals_val_get(low_scaling_section, "EPS_FILTER", &
r_val=mp2_env%mp2_gpw%eps_filter)
CALL section_vals_val_get(low_scaling_section, "EPS_FILTER_FACTOR", &
r_val=eps_filter_factor)
mp2_env%ri_rpa_im_time%eps_filter_im_time = eps_filter_factor*mp2_env%mp2_gpw%eps_filter
CALL section_vals_val_get(low_scaling_section, "MEMORY_CUT", i_val=mp2_env%ri_rpa_im_time%cut_memory)
CALL section_vals_val_get(low_scaling_section, "MEMORY_INFO", l_val=mp2_env%ri_rpa_im_time%memory_info)
CALL section_vals_val_get(low_scaling_section, "EPS_FILTER", r_val=mp2_env%ri_rpa_im_time%eps_filter)
CALL section_vals_val_get(low_scaling_section, "EPS_FILTER_FACTOR", r_val=mp2_env%ri_rpa_im_time%eps_filter_factor)

CALL section_vals_val_get(low_scaling_section, "DO_KPOINTS", &
l_val=mp2_env%ri_rpa_im_time%do_im_time_kpoints)
Expand Down
4 changes: 2 additions & 2 deletions src/mp2_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ MODULE mp2_types
TYPE ri_rpa_im_time_type
INTEGER :: cut_memory
LOGICAL :: memory_info
REAL(KIND=dp) :: eps_filter_im_time, cutoff, &
exp_kpoints
REAL(KIND=dp) :: eps_filter, cutoff, &
exp_kpoints, eps_filter_factor
INTEGER :: group_size_P, group_size_3c
INTEGER, DIMENSION(:), POINTER :: kp_grid
LOGICAL :: do_im_time_kpoints
Expand Down
45 changes: 29 additions & 16 deletions src/rpa_main.F
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
!> 03.2019 Refactoring [Frederick Stein]
! **************************************************************************************************
MODULE rpa_main
USE bibliography, ONLY: Bates2013,&
DelBen2013,&
DelBen2015,&
Ren2011,&
Ren2013,&
cite_reference
USE bibliography, ONLY: &
Bates2013, DelBen2013, DelBen2015, Ren2011, Ren2013, Wilhelm2016a, Wilhelm2016b, &
Wilhelm2017, Wilhelm2018, cite_reference
USE bse, ONLY: do_subspace_iterations,&
mult_B_with_W_and_fill_local_3c_arrays
USE cp_blacs_env, ONLY: cp_blacs_env_create,&
Expand Down Expand Up @@ -142,7 +139,6 @@ MODULE rpa_main
!> \param ends_array_mc ...
!> \param starts_array_mc_block ...
!> \param ends_array_mc_block ...
!> \param eps_filter ...
!> \param BIb_C_beta ...
!> \param homo_beta ...
!> \param Eigenval_beta ...
Expand All @@ -163,7 +159,7 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
t_3c_M, t_3c_O, &
starts_array_mc, ends_array_mc, &
starts_array_mc_block, ends_array_mc_block, &
eps_filter, BIb_C_beta, homo_beta, Eigenval_beta, &
BIb_C_beta, homo_beta, Eigenval_beta, &
gd_B_virtual_beta, &
mo_coeff_beta, BIb_C_gw_beta, gw_corr_lev_occ_beta, gw_corr_lev_virt_beta)

Expand Down Expand Up @@ -194,7 +190,6 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
INTEGER, ALLOCATABLE, DIMENSION(:), INTENT(IN) :: starts_array_mc, ends_array_mc, &
starts_array_mc_block, &
ends_array_mc_block
REAL(KIND=dp), INTENT(IN) :: eps_filter
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :), &
INTENT(INOUT), OPTIONAL :: BIb_C_beta
INTEGER, INTENT(IN), OPTIONAL :: homo_beta
Expand Down Expand Up @@ -248,6 +243,16 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
CALL cite_reference(Ren2013)
ENDIF

IF (my_do_gw) THEN
CALL cite_reference(Wilhelm2016a)
CALL cite_reference(Wilhelm2017)
CALL cite_reference(Wilhelm2018)
END IF

IF (do_im_time) THEN
CALL cite_reference(Wilhelm2016b)
END IF

my_open_shell = .FALSE.
IF (PRESENT(BIb_C_beta) .AND. &
PRESENT(gd_B_virtual_beta) .AND. &
Expand Down Expand Up @@ -309,6 +314,13 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
"Minimax quadrature scheme. The number of quadrature point has been reset to 30.")
num_integ_points = 30
END IF
IF (num_integ_points > 20 .AND. E_Range < 100.0_dp) THEN
IF (unit_nr > 0) &
CALL cp_warn(__LOCATION__, &
"You requested a large minimax grid for a small minimax range (< 100). That may lead to numerical "// &
"instabilities when computing minimax grid weights. You can prevent small ranges by choosing "// &
"a larger basis set with higher angular momenta or alternatively using all-electron calculations.")
END IF
ELSE
IF (do_minimax_quad .AND. num_integ_points > 20) THEN
IF (unit_nr > 0) &
Expand Down Expand Up @@ -670,7 +682,7 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
starts_array_mc, ends_array_mc, &
starts_array_mc_block, ends_array_mc_block, &
matrix_s, &
kpoints, eps_filter, &
kpoints, &
gd_array, color_sub, &
fm_mo_coeff_occ_beta=fm_mo_coeff_occ_beta, fm_mo_coeff_virt_beta=fm_mo_coeff_virt_beta, &
homo_beta=homo_beta, virtual_beta=virtual_beta, &
Expand All @@ -695,7 +707,7 @@ SUBROUTINE rpa_ri_compute_en(qs_env, Erpa, mp2_env, BIb_C, BIb_C_gw, BIb_C_bse_i
starts_array_mc_block, ends_array_mc_block, &
matrix_s, &
kpoints, &
eps_filter, gd_array, color_sub, &
gd_array, color_sub, &
do_ri_sos_laplace_mp2=do_ri_sos_laplace_mp2)
END IF

Expand Down Expand Up @@ -1229,7 +1241,6 @@ END SUBROUTINE create_occ_virt_mo_coeffs
!> \param ends_array_mc_block ...
!> \param matrix_s ...
!> \param kpoints ...
!> \param eps_filter ...
!> \param gd_array ...
!> \param color_sub ...
!> \param fm_mo_coeff_occ_beta ...
Expand Down Expand Up @@ -1261,7 +1272,7 @@ SUBROUTINE rpa_num_int(qs_env, Erpa, mp2_env, para_env, para_env_RPA, para_env_s
starts_array_mc, ends_array_mc, &
starts_array_mc_block, ends_array_mc_block, &
matrix_s, kpoints, &
eps_filter, gd_array, color_sub, &
gd_array, color_sub, &
fm_mo_coeff_occ_beta, fm_mo_coeff_virt_beta, &
homo_beta, virtual_beta, dimen_ia_beta, Eigenval_beta, fm_mat_S_beta, &
fm_mat_Q_gemm_beta, fm_mat_Q_beta, fm_mat_S_gw_beta, &
Expand Down Expand Up @@ -1297,7 +1308,6 @@ SUBROUTINE rpa_num_int(qs_env, Erpa, mp2_env, para_env, para_env_RPA, para_env_s
ends_array_mc_block
TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_s
TYPE(kpoint_type), POINTER :: kpoints
REAL(KIND=dp), INTENT(IN) :: eps_filter
TYPE(group_dist_d1_type), INTENT(IN) :: gd_array
INTEGER, INTENT(IN) :: color_sub
TYPE(cp_fm_type), OPTIONAL, POINTER :: fm_mo_coeff_occ_beta, &
Expand Down Expand Up @@ -1334,7 +1344,7 @@ SUBROUTINE rpa_num_int(qs_env, Erpa, mp2_env, para_env, para_env_RPA, para_env_s
first_cycle_periodic_correction, my_open_shell, print_ic_values
LOGICAL, ALLOCATABLE, DIMENSION(:, :, :, :, :) :: has_mat_P_blocks
REAL(dp) :: dbcsr_time
REAL(KIND=dp) :: a_scaling, alpha, e_axk, e_axk_corr, e_fermi, e_fermi_beta, &
REAL(KIND=dp) :: a_scaling, alpha, e_axk, e_axk_corr, e_fermi, e_fermi_beta, eps_filter, &
eps_filter_im_time, eps_min_trans, ext_scaling, fermi_level_offset, &
fermi_level_offset_input, my_flop_rate, omega, omega_max_fit, omega_old, tau, tau_old
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:) :: delta_corr, Eigenval_last, Eigenval_last_beta, &
Expand Down Expand Up @@ -1433,7 +1443,10 @@ SUBROUTINE rpa_num_int(qs_env, Erpa, mp2_env, para_env, para_env_RPA, para_env_s

group_size_P = mp2_env%ri_rpa_im_time%group_size_P
cut_memory = mp2_env%ri_rpa_im_time%cut_memory
eps_filter_im_time = mp2_env%ri_rpa_im_time%eps_filter_im_time
eps_filter = mp2_env%ri_rpa_im_time%eps_filter
eps_filter_im_time = mp2_env%ri_rpa_im_time%eps_filter* &
mp2_env%ri_rpa_im_time%eps_filter_factor

min_bsize = mp2_env%ri_rpa_im_time%min_bsize

CALL alloc_im_time(qs_env, para_env, dimen_RI, dimen_RI_red, &
Expand Down

1 comment on commit 4755e83

@alazzaro
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JWilhelm This commit makes Cray compiler unhappy, see https://www.cp2k.org/static/regtest/trunk/swan-skl28/CRAY-XC40-cce.popt.out Could you fix it?

Please sign in to comment.