10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 22:53:52 +01:00
QuantumPackage/src/casscf/bielec_natorb.irp.f

370 lines
11 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
2019-07-04 00:22:44 +02:00
integer :: i,j,k,l,t,u,p,q
2019-07-03 01:08:48 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
2019-07-03 21:38:40 +02:00
!$OMP PARALLEL DEFAULT(NONE) &
2019-07-04 00:22:44 +02:00
!$OMP PRIVATE(j,k,l,p,d,f) &
2019-07-03 21:38:40 +02:00
!$OMP SHARED(n_core_inact_act_orb,mo_num,n_act_orb,n_core_inact_orb, &
!$OMP bielec_PQxx_no,bielec_PQxx,list_act,natorbsCI)
2019-06-25 16:46:14 +02:00
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))
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 01:08:48 +02:00
do l=1,n_core_inact_act_orb
2019-07-03 21:38:40 +02:00
bielec_PQxx_no(:,:,:,l) = bielec_PQxx(:,:,:,l)
2019-07-03 01:08:48 +02:00
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
2019-07-04 00:22:44 +02:00
bielec_PQxx_no(list_act(p),j,k,l)=d(p,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
do j=1,mo_num
2019-07-04 00:22:44 +02:00
bielec_PQxx_no(j,list_act(p),k,l)=d(p,j,k)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
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))
2019-07-03 21:38:40 +02:00
!$OMP 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,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
do k=1,mo_num
do j=1,mo_num
2019-07-04 00:22:44 +02:00
bielec_PQxx_no(j,k,n_core_inact_orb+p,l)=d(j,k,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
!$OMP BARRIER
2019-07-03 01:08:48 +02:00
2019-07-03 21:38:40 +02:00
!$OMP 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
do k=1,mo_num
do j=1,mo_num
2019-07-04 00:22:44 +02:00
bielec_PQxx_no(j,k,l,n_core_inact_orb+p)=d(j,k,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO
2019-06-25 16:46:14 +02:00
2019-07-03 01:08:48 +02:00
deallocate (f,d)
2019-07-03 21:38:40 +02:00
!$OMP END PARALLEL
2019-07-03 01:08:48 +02:00
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
2019-07-04 00:22:44 +02:00
integer :: i,j,k,l,t,u,p,q
2019-07-03 08:58:30 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
2019-07-03 21:38:40 +02:00
!$OMP PARALLEL DEFAULT(NONE) &
2019-07-04 00:22:44 +02:00
!$OMP PRIVATE(j,k,l,p,d,f) &
2019-07-03 21:38:40 +02:00
!$OMP SHARED(n_core_inact_act_orb,mo_num,n_act_orb,n_core_inact_orb, &
!$OMP bielec_PxxQ_no,bielec_PxxQ,list_act,natorbsCI)
2019-06-25 16:46:14 +02:00
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-07-03 21:38:40 +02:00
!$OMP DO
2019-06-25 16:46:14 +02:00
do j=1,mo_num
2019-07-03 21:38:40 +02:00
bielec_PxxQ_no(:,:,:,j) = bielec_PxxQ(:,:,:,j)
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
2019-07-04 00:22:44 +02:00
bielec_PxxQ_no(list_act(p),k,l,j)=d(p,k,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
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))
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 08:58:30 +02:00
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
2019-07-04 00:22:44 +02:00
bielec_PxxQ_no(j,n_core_inact_orb+p,l,k)=d(p,j,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
2019-07-03 08:58:30 +02:00
2019-07-03 20:03:44 +02:00
deallocate(f,d)
allocate(f(mo_num,n_core_inact_act_orb,n_act_orb), &
d(mo_num,n_core_inact_act_orb,n_act_orb) )
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 08:58:30 +02:00
do k=1,mo_num
2019-07-03 20:03:44 +02:00
do p=1,n_act_orb
do l=1,n_core_inact_act_orb
do j=1,mo_num
f(j,l,p) = bielec_PxxQ_no(j,l,n_core_inact_orb+p,k)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 20:03:44 +02:00
end do
end do
call dgemm('N','N',mo_num*n_core_inact_act_orb,n_act_orb,n_act_orb,1.d0, &
f, mo_num*n_core_inact_act_orb, &
natorbsCI, size(natorbsCI,1), &
0.d0, &
d, mo_num*n_core_inact_act_orb)
do p=1,n_act_orb
do l=1,n_core_inact_act_orb
do j=1,mo_num
2019-07-04 00:22:44 +02:00
bielec_PxxQ_no(j,l,n_core_inact_orb+p,k)=d(j,l,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
2019-07-03 20:03:44 +02:00
2019-07-03 21:38:40 +02:00
!$OMP BARRIER
2019-07-03 20:03:44 +02:00
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 20:03:44 +02:00
do l=1,n_core_inact_act_orb
do p=1,n_act_orb
do k=1,n_core_inact_act_orb
do j=1,mo_num
f(j,k,p) = bielec_PxxQ_no(j,k,l,n_core_inact_orb+p)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 20:03:44 +02:00
end do
end do
call dgemm('N','N',mo_num*n_core_inact_act_orb,n_act_orb,n_act_orb,1.d0, &
f, mo_num*n_core_inact_act_orb, &
natorbsCI, size(natorbsCI,1), &
0.d0, &
d, mo_num*n_core_inact_act_orb)
do p=1,n_act_orb
do k=1,n_core_inact_act_orb
do j=1,mo_num
2019-07-04 00:22:44 +02:00
bielec_PxxQ_no(j,k,l,n_core_inact_orb+p)=d(j,k,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO NOWAIT
deallocate(f,d)
!$OMP END PARALLEL
2019-06-25 16:46:14 +02:00
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
2019-07-04 00:22:44 +02:00
integer :: i,j,k,l,t,u,p,q
2019-07-03 08:58:30 +02:00
double precision, allocatable :: f(:,:,:), d(:,:,:)
2019-06-25 16:46:14 +02:00
2019-07-03 21:38:40 +02:00
!$OMP PARALLEL DEFAULT(NONE) &
2019-07-04 00:22:44 +02:00
!$OMP PRIVATE(j,k,l,p,d,f) &
2019-07-03 21:38:40 +02:00
!$OMP SHARED(n_core_inact_act_orb,mo_num,n_act_orb,n_core_inact_orb, &
!$OMP bielecCI_no,bielecCI,list_act,natorbsCI)
2019-06-25 16:46:14 +02:00
2019-07-03 20:03:44 +02:00
allocate (f(n_act_orb,n_act_orb,mo_num), &
d(n_act_orb,n_act_orb,mo_num))
2019-07-03 08:58:30 +02:00
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 20:03:44 +02:00
do l=1,mo_num
2019-07-03 21:38:40 +02:00
bielecCI_no(:,:,:,l) = bielecCI(:,:,:,l)
2019-06-25 16:46:14 +02:00
do k=1,n_act_orb
2019-07-03 20:03:44 +02:00
do j=1,n_act_orb
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 20:03:44 +02:00
f(p,j,k)=bielecCI_no(p,j,k,l)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 20:03:44 +02:00
end do
end do
call dgemm('T','N',n_act_orb,n_act_orb*n_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_act_orb
do j=1,n_act_orb
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-04 00:22:44 +02:00
bielecCI_no(p,j,k,l)=d(p,j,k)
2019-06-25 16:46:14 +02:00
end do
end do
2019-07-03 20:03:44 +02:00
2019-07-03 21:38:40 +02:00
do j=1,n_act_orb
2019-06-25 16:46:14 +02:00
do p=1,n_act_orb
2019-07-03 21:38:40 +02:00
f(p,j,k)=bielecCI_no(j,p,k,l)
2019-06-25 16:46:14 +02:00
end do
end do
end do
2019-07-03 21:38:40 +02:00
call dgemm('T','N',n_act_orb,n_act_orb*n_act_orb,n_act_orb,1.d0, &
natorbsCI, n_act_orb, &
f, n_act_orb, &
0.d0, &
d, n_act_orb)
2019-06-25 16:46:14 +02:00
do k=1,n_act_orb
2019-07-03 21:38:40 +02:00
do p=1,n_act_orb
do j=1,n_act_orb
2019-07-04 00:22:44 +02:00
bielecCI_no(j,p,k,l)=d(p,j,k)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 21:38:40 +02:00
end do
end do
do p=1,n_act_orb
do k=1,n_act_orb
do j=1,n_act_orb
f(j,k,p)=bielecCI_no(j,k,p,l)
2019-06-25 16:46:14 +02:00
end do
2019-07-03 21:38:40 +02:00
end do
end do
call dgemm('N','N',n_act_orb*n_act_orb,n_act_orb,n_act_orb,1.d0, &
f, n_act_orb*n_act_orb, &
natorbsCI, n_act_orb, &
0.d0, &
d, n_act_orb*n_act_orb)
do p=1,n_act_orb
do k=1,n_act_orb
do j=1,n_act_orb
2019-07-04 00:22:44 +02:00
bielecCI_no(j,k,p,l)=d(j,k,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO
2019-07-03 20:03:44 +02:00
2019-07-03 21:38:40 +02:00
!$OMP DO
2019-07-03 20:03:44 +02:00
do l=1,n_act_orb
2019-07-03 21:38:40 +02:00
do p=1,n_act_orb
do k=1,n_act_orb
do j=1,n_act_orb
f(j,k,p)=bielecCI_no(j,k,l,list_act(p))
2019-06-25 16:46:14 +02:00
end do
2019-07-03 21:38:40 +02:00
end do
end do
call dgemm('N','N',n_act_orb*n_act_orb,n_act_orb,n_act_orb,1.d0, &
f, n_act_orb*n_act_orb, &
natorbsCI, n_act_orb, &
0.d0, &
d, n_act_orb*n_act_orb)
do p=1,n_act_orb
do k=1,n_act_orb
do j=1,n_act_orb
2019-07-04 00:22:44 +02:00
bielecCI_no(j,k,l,list_act(p))=d(j,k,p)
2019-06-25 16:46:14 +02:00
end do
end do
end do
end do
2019-07-03 21:38:40 +02:00
!$OMP END DO
deallocate(d,f)
!$OMP END PARALLEL
2019-06-25 16:46:14 +02:00
END_PROVIDER