9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

Merge branch 'dev' into csf_verified

This commit is contained in:
vijay 2022-06-14 18:40:04 +02:00 committed by GitHub
commit 8ba4afe455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 28 deletions

View File

@ -47,6 +47,37 @@ program cisd
PROVIDE N_states
read_wf = .False.
SOFT_TOUCH read_wf
integer :: i,k
if(pseudo_sym)then
call H_apply_cisd_sym
else
call H_apply_cisd
endif
double precision :: r1, r2
double precision, allocatable :: U_csf(:,:)
allocate(U_csf(N_csf,N_states))
U_csf = 0.d0
U_csf(1,1) = 1.d0
do k=2,N_states
do i=1,N_csf
call random_number(r1)
call random_number(r2)
r1 = dsqrt(-2.d0*dlog(r1))
r2 = dacos(-1.d0)*2.d0*r2
U_csf(i,k) = r1*dcos(r2)
enddo
U_csf(k,k) = U_csf(k,k) +100.d0
enddo
do k=1,N_states
call normalize(U_csf(1,k),N_csf)
enddo
call convertWFfromCSFtoDET(N_states,U_csf(1,1),psi_coef(1,1))
deallocate(U_csf)
SOFT_TOUCH psi_coef
call run
end
@ -56,13 +87,7 @@ subroutine run
double precision :: cisdq(N_states), delta_e
double precision,external :: diag_h_mat_elem
if(pseudo_sym)then
call H_apply_cisd_sym
else
call H_apply_cisd
endif
psi_coef = ci_eigenvectors
SOFT_TOUCH psi_coef
call save_wavefunction_truncated(save_threshold)
call ezfio_set_cisd_energy(CI_energy)

View File

@ -124,7 +124,7 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
stop -1
endif
itermax = max(2,min(davidson_sze_max, sze/N_st_diag))+1
itermax = max(2,min(davidson_sze_max, sze_csf/N_st_diag))+1
itertot = 0
if (state_following) then
@ -263,34 +263,20 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N
! ===================
converged = .False.
kk=1
call convertWFfromDETtoCSF(N_st_diag,u_in(1,1),U_csf(1,1))
do k=N_st+1,N_st_diag
do i=1,sze
do i=1,sze_csf
call random_number(r1)
call random_number(r2)
r1 = dsqrt(-2.d0*dlog(r1))
r2 = dtwo_pi*r2
u_in(i,k) = r1*dcos(r2) * u_in(i,k-N_st)
U_csf(i,k) = r1*dcos(r2) * u_csf(i,k-N_st)
enddo
do while(POPCNT(AND(psi_det(1,1,kk),psi_det(1,2,kk))) .ne. 3)
kk=kk+1
end do
u_in(kk,k) = u_in(kk,k) + 10.d0
kk=kk+1
U_csf(k,k) = u_csf(k,k) + 10.d0
enddo
do k=1,N_st_diag
call normalize(u_in(1,k),sze)
call normalize(U_csf(1,k),sze_csf)
enddo
do k=1,N_st_diag
do i=1,sze
U(i,k) = u_in(i,k)
enddo
enddo
! Make random verctors eigenstates of S2
call convertWFfromDETtoCSF(N_st_diag,U(1,1),U_csf(1,1))
call convertWFfromCSFtoDET(N_st_diag,U_csf(1,1),U(1,1))
do while (.not.converged)

View File

@ -77,7 +77,7 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
END_DOC
PROVIDE ezfio_filename
logical :: exists
psi_det_size = 1
psi_det_size = N_states
PROVIDE mpi_master
if (read_wf) then
if (mpi_master) then
@ -85,7 +85,7 @@ BEGIN_PROVIDER [ integer, psi_det_size ]
if (exists) then
call ezfio_get_determinants_n_det(psi_det_size)
else
psi_det_size = 1
psi_det_size = N_states
endif
call write_int(6,psi_det_size,'Dimension of the psi arrays')
endif