10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-25 05:43:47 +01:00

Fixed CISD

This commit is contained in:
Anthony Scemama 2018-07-30 19:17:27 +02:00
parent 7298ba2b66
commit df90b9fe98
3 changed files with 20 additions and 16 deletions

View File

@ -3,7 +3,9 @@
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python2 ]
from generate_h_apply import H_apply from generate_h_apply import H_apply
H = H_apply("cisd") H = H_apply("cisd",do_double_exc=True)
print H
H = H_apply("cis",do_double_exc=False)
print H print H
END_SHELL END_SHELL

View File

@ -1,20 +1,22 @@
program cisd program cis
implicit none
read_wf = .False.
SOFT_TOUCH read_wf
call run
end
subroutine run
implicit none implicit none
integer :: i integer :: i
print *, 'HF = ', HF_energy
print *, 'N_states = ', N_states
N_det = 1
touch psi_det psi_coef N_det
call H_apply_cisd call H_apply_cisd
print *, 'N_det = ', N_det print *, 'N_det = ', N_det
do i = 1,N_states do i = 1,N_states
print *, 'energy = ',CI_energy(i) print *, 'energy = ',CI_energy(i)
print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy
enddo enddo
call ezfio_set_cisd_energy(CI_energy(1))
psi_coef = ci_eigenvectors psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef SOFT_TOUCH psi_coef
call save_wavefunction call save_wavefunction
end end

View File

@ -26,13 +26,13 @@ subroutine run1
!$OMP PARALLEL DO DEFAULT(SHARED) & !$OMP PARALLEL DO DEFAULT(SHARED) &
!$OMP PRIVATE(k,c_alpha) SCHEDULE(static,64) !$OMP PRIVATE(k,c_alpha) SCHEDULE(static,64)
do k=1,N_det do k=1,N_det
if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then ! if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then
if (iand(k,1023) == 0) then if (iand(k,1023) == 0) then
print *, k, '/', N_det print *, k, '/', N_det
endif endif
call get_cc_coef(psi_det(1,1,k), c_alpha) call get_cc_coef(psi_det(1,1,k), c_alpha)
psi_coef(k,1:N_states) = c_alpha(1:N_states) psi_coef(k,1:N_states) = c_alpha(1:N_states)
endif ! endif
enddo enddo
!$OMP END PARALLEL DO !$OMP END PARALLEL DO
SOFT_TOUCH psi_coef SOFT_TOUCH psi_coef
@ -46,12 +46,12 @@ subroutine run2
psi_det(1:N_int,1:2,1:N_det) = psi_det_sorted(1:N_int,1:2,1:N_det) psi_det(1:N_int,1:2,1:N_det) = psi_det_sorted(1:N_int,1:2,1:N_det)
psi_coef(1:N_det,1:N_states) = psi_coef_sorted(1:N_det,1:N_states) psi_coef(1:N_det,1:N_states) = psi_coef_sorted(1:N_det,1:N_states)
do k=N_det,1,-1 ! do k=N_det,1,-1
if (maxval(abs(psi_coef(k,1:N_states))) > 0.d0) then ! if (maxval(abs(psi_coef(k,1:N_states))) > 0.d0) then
exit ! exit
endif ! endif
enddo ! enddo
N_det = k ! N_det = k
SOFT_TOUCH N_det psi_coef psi_det SOFT_TOUCH N_det psi_coef psi_det
call save_wavefunction call save_wavefunction
end end