2014-05-30 18:07:04 +02:00
|
|
|
program cisd_sc2_selected
|
|
|
|
implicit none
|
|
|
|
integer :: i,k
|
2014-06-01 22:03:26 +02:00
|
|
|
use bitmasks
|
2014-05-30 18:07:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:),E_old(:)
|
2014-06-01 22:03:26 +02:00
|
|
|
integer :: N_st, iter,degree
|
2014-05-30 18:07:04 +02:00
|
|
|
character*(64) :: perturbation
|
|
|
|
N_st = N_states
|
|
|
|
allocate (pt2(N_st), norm_pert(N_st), H_pert_diag(N_st),E_old(N_st))
|
|
|
|
|
|
|
|
pt2 = 1.d0
|
2014-08-21 11:14:30 +02:00
|
|
|
perturbation = "epstein_nesbet_sc2_projected"
|
2014-10-06 15:49:16 +02:00
|
|
|
|
2014-05-30 18:07:04 +02:00
|
|
|
E_old(1) = HF_energy
|
2016-02-19 00:20:28 +01:00
|
|
|
threshold_davidson = 1.d-10
|
2015-05-12 15:14:54 +02:00
|
|
|
if (N_det > N_det_max) then
|
2014-08-16 16:06:27 +02:00
|
|
|
call diagonalize_CI_SC2
|
|
|
|
call save_wavefunction
|
|
|
|
psi_det = psi_det_sorted
|
|
|
|
psi_coef = psi_coef_sorted
|
2015-05-12 15:14:54 +02:00
|
|
|
N_det = N_det_max
|
2014-08-16 16:06:27 +02:00
|
|
|
soft_touch N_det psi_det psi_coef
|
|
|
|
call diagonalize_CI
|
|
|
|
call save_wavefunction
|
|
|
|
print *, 'N_det = ', N_det
|
|
|
|
print *, 'N_states = ', N_states
|
|
|
|
print *, 'PT2 = ', pt2
|
|
|
|
print *, 'E = ', CI_SC2_energy
|
|
|
|
print *, 'E+PT2 = ', CI_SC2_energy+pt2
|
|
|
|
print *, '-----'
|
|
|
|
endif
|
2014-06-04 21:28:43 +02:00
|
|
|
|
2014-10-06 15:49:16 +02:00
|
|
|
integer :: i_count
|
|
|
|
i_count = 0
|
2015-05-12 15:14:54 +02:00
|
|
|
do while (N_det < N_det_max.and.maxval(abs(pt2(1:N_st))) > pt2_max)
|
2014-05-30 18:07:04 +02:00
|
|
|
print*,'----'
|
|
|
|
print*,''
|
2015-03-19 21:14:52 +01:00
|
|
|
call H_apply_SC2_selected(pt2, norm_pert, H_pert_diag, N_st)
|
2014-05-30 18:07:04 +02:00
|
|
|
call diagonalize_CI_SC2
|
|
|
|
print *, 'N_det = ', N_det
|
2014-05-31 11:35:44 +02:00
|
|
|
do i = 1, N_st
|
2014-06-01 22:03:26 +02:00
|
|
|
print*,'state ',i
|
2014-05-31 11:35:44 +02:00
|
|
|
print *, 'PT2(SC2) = ', pt2(i)
|
|
|
|
print *, 'E(SC2) = ', CI_SC2_energy(i)
|
2014-06-01 22:03:26 +02:00
|
|
|
print *, 'E_before(SC2)+PT2(SC2) = ', (E_old(i)+pt2(i))
|
2014-05-31 11:35:44 +02:00
|
|
|
if(i==1)then
|
|
|
|
print *, 'E(SC2)+PT2(projctd)SC2 = ', (E_old(i)+H_pert_diag(i))
|
|
|
|
endif
|
2014-06-01 22:03:26 +02:00
|
|
|
E_old(i) = CI_SC2_energy(i)
|
2014-05-31 11:35:44 +02:00
|
|
|
enddo
|
2014-10-06 15:49:16 +02:00
|
|
|
if(dabs(E_old(i) - CI_SC2_energy(i) ).le.1.d-12)then
|
|
|
|
i_count += 1
|
|
|
|
selection_criterion_factor = selection_criterion_factor * 0.5d0
|
|
|
|
if(i_count > 5)then
|
|
|
|
exit
|
|
|
|
endif
|
2015-03-19 21:14:52 +01:00
|
|
|
else
|
|
|
|
i_count = 0
|
2014-10-06 15:49:16 +02:00
|
|
|
endif
|
2015-04-01 15:50:34 +02:00
|
|
|
|
|
|
|
! =~=~=~=~=~=~=~=~=~=~=~=~=~!
|
|
|
|
! W r i t e _ o n _ d i s k !
|
|
|
|
! =~=~=~=~=~=~=~=~=~=~=~=~=~!
|
|
|
|
|
2015-06-03 18:33:35 +02:00
|
|
|
call ezfio_set_cisd_sc2_selected_energy(CI_SC2_energy(1))
|
2015-04-01 15:50:34 +02:00
|
|
|
|
2014-05-30 18:07:04 +02:00
|
|
|
enddo
|
2015-05-12 15:14:54 +02:00
|
|
|
N_det = min(N_det_max,N_det)
|
2016-02-19 00:20:28 +01:00
|
|
|
threshold_davidson = 1.d-10
|
|
|
|
touch N_det psi_det psi_coef threshold_davidson davidson_criterion
|
2014-08-16 16:06:27 +02:00
|
|
|
call diagonalize_CI_SC2
|
|
|
|
pt2 = 0.d0
|
2015-03-31 09:31:59 +02:00
|
|
|
|
2014-08-16 16:06:27 +02:00
|
|
|
if(do_pt2_end)then
|
|
|
|
threshold_selectors = 1.d0
|
|
|
|
call H_apply_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
|
|
|
do i = 1, N_st
|
|
|
|
max = 0.d0
|
|
|
|
|
|
|
|
print*,''
|
|
|
|
print*,'-------------'
|
|
|
|
print*,'for state ',i
|
|
|
|
print*,''
|
|
|
|
print*,'N_det = ',N_det
|
|
|
|
do k = 1, N_det
|
|
|
|
if(dabs(psi_coef(k,i)).gt.max)then
|
|
|
|
max = dabs(psi_coef(k,i))
|
|
|
|
imax = k
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
double precision :: max
|
|
|
|
integer :: imax
|
|
|
|
print *, 'PT2(SC2) = ', pt2(i)
|
|
|
|
print *, 'E(SC2) = ', CI_SC2_energy(i)
|
2014-08-21 11:14:30 +02:00
|
|
|
print *, 'E_before(SC2)+PT2(SC2) = ', CI_SC2_energy(i)+pt2(i)
|
2014-10-06 15:49:16 +02:00
|
|
|
print *, 'E_before(SC2)+PT2(SC2)_new = ', CI_SC2_energy(i)+pt2(i)* (1.d0 + norm_pert) - H_pert_diag(i)
|
2014-06-01 22:03:26 +02:00
|
|
|
|
2015-03-17 22:39:00 +01:00
|
|
|
print*,'Largest coefficient of the state : ',dabs(psi_coef(imax,i))
|
2014-08-16 16:06:27 +02:00
|
|
|
call get_excitation_degree(ref_bitmask,psi_det(1,1,imax),degree,N_int)
|
2015-03-17 22:39:00 +01:00
|
|
|
print*,'Degree of excitation of this determinant : ',degree
|
2014-08-16 16:06:27 +02:00
|
|
|
|
|
|
|
enddo
|
2015-04-01 15:50:34 +02:00
|
|
|
|
|
|
|
! =~=~=~=~=~=~=~=~=~=~=~=~=~!
|
|
|
|
! W r i t e _ o n _ d i s k !
|
|
|
|
! =~=~=~=~=~=~=~=~=~=~=~=~=~!
|
|
|
|
|
2015-06-03 18:33:35 +02:00
|
|
|
call ezfio_set_cisd_sc2_selected_energy_pt2(CI_SC2_energy(i)+pt2(i)* (1.d0 + norm_pert) - H_pert_diag(i))
|
2014-08-16 16:06:27 +02:00
|
|
|
endif
|
2014-08-16 19:00:29 +02:00
|
|
|
call save_wavefunction
|
2014-05-30 18:07:04 +02:00
|
|
|
deallocate(pt2,norm_pert,H_pert_diag)
|
|
|
|
end
|