10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 12:56:14 +01:00

experimental - OLD_LAMBDA and NO_MONO_DRESSING

This commit is contained in:
Yann Garniron 2016-04-08 13:25:55 +02:00
parent f2fef4a6dc
commit 2774af5bbd
3 changed files with 83 additions and 127 deletions

View File

@ -1,50 +1,74 @@
!
! BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ] BEGIN_PROVIDER [ integer, mrmode ]
! &BEGIN_PROVIDER [ integer, lambda_mrcc_pt2, (0:psi_det_size) ] &BEGIN_PROVIDER [ logical, old_lambda ]
! implicit none &BEGIN_PROVIDER [ logical, no_mono_dressing ]
! BEGIN_DOC implicit none
! cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m) CHARACTER(len=255) :: test
! END_DOC CALL get_environment_variable("OLD_LAMBDA", test)
! integer :: i,k old_lambda = trim(test) /= "" .and. trim(test) /= "0"
! double precision :: ihpsi_current(N_states) CALL get_environment_variable("NO_MONO_DRESSING", test)
! integer :: i_pert_count no_mono_dressing = trim(test) /= "" .and. trim(test) /= "0"
! double precision :: hii, lambda_pert print *, "old", old_lambda, "mono", no_mono_dressing
! lambda_mrcc_pt2(:) = 0d0 mrmode = 0
! i_pert_count = 0 END_PROVIDER
! 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, & BEGIN_PROVIDER [ double precision, lambda_mrcc_old, (N_states,psi_det_size) ]
! size(psi_ref_coef,1), N_states,ihpsi_current) &BEGIN_PROVIDER [ integer, lambda_mrcc_pt2_old, (0:psi_det_size) ]
! call i_H_j(psi_non_ref(1,1,i),psi_non_ref(1,1,i),N_int,hii) implicit none
! do k=1,N_states BEGIN_DOC
! if (ihpsi_current(k) == 0.d0) then cm/<Psi_0|H|D_m> or perturbative 1/Delta_E(m)
! ihpsi_current(k) = 1.d-32 END_DOC
! endif integer :: i,k
! lambda_mrcc(k,i) = psi_non_ref_coef(i,k)/ihpsi_current(k) double precision :: ihpsi_current(N_states)
! if ( dabs(psi_non_ref_coef(i,k)*ihpsi_current(k)) < 1.d-5 ) then integer :: i_pert_count
! i_pert_count += 1 double precision :: hii, lambda_pert
! lambda_mrcc(k,i) = 0.d0 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) ! 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 ! if((ihpsi_current(k) * lambda_pert) < 0.5d0 * psi_non_ref_coef_restart(i,k) ) then
! lambda_mrcc(k,i) = 0.d0 ! lambda_mrcc_old(k,i) = 0.d0
! endif ! endif
! endif endif
! double precision, parameter :: x = 2.d0
! if (lambda_mrcc(k,i) > x) then if (lambda_mrcc_old(k,i) > x) then
! lambda_mrcc(k,i) = x lambda_mrcc_old(k,i) = x
! else if (lambda_mrcc(k,i) < -x) then else if (lambda_mrcc_old(k,i) < -x) then
! lambda_mrcc(k,i) = -x lambda_mrcc_old(k,i) = -x
! endif endif
! enddo enddo
! 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*,'N_det_non_ref = ',N_det_non_ref
! print*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1) print*,'Number of ignored determinants = ',i_pert_count
! print*,'lambda min/max = ',maxval(dabs(lambda_mrcc)), minval(dabs(lambda_mrcc)) 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
END_PROVIDER
BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ] BEGIN_PROVIDER [ double precision, lambda_mrcc, (N_states,psi_det_size) ]
@ -59,6 +83,10 @@
double precision :: hii, lambda_pert double precision :: hii, lambda_pert
integer :: N_lambda_mrcc_pt2 integer :: N_lambda_mrcc_pt2
if(old_lambda) then
lambda_mrcc = lambda_mrcc_old
lambda_mrcc_pt2 = lambda_mrcc_pt2_old
else
i_pert_count = 0 i_pert_count = 0
lambda_mrcc = 0.d0 lambda_mrcc = 0.d0
N_lambda_mrcc_pt2 = 0 N_lambda_mrcc_pt2 = 0
@ -85,9 +113,10 @@
enddo enddo
enddo enddo
lambda_mrcc_pt2(0) = N_lambda_mrcc_pt2 lambda_mrcc_pt2(0) = N_lambda_mrcc_pt2
end if
print*,'N_det_non_ref = ',N_det_non_ref 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*,'psi_coef_ref_ratio = ',psi_ref_coef(2,1)/psi_ref_coef(1,1)
print*,'lambda max = ',maxval(dabs(lambda_mrcc)) print*,'lambda max = ',maxval(dabs(lambda_mrcc))

View File

@ -124,11 +124,11 @@ END_PROVIDER
provide lambda_mrcc provide lambda_mrcc
do i_state = 1, N_states 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 i=1,N_det_ref
do j=1,i do j=1,i
call get_excitation_degree(psi_ref(1,1,i), psi_ref(1,1,j), degree, N_int) 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 delta_cas(i,j,i_state) = 0d0
do k=1,N_det_non_ref do k=1,N_det_non_ref

View File

@ -1,10 +1,5 @@
BEGIN_PROVIDER [ integer, mrmode ]
END_PROVIDER
subroutine run(N_st,energy) subroutine run(N_st,energy)
implicit none implicit none
@ -109,71 +104,3 @@ subroutine print_cas_coefs
end 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