mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-22 20:35:19 +01:00
MRCC(Var) converges
This commit is contained in:
parent
39db434f63
commit
517c1a14ac
@ -389,16 +389,17 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate)
|
||||
Vt = 0.d0
|
||||
!$OMP DO SCHEDULE(guided)
|
||||
do i=1,n
|
||||
idx(0) = i
|
||||
call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx)
|
||||
do jj=1,idx(0)
|
||||
j = idx(jj)
|
||||
if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then
|
||||
! idx(0) = i
|
||||
! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx)
|
||||
! do jj=1,idx(0)
|
||||
! j = idx(jj)
|
||||
! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then
|
||||
do j = 1, i-1
|
||||
call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij)
|
||||
hij = hij + delta_ij(j,i,istate)
|
||||
vt (i) = vt (i) + hij*u_0(j)
|
||||
vt (j) = vt (j) + hij*u_0(i)
|
||||
endif
|
||||
! endif
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
|
@ -2,76 +2,26 @@
|
||||
&BEGIN_PROVIDER [ double precision, lambda_pert, (N_states,psi_det_size) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! cm/<Psi_0|H|D_m>
|
||||
! cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
|
||||
END_DOC
|
||||
integer :: i,k
|
||||
double precision :: ihpsi(N_states), hii
|
||||
!integer :: icount
|
||||
!integer :: icount_manu
|
||||
!integer :: icount_gregoire
|
||||
|
||||
!icount = 0
|
||||
!icount_manu = 0
|
||||
!icount_gregoire = 0
|
||||
|
||||
|
||||
k = 1
|
||||
print*,'psi_cas_energy_diagonalized = ', psi_cas_energy_diagonalized(k) + nuclear_repulsion
|
||||
do i=1,N_det_non_cas
|
||||
! Questions : psi_cas_coef normalized or not ?
|
||||
call i_h_psi(psi_non_cas(1,1,i), psi_cas, psi_cas_coef, N_int, N_det_cas, &
|
||||
size(psi_cas_coef,1), n_states, ihpsi)
|
||||
call i_h_j(psi_non_cas(1,1,i),psi_non_cas(1,1,i),N_int,hii)
|
||||
do k=1,N_states
|
||||
|
||||
lambda_pert(k,i) = 0.d0
|
||||
lambda_mrcc(k,i) = 0.d0
|
||||
lambda_pert(k,i) = 1.d0 / (psi_cas_energy_diagonalized(k)-hii)
|
||||
lambda_mrcc(k,i) = psi_non_cas_coef(i,k)/ihpsi(k)
|
||||
lambda_mrcc(k,i) = lambda_pert(k,i)
|
||||
cycle
|
||||
if (dabs(psi_non_cas_coef(i,k)).le.1.d-6) then
|
||||
cycle
|
||||
else
|
||||
lambda_pert(k,i) = 1.d0 / (psi_cas_energy_diagonalized(k)-hii)
|
||||
lambda_mrcc(k,i) = psi_non_cas_coef(i,k)/ihpsi(k)
|
||||
lambda_mrcc(k,i) = lambda_pert(k,i)
|
||||
cycle
|
||||
! icount = icount+1
|
||||
if (dabs(ihpsi(k)).le.1.d-6) then
|
||||
lambda_pert(k,i) = 0.d0
|
||||
lambda_mrcc(k,i) = 0.d0
|
||||
! icount_manu = icount_manu+1
|
||||
cycle
|
||||
else
|
||||
if ((lambda_mrcc(k,i)*lambda_pert(k,i))<0.d0)then
|
||||
lambda_mrcc(k,i) = lambda_pert(k,i)
|
||||
else if ((lambda_mrcc(k,i)/lambda_pert(k,i))>1.2d0) then
|
||||
lambda_mrcc(k,i) = lambda_pert(k,i)
|
||||
! icount_gregoire = icount_gregoire + 1
|
||||
else
|
||||
if ((lambda_mrcc(k,i)/lambda_pert(k,i))<0.1d0 .or. (lambda_mrcc(k,i)/lambda_pert(k,i))>=0d0) then
|
||||
lambda_mrcc(k,i) = lambda_mrcc(k,i)*((cos((lambda_mrcc(k,i)/lambda_pert(k,i))*3.141592653589793d0/0.1d0+3.141592653589793d0)+1d0)/2.d0) &
|
||||
+ lambda_pert(k,i)*(1.d0-((cos((lambda_mrcc(k,i)/lambda_pert(k,i))*3.141592653589793d0/0.1d0+3.141592653589793d0)+1.d0)/2.d0))
|
||||
elseif ((lambda_mrcc(k,i)/lambda_pert(k,i))<=1.2d0 .or. (lambda_mrcc(k,i)/lambda_pert(k,i))>1.0d0) then
|
||||
lambda_mrcc(k,i) = lambda_mrcc(k,i)*(1.d0-(cos(abs(2.d0-(lambda_mrcc(k,i)/lambda_pert(k,i)))*3.141592653589793d0/0.2d0+3.141592653589793d0)+1.d0)/2d0) &
|
||||
+ lambda_pert(k,i)*((cos(abs(2.d0-(lambda_mrcc(k,i)/lambda_pert(k,i)))*3.141592653589793d0/0.2d0+3.141592653589793d0)+1.d0)/2.d0)
|
||||
! icount_gregoire = icount_gregoire + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if (dabs(ihpsi(k)).le.1.d-3) then
|
||||
lambda_mrcc(k,i) = 1.d0 / (psi_cas_energy_diagonalized(k)-hii)
|
||||
icount_manu = icount_manu+1
|
||||
cycle
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
!print *, 'icount, icount_manu, icount_gregoire'
|
||||
!print *, icount, icount_manu, icount_gregoire
|
||||
|
||||
|
||||
!do i=1,N_det_non_cas
|
||||
! write(33,*) float(lambda_mrcc(1,i)), float(lambda_pert(1,i))
|
||||
!enddo
|
||||
!write(33,*) ''
|
||||
!write(33,*) ''
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
@ -124,13 +74,6 @@ BEGIN_PROVIDER [ double precision, delta_ij, (N_det,N_det,N_states) ]
|
||||
enddo
|
||||
enddo
|
||||
|
||||
!integer :: i_I
|
||||
!do i_I = 1, N_det_cas
|
||||
! print*,''
|
||||
! print*,'i_I = ',i_I
|
||||
! print*,'psi_coef_cas = ',psi_coef(idx_cas(i_I), 1)
|
||||
! print*,'delta_ij ',delta_ij(idx_cas(i_I),idx_cas(i_I),1)
|
||||
!enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, h_matrix_dressed, (N_det,N_det) ]
|
||||
|
Loading…
Reference in New Issue
Block a user