Skip to content

Commit

Permalink
CP2K functionals (#1539)
Browse files Browse the repository at this point in the history
* Correct error message for LTC functional derivatives
Disable higher derivatives for XWPBE (most likely wrong)

* Simplify ADMM functional setup for case of no correction functional.

* Initialize ADMM aux functional section to xc_none if not requested.
  • Loading branch information
juerghutter committed May 27, 2021
1 parent 8ad318d commit fd1f745
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/hfx_admm_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MODULE hfx_admm_utils
do_admm_aux_exch_func_bee, do_admm_aux_exch_func_default, do_admm_aux_exch_func_none, &
do_admm_aux_exch_func_opt, do_admm_aux_exch_func_pbex, do_potential_coulomb, &
do_potential_long, do_potential_mix_cl, do_potential_mix_cl_trunc, do_potential_short, &
do_potential_truncated, xc_funct_no_shortcut
do_potential_truncated, xc_funct_no_shortcut, xc_none
USE input_section_types, ONLY: section_vals_duplicate,&
section_vals_get,&
section_vals_get_subs_vals,&
Expand Down Expand Up @@ -596,12 +596,17 @@ END SUBROUTINE hfx_ks_matrix
!> XWPBEX0: PBE exchange hole for standard coulomb potential
!> PBE_HOLE_TC_LR: PBE exchange hole for longrange truncated coulomb potential
!>
!> Above explanation is correct for the deafult case. If a specific functional is requested
!> for the correction term (cfun), we get
!> Ex,hf = Ex,hf' + (cfun-cfun')
!> for all cases of operators.
!>
!> \param qs_env the qs environment
!> \param xc_section the original xc_section
!> \param admm_env the ADMM environment
!> \par History
!> 12.2009 created [Manuel Guidon]
!> 05.2021 simplify for case of no correction [JGH]
!> \author Manuel Guidon
! **************************************************************************************************
SUBROUTINE create_admm_xc_section(qs_env, xc_section, admm_env)
Expand Down Expand Up @@ -658,12 +663,9 @@ SUBROUTINE create_admm_xc_section(qs_env, xc_section, admm_env)
!in case of no admm exchange corr., no auxiliary exchange functional needed
IF (admm_env%aux_exch_func == do_admm_aux_exch_func_none) THEN
hfx_fraction = 0.0_dp
END IF
! default PBE Functional
IF (admm_env%aux_exch_func == do_admm_aux_exch_func_default .OR. &
admm_env%aux_exch_func == do_admm_aux_exch_func_none) THEN
CALL section_vals_val_set(xc_fun_section, "_SECTION_PARAMETERS_", &
i_val=xc_none)
ELSE IF (admm_env%aux_exch_func == do_admm_aux_exch_func_default) THEN
!! ** Add functionals evaluated with auxiliary basis
SELECT CASE (hfx_potential_type)
CASE (do_potential_coulomb)
Expand Down
4 changes: 2 additions & 2 deletions src/xc/xc_xpbe_hole_t_c_lr.F
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ SUBROUTINE xpbe_hole_t_c_lr_lda_eval(rho_set, deriv_set, order, params)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho)
END IF
IF (order > 1 .OR. order < -1) THEN
CPABORT("derivatives bigger than 2 not implemented")
CPABORT("derivatives bigger than 1 not implemented")
END IF

IF (R == 0.0_dp) THEN
Expand Down Expand Up @@ -361,7 +361,7 @@ SUBROUTINE xpbe_hole_t_c_lr_lsd_eval(rho_set, deriv_set, order, params)
CALL xc_derivative_get(deriv, deriv_data=e_ndrhob)
END IF
IF (order > 1 .OR. order < -1) THEN
CPABORT("derivatives bigger than 2 not implemented")
CPABORT("derivatives bigger than 1 not implemented")
END IF

IF (R == 0.0_dp) THEN
Expand Down
7 changes: 6 additions & 1 deletion src/xc/xc_xwpbe.F
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ SUBROUTINE xwpbe_lda_info(reference, shortform, needs, max_deriv)
needs%rho = .TRUE.
needs%norm_drho = .TRUE.
END IF
IF (PRESENT(max_deriv)) max_deriv = 2
! deriv > 1 are not correct
! IF (PRESENT(max_deriv)) max_deriv = 2
IF (PRESENT(max_deriv)) max_deriv = 1
END SUBROUTINE xwpbe_lda_info

! **************************************************************************************************
Expand Down Expand Up @@ -208,6 +210,9 @@ SUBROUTINE xwpbe_lda_eval(rho_set, deriv_set, order, xwpbe_params)
"(norm_drho)(norm_drho)", allocate_deriv=.TRUE.)
CALL xc_derivative_get(deriv, deriv_data=e_ndrho_ndrho)
END IF
IF (order > 1 .OR. order < -1) THEN
CPABORT("derivatives bigger than 1 do not work correctly")
END IF
IF (order > 2 .OR. order < -2) THEN
CPABORT("derivatives bigger than 2 not implemented")
END IF
Expand Down

0 comments on commit fd1f745

Please sign in to comment.