Skip to content

Commit

Permalink
Fix bug in optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtran authored Nov 3, 2024
1 parent 3956a0e commit b5f3614
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/optimizer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit b5f3614

Please sign in to comment.