Skip to content

Commit

Permalink
LSD and G-space mixing (#1719)
Browse files Browse the repository at this point in the history
* gspace mixing with lsd

* prettify

* GMIX_P is needed when GAPW and G-space mixing

* check that GMIX_P is active for mixing the gapw densities

* g-space mixing with spin polarized uses spin up and spin down densities
 rather than spin up density and spin up minus spin down density

* pretty

* changed tolerance

* reference changed
  • Loading branch information
marci73 committed Nov 2, 2021
1 parent e840aa2 commit e6ceced
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 119 deletions.
7 changes: 4 additions & 3 deletions src/qs_density_mixing_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ MODULE qs_density_mixing_types

TYPE mixing_storage_type
INTEGER :: ref_count
INTEGER :: ig_max, ncall, nbuffer, n_simple_mix, &
INTEGER :: ig_max, ncall, ncall_p(2), nbuffer, n_simple_mix, &
nskip_mixing, p_metric_method
INTEGER, POINTER, DIMENSION(:) :: ig_global_index
LOGICAL :: gmix_p
Expand All @@ -70,8 +70,8 @@ MODULE qs_density_mixing_types
REAL(KIND=dp), DIMENSION(:), POINTER :: kerker_factor
REAL(KIND=dp), DIMENSION(:), POINTER :: special_metric
REAL(KIND=dp), DIMENSION(:, :), POINTER :: weight
REAL(KIND=dp), DIMENSION(:, :), POINTER :: norm_res_buffer, pulay_matrix
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: fmat, gmat, smat
REAL(KIND=dp), DIMENSION(:, :), POINTER :: norm_res_buffer
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: fmat, gmat, pulay_matrix, smat
!
INTEGER :: nat_local, max_shell
REAL(KIND=dp), DIMENSION(:, :, :), POINTER :: acharge
Expand Down Expand Up @@ -121,6 +121,7 @@ SUBROUTINE mixing_storage_create(mixing_store, mixing_section, mixing_method, ec
mixing_store%nbuffer = 0
mixing_store%n_simple_mix = 0
mixing_store%ncall = 0
mixing_store%ncall_p = 0
mixing_store%alpha = 1.0_dp
mixing_store%pulay_beta = 1.0_dp
mixing_store%beta = 1.0_dp
Expand Down
332 changes: 222 additions & 110 deletions src/qs_gspace_mixing.F

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/qs_mixing_utils.F
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ SUBROUTINE mixing_allocate(qs_env, mixing_method, p_mix_new, p_delta, nspins, mi
END IF
IF (mixing_method == pulay_mixing_nr) THEN
IF (ASSOCIATED(mixing_store%pulay_matrix)) DEALLOCATE (mixing_store%pulay_matrix)
ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer))
ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer, nspins))
mixing_store%pulay_matrix = 0.0_dp
ELSEIF (mixing_method == broyden_mixing_nr) THEN
IF (ASSOCIATED(mixing_store%abroy)) DEALLOCATE (mixing_store%abroy)
Expand Down Expand Up @@ -280,7 +280,7 @@ SUBROUTINE mixing_allocate(qs_env, mixing_method, p_mix_new, p_delta, nspins, mi
! *** allocate pulay
IF (mixing_method == pulay_mixing_nr) THEN
IF (.NOT. ASSOCIATED(mixing_store%pulay_matrix)) THEN
ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer))
ALLOCATE (mixing_store%pulay_matrix(nbuffer, nbuffer, nspins))
END IF

IF (.NOT. ASSOCIATED(mixing_store%rhoin_buffer)) THEN
Expand Down
4 changes: 2 additions & 2 deletions tests/QS/regtest-gapw-1/TEST_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ CH3SH_xastpfh_list.inp 1 5e-7 -
# density mixing
c8_pmix_gapw_all.inp 1 4e-04 -302.63376760933824
c8_pmix_gapw_all_xashh.inp 1 1e-04 -297.77088288250752
c8_broy_gapw_all.inp 1 1e-13 -303.76231051467545
c8_broy_gapw_all_xashh.inp 1 2e-11 -296.95066303779714
c8_broy_gapw_all.inp 1 1e-13 -303.71942702489218
c8_broy_gapw_all_xashh.inp 1 2e-11 -294.57321406651721
# different scf_env
CO_xastpfh_gsot.inp 1 8e-14 -79.09997113686542
# XAS TP choice of core occ from input
Expand Down
1 change: 1 addition & 0 deletions tests/QS/regtest-gapw-1/c8_broy_gapw_all.inp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ALPHA 0.1
BETA 1.0
NBUFFER 8
GMIX_P
&END
ADDED_MOS 20 20
&END SCF
Expand Down
2 changes: 2 additions & 0 deletions tests/QS/regtest-gapw-1/c8_broy_gapw_all_xashh.inp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
ALPHA 0.2
BETA 1.0
NBUFFER 8
GMIX_P
&END
ADDED_MOS 20 20
&END SCF
Expand All @@ -59,6 +60,7 @@
ALPHA 0.1
BETA 1.5
NBUFFER 8
GMIX_P
&END MIXING
&END

Expand Down
2 changes: 1 addition & 1 deletion tests/QS/regtest-gpw-5/TEST_FILES
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ si8_pmix.inp 1 7e-14 -
si8_kerker.inp 1 1e-13 -31.15224294859119
si8_pulay.inp 1 2e-13 -31.16058546019718
si8_broy.inp 1 7e-14 -31.14863007620936
si8_pulay_md.inp 1 3e-14 -31.16148751713639
si8_pulay_md.inp 1 3e-12 -31.16216174849309
si8_pulay_skip.inp 1 5e-14 -31.16145405092692
# cholesky methods
si8_pulay_reduce.inp 1 2e-13 -31.16058546019707
Expand Down
2 changes: 1 addition & 1 deletion tests/QS/regtest-gpw-6-3/TEST_FILES
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
si8_lsd_broy_wc_rst.inp 23 2e-09 2111.2137083255
si8_lsd_broy_wc_list.inp 23 4e-10 992.1693045962
si8_lsd_broy_wc_list_rst.inp 23 4e-10 991.9475824044
si8_lsd_broy_fm0.2.inp 48 1.0E-14 -0.049499
si8_lsd_broy_fm0.2.inp 48 1.0E-14 -0.050162
#
c8_kerker.inp 1 1e-13 -44.11857062837854
c8_pmix.inp 1 2e-13 -43.56688833744322
Expand Down

0 comments on commit e6ceced

Please sign in to comment.