Skip to content

Commit

Permalink
FAB update embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
rybkinjr committed Apr 8, 2019
1 parent 402e069 commit 612a322
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/embed_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ MODULE embed_types
INTEGER :: n_iter, i_iter, dimen_aux, last_accepted, dimen_var_aux
REAL(KIND=dp) :: lambda, allowed_decrease, max_trad, min_trad, &
grad_norm
TYPE(pw_p_type), POINTER :: const_pot
TYPE(pw_p_type), DIMENSION(:), POINTER :: prev_grid_grad, prev_grid_pot, prev_subsys_dens
TYPE(pw_p_type), POINTER :: const_pot, prev_embed_pot, prev_spin_embed_pot
TYPE(pw_p_type), DIMENSION(:), POINTER :: prev_grid_grad, prev_grid_pot, prev_subsys_dens, v_w
REAL(KIND=dp) :: reg_term, trust_rad, conv_max, conv_int, &
conv_max_spin, conv_int_spin, step_len
LOGICAL :: accept_step, newton_step, level_shift, steep_desc, &
add_const_pot, converged, read_embed_pot, &
read_embed_pot_cube, change_spin, open_shell_embed, &
grid_opt, leeuwen
grid_opt, leeuwen, fab
INTEGER, ALLOCATABLE, DIMENSION(:) :: all_nspins
TYPE(lri_kind_type), DIMENSION(:), POINTER :: lri ! Needed to store integrals

Expand Down
5 changes: 2 additions & 3 deletions src/force_env_methods.F
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ SUBROUTINE dfet_embedding(force_env, ref_subsys_number, energies, converged_embe
IF ((i_iter .GT. 1) .AND. (.NOT. opt_embed%steep_desc)) CALL step_control(opt_embed)
! Print density difference
CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
!CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
IF (opt_embed%open_shell_embed) THEN ! Spin part
CALL print_rho_spin_diff(diff_rho_spin, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .FALSE.)
ENDIF
Expand All @@ -1870,7 +1870,7 @@ SUBROUTINE dfet_embedding(force_env, ref_subsys_number, energies, converged_embe
force_env%sub_force_env(cluster_subsys_num)%force_env%qs_env)
! Print final density difference
CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .TRUE.)
!CALL print_rho_diff(diff_rho_r, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .TRUE.)
IF (opt_embed%open_shell_embed) THEN ! Spin part
CALL print_rho_spin_diff(diff_rho_spin, i_iter, force_env%sub_force_env(ref_subsys_number)%force_env%qs_env, .TRUE.)
ENDIF
Expand Down Expand Up @@ -2086,4 +2086,3 @@ SUBROUTINE dmfet_embedding(force_env, ref_subsys_number, energies, converged_emb
END SUBROUTINE dmfet_embedding
END MODULE force_env_methods
9 changes: 8 additions & 1 deletion src/input_cp2k_dft.F
Original file line number Diff line number Diff line change
Expand Up @@ -5830,7 +5830,7 @@ SUBROUTINE create_optimize_embed(section)
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, name="OPT_EMBED", &
description="This section specifies optional parameters for DFT embedding potential optimization.", &
n_keywords=16, n_subsections=4, repeats=.FALSE.)
n_keywords=17, n_subsections=4, repeats=.FALSE.)

NULLIFY (keyword)

Expand Down Expand Up @@ -5906,8 +5906,15 @@ SUBROUTINE create_optimize_embed(section)
usage="LEEUWEN-BAERENDS .TRUE.", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, name="FAB", &
description="Finzel-Ayers-Bultinck iterative update. Alternative to Wu-Yang. ", &
usage="FAB .TRUE.", &
default_l_val=.FALSE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)

CALL keyword_create(keyword, name="ADD_CONST_POT", &
description="Apply level shift in the "// &
"optimization of the embedding potential.", &
Expand Down

0 comments on commit 612a322

Please sign in to comment.