From 0b95209c3d73b7d9913658e47fee05a12e432f4e Mon Sep 17 00:00:00 2001 From: Marc de Wergifosse <56387143+mdewergi@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:47:18 +0200 Subject: [PATCH] NTOs bug with dual threshold fixed --- print_nto.f | 25 +++++++++++++++++++++++++ stda-rw_dual.f | 35 +++++++++++++++-------------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/print_nto.f b/print_nto.f index 3a03213..dcdb3a7 100755 --- a/print_nto.f +++ b/print_nto.f @@ -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) @@ -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 @@ -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) @@ -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 @@ -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) @@ -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 @@ -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) @@ -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 @@ -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) @@ -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 diff --git a/stda-rw_dual.f b/stda-rw_dual.f index 991b7c6..094fdf1 100755 --- a/stda-rw_dual.f +++ b/stda-rw_dual.f @@ -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 @@ -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(*,*) @@ -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 @@ -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 @@ -637,7 +637,7 @@ 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 @@ -645,18 +645,18 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr, 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 @@ -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 @@ -1557,8 +1557,3 @@ SUBROUTINE stda_rw_dual(ncent,nmo,nao,xyz,c,eps,occ,iaoat,thr, close(28) end - - - - -