! Module file: coordinaterefine ! ! CNS module ! ********** ! ! Authors: Piet Gros and Axel T. Brunger ! ! copyright Yale University ! ! Function: ! Refine coordinates against generalized target function ! ! Requirements: ! 0. definetarget must be called before this module. ! 1. This module can only be called from the main level. ! 2. Target and derivative function have to be defined fully ! see module definetarget ! module {coordinaterefine} ( &table; {identifying text for tabulation} &messages; {set verbosity "normal" | "all" | "off"} &tolerance; {tolerance for conjugate gradient minimizer} &step; {number of steps in minimization} &h; {atom selection contributing to Fcalc} &hfix; {atom subselection of &h whose parameters are not refined} ) checkversion 1.3 {- set fixed atoms -} fix selection=(not &h or &hfix) end do (refx=x) (&h) {- store starting coordinates -} do (refy=y) (&h) do (refz=z) (&h) show sum ( x ) ( not (tag and &h and not(&hfix)) and (&h and not(&hfix) )) if ($select>0) then display TAB: &table groups present -- groups will be refined as rigid bodies. minimize rigid for $aa in id (tag and &h and not(&hfix)) loop bref group=(byresidue ( id $aa ) ) end loop bref nstep=&step drop=10. tolerance=&tolerance end else display TAB: &table individual site refinement minimize lbfgs nstep=&step !!! drop=10. tolgradient=&tolerance end end if {*fill table*} if (&table # "") then {fill table with shift} for $1 in id (&h and not(&hfix)) loop minc_shift {parameters} show (x-refx) (id $1) evaluate ($x=$result) show (y-refy) (id $1) evaluate ($y=$result) show (z-refz) (id $1) evaluate ($z=$result) show element (segid ) (id $1) evaluate ($segid=$result) show element (resid ) (id $1) evaluate ($resid=$result) show element (name ) (id $1) evaluate ($name=$result) display TAB: &table atom=($segid $resid $name) coord.-shift (dx,dy,dz)= $x[F9.2] $y[F9.2] $z[F9.2] end loop minc_shift end if {*update stored coordinates*} do (refx=x) (&h) do (refy=y) (&h) do (refz=z) (&h)