10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-18 11:15:28 +02:00

Bug corrected in saved wave function

This commit is contained in:
Anthony Scemama 2014-06-09 00:15:48 +02:00
parent fd5a6ce174
commit 5818f4f255
6 changed files with 41 additions and 10 deletions

View File

@ -4,10 +4,9 @@ program cisd
print *, 'HF = ', HF_energy
print *, 'N_states = ', N_states
N_det = 1
touch psi_det psi_coef N_det
call H_apply_cisd
! do i=1,N_det
! print '(100(X,O32))', det_connections(:,i)
! enddo
print *, 'N_det = ', N_det
do i = 1,N_states
print *, 'energy = ',CI_energy(i)

View File

@ -381,7 +381,7 @@ subroutine $subroutine($params_main)
integer :: ispin, k
PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map N_det_selectors psi_generators
PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold
PROVIDE psi_det_sorted_bit coef_hf_selector psi_det psi_coef H_apply_threshold ref_bitmask_energy
nmax = ( N_det_generators/nproc ) *nproc
call wall_time(wall_1)

View File

@ -48,7 +48,7 @@ subroutine davidson_diag(dets_in,u_in,energies,dim_in,sze,N_st,Nint,iunit)
ASSERT (sze > 0)
ASSERT (Nint > 0)
ASSERT (Nint == N_int)
PROVIDE ref_bitmask_energy
PROVIDE ref_bitmask_energy mo_bielec_integrals_in_map
allocate(H_jj(sze))
!$OMP PARALLEL DEFAULT(NONE) &

View File

@ -1,6 +1,7 @@
determinants
n_int integer
bit_kind integer
mo_label character*(64)
n_det integer
n_states integer
psi_coef double precision (determinants_n_det,determinants_n_states)
@ -9,4 +10,3 @@ determinants
n_det_max_jacobi integer
threshold_generators double precision
threshold_selectors double precision

View File

@ -13,6 +13,7 @@ BEGIN_PROVIDER [ integer, N_states ]
else
N_states = 1
endif
call write_int(output_dets,N_states,'Number of states')
ASSERT (N_states > 0)
END_PROVIDER
@ -22,13 +23,24 @@ BEGIN_PROVIDER [ integer, N_det ]
! Number of determinants in the wave function
END_DOC
logical :: exists
character*64 :: label
PROVIDE ezfio_filename
call ezfio_has_determinants_n_det(exists)
if (exists) then
if (exists) then
call ezfio_has_determinants_mo_label(exists)
if (exists) then
call ezfio_get_determinants_mo_label(label)
exists = (label == mo_label)
endif
endif
endif
if (exists) then
call ezfio_get_determinants_n_det(N_det)
else
N_det = 1
endif
call write_int(output_dets,N_det,'Number of determinants')
ASSERT (N_det > 0)
END_PROVIDER
@ -46,6 +58,7 @@ BEGIN_PROVIDER [ integer, N_det_max_jacobi ]
else
N_det_max_jacobi = 2000
endif
call write_int(output_dets,N_det_max_jacobi,'Lapack diagonalization up to')
ASSERT (N_det_max_jacobi > 0)
END_PROVIDER
@ -64,6 +77,7 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
psi_det_size = 1
endif
psi_det_size = max(psi_det_size,10000)
call write_int(output_dets,psi_det_size,'Dimension of the psi arrays')
END_PROVIDER
@ -75,7 +89,8 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ]
END_DOC
integer :: i
logical :: exists
character*64 :: label
call ezfio_has_determinants_N_int(exists)
if (exists) then
call ezfio_has_determinants_bit_kind(exists)
@ -84,7 +99,14 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det, (N_int,2,psi_det_size) ]
if (exists) then
call ezfio_has_determinants_N_states(exists)
if (exists) then
call ezfio_has_determinants_psi_det(exists)
call ezfio_has_determinants_psi_det(exists)
if (exists) then
call ezfio_has_determinants_mo_label(exists)
if (exists) then
call ezfio_get_determinants_mo_label(label)
exists = (label == mo_label)
endif
endif
endif
endif
endif
@ -156,8 +178,16 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states) ]
integer :: i,k, N_int2
logical :: exists
double precision, allocatable :: psi_coef_read(:,:)
character*(64) :: label
call ezfio_has_determinants_psi_coef(exists)
if (exists) then
call ezfio_has_determinants_mo_label(exists)
if (exists) then
call ezfio_get_determinants_mo_label(label)
exists = (label == mo_label)
endif
endif
if (exists) then
@ -303,6 +333,7 @@ subroutine save_wavefunction
call ezfio_set_determinants_bit_kind(bit_kind)
call ezfio_set_determinants_N_det(N_det)
call ezfio_set_determinants_N_states(N_states)
call ezfio_set_determinants_mo_label(mo_label)
N_int2 = (N_int*bit_kind)/8
allocate (psi_det_save(N_int2,2,N_det))
@ -314,7 +345,7 @@ subroutine save_wavefunction
psi_det_save(k,1,i) = det_8(k)
enddo
do k=1,N_int
det_bk(k) = psi_det(k,2,i)
det_bk(k) = psi_det_sorted(k,2,i)
enddo
do k=1,N_int2
psi_det_save(k,2,i) = det_8(k)
@ -330,6 +361,7 @@ subroutine save_wavefunction
enddo
enddo
call ezfio_set_determinants_psi_coef(psi_coef_save)
call write_int(output_dets,N_det,'Saved determinants')
deallocate (psi_coef_save)
end

View File

@ -11,7 +11,7 @@ program cisd
pt2 = 1.d0
diag_algorithm = "Lapack"
do while (maxval(abs(pt2(1:N_st))) > 1.d-3)
do while (maxval(abs(pt2(1:N_st))) > 1.d-4)
call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st)
call diagonalize_CI
call save_wavefunction