9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-18 11:23:38 +01:00

Merge pull request #159 from v1j4y/fix_ncsf

Bugfix for the calculation of n_CSF in the memory efficient version of QP2
This commit is contained in:
Anthony Scemama 2021-05-31 13:23:01 +02:00 committed by GitHub
commit 3fcaada161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,58 +4,47 @@
&BEGIN_PROVIDER [ integer, NBFMax] &BEGIN_PROVIDER [ integer, NBFMax]
&BEGIN_PROVIDER [ integer, n_CSF] &BEGIN_PROVIDER [ integer, n_CSF]
&BEGIN_PROVIDER [ integer, maxDetDimPerBF] &BEGIN_PROVIDER [ integer, maxDetDimPerBF]
implicit none implicit none
BEGIN_DOC
BEGIN_DOC ! Documentation for NSOMOMax
! The maximum number of SOMOs for the current calculation. ! The maximum number of SOMOs for the current calculation.
! required for the calculation of prototype arrays. ! required for the calculation of prototype arrays.
END_DOC END_DOC
NSOMOMax = min(elec_num, cfg_nsomo_max + 2)
integer :: i,j,k,l ! Note that here we need NSOMOMax + 2 sizes
integer :: startdet,enddet NCSFMax = max(1,nint((binom(NSOMOMax,(NSOMOMax+1)/2)-binom(NSOMOMax,((NSOMOMax+1)/2)+1)))) ! TODO: NCSFs for MS=0
integer :: ncfg,ncfgprev NBFMax = NCSFMax
integer :: NSOMO maxDetDimPerBF = max(1,nint((binom(NSOMOMax,(NSOMOMax+1)/2))))
integer :: dimcsfpercfg NMO = n_act_orb
integer :: detDimperBF integer i,j,k,l
real*8 :: coeff integer startdet,enddet
integer :: MS integer ncfg,ncfgprev
integer :: ncfgpersomo integer NSOMO
double precision :: bin_1, bin_2 integer dimcsfpercfg
integer detDimperBF
NSOMOMax = min(elec_num, cfg_nsomo_max + 2) real*8 :: coeff
integer MS
bin_1 = binom(NSOMOMax, (NSOMOMax+1)/2) integer ncfgpersomo
bin_2 = binom(NSOMOMax,((NSOMOMax+1)/2)+1) detDimperBF = 0
MS = elec_alpha_num-elec_beta_num
! Note that here we need NSOMOMax + 2 sizes ! number of cfgs = number of dets for 0 somos
NCSFMax = max(1,int(bin_1-bin_2)) n_CSF = 0
NBFMax = NCSFMax ncfgprev = cfg_seniority_index(0)
maxDetDimPerBF = max(1,nint((binom(NSOMOMax,(NSOMOMax+1)/2)))) do i = iand(MS,1), NSOMOMax-2,2
NMO = n_act_orb if(cfg_seniority_index(i+2) .EQ. -1) then
ncfgpersomo = N_configuration + 1
detDimperBF = 0 else
MS = elec_alpha_num-elec_beta_num ncfgpersomo = cfg_seniority_index(i+2)
endif
! number of cfgs = number of dets for 0 somos ncfg = ncfgpersomo - ncfgprev
n_CSF = cfg_seniority_index(0)-1 if(iand(MS,1) .EQ. 0) then
ncfgprev = cfg_seniority_index(0) dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1))))
do i = 0-iand(MS,1)+2, cfg_nsomo_max,2 else
if(cfg_seniority_index(i) == -1)then dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2))))
ncfgpersomo = N_configuration + 1 endif
else n_CSF += ncfg * dimcsfpercfg
ncfgpersomo = cfg_seniority_index(i) ncfgprev = cfg_seniority_index(i+2)
endif enddo
ncfg = ncfgpersomo - ncfgprev
if (i > 2) then
bin_1 = binom(i-2, (i-2+1)/2)
bin_2 = binom(i-2,((i-2+1)/2)+1)
dimcsfpercfg = max(1,int(bin_1-bin_2))
else
dimcsfpercfg = 1
endif
n_CSF += ncfg * dimcsfpercfg
ncfgprev = cfg_seniority_index(i)
enddo
END_PROVIDER END_PROVIDER