10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-23 12:55:37 +01:00

modified reorder_core_orb for periodic

This commit is contained in:
Kevin Gasperich 2020-01-29 16:56:27 -06:00
parent cc840cdbc1
commit 0722e12882
2 changed files with 75 additions and 44 deletions

View File

@ -30,47 +30,81 @@ subroutine initialize_mo_coef_begin_iteration
end
subroutine reorder_core_orb
implicit none
BEGIN_DOC
! TODO: modify for complex
! routines that takes the current :c:data:`mo_coef` and reorder the core orbitals (see :c:data:`list_core` and :c:data:`n_core_orb`) according to the overlap with :c:data:`mo_coef_begin_iteration`
END_DOC
integer :: i,j,iorb
integer :: k,l
double precision, allocatable :: accu(:)
integer, allocatable :: index_core_orb(:),iorder(:)
double precision, allocatable :: mo_coef_tmp(:,:)
allocate(accu(mo_num),index_core_orb(n_core_orb),iorder(mo_num))
allocate(mo_coef_tmp(ao_num,mo_num))
do i = 1, n_core_orb
iorb = list_core(i)
do j = 1, mo_num
accu(j) = 0.d0
iorder(j) = j
do k = 1, ao_num
do l = 1, ao_num
accu(j) += mo_coef_begin_iteration(k,iorb) * mo_coef(l,j) * ao_overlap(k,l)
implicit none
BEGIN_DOC
! TODO: test for complex
! routines that takes the current :c:data:`mo_coef` and reorder the core orbitals (see :c:data:`list_core` and :c:data:`n_core_orb`) according to the overlap with :c:data:`mo_coef_begin_iteration`
END_DOC
integer :: i,j,iorb
integer :: k,l
integer, allocatable :: index_core_orb(:),iorder(:)
double precision, allocatable :: accu(:)
integer :: i1,i2
if (is_periodic) then
complex*16, allocatable :: accu_c(:)
allocate(accu(mo_num),accu_c(mo_num),index_core_orb(n_core_orb),iorder(mo_num))
do i = 1, n_core_orb
iorb = list_core(i)
do j = 1, mo_num
accu(j) = 0.d0
accu_c(j) = (0.d0,0.d0)
iorder(j) = j
do k = 1, ao_num
do l = 1, ao_num
accu_c(j) += dconjg(mo_coef_begin_iteration_complex(k,iorb)) * &
mo_coef_complex(l,j) * ao_overlap_complex(k,l)
enddo
enddo
accu(j) = -cdabs(accu_c(j))
enddo
call dsort(accu,iorder,mo_num)
index_core_orb(i) = iorder(1)
enddo
enddo
accu(j) = -dabs(accu(j))
enddo
call dsort(accu,iorder,mo_num)
index_core_orb(i) = iorder(1)
enddo
double precision :: x
integer :: i1,i2
do j = 1, n_core_orb
i1 = list_core(j)
i2 = index_core_orb(j)
do i=1,ao_num
x = mo_coef(i,i1)
mo_coef(i,i1) = mo_coef(i,i2)
mo_coef(i,i2) = x
enddo
enddo
!call loc_cele_routine
deallocate(accu,index_core_orb, iorder)
complex*16 :: x_c
do j = 1, n_core_orb
i1 = list_core(j)
i2 = index_core_orb(j)
do i=1,ao_num
x_c = mo_coef_complex(i,i1)
mo_coef_complex(i,i1) = mo_coef_complex(i,i2)
mo_coef_complex(i,i2) = x_c
enddo
enddo
!call loc_cele_routine
deallocate(accu,accu_c,index_core_orb, iorder)
else
allocate(accu(mo_num),index_core_orb(n_core_orb),iorder(mo_num))
do i = 1, n_core_orb
iorb = list_core(i)
do j = 1, mo_num
accu(j) = 0.d0
iorder(j) = j
do k = 1, ao_num
do l = 1, ao_num
accu(j) += mo_coef_begin_iteration(k,iorb) * mo_coef(l,j) * ao_overlap(k,l)
enddo
enddo
accu(j) = -dabs(accu(j))
enddo
call dsort(accu,iorder,mo_num)
index_core_orb(i) = iorder(1)
enddo
double precision :: x
do j = 1, n_core_orb
i1 = list_core(j)
i2 = index_core_orb(j)
do i=1,ao_num
x = mo_coef(i,i1)
mo_coef(i,i1) = mo_coef(i,i2)
mo_coef(i,i2) = x
enddo
enddo
!call loc_cele_routine
deallocate(accu,index_core_orb, iorder)
endif
end

View File

@ -14,9 +14,6 @@ ao_ints
[ double precision, ao_two_e_integral_schwartz,(ao_num,ao_num) ]
compute_ao_integrals_jl
mo_basis
reorder_core_orb: implement for periodic
scf
finish ao_two_e_integral_{alpha,beta}_complex (need reverse index?)