-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: albert <92109627+Albkat@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
596 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
subroutine optts(n,at,xyz,q,qsh,nshell,z,cn,nel,nopen,nbf,nao,P,wb, & | ||
& kspd,gscal,kcn,xbrad,xbdamp,alphaj,d3a1,d3a2,d3s8, & | ||
& d3atm,egap,et,maxiter,epot,grd) | ||
|
||
use iso_fortran_env, only : wp => real64 | ||
use setcommon | ||
use splitcommon | ||
use atmass | ||
implicit none | ||
|
||
integer :: n,at(n),nel,nopen,nbf,nao,icall,nshell,maxiter | ||
real(wp) :: xyz(3,n),epot,wb(n,n),q(n),z(n),kspd(6),et,egap | ||
real(wp) :: cn(n),grd(3,n),qsh(nshell),P(nao,nao) | ||
real(wp) :: gscal,kcn(4),xbrad,xbdamp,alphaj,d3a1,d3a2,d3s8,d3atm | ||
|
||
real(wp),allocatable:: coord(:,:), freq(:), u(:,:), uu(:,:) | ||
real(wp),allocatable:: xyza (:,:,:), rmass(:), e(:), e2(:), geo(:,:) | ||
real(wp),allocatable:: coord0(:,:), displ(:), xyzmin(:,:), bmat(:,:) | ||
real(wp),allocatable:: x(:),b(:),c(:),d(:),xx(:),yy(:),yy1(:),yy2(:) | ||
|
||
real(wp) :: norm,thr | ||
integer :: i,j,k,m,n3,ii,ia,ic,isave,nprj,mode,maxoptiter | ||
character(len=2) :: asym | ||
character(len=30) :: fname | ||
logical :: ex,fail | ||
|
||
thr=-10.0_wp ! modes below this value are projected out ! | ||
mode=tsroot+6 | ||
fname='xtb_normalmodes' | ||
|
||
write(*,*) | ||
write(*,'(7x,''======================================='')') | ||
write(*,'(7x,''| T S O P T I M I Z E R |'')') | ||
write(*,'(7x,''======================================='')') | ||
write(*,*) | ||
|
||
|
||
write(*,*) 'normal mode file : ',trim(fname) | ||
write(*,*) 'root for TS : ',mode | ||
|
||
! error section | ||
inquire(file=fname,exist=ex) | ||
if (.not.ex) then | ||
write(*,*) 'run -hess first!' | ||
return | ||
endif | ||
|
||
!> DoF | ||
n3=3*n | ||
allocate(freq(n3),u(n3,n3),rmass(n3)) | ||
|
||
! read normal modes ! | ||
! normal case ! | ||
open(newunit=112,file=fname,form='unformatted') | ||
read (112)k | ||
if(k.ne.n3) stop 'severe read error on modes' | ||
read (112)freq | ||
read (112)rmass | ||
read (112)u | ||
close(112) | ||
|
||
! remove masses from normal modes and re-normalize ! | ||
nprj=0 | ||
do m=7,n3 | ||
norm=0 | ||
|
||
! loop through the atoms | ||
do ia=1,n | ||
! loop through compnents | ||
do ic=1,3 | ||
|
||
|
||
ii = (ia-1)*3+ic | ||
u(ii,m)=u(ii,m)*sqrt(ams(at(ia))) ! remove atomic masses | ||
norm=norm+u(ii,m)**2 ! renormalize | ||
|
||
enddo | ||
enddo | ||
|
||
u(1:n3,m)=u(1:n3,m)/(sqrt(norm)+1.d-12) | ||
if(freq(m).lt.thr) nprj=nprj+1 | ||
enddo | ||
|
||
allocate(uu(n3,nprj)) | ||
k=0 | ||
do i=7,n3 | ||
if(freq(i).lt.thr) then | ||
k=k+1 | ||
uu(1:n3,k)=u(1:n3,i) | ||
endif | ||
enddo | ||
|
||
maxoptiter=25 | ||
isave=micro_opt | ||
micro_opt=1000 ! no coordinate update in ancopt | ||
|
||
write(*,'(''frequency /cm-1 :'',F12.2)')freq(mode) | ||
write(*,'(''maxiter (opt) :'',i5 )')maxoptiter | ||
write(*,'(''optlevel :'',i5 )')optlev | ||
write(*,'(''# of projected modes :'',i5 )')nprj | ||
|
||
open(unit=112,file='.xtbtmpmode',form='unformatted') | ||
write(112) nprj | ||
write(112) uu | ||
close(112) | ||
|
||
tsopt=.false. | ||
call ancopt(n,at,xyz,q,qsh,nshell,z,cn,nel,nopen,nbf,nao, | ||
. P,wb,kspd,gscal,kcn,xbrad,xbdamp,alphaj,d3a1,d3a2,d3s8, | ||
. d3atm,egap,et,maxiter,maxoptiter,epot,grd,optlev, | ||
. .true.,fail) | ||
|
||
call system('rm .xtbtmpmode 2>/dev/null') ! normal operation | ||
micro_opt =isave ! back to default | ||
tsopt=.true. | ||
|
||
! call system('mv hessian hessian.xtbtmp 2>/dev/null') ! don't use hessian in ancopt | ||
|
||
call ancopt(n,at,xyz,q,qsh,nshell,z,cn,nel,nopen,nbf,nao, | ||
. P,wb,kspd,gscal,kcn,xbrad,xbdamp,alphaj,d3a1,d3a2,d3s8, | ||
. d3atm,egap,et,maxiter,maxoptcycle,epot,grd,optlev, | ||
. .true.,fail) | ||
|
||
! call system('mv hessian.xtbtmp hessian 2>/dev/null') | ||
|
||
end subroutine optts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.