mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-22 20:35:19 +01:00
experimental - OLD_LAMBDA and NO_MONO_DRESSING
This commit is contained in:
parent
f2fef4a6dc
commit
2774af5bbd
@ -1,50 +1,74 @@
|
||||
!
|
||||
! BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ]
|
||||
! &BEGIN_PROVIDER [ integer, lambda_mrcc_pt2, (0:psi_det_size) ]
|
||||
! implicit none
|
||||
! BEGIN_DOC
|
||||
! cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
|
||||
! END_DOC
|
||||
! integer :: i,k
|
||||
! double precision :: ihpsi_current(N_states)
|
||||
! integer :: i_pert_count
|
||||
! double precision :: hii, lambda_pert
|
||||
! lambda_mrcc_pt2(:) = 0d0
|
||||
! i_pert_count = 0
|
||||
! lambda_mrcc = 0.d0
|
||||
!
|
||||
! do i=1,N_det_non_ref
|
||||
! call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref, &
|
||||
! size(psi_ref_coef,1), N_states,ihpsi_current)
|
||||
! call i_H_j(psi_non_ref(1,1,i),psi_non_ref(1,1,i),N_int,hii)
|
||||
! do k=1,N_states
|
||||
! if (ihpsi_current(k) == 0.d0) then
|
||||
! ihpsi_current(k) = 1.d-32
|
||||
! endif
|
||||
! lambda_mrcc(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k)
|
||||
! if ( dabs(psi_non_ref_coef(i,k)*ihpsi_current(k)) < 1.d-5 ) then
|
||||
! i_pert_count += 1
|
||||
! lambda_mrcc(k,i) = 0.d0
|
||||
! lambda_pert = 1.d0 / (psi_ref_energy_diagonalized(k)-hii)
|
||||
! if((ihpsi_current(k) * lambda_pert) < 0.5d0 * psi_non_ref_coef_restart(i,k) ) then
|
||||
! lambda_mrcc(k,i) = 0.d0
|
||||
! endif
|
||||
! endif
|
||||
! double precision, parameter :: x = 2.d0
|
||||
! if (lambda_mrcc(k,i) > x) then
|
||||
! lambda_mrcc(k,i) = x
|
||||
! else if (lambda_mrcc(k,i) < -x) then
|
||||
! lambda_mrcc(k,i) = -x
|
||||
|
||||
BEGIN_PROVIDER [ integer, mrmode ]
|
||||
&BEGIN_PROVIDER [ logical, old_lambda ]
|
||||
&BEGIN_PROVIDER [ logical, no_mono_dressing ]
|
||||
implicit none
|
||||
CHARACTER(len=255) :: test
|
||||
CALL get_environment_variable("OLD_LAMBDA", test)
|
||||
old_lambda = trim(test) /= "" .and. trim(test) /= "0"
|
||||
CALL get_environment_variable("NO_MONO_DRESSING", test)
|
||||
no_mono_dressing = trim(test) /= "" .and. trim(test) /= "0"
|
||||
print *, "old", old_lambda, "mono", no_mono_dressing
|
||||
mrmode = 0
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, lambda_mrcc_old, (N_states,psi_det_size) ]
|
||||
&BEGIN_PROVIDER [ integer, lambda_mrcc_pt2_old, (0:psi_det_size) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
|
||||
END_DOC
|
||||
integer :: i,k
|
||||
double precision :: ihpsi_current(N_states)
|
||||
integer :: i_pert_count
|
||||
double precision :: hii, lambda_pert
|
||||
integer :: N_lambda_mrcc_pt2
|
||||
double precision, parameter :: x = 2.d0
|
||||
|
||||
i_pert_count = 0
|
||||
lambda_mrcc_old = 0.d0
|
||||
N_lambda_mrcc_pt2 = 0
|
||||
lambda_mrcc_pt2_old(0) = 0
|
||||
|
||||
do i=1,N_det_non_ref
|
||||
call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref, &
|
||||
size(psi_ref_coef,1), N_states,ihpsi_current)
|
||||
call i_H_j(psi_non_ref(1,1,i),psi_non_ref(1,1,i),N_int,hii)
|
||||
do k=1,N_states
|
||||
if (ihpsi_current(k) == 0.d0) then
|
||||
ihpsi_current(k) = 1.d-32
|
||||
endif
|
||||
lambda_mrcc_old(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k)
|
||||
if ( dabs(psi_non_ref_coef(i,k)*ihpsi_current(k)) < 1.d-5 ) then
|
||||
i_pert_count += 1
|
||||
lambda_mrcc_old(k,i) = 0.d0
|
||||
if (lambda_mrcc_pt2_old(N_lambda_mrcc_pt2) /= i) then
|
||||
N_lambda_mrcc_pt2 += 1
|
||||
lambda_mrcc_pt2_old(N_lambda_mrcc_pt2) = i
|
||||
endif
|
||||
! lambda_pert = 1.d0 / (psi_ref_energy_diagonalized(k)-hii)
|
||||
! if((ihpsi_current(k) * lambda_pert) < 0.5d0 * psi_non_ref_coef_restart(i,k) ) then
|
||||
! lambda_mrcc_old(k,i) = 0.d0
|
||||
! endif
|
||||
! enddo
|
||||
! enddo
|
||||
!
|
||||
! print*,'N_det_non_ref = ',N_det_non_ref
|
||||
! print*,'Number of ignored determinants = ',i_pert_count
|
||||
! print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
|
||||
! print*,'lambda min/max = ',maxval(dabs(lambda_mrcc)), minval(dabs(lambda_mrcc))
|
||||
!
|
||||
! END_PROVIDER
|
||||
endif
|
||||
|
||||
if (lambda_mrcc_old(k,i) > x) then
|
||||
lambda_mrcc_old(k,i) = x
|
||||
else if (lambda_mrcc_old(k,i) < -x) then
|
||||
lambda_mrcc_old(k,i) = -x
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
lambda_mrcc_pt2_old(0) = N_lambda_mrcc_pt2
|
||||
|
||||
print*,'N_det_non_ref = ',N_det_non_ref
|
||||
print*,'Number of ignored determinants = ',i_pert_count
|
||||
print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
|
||||
print*,'lambda min/max = ',maxval(dabs(lambda_mrcc_old)), minval(dabs(lambda_mrcc_old))
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ]
|
||||
@ -58,11 +82,15 @@
|
||||
integer :: i_pert_count
|
||||
double precision :: hii, lambda_pert
|
||||
integer :: N_lambda_mrcc_pt2
|
||||
|
||||
i_pert_count = 0
|
||||
lambda_mrcc = 0.d0
|
||||
N_lambda_mrcc_pt2 = 0
|
||||
lambda_mrcc_pt2(0) = 0
|
||||
|
||||
if(old_lambda) then
|
||||
lambda_mrcc = lambda_mrcc_old
|
||||
lambda_mrcc_pt2 = lambda_mrcc_pt2_old
|
||||
else
|
||||
i_pert_count = 0
|
||||
lambda_mrcc = 0.d0
|
||||
N_lambda_mrcc_pt2 = 0
|
||||
lambda_mrcc_pt2(0) = 0
|
||||
|
||||
do i=1,N_det_non_ref
|
||||
call i_h_psi(psi_non_ref(1,1,i), psi_ref, psi_ref_coef, N_int, N_det_ref,&
|
||||
@ -85,9 +113,10 @@
|
||||
enddo
|
||||
enddo
|
||||
lambda_mrcc_pt2(0) = N_lambda_mrcc_pt2
|
||||
end if
|
||||
|
||||
print*,'N_det_non_ref = ',N_det_non_ref
|
||||
print*,'Number of ignored determinants = ',i_pert_count
|
||||
!print*,'Number of ignored determinants = ',i_pert_count
|
||||
print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
|
||||
print*,'lambda max = ',maxval(dabs(lambda_mrcc))
|
||||
|
||||
|
@ -124,11 +124,11 @@ END_PROVIDER
|
||||
|
||||
provide lambda_mrcc
|
||||
do i_state = 1, N_states
|
||||
!$OMP PARALLEL DO default(none) schedule(dynamic) private(j,k,Hjk,Hki,degree) shared(lambda_mrcc,i_state, N_det_non_ref,psi_ref, psi_non_ref,N_int,delta_cas,N_det_ref)
|
||||
!$OMP PARALLEL DO default(none) schedule(dynamic) private(j,k,Hjk,Hki,degree) shared(no_mono_dressing,lambda_mrcc,i_state, N_det_non_ref,psi_ref, psi_non_ref,N_int,delta_cas,N_det_ref)
|
||||
do i=1,N_det_ref
|
||||
do j=1,i
|
||||
call get_excitation_degree(psi_ref(1,1,i), psi_ref(1,1,j), degree, N_int)
|
||||
if(degree /= 2 .and. degree /= 0) cycle
|
||||
if(no_mono_dressing .and. degree == 1) cycle
|
||||
delta_cas(i,j,i_state) = 0d0
|
||||
do k=1,N_det_non_ref
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ integer, mrmode ]
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
subroutine run(N_st,energy)
|
||||
implicit none
|
||||
|
||||
@ -109,71 +104,3 @@ subroutine print_cas_coefs
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
! subroutine run_mrcepa0
|
||||
! implicit none
|
||||
! call set_generators_bitmasks_as_holes_and_particles
|
||||
! call mrcepa0_iterations
|
||||
! end
|
||||
!
|
||||
|
||||
!
|
||||
! subroutine mrcepa0_iterations
|
||||
! implicit none
|
||||
!
|
||||
! integer :: i,j
|
||||
!
|
||||
! double precision :: E_new, E_old, delta_e
|
||||
! integer :: iteration,i_oscillations
|
||||
! double precision :: E_past(4), lambda
|
||||
! E_new = 0.d0
|
||||
! delta_E = 1.d0
|
||||
! iteration = 0
|
||||
! j = 1
|
||||
! i_oscillations = 0
|
||||
! lambda = 1.d0
|
||||
! do while (delta_E > 1.d-7)
|
||||
! iteration += 1
|
||||
! print *, '==========================='
|
||||
! print *, 'MRCEPA0 Iteration', iteration
|
||||
! print *, '==========================='
|
||||
! print *, ''
|
||||
! E_old = sum(ci_energy_dressed)
|
||||
! call write_double(6,ci_energy_dressed(1),"MRCEPA0 energy")
|
||||
! call diagonalize_ci_dressed(lambda)
|
||||
! E_new = sum(ci_energy_dressed)
|
||||
! delta_E = dabs(E_new - E_old)
|
||||
! ! if (E_new > E_old) then
|
||||
! ! lambda = lambda * 0.7d0
|
||||
! ! else
|
||||
! ! lambda = min(1.d0, lambda * 1.1d0)
|
||||
! ! endif
|
||||
! ! print *, 'energy lambda ', lambda
|
||||
! ! E_past(j) = E_new
|
||||
! ! j +=1
|
||||
! call save_wavefunction
|
||||
! if (iteration > 10) then
|
||||
! exit
|
||||
! endif
|
||||
! print*,'------------'
|
||||
! print*,'VECTOR'
|
||||
! do i = 1, N_det_ref
|
||||
! print*,''
|
||||
! print*,'psi_ref_coef(i,1) = ',psi_ref_coef(i,1)
|
||||
! print*,'delta_ii(i,1) = ',delta_ii(i,1)
|
||||
! enddo
|
||||
! print*,'------------'
|
||||
! enddo
|
||||
! call write_double(6,ci_energy_dressed(1),"Final MRCEPA0 energy")
|
||||
! call ezfio_set_mrcc_cassd_energy(ci_energy_dressed(1))
|
||||
! call save_wavefunction
|
||||
! end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user