Skip to content

Commit

Permalink
Remove unused input variables, optional printing of self-energy for r…
Browse files Browse the repository at this point in the history
…eal frequency (#776)

* removed unused input variables; added printing of self-energy on real axis and intersection to see how the quasiparticle equation is solved

* adjusted regtests

* lower Fermi level offset in case of small bandgaps

* regtest for Fermi level offset change for systems with small bandgap

* first version of scGW0

* remove crossing search none that is never used

* update Fermi level

* introduce routine shift_unshifted_levels

* shift unshifted levels also in scGW0

* add regtests

* update evGW levels only once

* also shift beta eigenvalues of non-GW-corrected levels

* rename tests

* print cycle number in scGW0 and evGW

* enable scGW0 for N^4 GW algorithm

* finalize scGW0 for N^4 GW

* enable OMP
  • Loading branch information
JWilhelm committed Feb 18, 2020
1 parent d93e06c commit 9844dd2
Show file tree
Hide file tree
Showing 29 changed files with 1,082 additions and 768 deletions.
3 changes: 1 addition & 2 deletions src/input_constants.F
Original file line number Diff line number Diff line change
Expand Up @@ -971,8 +971,7 @@ MODULE input_constants
wfc_mm_style_syrk = 12

! G0W0 parameter
INTEGER, PARAMETER, PUBLIC :: ri_rpa_g0w0_crossing_none = 0, &
ri_rpa_g0w0_crossing_z_shot = 1, &
INTEGER, PARAMETER, PUBLIC :: ri_rpa_g0w0_crossing_z_shot = 1, &
ri_rpa_g0w0_crossing_newton = 2, &
ri_rpa_g0w0_crossing_bisection = 3, &
gw_no_print_exx = 5, &
Expand Down
110 changes: 55 additions & 55 deletions src/input_cp2k_mp2.F
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ MODULE input_cp2k_mp2
low_print_level,&
medium_print_level,&
silent_print_level
USE cp_units, ONLY: cp_unit_to_cp2k
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_none, &
ri_rpa_g0w0_crossing_z_shot, ri_rpa_method_gpw, wfc_mm_style_gemm, wfc_mm_style_syrk
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 @@ -697,23 +698,6 @@ SUBROUTINE create_ri_g0w0(section)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="PRINT_FIT_ERROR", &
variants=(/"FIT_ERROR"/), &
description="Print the statistical error due to the fitting. This error in most cases "// &
"is very pessimistic (e.g. can be a factor of 10 too large).", &
usage="FIT_ERROR", &
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="MAX_ITER_FIT", &
description="Maximum number of iterations for the Levenberg-Marquard fit.", &
usage="MAX_ITER_FIT 10000", &
default_i_val=10000)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="CHECK_FIT", &
description="If true, the self-energy on the imaginary axis and the fit are printed"// &
"the file self_energy_of_MO_<level>_for_imaginary_frequency.", &
Expand All @@ -726,14 +710,13 @@ SUBROUTINE create_ri_g0w0(section)
CALL keyword_create(keyword, __LOCATION__, name="CROSSING_SEARCH", &
description="Determines, how the self_energy is evaluated on the real axis.", &
usage="CROSSING_SEARCH Z_SHOT", &
enum_c_vals=s2a("NONE", "Z_SHOT", "NEWTON", "BISECTION"), &
enum_i_vals=(/ri_rpa_g0w0_crossing_none, ri_rpa_g0w0_crossing_z_shot, &
enum_c_vals=s2a("Z_SHOT", "NEWTON", "BISECTION"), &
enum_i_vals=(/ri_rpa_g0w0_crossing_z_shot, &
ri_rpa_g0w0_crossing_newton, ri_rpa_g0w0_crossing_bisection/), &
enum_desc=s2a("Evaluate the correlation self-energy at the energy eigenvalue of SCF.", &
"Calculate the derivative of Sigma and out of it Z. Then extrapolate using Z.", &
enum_desc=s2a("Calculate the derivative of Sigma and out of it Z. Then extrapolate using Z.", &
"Make a Newton-Raphson fix point iteration.", &
"Make a bisection fix point iteration."), &
default_i_val=ri_rpa_g0w0_crossing_z_shot)
default_i_val=ri_rpa_g0w0_crossing_newton)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

Expand All @@ -750,48 +733,29 @@ SUBROUTINE create_ri_g0w0(section)

CALL keyword_create(keyword, __LOCATION__, name="EV_SC_ITER", &
description="Maximum number of iterations for eigenvalue self-consistency cycle. The "// &
"computational effort of RPA and GW scales linearly with this number. "// &
"Eigenvalue self-consistency is not implemented for cubic-scaling GW.", &
"computational effort of GW scales linearly with this number. ", &
usage="EV_SC_ITER 3", &
default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="EPS_EV_SC_ITER", &
CALL keyword_create(keyword, __LOCATION__, name="SC_GW0_ITER", &
description="Maximum number of iterations for GW0 self-consistency cycle. The "// &
"computational effort of GW is not much affected by the number of scGW0 cycles. ", &
usage="SC_GW0_ITER 3", &
default_i_val=1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="EPS_ITER", &
description="Target accuracy for the eigenvalue self-consistency. "// &
"If the G0W0 HOMO-LUMO gap differs by less than the "// &
"target accuracy during the iteration, the eigenvalue "// &
"self-consistency cycle stops. Unit: Hartree.", &
usage="EPS_EV_SC_ITER 0.00005", &
default_r_val=0.00005_dp, &
unit_str="")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
default_r_val=cp_unit_to_cp2k(value=0.00136_dp, unit_str="eV"), &
unit_str="eV")

CALL keyword_create(keyword, __LOCATION__, name="HF_LIKE_EV_START", &
description="If true, take as input for GW/RPA corrected HF-like eigenvalues according "// &
"to PRB 83, 115103 (2011), Sec. IV.", &
usage="HF_LIKE_EV_START", &
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="EV_SC_GW_REMOVE_NEG_VIRT_ENERGIES", &
variants=(/"REMOVE_NEG"/), &
description="Set all GW energies of virtual orbitals which are below the HOMO to the "// &
"value of the last eigenvalue-selfconsistency cycle.", &
usage="EV_SC_GW_REMOVE_NEG_VIRT_ENERGIES", &
default_l_val=.TRUE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, __LOCATION__, name="PRINT_GW_DETAILS", &
description="If true, prints additional information on the quasiparticle energies.", &
usage="PRINT_GW_DETAILS", &
default_l_val=.TRUE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

Expand Down Expand Up @@ -940,8 +904,44 @@ SUBROUTINE create_ri_g0w0(section)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)

! here we generate a subsection for additional printing
CALL create_print_section(subsection)
CALL section_add_subsection(section, subsection)
CALL section_release(subsection)

END SUBROUTINE create_ri_g0w0

! **************************************************************************************************
!> \brief ...
!> \param section ...
! **************************************************************************************************
SUBROUTINE create_print_section(section)
TYPE(section_type), POINTER :: section

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

TYPE(keyword_type), POINTER :: keyword

CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="PRINT", &
description="Parameters for GW related output.", &
n_keywords=1, n_subsections=0, repeats=.FALSE.)

NULLIFY (keyword)

CALL keyword_create(keyword, __LOCATION__, name="", &
variants=(/"SELF_ENERGY"/), &
description="If true, print the self-energy for all levels for real energy "// &
"together with the straight line to see the quasiparticle energy as intersection.", &
usage="SELF_ENERGY TRUE", &
default_l_val=.FALSE., &
lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

END SUBROUTINE

! **************************************************************************************************
!> \brief ...
!> \param section ...
Expand Down
21 changes: 8 additions & 13 deletions src/mp2_setup.F
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,16 @@ SUBROUTINE read_mp2_section(input, mp2_env)
i_val=mp2_env%ri_g0w0%analytic_continuation)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%OMEGA_MAX_FIT", &
r_val=mp2_env%ri_g0w0%omega_max_fit)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%MAX_ITER_FIT", &
i_val=mp2_env%ri_g0w0%max_iter_fit)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%CHECK_FIT", &
l_val=mp2_env%ri_g0w0%check_fit)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%CROSSING_SEARCH", &
i_val=mp2_env%ri_g0w0%crossing_search)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%FERMI_LEVEL_OFFSET", &
r_val=mp2_env%ri_g0w0%fermi_level_offset)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%EV_SC_ITER", &
i_val=mp2_env%ri_g0w0%iter_ev_sc)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%EPS_EV_SC_ITER", &
r_val=mp2_env%ri_g0w0%eps_ev_sc_iter)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%EV_SC_GW_REMOVE_NEG_VIRT_ENERGIES", &
l_val=mp2_env%ri_g0w0%remove_neg_virt_energies)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%HF_LIKE_EV_START", &
l_val=mp2_env%ri_g0w0%hf_like_ev_start)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%PRINT_GW_DETAILS", &
l_val=mp2_env%ri_g0w0%print_gw_details)
i_val=mp2_env%ri_g0w0%iter_evGW)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%SC_GW0_ITER", &
i_val=mp2_env%ri_g0w0%iter_sc_GW0)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%EPS_ITER", &
r_val=mp2_env%ri_g0w0%eps_iter)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%PRINT_EXX", &
i_val=mp2_env%ri_g0w0%print_exx)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%RI_SIGMA_X", &
Expand Down Expand Up @@ -222,6 +214,9 @@ SUBROUTINE read_mp2_section(input, mp2_env)
CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%PERIODIC%NUM_OMEGA_POINTS", &
i_val=mp2_env%ri_g0w0%num_omega_points)

CALL section_vals_val_get(mp2_section, "RI_RPA%RI_G0W0%PRINT%SELF_ENERGY", &
l_val=mp2_env%ri_g0w0%print_self_energy)

NULLIFY (im_time_section)
im_time_section => section_vals_get_subs_vals(mp2_section, "IM_TIME")
CALL section_vals_val_get(im_time_section, "_SECTION_PARAMETERS_", &
Expand Down
16 changes: 5 additions & 11 deletions src/mp2_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,13 @@ MODULE mp2_types
INTEGER :: nparam_pade
INTEGER :: analytic_continuation
REAL(KIND=dp) :: omega_max_fit
INTEGER :: max_iter_fit
LOGICAL :: check_fit
INTEGER :: crossing_search
REAL(KIND=dp) :: fermi_level_offset
INTEGER :: iter_ev_sc
REAL(KIND=dp) :: eps_ev_sc_iter
LOGICAL :: hf_like_ev_start, &
print_gw_details, &
do_ri_Sigma_x, &
remove_neg_virt_energies
LOGICAL :: do_periodic
INTEGER :: iter_evGW, iter_sc_GW0
REAL(KIND=dp) :: eps_iter
LOGICAL :: do_ri_Sigma_x, &
do_periodic, &
print_self_energy
REAL(KIND=dp), ALLOCATABLE, DIMENSION(:, :, :) :: vec_Sigma_x_minus_vxc_gw
INTEGER, DIMENSION(:), POINTER :: kp_grid
INTEGER :: num_kp_grids
Expand All @@ -149,8 +145,6 @@ MODULE mp2_types
REAL(KIND=dp) :: frac_aux_mos
INTEGER :: num_omega_points
LOGICAL :: do_bse
INTEGER, DIMENSION(:), POINTER :: atoms_for_projection, atom_range_for_projection
REAL(KIND=dp) :: eps_charge
INTEGER :: num_z_vectors, max_iter_bse
REAL(KIND=dp) :: eps_min_trans
LOGICAL :: do_ic_model, print_ic_values
Expand Down

0 comments on commit 9844dd2

Please sign in to comment.