From d98658389cb5eece5591f460846751d4fa572d7e Mon Sep 17 00:00:00 2001 From: Lee Thompson Date: Mon, 26 Feb 2024 21:27:24 -0500 Subject: [PATCH 1/2] Added MQC_Get_Strings_At_Index to return strings at index in the CI basis. --- src/mqc_est.F03 | 182 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 178 insertions(+), 4 deletions(-) diff --git a/src/mqc_est.F03 b/src/mqc_est.F03 index ab904a55..d2536d82 100644 --- a/src/mqc_est.F03 +++ b/src/mqc_est.F03 @@ -16811,8 +16811,8 @@ Function S2_Mat_Elem(IOut,IPrint,NBasisIn,Alpha_String_1,Beta_String_1, & End Select ! End Function S2_Mat_Elem - - +! +! !===================================================================== ! ! PROCEDURE MQC_BUILD_CI_HAMILTONIAN @@ -16828,7 +16828,8 @@ End Function S2_Mat_Elem !> MQC_BUILD_CI_HAMILTONIAN is a subroutine that builds the CI operator matrix !> given MO integrals and determinant strings. The name of the routine reflects !> its original purpose of returning the CI Hamiltonian matrix, but in fact it -!> can be used for any one, two, or one and two particle operator. +!> can be used for any one, two, or one and two particle operator. The routine +!> can also be used to build the S^2 operator matrix in the CI basis. !> !> \endverbatim ! @@ -17209,13 +17210,186 @@ Subroutine MQC_Build_CI_Hamiltonian(IOut,IPrint,NBasis,Determinants, & iOut,'Determinants%order',Determinants%order) end select ! - If(iPrint.ge.1) write(iOut,*) NEW_LINE('a') + If(iPrint.ge.2) write(iOut,*) NEW_LINE('a') End Subroutine MQC_Build_CI_Hamiltonian ! ! !===================================================================== ! +! PROCEDURE MQC_GET_STRINGS_AT_INDEX +! +!> \brief MQC_GET_STRINGS_AT_INDEX is a subroutine that returns the strings +!> corresponding to the index of matrices built by MQC_Build_CI_Hamiltonian +!> +!> \par Purpose: +! ============= +!> +!> \verbatim +!> +!> MQC_GET_STRINGS_AT_INDEX is a subroutine that returns the strings corresponding +!> to the index of matrices built by MQC_Build_CI_Hamiltonian. +!> +!> \endverbatim +! +! Arguments: +! ========== +!> \param[in] IOut +!> \verbatim +!> IOut is Integer(kind=int64) +!> The FORTRAN file to print to. +!> \endverbatim +!> +!> \param[in] IPrint +!> \verbatim +!> IPrint is Integer(kind=int64) +!> The print level for the subroutine. +!> \endverbatim +!> +!> \param[in] Ind +!> \verbatim +!> Ind is Integer(kind=int64) +!> The index from which determinant strings will be +!> returned. If Ind is negative, the index will be +!> counted from the end. +!> \endverbatim +!> +!> \param[out] aString +!> \verbatim +!> aString is Integer(kind=int64),Dimension(:),Allocatable +!> The alpha string at index Ind. +!> \endverbatim +!> +!> \param[in] bString +!> \verbatim +!> bString is Integer(kind=int64),Dimension(:),Allocatable +!> The beta string at index Ind. +!> \endverbatim +!> +!> \param[in] NBasis +!> \verbatim +!> NBasis is Type(MQC_Scalar) +!> The number of basis functions. +!> \endverbatim +!> +!> \param[in] Determinants +!> \verbatim +!> Determinants is Type(MQC_Determinant) +!> The binary string occupation number vectors. If +!> opional argument Dets2 is provided Determinants +!> variable will contain the row basis strings. +!> \endverbatim +!> +!> \param[in] Subs +!> \verbatim +!> Subs is Integer(kind=int64),Dimension(:),Optional +!> Permitted substitutions to include in the Hamiltonian. +!> If not present, all substitutions are included. +!> \endverbatim +!> +! Authors: +! ======== +!> \author L. M. Thompson +!> \date 2024 +! + Subroutine MQC_Get_Strings_At_Index(IOut,IPrint,Ind,aString,bString,NBasis,Determinants, & + Subs) +! + Implicit None + Integer(kind=int64),Intent(In)::IOut,IPrint,Ind + Type(MQC_Scalar),Intent(In)::NBasis + Type(MQC_Determinant),Intent(In)::Determinants + Integer(kind=int64),Dimension(:),Intent(In),Optional::Subs + Type(MQC_Vector),Intent(Out)::aString,bString + + Integer(kind=int64)::IndIn,I,J,K,NAlpha_Str1,NBeta_Str1,NDets1,L_A_String,L_B_String, & + L_Index,L_A_Start,L_B_Start,L_A_End,L_B_End,L_A_Sub,L_B_Sub,NBit_Ints +! +! Need to figure out dimensions of CI Hamiltonian, alpha strings and beta stings + NAlpha_Str1 = MQC_Matrix_Rows(Determinants%Strings%Alpha) + NBeta_Str1 = MQC_Matrix_Rows(Determinants%Strings%Beta) + If(present(subs)) then + NDets1 = 0 + Do I = 1, Size(Subs) + Do J = 1, Size(Determinants%NSubsAlpha) + Do K = 1, Size(Determinants%NSubsBeta) + If((J-1)+(K-1).eq.Subs(i)) then + NDets1 = NDets1 + Determinants%NSubsAlpha%at(J)*& + Determinants%NSubsBeta%at(K) + EndIf + EndDo + EndDo + EndDo + Else + NDets1 = NAlpha_Str1 * NBeta_Str1 + EndIf + If(Ind.gt.NDets1) call mqc_error_i('Index requested is larger than dimension of matrix in & + &MQC_Get_String_At_Index',6,'Ind',Ind,'NDets1',NDets1) + If(Ind.eq.0) call mqc_error_i('Index zero requested in MQC_Get_String_At_Index',6,'Ind',Ind) + If(Ind.lt.0) then + IndIn = NDets1+Ind+1 + Else + IndIn = Ind + EndIf +! + NBit_Ints = (NBasis/(Bit_Size(0)-1))+1 +! + select case (Determinants%order) + case ('lexical') + Do L_A_String = 1, NAlpha_Str1 + Do L_B_String = 1, NBeta_Str1 + L_Index = 1+(L_B_String-1)*NAlpha_Str1+(L_A_String-1) + If(L_Index.eq.IndIn) then + aString = Determinants%Strings%Alpha%vat([L_A_String],[1,NBit_Ints]) + bString = Determinants%Strings%Beta%vat([L_B_String],[1,NBit_Ints]) + If(iPrint.ge.3) then + write(iOut,'(A)') ' Determinant at index '//trim(num2char(IndIn))//' = '//& + trim(mqc_detstring_print(Determinants%Strings%Alpha%vat([L_A_String],[0]),& + Determinants%Strings%Beta%vat([L_B_String],[0]),Int(NBasis))) + EndIf + Return + EndIf + EndDo + EndDo + case('ci') + L_Index = 0 + L_A_Start = 1 + Do L_A_Sub = 0, size(Determinants%NSubsAlpha)-1 + L_B_Start = 1 + Do L_B_Sub = 0, size(Determinants%NSubsBeta)-1 + If(.not.any(subs.eq.(L_A_Sub+L_B_Sub))) cycle + If (L_A_Sub.ne.0) L_A_Start = sum(Determinants%NSubsAlpha%vat(1,L_A_Sub))+1 + If (L_B_Sub.ne.0) L_B_Start = sum(Determinants%NSubsBeta%vat(1,L_B_Sub))+1 + If((L_A_Start.gt.NAlpha_Str1).or.(L_B_Start.gt.NBeta_Str1)) cycle + L_A_End = L_A_Start + Determinants%NSubsAlpha%at(L_A_Sub+1) - 1 + L_B_End = L_B_Start + Determinants%NSubsBeta%at(L_B_Sub+1) - 1 + Do L_A_String = L_A_Start, L_A_End + Do L_B_String = L_B_Start, L_B_End + L_Index = L_Index + 1 + If(L_Index.eq.IndIn) then + aString = Determinants%Strings%Alpha%vat([L_A_String],[1,NBit_Ints]) + bString = Determinants%Strings%Beta%vat([L_B_String],[1,NBit_Ints]) + If(iPrint.ge.3) then + write(iOut,'(A)') ' Determinant at index '//trim(num2char(IndIn))//' = '//& + trim(mqc_detstring_print(Determinants%Strings%Alpha%vat([L_A_String],[0]),& + Determinants%Strings%Beta%vat([L_B_String],[0]),Int(NBasis))) + EndIf + Return + EndIf + EndDo + EndDo + EndDo + EndDo + case default + call mqc_error_a('Unrecognized determinant storage type in mqc_get_strings_at_index',& + iOut,'Determinants%order',Determinants%order) + end select +! + End Subroutine MQC_Get_Strings_At_Index +! +! +!===================================================================== +! ! PROCEDURE Get_One_Gamma_Matrix function get_one_gamma_matrix(iOut,iPrint,nBasisIn,determinants,ci_amplitudes,UHF,nCoreIn,nOrbsIn,Subs) Result(onePDMint) ! From e1b77825f361e93b439c5751d2b97cc6a51da931 Mon Sep 17 00:00:00 2001 From: Lee Thompson Date: Mon, 26 Feb 2024 21:59:44 -0500 Subject: [PATCH 2/2] Updated version number. --- releaseNotes.txt | 5 +++++ src/mqc_FullWavefunction.F03 | 2 +- src/mqc_algebra.F03 | 2 +- src/mqc_algebra2.F03 | 2 +- src/mqc_binary.F03 | 2 +- src/mqc_datastructures.F03 | 2 +- src/mqc_est.F03 | 2 +- src/mqc_files.F03 | 2 +- src/mqc_gaussian.F03 | 2 +- src/mqc_general.F03 | 6 +++--- src/mqc_general_lapack.F03 | 2 +- src/mqc_interface.F03 | 2 +- src/mqc_matwrapper.F03 | 2 +- src/mqc_molecule.F03 | 2 +- 14 files changed, 20 insertions(+), 15 deletions(-) diff --git a/releaseNotes.txt b/releaseNotes.txt index 70dfc9e6..f82a4e54 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -8,6 +8,11 @@ number updates will be documented here. Note that the minor version number will often be updated near the start of the month and the revision number in that case will be set to 0. +February 26, 2024 +* MQCPack version set to 24.2.2. +* CI basis index to string subroutine implemented. +* UHF logical option has been removed from mqc_build_ci_hamiltonian and +slater_condon. February 19, 2024 * MQCPack version set to 24.2.1. diff --git a/src/mqc_FullWavefunction.F03 b/src/mqc_FullWavefunction.F03 index 66d55ee5..81604ff9 100644 --- a/src/mqc_FullWavefunction.F03 +++ b/src/mqc_FullWavefunction.F03 @@ -11,7 +11,7 @@ module MQC_FullWavefunction ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_algebra.F03 b/src/mqc_algebra.F03 index 99fbf925..b18bc547 100644 --- a/src/mqc_algebra.F03 +++ b/src/mqc_algebra.F03 @@ -43,7 +43,7 @@ Module MQC_Algebra ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_algebra2.F03 b/src/mqc_algebra2.F03 index 650f0fd3..60379131 100644 --- a/src/mqc_algebra2.F03 +++ b/src/mqc_algebra2.F03 @@ -12,7 +12,7 @@ Module MQC_Algebra2 ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_binary.F03 b/src/mqc_binary.F03 index 4d62be98..4f48c1b4 100644 --- a/src/mqc_binary.F03 +++ b/src/mqc_binary.F03 @@ -10,7 +10,7 @@ module MQC_Binary ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_datastructures.F03 b/src/mqc_datastructures.F03 index 8ce9f624..f3752929 100644 --- a/src/mqc_datastructures.F03 +++ b/src/mqc_datastructures.F03 @@ -10,7 +10,7 @@ Module MQC_DataStructures ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_est.F03 b/src/mqc_est.F03 index d2536d82..8c1ab0dc 100644 --- a/src/mqc_est.F03 +++ b/src/mqc_est.F03 @@ -38,7 +38,7 @@ Module MQC_EST ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_files.F03 b/src/mqc_files.F03 index 7418223f..e9238f83 100644 --- a/src/mqc_files.F03 +++ b/src/mqc_files.F03 @@ -10,7 +10,7 @@ Module MQC_Files ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_gaussian.F03 b/src/mqc_gaussian.F03 index 8505eb35..e58b36a9 100644 --- a/src/mqc_gaussian.F03 +++ b/src/mqc_gaussian.F03 @@ -10,7 +10,7 @@ Module MQC_Gaussian ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_general.F03 b/src/mqc_general.F03 index 8cd0e692..da5873a1 100644 --- a/src/mqc_general.F03 +++ b/src/mqc_general.F03 @@ -10,7 +10,7 @@ Module MQC_General ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** @@ -173,8 +173,8 @@ subroutine mqc_version(major,minor,revision,versionString) ! if(PRESENT(major)) major = 24 if(PRESENT(minor)) minor = 2 - if(PRESENT(revision)) revision = 1 - if(PRESENT(versionString)) versionString = '24.02.1' + if(PRESENT(revision)) revision = 2 + if(PRESENT(versionString)) versionString = '24.2.2' ! return end subroutine mqc_version diff --git a/src/mqc_general_lapack.F03 b/src/mqc_general_lapack.F03 index 5608309b..ad859690 100644 --- a/src/mqc_general_lapack.F03 +++ b/src/mqc_general_lapack.F03 @@ -9,7 +9,7 @@ ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_interface.F03 b/src/mqc_interface.F03 index c1d07d41..81ca54c9 100644 --- a/src/mqc_interface.F03 +++ b/src/mqc_interface.F03 @@ -9,7 +9,7 @@ ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_matwrapper.F03 b/src/mqc_matwrapper.F03 index 01355f65..249d4d1f 100644 --- a/src/mqc_matwrapper.F03 +++ b/src/mqc_matwrapper.F03 @@ -11,7 +11,7 @@ Module MQC_MatWrapper ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** ** diff --git a/src/mqc_molecule.F03 b/src/mqc_molecule.F03 index 3d93847f..30d2e825 100644 --- a/src/mqc_molecule.F03 +++ b/src/mqc_molecule.F03 @@ -10,7 +10,7 @@ Module MQC_Molecule ! ** Lee M. Thompson, Dave Mullaly, Xianghai Sheng, and Hrant P. ** ! ** Hratchian ** ! ** ** -! ** Version 24.02.1 ** +! ** Version 24.2.2 ** ! ** Feburary 19, 2024 ** ! ** ** ! ** **