From a8424c6d3be3c9b0da747ed64b51f149d171c277 Mon Sep 17 00:00:00 2001 From: v1j4y Date: Thu, 28 Jan 2021 21:10:45 +0100 Subject: [PATCH] Added provider for getting the #143. --- src/determinants/configurations.org | 80 ++++++++++++++++++- .../configurations_sigma_vector.irp.f | 69 +++++++++++++++- 2 files changed, 144 insertions(+), 5 deletions(-) diff --git a/src/determinants/configurations.org b/src/determinants/configurations.org index fb9329ba..5de265e4 100644 --- a/src/determinants/configurations.org +++ b/src/determinants/configurations.org @@ -44,8 +44,9 @@ via BLAS level 3 operations. #+begin_src f90 :main no :tangle configurations_sigma_vector.irp.f - BEGIN_PROVIDER [ integer, NSOMOMax] - &BEGIN_PROVIDER [ integer, NCSFMax] + BEGIN_PROVIDER [ integer*8, NSOMOMax] + &BEGIN_PROVIDER [ integer*8, NCSFMax] + &BEGIN_PROVIDER [ integer*8, NMO] implicit none BEGIN_DOC ! Documentation for NSOMOMax @@ -54,6 +55,7 @@ via BLAS level 3 operations. END_DOC NSOMOMax = 8 NCSFMax = 14 ! TODO: NCSFs for MS=0 + NMO = NSOMOMax ! TODO: remove this END_PROVIDER #+end_src @@ -62,7 +64,9 @@ via BLAS level 3 operations. 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 + The dimensions for each Isomo, Jsomo pair are precalculated and stored in the AIJpqMatrixDimsList + variable which is provided here. + #+begin_src f90 :main no :tangle configurations_sigma_vector.irp.f BEGIN_PROVIDER [ double precision, AIJpqMatrixDimsList, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)] @@ -117,4 +121,74 @@ via BLAS level 3 operations. #+end_src +- [ ] Read the transformation matrix based on the number of SOMOs + + We go through all the possible SOMOs and build the matrix-elements \(\) and + store it in the AIJpq container. + + #+begin_src f90 :main no :tangle configurations_sigma_vector.irp.f + BEGIN_PROVIDER [ real*8, AIJpqContainer, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,NSOMOMax,NSOMOMax)] + 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, orbp, orbq, ri, ci + orbp = 0 + orbq = 0 + integer*8 Isomo, Jsomo + Isomo = 0 + Jsomo = 0 + integer*8 rows, cols + rows = -1 + cols = -1 + integer*8 MS + MS = 0 + real*8,dimension(:),allocatable :: meMatrix + 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) + + ! allocate matrix + allocate(meMatrix(rows*cols)) + + ! fill matrix + call getApqIJMatrixDriver(Isomo, & + Jsomo, & + orbp, & + orbq, & + MS, & + NMO, & + meMatrix, & + rows, & + cols) + print *, i,j,k,l,">",Isomo,Jsomo,">",rows, cols + ! i -> j + do ri = 1,rows + do ci = 1,cols + AIJpqContainer(i,j,1,k,l,ri,ci) = meMatrix(ri*(cols-1) + ci) + end do + end do + end do + end do + end do + end do + END_PROVIDER + #+end_src + - [ ] Perform the conversion by matrix-vector BLAS level 2 call diff --git a/src/determinants/configurations_sigma_vector.irp.f b/src/determinants/configurations_sigma_vector.irp.f index 44665016..5253703f 100644 --- a/src/determinants/configurations_sigma_vector.irp.f +++ b/src/determinants/configurations_sigma_vector.irp.f @@ -1,5 +1,6 @@ - BEGIN_PROVIDER [ integer, NSOMOMax] - &BEGIN_PROVIDER [ integer, NCSFMax] + BEGIN_PROVIDER [ integer*8, NSOMOMax] + &BEGIN_PROVIDER [ integer*8, NCSFMax] + &BEGIN_PROVIDER [ integer*8, NMO] implicit none BEGIN_DOC ! Documentation for NSOMOMax @@ -8,6 +9,7 @@ END_DOC NSOMOMax = 8 NCSFMax = 14 ! TODO: NCSFs for MS=0 + NMO = NSOMOMax ! TODO: remove this END_PROVIDER BEGIN_PROVIDER [ double precision, AIJpqMatrixDimsList, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)] @@ -59,3 +61,66 @@ end do end do END_PROVIDER + + BEGIN_PROVIDER [ real*8, AIJpqContainer, (NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,NSOMOMax,NSOMOMax)] + 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, orbp, orbq, ri, ci + orbp = 0 + orbq = 0 + integer*8 Isomo, Jsomo + Isomo = 0 + Jsomo = 0 + integer*8 rows, cols + rows = -1 + cols = -1 + integer*8 MS + MS = 0 + real*8,dimension(:),allocatable :: meMatrix + 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) + + ! allocate matrix + allocate(meMatrix(rows*cols)) + + ! fill matrix + call getApqIJMatrixDriver(Isomo, & + Jsomo, & + orbp, & + orbq, & + MS, & + NMO, & + meMatrix, & + rows, & + cols) + print *, i,j,k,l,">",Isomo,Jsomo,">",rows, cols + ! i -> j + do ri = 1,rows + do ci = 1,cols + AIJpqContainer(i,j,1,k,l,ri,ci) = meMatrix(ri*(cols-1) + ci) + end do + end do + end do + end do + end do + end do + END_PROVIDER