10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-26 14:23:43 +01:00
quantum_package/plugins/dress_zmq/dress_general.irp.f

77 lines
2.2 KiB
Fortran
Raw Normal View History

2018-03-05 17:04:26 +01:00
subroutine run_dressing(N_st,energy)
2017-12-15 16:21:04 +01:00
implicit none
integer, intent(in) :: N_st
double precision, intent(out) :: energy(N_st)
integer :: i,j
double precision :: E_new, E_old, delta_e
integer :: iteration
integer :: n_it_dress_max
double precision :: thresh_dress, dummy
2017-12-15 16:21:04 +01:00
thresh_dress = thresh_dressed_ci
n_it_dress_max = n_it_max_dressed_ci
if(n_it_dress_max == 1) then
do j=1,N_states
do i=1,N_det
psi_coef(i,j) = CI_eigenvectors_dressed(i,j)
enddo
enddo
SOFT_TOUCH psi_coef ci_energy_dressed
call write_double(6,ci_energy_dressed(1),"Final dress energy")
2018-02-27 18:43:07 +01:00
! call ezfio_set_dress_zmq_energy(ci_energy_dressed(1))
2017-12-15 16:21:04 +01:00
call save_wavefunction
else
E_new = 0.d0
delta_E = 1.d0
iteration = 0
2018-05-07 15:21:28 +02:00
do iteration=1,n_it_dress_max
N_det_delta_ij = N_det
touch N_det_delta_ij
2017-12-15 16:21:04 +01:00
print *, '==============================================='
print *, 'Iteration', iteration, '/', n_it_dress_max
print *, '==============================================='
print *, ''
2018-05-07 15:21:28 +02:00
E_old = sum(psi_energy(:))
print *, 'Variational energy <Psi|H|Psi>'
do i=1,N_st
2018-05-23 18:16:33 +02:00
print *, i, psi_energy(i)+nuclear_repulsion
enddo
!print *, "DELTA IJ", delta_ij(1,1,1)
2018-05-23 18:16:33 +02:00
PROVIDE delta_ij_tmp
if(.true.) call delta_ij_done()
print *, 'Dressed energy <Psi|H+Delta|Psi>'
2017-12-15 16:21:04 +01:00
do i=1,N_st
print *, i, ci_energy_dressed(i)
2017-12-15 16:21:04 +01:00
enddo
2018-03-05 17:04:26 +01:00
call diagonalize_ci_dressed
2018-05-07 15:21:28 +02:00
E_new = sum(psi_energy(:))
2017-12-15 16:21:04 +01:00
delta_E = (E_new - E_old)/dble(N_states)
print *, ''
call write_double(6,thresh_dress,"thresh_dress")
2018-05-07 15:21:28 +02:00
call write_double(6,delta_E,"delta_E (undressed)")
2017-12-15 16:21:04 +01:00
delta_E = dabs(delta_E)
call save_wavefunction
2018-02-27 18:43:07 +01:00
! call ezfio_set_dress_zmq_energy(ci_energy_dressed(1))
2018-05-07 15:21:28 +02:00
if (delta_E < thresh_dress) then
2017-12-15 16:21:04 +01:00
exit
endif
enddo
print *, 'Variational energy <Psi|H|Psi>'
do i=1,N_st
2018-05-22 19:11:10 +02:00
print *, i, psi_energy(i)+nuclear_repulsion
enddo
print *, 'Dressed energy <Psi|H+Delta|Psi>'
do i=1,N_st
2018-05-22 19:11:10 +02:00
print *, i, ci_energy_dressed(i)+nuclear_repulsion
enddo
2017-12-15 16:21:04 +01:00
endif
if(.true.) energy(1:N_st) = 0d0 ! ci_energy_dressed(1:N_st)
2017-12-15 16:21:04 +01:00
end