From 10c8a31cd6c9e1ff7a8ecf4db6d9666f39b24215 Mon Sep 17 00:00:00 2001 From: foxtran <39676482+foxtran@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:37:58 +0100 Subject: [PATCH] Fix bug in optimizer (#1125) Signed-off-by: Igor S. Gerasimov --- src/optimizer.f90 | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/optimizer.f90 b/src/optimizer.f90 index 4d5779276..f1d936347 100644 --- a/src/optimizer.f90 +++ b/src/optimizer.f90 @@ -471,16 +471,6 @@ subroutine ancopt(env,ilog,mol,chk,calc, & call env%error("Calculation of model hessian failed", source) return end if - - ! blow up Hessian ! - k=0 - do i=1,nat3 - do j=1,i - k=k+1 - h(i,j)=fc(k) - h(j,i)=fc(k) - enddo - enddo thr=1.d-11 @@ -502,12 +492,6 @@ subroutine ancopt(env,ilog,mol,chk,calc, & thr=1.d-10 endif - - if (debug(2) .and. nat3 <= 30) then !######## DEBUG ######## - write(env%unit,'(/,''Hessian matrix'')') - write(hessfmt,'(a,i0,a)') '(', nat3, 'F10.6)' - write(env%unit,hessfmt) (h(:,i), i=1,nat3) - endif ! project out translational and rotational modes ! if(modef.eq.0)then @@ -520,6 +504,22 @@ subroutine ancopt(env,ilog,mol,chk,calc, & else call trproj(molopt%n,nat3,molopt%xyz,fc,.false.,modef,pmode,modef) ! NMF endif + + ! blow up Hessian ! + k=0 + do i=1,nat3 + do j=1,i + k=k+1 + h(i,j)=fc(k) + h(j,i)=fc(k) + enddo + enddo + + if (debug(2) .and. nat3 <= 30) then !######## DEBUG ######## + write(env%unit,'(/,''Hessian matrix'')') + write(hessfmt,'(a,i0,a)') '(', nat3, 'F10.6)' + write(env%unit,hessfmt) (h(:,i), i=1,nat3) + endif if (profile) call timer%measure(2) ! stop timer for model Hessian