# Copyright (c) 2002-08 Peter Guntert. All rights reserved. ## 7MACROS: vtfmin - CYANA macro ## ## Parameters: levels= (default: ) ## steps= (default: 150,400) ## flatsteps= (default: 50,100) ## tf ## ## Performs a standard variable target function minimization (Guntert et ## al., 1991a) starting at minimization level L1 and ending at minimization ## level L2. ## At each of the lower levels (i.e. those below L2) N1 minimization steps ## are performed, the minimization is stopped if n1 steps failed to decrease ## the target function by at least 1%, and the steric repulsion is considered ## only for the heavy atoms. The weight for steric lower limits is 0.2. ## At minimization level L2 three times N2 minimization steps are performed, ## the minimization is stopped if n2 steps failed to decrease the target ## function by at least 1%, and the steric repulsion is considered for all ## atoms. The weight for steric lower limits is 0.2 for the first N2 ## minimization steps, then it is increased to 0.6 for the following N2 ## minimization steps, and to 2.0 for the final N2 minimization steps. ## If the option tf (and none of the other parameters) is given, the final ## target function value is calculated, without performing any minimization. var l nl p np echo t0 syntax $macro:levels=*=0,${rnum(nr)-rnum(1)} steps=*=150,400 flatsteps=*=50,100 tf echo := off t0=cputime if (length('levels').eq.1) levels:=$levels,$levels levels(1)=$levels(1) levels(2)=$levels(2) steps(1)=$steps(1) steps(2)=$steps(2) flatsteps(1)=$flatsteps(1) flatsteps(2)=$flatsteps(2) if (tf) then mr=rnum(nr)-rnum(1) levels(1)=mr; levels(2)=mr; steps(1)=0; steps(2)=0 end if unset tf print " Minimization (standard strategy):" level=normal print " lev upper lower vdw angle target funct. |grad| \#up \#f stop" level=normal print " \# act \# act \# act \# act begin end end" level=normal if (steps(1).gt.0) then atom set HYDROGEN radius=-1.0 info=none atom set HBOUND radius=radius+0.15 info=none weight_vdw=0.2 p = -10; np = 0 do l levels(1) levels(2) if (l.le.10 .or. l.ge.p+2) then nl = nlevel(l) if (l.ge.p+10 .or. nl.ge.np+5 .or. \ (nl.ge.np+2 .and. nlevel(min(l+1,levels(2))).gt.np+5)) then level=l minimize steps(1) flat=$flatsteps(1) p = l; np = nl end if end if end do end if atom set * radius=* info=none level=levels(2) if (steps(2).gt.0) then weight_vdw=0.2 minimize steps(2) flat=$flatsteps(2) weight_vdw=0.6 minimize steps(2) flat=$flatsteps(2) end if weight_vdw=2.0 minimize steps(2) flat=$flatsteps(2) print " Structure minimized in $nint(cputime-t0) s, f = $tf."