9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-08 14:33:38 +01:00
qp2/src/casscf/bielec_natorb.irp.f

316 lines
8.5 KiB
Fortran
Raw Normal View History

2019-07-03 01:08:48 +02:00
BEGIN_PROVIDER [real*8, bielec_PQxx_no, (mo_num, mo_num,n_core_inact_act_orb,n_core_inact_act_orb)]
2019-06-25 16:46:14 +02:00
BEGIN_DOC
! integral (pq|xx) in the basis of natural MOs
! indices are unshifted orbital numbers
END_DOC
implicit none
integer :: i,j,k,l,t,u,p,q,pp
2019-07-03 01:08:48 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
bielec_PQxx_no(:,:,:,:) = bielec_PQxx(:,:,:,:)
2019-07-03 01:08:48 +02:00
allocate (f(n_act_orb,mo_num,n_core_inact_act_orb), &
d(n_act_orb,mo_num,n_core_inact_act_orb))
do l=1,n_core_inact_act_orb
do k=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 01:08:48 +02:00
f(p,j,k)=bielec_PQxx_no(list_act(p),j,k,l)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 01:08:48 +02:00
end do
end do
call dgemm('T','N',n_act_orb,mo_num*n_core_inact_act_orb,n_act_orb,1.d0, &
natorbsCI, size(natorbsCI,1), &
f, n_act_orb, &
0.d0, &
d, n_act_orb)
do k=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
pp=n_act_orb-p+1
2019-07-03 01:08:48 +02:00
bielec_PQxx_no(list_act(p),j,k,l)=d(pp,j,k)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 01:08:48 +02:00
end do
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 01:08:48 +02:00
f(p,j,k)=bielec_PQxx_no(j,list_act(p),k,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
2019-07-03 01:08:48 +02:00
call dgemm('T','N',n_act_orb,mo_num*n_core_inact_act_orb,n_act_orb,1.d0, &
natorbsCI, n_act_orb, &
f, n_act_orb, &
0.d0, &
d, n_act_orb)
do k=1,n_core_inact_act_orb
do p=1,n_act_orb
pp=n_act_orb-p+1
do j=1,mo_num
bielec_PQxx_no(j,list_act(p),k,l)=d(pp,j,k)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 01:08:48 +02:00
deallocate (f,d)
allocate (f(mo_num,mo_num,n_act_orb),d(mo_num,mo_num,n_act_orb))
do l=1,n_core_inact_act_orb
do p=1,n_act_orb
do k=1,mo_num
do j=1,mo_num
f(j,k,p) = bielec_PQxx_no(j,k,n_core_inact_orb+p,l)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 01:08:48 +02:00
end do
end do
call dgemm('N','N',mo_num*mo_num,n_act_orb,n_act_orb,1.d0, &
f, mo_num*mo_num, &
natorbsCI, n_act_orb, &
0.d0, &
d, mo_num*mo_num)
do p=1,n_act_orb
pp=n_act_orb-p+1
do k=1,mo_num
do j=1,mo_num
bielec_PQxx_no(j,k,n_core_inact_orb+p,l)=d(j,k,pp)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 01:08:48 +02:00
do l=1,n_core_inact_act_orb
do p=1,n_act_orb
do k=1,mo_num
do j=1,mo_num
f(j,k,p) = bielec_PQxx_no(j,k,l,n_core_inact_orb+p)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 01:08:48 +02:00
end do
end do
call dgemm('N','N',mo_num*mo_num,n_act_orb,n_act_orb,1.d0, &
f, mo_num*mo_num, &
natorbsCI, n_act_orb, &
0.d0, &
d, mo_num*mo_num)
do p=1,n_act_orb
pp=n_act_orb-p+1
do k=1,mo_num
do j=1,mo_num
bielec_PQxx_no(j,k,l,n_core_inact_orb+p)=d(j,k,pp)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 01:08:48 +02:00
deallocate (f,d)
2019-06-25 16:46:14 +02:00
END_PROVIDER
2019-07-03 08:58:30 +02:00
BEGIN_PROVIDER [real*8, bielec_PxxQ_no, (mo_num,n_core_inact_act_orb,n_core_inact_act_orb, mo_num)]
2019-06-25 16:46:14 +02:00
BEGIN_DOC
! integral (px|xq) in the basis of natural MOs
! indices are unshifted orbital numbers
END_DOC
implicit none
integer :: i,j,k,l,t,u,p,q,pp
2019-07-03 08:58:30 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
bielec_PxxQ_no(:,:,:,:) = bielec_PxxQ(:,:,:,:)
2019-07-03 08:58:30 +02:00
allocate (f(n_act_orb,n_core_inact_act_orb,n_core_inact_act_orb), &
d(n_act_orb,n_core_inact_act_orb,n_core_inact_act_orb))
2019-06-25 16:46:14 +02:00
do j=1,mo_num
2019-07-03 08:58:30 +02:00
do l=1,n_core_inact_act_orb
do k=1,n_core_inact_act_orb
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
f(p,k,l) = bielec_PxxQ_no(list_act(p),k,l,j)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 08:58:30 +02:00
end do
end do
call dgemm('T','N',n_act_orb,n_core_inact_act_orb**2,n_act_orb,1.d0, &
natorbsCI, size(natorbsCI,1), &
f, n_act_orb, &
0.d0, &
d, n_act_orb)
do l=1,n_core_inact_act_orb
do k=1,n_core_inact_act_orb
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
pp=n_act_orb-p+1
2019-07-03 08:58:30 +02:00
bielec_PxxQ_no(list_act(p),k,l,j)=d(pp,k,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 08:58:30 +02:00
deallocate (f,d)
allocate (f(n_act_orb,mo_num,n_core_inact_act_orb), &
d(n_act_orb,mo_num,n_core_inact_act_orb))
! 3rd quarter
do k=1,mo_num
do l=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
f(p,j,l) = bielec_PxxQ_no(j,n_core_inact_orb+p,l,k)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 08:58:30 +02:00
end do
end do
call dgemm('T','N',n_act_orb,mo_num*n_core_inact_act_orb,n_act_orb,1.d0, &
natorbsCI, size(natorbsCI,1), &
f, n_act_orb, &
0.d0, &
d, n_act_orb)
do l=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
pp=n_act_orb-p+1
2019-07-03 08:58:30 +02:00
bielec_PxxQ_no(j,n_core_inact_orb+p,l,k)=d(pp,j,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 08:58:30 +02:00
! 4th quarter
do k=1,mo_num
do l=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielec_PxxQ_no(j,l,n_core_inact_orb+q,k)*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielec_PxxQ_no(j,l,n_core_inact_orb+p,k)=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 08:58:30 +02:00
! 2nd quarter
do k=1,n_core_inact_act_orb
do l=1,n_core_inact_act_orb
do j=1,mo_num
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielec_PxxQ_no(j,k,l,list_act(q))*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielec_PxxQ_no(j,k,l,list_act(p))=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
END_PROVIDER
BEGIN_PROVIDER [real*8, bielecCI_no, (n_act_orb,n_act_orb,n_act_orb, mo_num)]
BEGIN_DOC
! integrals (tu|vp) in the basis of natural MOs
! index p runs over the whole basis, t,u,v only over the active orbitals
END_DOC
implicit none
integer :: i,j,k,l,t,u,p,q,pp
2019-07-03 08:58:30 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
bielecCI_no(:,:,:,:) = bielecCI(:,:,:,:)
2019-07-03 08:58:30 +02:00
allocate (f(n_act_orb,mo_num,n_act_orb), &
d(n_act_orb,mo_num,n_act_orb))
2019-06-25 16:46:14 +02:00
do j=1,n_act_orb
do k=1,n_act_orb
do l=1,mo_num
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielecCI_no(q,j,k,l)*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielecCI_no(p,j,k,l)=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
! 2nd quarter
do j=1,n_act_orb
do k=1,n_act_orb
do l=1,mo_num
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielecCI_no(j,q,k,l)*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielecCI_no(j,p,k,l)=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
! 3rd quarter
do j=1,n_act_orb
do k=1,n_act_orb
do l=1,mo_num
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielecCI_no(j,k,q,l)*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielecCI_no(j,k,p,l)=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
! 4th quarter
do j=1,n_act_orb
do k=1,n_act_orb
do l=1,n_act_orb
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)=0.D0
2019-06-25 16:46:14 +02:00
end do
do p=1,n_act_orb
do q=1,n_act_orb
2019-07-03 08:58:30 +02:00
d(p,1,1)+=bielecCI_no(j,k,l,list_act(q))*natorbsCI(q,p)
2019-06-25 16:46:14 +02:00
end do
end do
do p=1,n_act_orb
2019-07-03 08:58:30 +02:00
pp=n_act_orb-p+1
bielecCI_no(j,k,l,list_act(p))=d(pp,1,1)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
END_PROVIDER