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

fix bitmask for kpoint ordered MOs

This commit is contained in:
Kevin Gasperich 2020-03-12 16:09:00 -05:00
parent 7be57b7a14
commit d44a22f3d8
3 changed files with 67 additions and 9 deletions

View File

@ -78,14 +78,38 @@ BEGIN_PROVIDER [ integer(bit_kind), HF_bitmask, (N_int,2)]
END_DOC
integer :: i,j,n
integer :: occ(elec_alpha_num)
integer :: occb(elec_beta_num)
HF_bitmask = 0_bit_kind
do i=1,elec_alpha_num
occ(i) = i
enddo
if (is_complex) then
integer :: kpt,korb
kpt=1
korb=1
do i=1,elec_beta_num
occ(i) = korb + (kpt-1) * ao_num_per_kpt
occb(i) = korb + (kpt-1) * ao_num_per_kpt
kpt += 1
if (kpt > kpt_num) then
kpt = 1
korb += 1
endif
enddo
do i=elec_beta_num+1,elec_alpha_num
occ(i) = korb + (kpt-1) * ao_num_per_kpt
kpt += 1
if (kpt > kpt_num) then
kpt = 1
korb += 1
endif
enddo
else
do i=1,elec_alpha_num
occ(i) = i
enddo
endif
call list_to_bitstring( HF_bitmask(1,1), occ, elec_alpha_num, N_int)
! elec_alpha_num <= elec_beta_num, so occ is already OK.
call list_to_bitstring( HF_bitmask(1,2), occ, elec_beta_num, N_int)
call list_to_bitstring( HF_bitmask(1,2), occb, elec_beta_num, N_int)
END_PROVIDER

View File

@ -80,7 +80,7 @@
if (dabs(dimag(Fock_matrix_mo_complex(i,i))) .gt. 1.0d-12) then
!stop 'diagonal elements of Fock matrix should be real'
print *, 'diagonal elements of Fock matrix should be real',i,Fock_matrix_mo_complex(i,i)
stop -1
!stop -1
endif
enddo

View File

@ -4,11 +4,28 @@ BEGIN_PROVIDER [ complex*16, scf_density_matrix_ao_alpha_complex, (ao_num,ao_num
! $C.C^t$ over $\alpha$ MOs
END_DOC
complex*16, allocatable :: mo_coef_alpha_tmp(:,:)
integer :: occ(N_int*bit_kind_size)
integer :: na, i
call bitstring_to_list(hf_bitmask(1,1), occ, na, n_int)
allocate(mo_coef_alpha_tmp(ao_num,na))
do i=1,na
mo_coef_alpha_tmp(:,i) = mo_coef_complex(:,occ(i))
enddo
call zgemm('N','C',ao_num,ao_num,elec_alpha_num,(1.d0,0.d0), &
mo_coef_complex, size(mo_coef_complex,1), &
mo_coef_complex, size(mo_coef_complex,1), (0.d0,0.d0), &
mo_coef_alpha_tmp, size(mo_coef_alpha_tmp,1), &
mo_coef_alpha_tmp, size(mo_coef_alpha_tmp,1), (0.d0,0.d0), &
scf_density_matrix_ao_alpha_complex, size(scf_density_matrix_ao_alpha_complex,1))
deallocate(mo_coef_alpha_tmp)
!call zgemm('N','C',ao_num,ao_num,elec_alpha_num,(1.d0,0.d0), &
! mo_coef_complex, size(mo_coef_complex,1), &
! mo_coef_complex, size(mo_coef_complex,1), (0.d0,0.d0), &
! scf_density_matrix_ao_alpha_complex, size(scf_density_matrix_ao_alpha_complex,1))
END_PROVIDER
BEGIN_PROVIDER [ complex*16, scf_density_matrix_ao_beta_complex, (ao_num,ao_num) ]
@ -17,11 +34,28 @@ BEGIN_PROVIDER [ complex*16, scf_density_matrix_ao_beta_complex, (ao_num,ao_num
! $C.C^t$ over $\beta$ MOs
END_DOC
complex*16, allocatable :: mo_coef_beta_tmp(:,:)
integer :: occ(N_int*bit_kind_size)
integer :: nb, i
call bitstring_to_list(hf_bitmask(1,2), occ, nb, n_int)
allocate(mo_coef_beta_tmp(ao_num,nb))
do i=1,nb
mo_coef_beta_tmp(:,i) = mo_coef_complex(:,occ(i))
enddo
call zgemm('N','C',ao_num,ao_num,elec_beta_num,(1.d0,0.d0), &
mo_coef_complex, size(mo_coef_complex,1), &
mo_coef_complex, size(mo_coef_complex,1), (0.d0,0.d0), &
mo_coef_beta_tmp, size(mo_coef_beta_tmp,1), &
mo_coef_beta_tmp, size(mo_coef_beta_tmp,1), (0.d0,0.d0), &
scf_density_matrix_ao_beta_complex, size(scf_density_matrix_ao_beta_complex,1))
deallocate(mo_coef_beta_tmp)
!call zgemm('N','C',ao_num,ao_num,elec_beta_num,(1.d0,0.d0), &
! mo_coef_complex, size(mo_coef_complex,1), &
! mo_coef_complex, size(mo_coef_complex,1), (0.d0,0.d0), &
! scf_density_matrix_ao_beta_complex, size(scf_density_matrix_ao_beta_complex,1))
END_PROVIDER
BEGIN_PROVIDER [ complex*16, scf_density_matrix_ao_complex, (ao_num,ao_num) ]