Skip to content

Commit

Permalink
NTOs bug with dual threshold fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mdewergi committed Jun 12, 2023
1 parent 4af6c84 commit 0b95209
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
25 changes: 25 additions & 0 deletions print_nto.f
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ subroutine print_nto(Xci,ca,moci,nci,nroot,nao,iconf,maxconf,
. no,nv)
use stdacommon
use commonresp
use commonlogicals
implicit none
integer:: moci,nci,nroot,nao,maxconf,no,nv
real*4:: Xci(nci,nroot),X(no,nv),MO(nao)
Expand Down Expand Up @@ -72,7 +73,11 @@ subroutine print_nto(Xci,ca,moci,nci,nroot,nao,iconf,maxconf,
enddo
close(12,status='delete')
open(unit=11,file='NTOao')
if(rw_dual)then
allocate(ipty(nprims),info(nprims))
else
allocate(ipat(nprims),ipty(nprims),ipao(nprims),info(nprims))
endif
allocate(atnam(ncent),exip(nprims),cxip(nprims),co(ncent,4))
allocate(f_info(nbf))
Do i=1, nprims
Expand Down Expand Up @@ -359,6 +364,7 @@ subroutine Uprint_nto(Xci,cca,mocia,nexa,nci,nroot,nao,iconfa,
. maxconfb,nob,nvb)
use stdacommon
use commonresp
use commonlogicals
implicit none
integer:: mocia,nci,nroot,nao,maxconfa,noa,nva
real*4:: Xci(nci,nroot),Xa(noa,nva),MO(nao)
Expand Down Expand Up @@ -400,7 +406,11 @@ subroutine Uprint_nto(Xci,cca,mocia,nexa,nci,nroot,nao,iconfa,
enddo
close(12,status='delete')
open(unit=11,file='NTOao')
if(rw_dual)then
allocate(ipty(nprims),info(nprims))
else
allocate(ipat(nprims),ipty(nprims),ipao(nprims),info(nprims))
endif
allocate(atnam(ncent),exip(nprims),cxip(nprims),co(ncent,4))
allocate(f_info(nbf))
Do i=1, nprims
Expand Down Expand Up @@ -783,6 +793,7 @@ subroutine SFprint_nto(Xci,cca,mocia,nci,nroot,nao,
. maxconfb,nob,nvb)
use stdacommon
use commonresp
use commonlogicals
implicit none
integer:: mocia,nci,nroot,nao,noa,nva
real*4:: Xci(nci,nroot),Xa(noa,noa),MO(nao),X(noa,nvb)
Expand Down Expand Up @@ -827,7 +838,11 @@ subroutine SFprint_nto(Xci,cca,mocia,nci,nroot,nao,
enddo
close(12,status='delete')
open(unit=11,file='NTOao')
if(rw_dual)then
allocate(ipty(nprims),info(nprims))
else
allocate(ipat(nprims),ipty(nprims),ipao(nprims),info(nprims))
endif
allocate(atnam(ncent),exip(nprims),cxip(nprims),co(ncent,4))
allocate(f_info(nbf))
Do i=1, nprims
Expand Down Expand Up @@ -1713,6 +1728,7 @@ subroutine print_nto_resp(Xci,ca,moci,nci,nroot,nao,iconf,
. maxconf,no,nv,axe,mu_x,mu_y,mu_z,flag3)
use stdacommon
use commonresp
use commonlogicals
implicit none
integer:: moci,nci,nroot,nao,maxconf,no,nv
real*4:: Xci(nci,nroot),X(no,nv),MO(nao)
Expand Down Expand Up @@ -1767,7 +1783,11 @@ subroutine print_nto_resp(Xci,ca,moci,nci,nroot,nao,iconf,
close(12)
endif
open(unit=11,file='NTOao')
if(rw_dual)then
allocate(ipty(nprims),info(nprims))
else
allocate(ipat(nprims),ipty(nprims),ipao(nprims),info(nprims))
endif
allocate(atnam(ncent),exip(nprims),cxip(nprims),co(ncent,4))
allocate(f_info(nbf))
Do i=1, nprims
Expand Down Expand Up @@ -2185,6 +2205,7 @@ subroutine print_nto_resp_new(Xci,ca,moci,nci,nroot,nao,iconf,
. maxconf,no,nv,axe,mu_x,mu_y,mu_z,flag3)
use stdacommon
use commonresp
use commonlogicals
implicit none
integer:: moci,nci,nroot,nao,maxconf,no,nv
real*4:: Xci(nci,nroot),X(no,nv),MO(nao)
Expand Down Expand Up @@ -2254,7 +2275,11 @@ subroutine print_nto_resp_new(Xci,ca,moci,nci,nroot,nao,iconf,
close(12)
endif
open(unit=11,file='NTOao')
if(rw_dual)then
allocate(ipty(nprims),info(nprims))
else
allocate(ipat(nprims),ipty(nprims),ipao(nprims),info(nprims))
endif
allocate(atnam(ncent),exip(nprims),cxip(nprims),co(ncent,4))
allocate(f_info(nbf))
Do i=1, nprims
Expand Down
35 changes: 15 additions & 20 deletions stda-rw_dual.f
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
write(740)pia(1:ncent,i)
enddo
close(740)


write(*,'(/'' SCF atom population (using active MOs):'')')
write(*,'(10F7.3)')q2(1:ncent)*2.0
Expand Down Expand Up @@ -533,7 +533,7 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
deallocate(pij)

allocate(q3(1:ncent))

c DUAL parameter selection threshold
write(*,*)'***Dual thresholds Method***'
write(*,*)
Expand All @@ -545,14 +545,14 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
Do i=1,num_atoms
read(15,*)atom_list(i)
enddo
write(*,'(a,f6.2,a)') 'Atoms in the chromophore considered with
.a threshold of ',thresh(1),' eV'
write(*,'(a,f6.2,a)') 'Atoms in the chromophore considered with
.a threshold of ',thresh(1),' eV'
write(*,*) atom_list(:)
write(*,'(a,f6.2,a)') 'The rest uses a threshold of ',
. thresh(2),' eV'

c Identify important occupied MOs for the atom list

allocate(mo_list(no))
n_MO=0
Do i=1,no
Expand Down Expand Up @@ -596,7 +596,7 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
write(*,'(a,f6.2,a,i)')' num. of occ. MOs with a
. threshold of',thresh(2),' eV :',n_MO(2)
thresh=thresh/27.211385050d0

c determine singles which are lower than thr
k=0
j=0
Expand Down Expand Up @@ -637,26 +637,26 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,

enddo ! virt loop
enddo ! occ loop

nci=nex
nex=k
nexpt=j

write(*,*)
write(*,*)nex,'CSF included by energy with 1st threshold'
write(*,*)nexpt,'considered in PT2.'

!Second threshold
write(*,*)
write(*,*)' Second threshold '
write(*,*)
! Because MOs were included by the first threshold below vthr, we need to restrain this range
! Because MOs were included by the first threshold below vthr, we need to restrain this range
! for the lower threshold. Thus, fthr is limited now to a resonable value:
fthr=((1.+0.8*ax)*thresh(2))*2.0 ! The orbital energy window with the second threshold.
write(*,'(2x,a,f6.2,a)')'Limiting the range for PT2 to ',
.fthr*27.211385050d0,' eV'


do io=1,n_MO(2) ! occ loop
q1(1:ncent)=qij(1:ncent,mocc_2(io)) !qii
do iv=no+1,moci ! virt loop
Expand Down Expand Up @@ -691,9 +691,9 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
endif

enddo ! virt loop
enddo ! occ loop
enddo ! occ loop


deallocate(qij,qab,qia,pia,uci)

nci=nex
Expand Down Expand Up @@ -1557,8 +1557,3 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr,
close(28)

end





0 comments on commit 0b95209

Please sign in to comment.