Skip to content

Commit

Permalink
Simplify input (#783)
Browse files Browse the repository at this point in the history
* input IM_TIME section to LOW_SCALING section
* change &RI_G0W0 section to &GW section
* GW is now actived only by the &GW section, not by the GW keyword
* introduce ERI_METHOD DEFAULT that is GPW for periodic systems and Obara-Saika for non-periodic systems
* shift EPS_FILTER for low-scaling RPA/SOS-MP2/GW to the &LOW_SCALING section
* remove MINIMAX keywords that are not necessary any more
* simplify kpoints regtest
  • Loading branch information
JWilhelm committed Feb 24, 2020
1 parent 76d510d commit 2a0f2a8
Show file tree
Hide file tree
Showing 60 changed files with 223 additions and 303 deletions.
3 changes: 2 additions & 1 deletion src/input_constants.F
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@ MODULE input_constants

INTEGER, PARAMETER, PUBLIC :: do_eri_gpw = 0, &
do_eri_mme = 1, &
do_eri_os = 2
do_eri_os = 2, &
eri_default = 3

! Cell optimisation constraints
INTEGER, PARAMETER, PUBLIC :: fix_none = 0, &
Expand Down
64 changes: 35 additions & 29 deletions src/input_cp2k_mp2.F
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ MODULE input_cp2k_mp2
USE input_constants, ONLY: &
do_eri_gpw, do_eri_mme, do_eri_os, do_potential_coulomb, do_potential_id, &
do_potential_long, do_potential_short, do_potential_truncated, do_potential_tshpsc, &
gaussian, gw_no_print_exx, gw_pade_approx, gw_print_exx, gw_read_exx, gw_skip_for_regtest, &
gw_two_pole_model, mp2_method_direct, mp2_method_gpw, mp2_method_none, &
mp2_ri_optimize_basis, numerical, ri_default, ri_mp2_laplace, ri_mp2_method_gpw, &
ri_rpa_g0w0_crossing_bisection, ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_z_shot, &
ri_rpa_method_gpw, wfc_mm_style_gemm, wfc_mm_style_syrk
eri_default, gaussian, gw_no_print_exx, gw_pade_approx, gw_print_exx, gw_read_exx, &
gw_skip_for_regtest, gw_two_pole_model, mp2_method_direct, mp2_method_gpw, &
mp2_method_none, mp2_ri_optimize_basis, numerical, ri_default, ri_mp2_laplace, &
ri_mp2_method_gpw, ri_rpa_g0w0_crossing_bisection, ri_rpa_g0w0_crossing_newton, &
ri_rpa_g0w0_crossing_z_shot, ri_rpa_method_gpw, wfc_mm_style_gemm, wfc_mm_style_syrk
USE input_cp2k_hfx, ONLY: create_hfx_section
USE input_keyword_types, ONLY: keyword_create,&
keyword_release,&
Expand Down Expand Up @@ -185,14 +185,15 @@ SUBROUTINE create_mp2_section(section)
"(MME method is faster but experimental, forces not yet implemented)."// &
"Obara-Saika (OS) for the Coulomb operator can only be used for non-periodic calculations.", &
usage="ERI_METHOD MME", &
enum_c_vals=s2a("GPW", "MME", "OS"), &
enum_i_vals=(/do_eri_gpw, do_eri_mme, do_eri_os/), &
enum_desc=s2a("Uses Gaussian Plane Wave method [DelBen2013].", &
enum_c_vals=s2a("DEFAULT", "GPW", "MME", "OS"), &
enum_i_vals=(/eri_default, do_eri_gpw, do_eri_mme, do_eri_os/), &
enum_desc=s2a("Use default ERI method (for periodic systems: GPW, for molecules: OS, "// &
"for MP2 and RI-MP2: GPW in any case).", &
"Uses Gaussian Plane Wave method [DelBen2013].", &
"Uses MiniMax-Ewald method (experimental, ERI_MME subsection, only for fully periodic "// &
"systems with orthorhombic cells).", &
"Uses Obara-Saika method (only for two-center integrals, only for gas phase"// &
"and only for cubic-scaling RPA and GW)."), &
default_i_val=do_eri_gpw)
"Use analytical Obara-Saika method."), &
default_i_val=eri_default)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

Expand Down Expand Up @@ -255,7 +256,7 @@ SUBROUTINE create_mp2_section(section)
CALL section_release(subsection)

! here we generate an imag. time subsection to use with RPA or Laplace-SOS-MP2
CALL create_ri_im_time(subsection)
CALL create_low_scaling(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)

Expand Down Expand Up @@ -543,17 +544,6 @@ SUBROUTINE create_ri_rpa(section)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, &
name="RI_G0W0", &
variants=(/"GW"/), &
description="Decide whether to perform an RI_G0W0 calculation on top of RI_RPA. ", &
usage="RI_G0W0", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, &
name="RI_AXK", &
Expand Down Expand Up @@ -650,12 +640,19 @@ SUBROUTINE create_ri_g0w0(section)
TYPE(section_type), POINTER :: subsection

CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="RI_G0W0", &
CALL section_create(section, __LOCATION__, name="GW", &
description="Parameters influencing the RI-G0W0 method", &
n_keywords=24, n_subsections=1, repeats=.FALSE.)

NULLIFY (keyword, subsection)

CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="Activates cubic-scaling RPA, GW and Laplace-SOS-MP2 calculations.", &
usage="&GW .TRUE.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="CORR_MOS_OCC", &
variants=(/"CORR_OCC"/), &
description="Number of occupied MOs whose energies are corrected by RI-G0W0. "// &
Expand Down Expand Up @@ -1142,26 +1139,26 @@ SUBROUTINE create_ic_section(section)
!> \brief ...
!> \param section ...
! **************************************************************************************************
SUBROUTINE create_ri_im_time(section)
SUBROUTINE create_low_scaling(section)
TYPE(section_type), POINTER :: section

CHARACTER(len=*), PARAMETER :: routineN = 'create_ri_im_time', &
CHARACTER(len=*), PARAMETER :: routineN = 'create_low_scaling', &
routineP = moduleN//':'//routineN

TYPE(keyword_type), POINTER :: keyword
TYPE(section_type), POINTER :: subsection

CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create( &
section, __LOCATION__, name="IM_TIME", &
section, __LOCATION__, name="LOW_SCALING", &
description="Cubic scaling RI-RPA, GW and Laplace-SOS-MP2 method using the imaginary time formalism.", &
n_keywords=12, n_subsections=2, repeats=.FALSE.)

NULLIFY (keyword)

CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
description="Activates cubic-scaling RPA, GW and Laplace-SOS-MP2 calculations.", &
usage="&im_time .TRUE.", &
usage="&LOW_SCALING .TRUE.", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
Expand Down Expand Up @@ -1192,9 +1189,18 @@ SUBROUTINE create_ri_im_time(section)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, name="EPS_FILTER", &
description="Determines a threshold for the DBCSR based multiply."// &
"Normally, this EPS_FILTER determines accuracy and timing of low-scaling RPA and GW calculations.", &
usage="EPS_FILTER 1.0E-10 ", type_of_var=real_t, &
default_r_val=1.0E-9_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create( &
keyword, __LOCATION__, name="EPS_FILTER_FACTOR", &
description="Multiply EPS_FILTER of WFC_GPW section with this factor to determine filter epsilon "// &
description="Multiply EPS_FILTER with this factor to determine filter epsilon "// &
"for DBCSR based multiply P(it)=(Mocc(it))^T*Mvirt(it) "// &
"Default should be kept.", &
type_of_var=real_t, &
Expand Down
29 changes: 18 additions & 11 deletions src/mp2_gpw.F
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ MODULE mp2_gpw
USE basis_set_types, ONLY: get_gto_basis_set,&
gto_basis_set_p_type,&
gto_basis_set_type
USE cell_types, ONLY: cell_type
USE cell_types, ONLY: cell_type,&
get_cell
USE cp_blacs_env, ONLY: BLACS_GRID_SQUARE,&
cp_blacs_env_create,&
cp_blacs_env_release,&
Expand Down Expand Up @@ -55,13 +56,9 @@ MODULE mp2_gpw
get_group_dist,&
group_dist_d1_type,&
release_group_dist
USE input_constants, ONLY: do_eri_gpw,&
do_eri_mme,&
do_eri_os,&
do_potential_coulomb,&
do_potential_id,&
do_potential_long,&
ri_default
USE input_constants, ONLY: &
do_eri_gpw, do_eri_mme, do_eri_os, do_potential_coulomb, do_potential_id, &
do_potential_long, eri_default, mp2_method_gpw, ri_default, ri_mp2_method_gpw
USE input_section_types, ONLY: section_vals_val_get
USE kinds, ONLY: dp
USE kpoint_types, ONLY: kpoint_type
Expand Down Expand Up @@ -152,6 +149,7 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T
my_group_L_end, my_group_L_size, my_group_L_start, nelectron, nelectron_beta, nmo, &
nspins, potential_type, ri_metric_type
INTEGER, ALLOCATABLE, DIMENSION(:) :: ends_array_mc, starts_array_mc
INTEGER, DIMENSION(3) :: periodic
LOGICAL :: blacs_repeatable, do_bse, do_gpw, do_im_time, do_kpoints_cubic_RPA, my_do_gw, &
my_do_ri_mp2, my_do_ri_rpa, my_do_ri_sos_laplace_mp2
REAL(KIND=dp) :: Emp2_AB, Emp2_BB, Emp2_Cou_BB, Emp2_d2_AB, Emp2_d_AB, Emp2_EX_BB, &
Expand Down Expand Up @@ -214,7 +212,7 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T
do_kpoints_cubic_RPA = qs_env%mp2_env%ri_rpa_im_time%do_im_time_kpoints

IF (do_kpoints_cubic_RPA .AND. mp2_env%ri_rpa%do_ri_g0w0) THEN
CPABORT("Full RPA k-points (DO_KPOINTS in IM_TIME section) not implemented with GW")
CPABORT("Full RPA k-points (DO_KPOINTS in LOW_SCALING section) not implemented with GW")
ENDIF

! Get the number of spins
Expand Down Expand Up @@ -279,8 +277,6 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T

blacs_env_sub_mat_munu => blacs_env_sub

eri_method = qs_env%mp2_env%eri_method

IF (do_im_time) THEN

IF (.NOT. mp2_env%ri_rpa_im_time%group_size_internal) THEN
Expand Down Expand Up @@ -330,6 +326,17 @@ SUBROUTINE mp2_gpw_main(qs_env, mp2_env, Emp2, Emp2_Cou, Emp2_EX, Emp2_S, Emp2_T
dft_control=dft_control, &
matrix_s_kp=matrix_s_kp)

IF (mp2_env%eri_method == eri_default) THEN
CALL get_cell(cell=cell, periodic=periodic)
IF (SUM(periodic) > 0) mp2_env%eri_method = do_eri_gpw
IF (SUM(periodic) == 0) mp2_env%eri_method = do_eri_os
IF (SUM(mp2_env%ri_rpa_im_time%kp_grid) > 0) mp2_env%eri_method = do_eri_os
IF (mp2_env%method == mp2_method_gpw) mp2_env%eri_method = do_eri_gpw
IF (mp2_env%method == ri_mp2_method_gpw) mp2_env%eri_method = do_eri_gpw
IF (mp2_env%ri_rpa_im_time%do_im_time_kpoints) mp2_env%eri_method = do_eri_os
END IF
eri_method = mp2_env%eri_method

matrix_s(1:1) => matrix_s_kp(1:1, 1)

CALL get_eps_old(dft_control, eps_pgf_orb_old, eps_rho_rspace_old, eps_gvg_rspace_old)
Expand Down

0 comments on commit 2a0f2a8

Please sign in to comment.