From 1a896cf005b01ac66db682f60ca5f9b9bdd45fca Mon Sep 17 00:00:00 2001 From: v1j4y Date: Thu, 28 Jan 2021 20:20:25 +0100 Subject: [PATCH] Added provider for getting the dimensions of AIJpq tensor #143. --- src/determinants/configurations.org | 53 +++++++++++++++--- .../configurations_sigma_vector.irp.f | 55 ++++++++++++++++++- 2 files changed, 97 insertions(+), 11 deletions(-) diff --git a/src/determinants/configurations.org b/src/determinants/configurations.org index f6b3e711..fb9329ba 100644 --- a/src/determinants/configurations.org +++ b/src/determinants/configurations.org @@ -44,7 +44,8 @@ via BLAS level 3 operations. #+begin_src f90 :main no :tangle configurations_sigma_vector.irp.f - BEGIN_PROIDER[ integer, NSOMOMax] + BEGIN_PROVIDER [ integer, NSOMOMax] + &BEGIN_PROVIDER [ integer, NCSFMax] implicit none BEGIN_DOC ! Documentation for NSOMOMax @@ -52,30 +53,64 @@ via BLAS level 3 operations. ! required for the calculation of prototype arrays. END_DOC NSOMOMax = 8 - NCSFMAx = 14 ! TODO: NCSFs for MS=0 + NCSFMax = 14 ! TODO: NCSFs for MS=0 END_PROVIDER #+end_src The prototype matrix AIJpqMatrixList has the following dimensions - ,,\(\left(NSOMOMax, NSOMOMax, 4, NSOMOMax, NSOMOMax,NCSFMAx,NCSFMax\right)\) where the first two + \(\left(NSOMOMax, NSOMOMax, 4, NSOMOMax, NSOMOMax,NCSFMAx,NCSFMax\right)\) where the first two indices represent the somos in \(I,J\) followed by the type of excitation and finally the two model space orbitals \(p,q\). - [ ] Read the transformation matrix based on the number of SOMOs - #+begin_src f90 :main no - BEGIN_PROIDER[ double precision, AIJpqMatrixList, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,NCSFMax,NCSFMax)] + #+begin_src f90 :main no :tangle configurations_sigma_vector.irp.f + BEGIN_PROVIDER [ double precision, AIJpqMatrixDimsList, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)] + use cfunctions implicit none BEGIN_DOC ! Documentation for AIJpqMatrixList ! The prototype matrix containing the ! matrices for each I,J somo pair and orb ids. END_DOC - do i = 1,NSOMOMax - do j = i-1,i+1 - if(j > NSOMOMax || j ==0) then - continue + integer i,j,k,l + integer*8 Isomo, Jsomo + Isomo = 0 + Jsomo = 0 + integer*8 rows, cols + rows = -1 + cols = -1 + integer*8 MS + MS = 0 + print *,"NSOMOMax = ",NSOMOMax + !allocate(AIJpqMatrixDimsList(NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)) + do i = 2, NSOMOMax, 2 + Isomo = ISHFT(1,i)-1 + do j = i-2,i+2, 2 + Jsomo = ISHFT(1,j)-1 + if(j .GT. NSOMOMax .OR. j .LE. 0) then + cycle end if + do k = 1,NSOMOMax + do l = k,NSOMOMax + call getApqIJMatrixDims(Isomo, & + Jsomo, & + MS, & + rows, & + cols) + print *, i,j,k,l,">",Isomo,Jsomo,">",rows, cols + ! i -> j + AIJpqMatrixDimsList(i,j,1,k,l,1) = rows + AIJpqMatrixDimsList(i,j,1,k,l,2) = cols + AIJpqMatrixDimsList(i,j,1,l,k,1) = rows + AIJpqMatrixDimsList(i,j,1,l,k,2) = cols + ! j -> i + AIJpqMatrixDimsList(j,i,1,k,l,1) = rows + AIJpqMatrixDimsList(j,i,1,k,l,2) = cols + AIJpqMatrixDimsList(j,i,1,l,k,1) = rows + AIJpqMatrixDimsList(j,i,1,l,k,2) = cols + end do + end do end do end do END_PROVIDER diff --git a/src/determinants/configurations_sigma_vector.irp.f b/src/determinants/configurations_sigma_vector.irp.f index a2913af3..44665016 100644 --- a/src/determinants/configurations_sigma_vector.irp.f +++ b/src/determinants/configurations_sigma_vector.irp.f @@ -1,4 +1,5 @@ - BEGIN_PROIDER[ integer, NSOMOMax] + BEGIN_PROVIDER [ integer, NSOMOMax] + &BEGIN_PROVIDER [ integer, NCSFMax] implicit none BEGIN_DOC ! Documentation for NSOMOMax @@ -6,5 +7,55 @@ ! required for the calculation of prototype arrays. END_DOC NSOMOMax = 8 - NCSFMAx = 14 ! TODO: NCSFs for MS=0 + NCSFMax = 14 ! TODO: NCSFs for MS=0 + END_PROVIDER + + BEGIN_PROVIDER [ double precision, AIJpqMatrixDimsList, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)] + use cfunctions + implicit none + BEGIN_DOC + ! Documentation for AIJpqMatrixList + ! The prototype matrix containing the + ! matrices for each I,J somo pair and orb ids. + END_DOC + integer i,j,k,l + integer*8 Isomo, Jsomo + Isomo = 0 + Jsomo = 0 + integer*8 rows, cols + rows = -1 + cols = -1 + integer*8 MS + MS = 0 + print *,"NSOMOMax = ",NSOMOMax + !allocate(AIJpqMatrixDimsList(NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)) + do i = 2, NSOMOMax, 2 + Isomo = ISHFT(1,i)-1 + do j = i-2,i+2, 2 + Jsomo = ISHFT(1,j)-1 + if(j .GT. NSOMOMax .OR. j .LE. 0) then + cycle + end if + do k = 1,NSOMOMax + do l = k,NSOMOMax + call getApqIJMatrixDims(Isomo, & + Jsomo, & + MS, & + rows, & + cols) + print *, i,j,k,l,">",Isomo,Jsomo,">",rows, cols + ! i -> j + AIJpqMatrixDimsList(i,j,1,k,l,1) = rows + AIJpqMatrixDimsList(i,j,1,k,l,2) = cols + AIJpqMatrixDimsList(i,j,1,l,k,1) = rows + AIJpqMatrixDimsList(i,j,1,l,k,2) = cols + ! j -> i + AIJpqMatrixDimsList(j,i,1,k,l,1) = rows + AIJpqMatrixDimsList(j,i,1,k,l,2) = cols + AIJpqMatrixDimsList(j,i,1,l,k,1) = rows + AIJpqMatrixDimsList(j,i,1,l,k,2) = cols + end do + end do + end do + end do END_PROVIDER