## This takes a selection and fits that selection for every frame in the ## molecule (all atoms are moved, but the fit is based on the selection). ## ## For example: fitframes top "protein" ## ## -Jim puts "vmd -dispdev text < fit_frames.tcl -args psffile dcdfile temp_k" set psffile [lindex $argv 0] set dcdfile [lindex $argv 1] set temp [lindex $argv 2] set molid top set seltext protein # load files mol new $psffile waitfor all mol addfile $dcdfile waitfor all # create atom selections set ref [atomselect $molid $seltext frame 0] set sel [atomselect $molid $seltext] set all [atomselect $molid all] # count frames set n [molinfo $molid get numframes] set fin [expr $n-1] # loop over all frames and perform fit for { set i 1 } { $i < $n } { incr i } { $sel frame $i $all frame $i $all move [measure fit $sel $ref] } # write resulting trajectory to a new DCD file animate write dcd fitted_$temp.dcd beg 0 end $fin waitfor all sel $ref