Skip to content

Commit

Permalink
Merge pull request #129 from thompsonresearchgroup/master
Browse files Browse the repository at this point in the history
Added MQC_Get_Strings_At_Index to return strings at index in the CI basis. Updated version number.
  • Loading branch information
leethomo86 authored Feb 27, 2024
2 parents e358d0f + 40d0821 commit e6b16af
Show file tree
Hide file tree
Showing 14 changed files with 198 additions and 19 deletions.
5 changes: 5 additions & 0 deletions releaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_FullWavefunction.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_algebra.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_algebra2.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_binary.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_datastructures.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
184 changes: 179 additions & 5 deletions src/mqc_est.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down Expand Up @@ -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
Expand All @@ -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
!
Expand Down Expand Up @@ -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 <b> MQC_GET_STRINGS_AT_INDEX is a subroutine that returns the strings
!> corresponding to the index of matrices built by MQC_Build_CI_Hamiltonian</b>
!>
!> \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)
!
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_files.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_gaussian.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
6 changes: 3 additions & 3 deletions src/mqc_general.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_general_lapack.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_interface.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_matwrapper.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down
2 changes: 1 addition & 1 deletion src/mqc_molecule.F03
Original file line number Diff line number Diff line change
Expand Up @@ -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 **
! ** **
! ** **
Expand Down

0 comments on commit e6b16af

Please sign in to comment.