10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-04 02:16:02 +02:00

Fixed bug in truncate_wf

This commit is contained in:
Anthony Scemama 2018-09-14 19:07:55 +02:00
parent b292a4e4e5
commit 5c769d531c
3 changed files with 12 additions and 14 deletions

View File

@ -549,23 +549,18 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,dim_psicoef,psicoef)
deallocate (psi_det_save)
allocate (psi_coef_save(ndet,nstates))
double precision :: accu_norm(nstates)
accu_norm = 0.d0
double precision :: accu_norm
do k=1,nstates
accu_norm = 0.d0
do i=1,ndet
accu_norm(k) = accu_norm(k) + psicoef(i,k) * psicoef(i,k)
psi_coef_save(i,k) = psicoef(i,k)
accu_norm = accu_norm + psicoef(i,k) * psicoef(i,k)
enddo
if (accu_norm(k) == 0.d0) then
accu_norm(k) = 1.e-12
if (accu_norm == 0.d0) then
accu_norm = 1.e-12
endif
enddo
do k = 1, nstates
accu_norm(k) = 1.d0/dsqrt(accu_norm(k))
enddo
do k=1,nstates
accu_norm = 1.d0/dsqrt(accu_norm)
do i=1,ndet
psi_coef_save(i,k) = psi_coef_save(i,k) * accu_norm(k)
psi_coef_save(i,k) = psicoef(i,k) * accu_norm
enddo
enddo

View File

@ -256,6 +256,8 @@ BEGIN_PROVIDER [ integer, det_to_occ_pattern, (N_det) ]
integer :: i,j,k
integer(bit_kind) :: occ(N_int,2)
logical :: found
!$OMP PARALLEL DO DEFAULT(SHARED) &
!$OMP PRIVATE(i,k,j,found,occ)
do i=1,N_det
do k = 1, N_int
occ(k,1) = ieor(psi_det(k,1,i),psi_det(k,2,i))
@ -276,6 +278,7 @@ BEGIN_PROVIDER [ integer, det_to_occ_pattern, (N_det) ]
endif
enddo
enddo
!$OMP END PARALLEL DO
END_PROVIDER
BEGIN_PROVIDER [ double precision, weight_occ_pattern, (N_occ_pattern,N_states) ]

View File

@ -39,7 +39,7 @@ subroutine routine
enddo
enddo
call save_wavefunction_general(ndet_max,N_states,psi_det_tmp,N_det_max,psi_coef_tmp)
call save_wavefunction_general(ndet_max,N_states,psi_det_tmp,size(psi_coef_tmp,1),psi_coef_tmp)
end
@ -86,6 +86,6 @@ subroutine routine_s2
enddo
enddo
call save_wavefunction_general(ndet_max,N_states,psi_det_tmp,N_det_max,psi_coef_tmp)
call save_wavefunction_general(ndet_max,N_states,psi_det_tmp,size(psi_coef_tmp,1),psi_coef_tmp)
end