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

fixed array assignment for complex nos

This commit is contained in:
Kevin Gasperich 2020-04-07 13:26:15 -05:00
parent f011ca845e
commit f32dc836a8
5 changed files with 41 additions and 5 deletions

View File

@ -259,6 +259,7 @@ subroutine set_natural_mos
label = "Natural"
integer :: i,j,iorb,jorb,k
if (is_complex) then
!todo: implement for kpts
do k=1,kpt_num
do i = 1, n_virt_orb_kpts(k)
@ -273,6 +274,14 @@ subroutine set_natural_mos
enddo
enddo
enddo
!print*,'1RDM'
!do k=1,kpt_num
! do j=1,mo_num_per_kpt
! do i=1,mo_num_per_kpt
! print'(3(I5),2(E25.15))',i,j,k,one_e_dm_mo_kpts(i,j,k)
! enddo
! enddo
!enddo
! call mo_as_svd_vectors_of_mo_matrix_eig_complex(one_e_dm_mo_complex,size(one_e_dm_mo_complex,1),mo_num,mo_num,mo_occ,label)
call mo_as_svd_vectors_of_mo_matrix_eig_kpts(one_e_dm_mo_kpts,size(one_e_dm_mo_kpts,1),mo_num_per_kpt,mo_num_per_kpt,kpt_num,mo_occ_kpts,label)
soft_touch mo_occ_kpts

View File

@ -228,7 +228,7 @@ BEGIN_PROVIDER [ complex*16, mo_coef_kpts, (ao_num_per_kpt, mo_num_per_kpt, kpt_
if (mpi_master) then
! Coefs
call ezfio_has_mo_basis_mo_coef_complex(exists)
call ezfio_has_mo_basis_mo_coef_kpts(exists)
endif
IRP_IF MPI_DEBUG
print *, irp_here, mpi_rank

View File

@ -2,7 +2,7 @@ subroutine save_mos
implicit none
double precision, allocatable :: buffer(:,:)
complex*16, allocatable :: buffer_c(:,:),buffer_k(:,:,:)
integer :: i,j,k
integer :: i,j,k,ishft,jshft
!TODO: change this for periodic?
! save real/imag parts of mo_coef_complex
! otherwise need to make sure mo_coef and mo_coef_imag
@ -12,19 +12,40 @@ subroutine save_mos
call ezfio_set_mo_basis_mo_label(mo_label)
call ezfio_set_mo_basis_ao_md5(ao_md5)
if (is_complex) then
!allocate ( buffer_c(ao_num,mo_num))
allocate ( buffer_c(ao_num,mo_num))
allocate ( buffer_k(ao_num_per_kpt,mo_num_per_kpt,kpt_num))
buffer_k = (0.d0,0.d0)
do k=1,kpt_num
do j = 1, mo_num_per_kpt
do i = 1, ao_num_per_kpt
buffer_k(i,j,k) = mo_coef_kpts(i,j,k)
!print*,i,j,k,buffer_k(i,j,k)
enddo
enddo
enddo
buffer_c = (0.d0,0.d0)
do k=1,kpt_num
ishft = (k-1)*ao_num_per_kpt
jshft = (k-1)*mo_num_per_kpt
do j=1,mo_num_per_kpt
do i=1,ao_num_per_kpt
buffer_c(i+ishft,j+jshft) = buffer_k(i,j,k)
enddo
enddo
enddo
call ezfio_set_mo_basis_mo_coef_kpts(buffer_k)
deallocate (buffer_k)
call ezfio_set_mo_basis_mo_coef_complex(buffer_c)
deallocate (buffer_k,buffer_c)
mo_occ = 0.d0
do k=1,kpt_num
ishft=(k-1)*mo_num_per_kpt
do i=1,mo_num_per_kpt
mo_occ(i+ishft)=mo_occ_kpts(i,k)
enddo
enddo
call ezfio_set_mo_basis_mo_occ_kpts(mo_occ_kpts)
call ezfio_set_mo_basis_mo_occ(mo_occ)
else
allocate ( buffer(ao_num,mo_num) )
buffer = 0.d0

View File

@ -415,7 +415,7 @@ subroutine mo_as_svd_vectors_of_mo_matrix_eig_kpts(matrix,lda,m,n,nk,eig,label)
A(i,j) = matrix(i,j,k)
enddo
enddo
mo_coef_new = mo_coef_kpts(1,1,k)
mo_coef_new(1:ao_num_per_kpt,1:m) = mo_coef_kpts(1:ao_num_per_kpt,1:m,k)
call svd_complex(A,lda,U,lda,D,Vt,lda,m,n)
@ -428,6 +428,11 @@ subroutine mo_as_svd_vectors_of_mo_matrix_eig_kpts(matrix,lda,m,n,nk,eig,label)
do i=1,m
eig(i,k) = D(i)
enddo
!do j=1,mo_num_per_kpt
! do i=1,mo_num_per_kpt
! print'(3(I5),2(E25.15))',i,j,k,mo_coef_kpts(i,j,k)
! enddo
!enddo
enddo
deallocate(A,mo_coef_new,U,Vt,D)

View File

@ -17,6 +17,7 @@ program save_natorb
call save_natural_mos
call save_ref_determinant
call ezfio_set_mo_two_e_ints_io_mo_two_e_integrals('None')
call ezfio_set_mo_two_e_ints_io_df_mo_integrals('None')
call ezfio_set_mo_one_e_ints_io_mo_one_e_integrals('None')
call ezfio_set_mo_one_e_ints_io_mo_integrals_kinetic('None')
call ezfio_set_mo_one_e_ints_io_mo_integrals_e_n('None')