Skip to content

Commit

Permalink
Fixes GFN-FF bug for specific pi systems (grimme-lab#836)
Browse files Browse the repository at this point in the history
* Fixes GFN-FF bug for specific pi systems

Signed-off-by: MtoLStoN <[email protected]>

---------

Signed-off-by: MtoLStoN <[email protected]>
Signed-off-by: Johannes Gorges <[email protected]>
  • Loading branch information
MtoLStoN authored and gorges97 committed Mar 27, 2024
1 parent cfd926d commit 7eaab9a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
30 changes: 20 additions & 10 deletions src/gfnff/gfnff_ini.f90
Original file line number Diff line number Diff line change
Expand Up @@ -918,16 +918,26 @@ integer function itabrow6(i)
if(pr)then
write(env%unit,'(''Hueckel system :'',i3,'' charge : '',i3,'' ndim/Nel :'',2i5, &
& 3x, ''eps(HOMO/LUMO)'',2f12.6)')pis,ipis(pis),npi,nelpi,pisip(pis),pisea(pis)
if(pisip(pis).gt.0.40) then
write(env%unit,*)'WARNING: probably wrong pi occupation. Second attempt with Nel=Nel-1!'
do i=1,mol%n
if(piadr4(i).ne.0) write(env%unit,*) 'at,nb,topo%hyb,Npiel:', i,mol%sym(i),topo%nb(20,i),topo%hyb(i),piel(i)
enddo
nelpi=nelpi-1
Api = Apisave
call gfnffqmsolve(.false.,Api,S,.false.,300.0d0,npi,0,nelpi,dum,occ,eps) !diagonalize
call PREIG(6,occ,1.0d0,eps,1,npi)
endif
end if
if(pisip(pis).gt.0.40) then
write(env%unit,'(a,i0,a)')'WARNING: probably wrong pi occupation for system ',pis,'. Second attempt with Nel=Nel-1!'
do i=1,mol%n
if(piadr4(i).ne.0) write(env%unit,*) 'at,nb,topo%hyb,Npiel:', i,mol%sym(i),topo%nb(20,i),topo%hyb(i),piel(i)
enddo
nelpi=nelpi-1
Api = Apisave
call gfnffqmsolve(.false.,Api,S,.false.,4000.0d0,npi,0,nelpi,dum,occ,eps) !diagonalize
call PREIG(6,occ,1.0d0,eps,1,npi)
do i=1,npi ! save IP/EA
if(occ(i).gt.0.5) then
pisip(pis)=eps(i) ! IP
if(i+1.lt.npi)pisea(pis)=eps(i+1) ! EA
endif
enddo
if(pr)then
write(env%unit,'(''Hueckel system :'',i3,'' charge : '',i3,'' ndim/Nel :'',2i5, &
& 3x, ''eps(HOMO/LUMO)'',2f12.6)')pis,ipis(pis),npi,nelpi,pisip(pis),pisea(pis)
end if
endif
! save BO
do i=1,topo%nbond
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_gfnff.f90
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ subroutine test_gfnff_scaleup(error)
character(len=*), parameter :: solvents(5) = [character(len=20) ::&
& "h2o", "acetonitrile", "toluene", "ether", "dmso"]
real(wp), parameter :: ref_energies(5) = &
&[-4.6919926039901_wp, -8.8807760138817_wp, -13.311107073100_wp, &
&[-4.6919926039901_wp, -8.8807760138817_wp, -13.40715596616603_wp, &
& -13.822994859730_wp, -20.577952329212_wp]
real(wp), parameter :: ref_gnorms(5) = &
&[0.05947676640487_wp, 0.09522104624089_wp, 0.16195989065950_wp, &
&[0.05947676640487_wp, 0.09522104624089_wp, 0.1753769495334539_wp, &
& 0.12496592222660_wp, 0.19366599743810_wp]

call init(env)
Expand Down

0 comments on commit 7eaab9a

Please sign in to comment.