10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 07:02:14 +02:00

Better convergence of MRCC

This commit is contained in:
Anthony Scemama 2016-11-08 23:03:11 +01:00
parent 9bfe41aa87
commit 2d1f40cae7

View File

@ -884,28 +884,26 @@ END_PROVIDER
!$OMP END PARALLEL !$OMP END PARALLEL
res = 0.d0 res = 0.d0
do a_coll=1,nactive ! nex
a_col = active_pp_idx(a_coll)
if (res < resold) then do j=1,N_det_non_ref
do a_coll=1,nactive ! nex i = A_ind(j,a_coll)
a_col = active_pp_idx(a_coll) if (i==0) exit
do j=1,N_det_non_ref rho_mrcc(i,s) = rho_mrcc(i,s) + A_val(j,a_coll) * X_new(a_col)
i = A_ind(j,a_coll) enddo
if (i==0) exit res = res + (X_new(a_col) - X(a_col))*(X_new(a_col) - X(a_col))
rho_mrcc(i,s) = rho_mrcc(i,s) + A_val(j,a_coll) * X_new(a_col) X(a_col) = X_new(a_col)
enddo end do
res = res + (X_new(a_col) - X(a_col))*(X_new(a_col) - X(a_col)) if (res > resold) then
X(a_col) = X_new(a_col)
end do
factor = 1.d0
else
factor = -factor * 0.5d0 factor = -factor * 0.5d0
endif endif
resold = res resold = res
if(mod(k, 100) == 0) then if(mod(k, 100) == 0) then
print *, "res ", k, res print *, "res ", k, res, factor
end if end if
if(res < 1d-9) exit if(res < 1d-9) exit