10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

Fixed SCF

This commit is contained in:
Anthony Scemama 2017-06-16 15:59:23 +02:00
parent 7b55cfad05
commit 783c890dbe
2 changed files with 12 additions and 13 deletions

View File

@ -20,7 +20,7 @@ default: 0.
type: Threshold
doc: Threshold on the convergence of the Hartree Fock energy.
interface: ezfio,provider,ocaml
default: 1.e-12
default: 1.e-10
[n_it_scf_max]
type: Strictly_positive_int
@ -32,7 +32,7 @@ default: 500
type: Positive_float
doc: Energy shift on the virtual MOs to improve SCF convergence
interface: ezfio,provider,ocaml
default: 0.3
default: 0.0
[scf_algorithm]
type: character*(32)

View File

@ -13,8 +13,9 @@ END_DOC
integer :: iteration_SCF,dim_DIIS,index_dim_DIIS
integer :: i,j
double precision, allocatable :: mo_coef_save(:,:)
allocate( &
allocate(mo_coef_save(ao_num,mo_tot_num), &
Fock_matrix_DIIS (ao_num,ao_num,max_dim_DIIS), &
error_matrix_DIIS(ao_num,ao_num,max_dim_DIIS) &
)
@ -72,9 +73,7 @@ END_DOC
Fock_matrix_AO_alpha = Fock_matrix_AO*0.5d0
Fock_matrix_AO_beta = Fock_matrix_AO*0.5d0
level_shift_save = level_shift
if (max_error_DIIS > 0.1d0) then
level_shift += 0.5d0
endif
level_shift += max_error_DIIS
TOUCH Fock_matrix_AO_alpha Fock_matrix_AO_beta
level_shift = level_shift_save
@ -97,21 +96,21 @@ END_DOC
Fock_matrix_AO_alpha = Fock_matrix_AO*0.5d0
Fock_matrix_AO_beta = Fock_matrix_AO*0.5d0
TOUCH Fock_matrix_AO_alpha Fock_matrix_AO_beta
dim_DIIS = 0
endif
double precision :: level_shift_save
level_shift_save = level_shift
if (max_error_DIIS > 0.5d0) then
level_shift += 0.5d0
endif
mo_coef_save(1:ao_num,1:mo_tot_num) = mo_coef(1:ao_num,1:mo_tot_num)
do while (Delta_Energy_SCF > 0.d0)
mo_coef(1:ao_num,1:mo_tot_num) = mo_coef_save
TOUCH mo_coef
level_shift = level_shift + 0.1d0
MO_coef = eigenvectors_Fock_matrix_MO
TOUCH MO_coef level_shift
mo_coef(1:ao_num,1:mo_tot_num) = eigenvectors_Fock_matrix_MO(1:ao_num,1:mo_tot_num)
TOUCH mo_coef level_shift
Delta_Energy_SCF = HF_energy - energy_SCF_previous
energy_SCF = HF_energy
if (level_shift-level_shift_save > 0.5d0) exit
if (level_shift-level_shift_save > 1.d0) exit
dim_DIIS=0
enddo
level_shift = level_shift_save
SOFT_TOUCH level_shift