Difference for vnd/orient.tcl from version 1.4 to 1.5

version 1.4version 1.5
Line 15
Line 15
     variable paxis     variable paxis
     variable COM     variable COM
     variable I     variable I
      variable priority_axis
 } }
  
 # package require Orient # package require Orient
Line 37
Line 38
  
 #replace sel with point list #replace sel with point list
 proc Orient::sel_mass { size } { proc Orient::sel_mass { size } {
     puts "VND MASS..."     #puts "VND MASS..."
     variable assigned_weights     variable assigned_weights
     set assigned_weights {}     set assigned_weights {}
     #length of values     #length of values
Line 56
Line 57
     set y $yarg     set y $yarg
     set z $zarg     set z $zarg
     set m $assigned_weights     set m $assigned_weights
     puts "[llength $m]" 
     set comx 0     set comx 0
     set comy 0     set comy 0
     set comz 0     set comz 0
Line 117
Line 117
 } }
  
 # draws the three principal axes # draws the three principal axes
 proc vmd_draw_principalaxes {xarg yarg zarg mol} { proc vmd_draw_principalaxes {xarg yarg zarg mol flip} {
     variable paxis     variable paxis
     variable COM     variable COM
     variable I     variable I
     variable a1     variable a1
      variable priority_axis
          
     set x $xarg     set x $xarg
     set y $yarg     set y $yarg
     set z $zarg     set z $zarg
  
      set flip_priority_axis $flip
  
     set I [Orient::calc_principalaxes $x $y $z]     set I [Orient::calc_principalaxes $x $y $z]
     set ::NeuronVND::princ_axes $I     set ::NeuronVND::princ_axes $I
  
Line 154
Line 156
     #set minmax [measure minmax $sel] remove because VMD only     #set minmax [measure minmax $sel] remove because VMD only
     #set ranges [vecsub [lindex $minmax 1] [lindex $minmax 0]]     #set ranges [vecsub [lindex $minmax 1] [lindex $minmax 0]]
     set ranges [vecsub $maxT $minT]     set ranges [vecsub $maxT $minT]
     puts "ranges = $ranges"    # puts "ranges = $ranges"
     set scale [expr .7*[Orient::max [lindex $ranges 0] \     set scale [expr .7*[Orient::max [lindex $ranges 0] \
                              [lindex $ranges 1] \                              [lindex $ranges 1] \
                              [lindex $ranges 2]]]                              [lindex $ranges 2]]]
Line 167
Line 169
     set COM [Orient::sel_com $x $y $z]     set COM [Orient::sel_com $x $y $z]
     set ::NeuronVND::princ_axes_com $COM     set ::NeuronVND::princ_axes_com $COM
     vmd_draw_vector $mol $COM [vecscale $scale $a1]     vmd_draw_vector $mol $COM [vecscale $scale $a1]
     graphics $mol color blue 
     vmd_draw_vector $mol $COM [vecscale $scale $a2] 
     graphics $mol color green     graphics $mol color green
     vmd_draw_vector $mol $COM [vecscale $scale $a3]     vmd_draw_vector $mol $COM [vecscale $scale $a2]
  
  
     set items [list [list x [lindex $ranges 0]] [list y [lindex $ranges 1]] [list z [lindex $ranges 2]]] 
     set ordered [lsort -real -index 1 $items] 
  
     set xindex [lsearch $ordered x]  
     set yindex [lsearch $ordered y]   
     set zindex [lsearch $ordered z] 
      
  
     if {$xindex == 0} { 
         set a1weight "3" 
     } elseif {$xindex == 1} { 
         set a1weight "2" 
     } elseif {$xindex == 2} { 
         set a1weight "3" 
     } 
  
     if {$yindex == 2} {     graphics $mol color 24
         set a2weight "1"     #Biological Constraint Check to See if We have to Flip the Axis for 3D Reconstruction
     } elseif {$yindex == 1} {     set ::NeuronVND::priority_axis $a3
         set a2weight "2"     if {$flip_priority_axis == 1} {
     } elseif {$yindex == 0} {         #set $a3 [vecscale -1 $a3]
         set a2weight "3"         set flippy -1
     }         set text "1"
     if {$zindex == 1} {     } else {
         set a3weight "2"         set flippy 1
     } elseif {$zindex == 0} {         set text "1"
         set a3weight "3" 
     } elseif {$zindex == 2} { 
         set a3weight "1" 
     }     }
  
     set a1weight "3"     vmd_draw_vector $mol $COM [vecscale [expr $flippy * $scale] $a3]
     set a2weight "1"     #setup data and order ascending
     set a3weight "2"     #a1 is x, a2 is z, a3 is y
     graphics $mol color white     graphics $mol color white
     graphics $mol text [vecadd $COM [vecscale $scale2 $a1]] "$a1weight"     graphics $mol text [vecadd $COM [vecscale $scale2 $a1]] "3"
     graphics $mol text [vecadd $COM [vecscale $scale2 $a2]] "$a2weight"     graphics $mol text [vecadd $COM [vecscale $scale2 $a2]] "2"
     graphics $mol text [vecadd $COM [vecscale $scale2 $a3]] "$a3weight"     graphics $mol text [vecadd $COM [vecscale [expr $flippy * $scale2] $a3]] "$text"
     set paxis [list $a1 $a2 $a3]     set paxis [list $a1 $a2 $a3]
     return $paxis     return $paxis
 } }
Line 232
Line 212
     puts "Computing the inertia tensor..."     puts "Computing the inertia tensor..."
     # get the I     # get the I
     set I [Orient::sel_it $x $y $z $COM]     set I [Orient::sel_it $x $y $z $COM]
     puts "I before the $I" 
     puts "Drawing the principal components..."     puts "Drawing the principal components..."
     La::mevsvd_br I evals     La::mevsvd_br I evals
     # now $I holds in its columns the principal axes     # now $I holds in its columns the principal axes
Line 240
Line 219
     set a2 "[lindex $I 4] [lindex $I 7] [lindex $I 10]"     set a2 "[lindex $I 4] [lindex $I 7] [lindex $I 10]"
     set a3 "[lindex $I 5] [lindex $I 8] [lindex $I 11]"     set a3 "[lindex $I 5] [lindex $I 8] [lindex $I 11]"
     set calculated_axis [list $a1 $a2 $a3]     set calculated_axis [list $a1 $a2 $a3]
      puts "this is the calculated_axis I after SVD" 
     foreach elem $calculated_axis {      set ::NeuronVND::priority_axis $a3
         puts "$elem\n" 
     } 
     return $::Orient::calculated_axis     return $::Orient::calculated_axis
 } }
  
Line 299
Line 276
    #  plotpoints $calced_list    #  plotpoints $calced_list
 } }
  
  #this file is not called
 proc Orient::draw_alignment_axis {xarg yarg zarg amol} { proc Orient::draw_alignment_axis {xarg yarg zarg amol} {
     set COM $::Orient::COM     set COM $::Orient::COM
     #initial principal axes tensor     #initial principal axes tensor
     set I $::Orient::calculated_axis     set I $::Orient::calculated_axis
     Orient::vnd_orient     Orient::vnd_orient
      variable priority_axis
     puts "$COM" 
     puts "$I" 
  
     set newa1 ""     set newa1 ""
     set newa2 ""     set newa2 ""
     set newa3 ""     set newa3 ""
      set minmax ""
  
  
     set x $xarg     set x $xarg
Line 338
Line 315
                              [lindex $ranges 1] \                              [lindex $ranges 1] \
                              [lindex $ranges 2]]]                              [lindex $ranges 2]]]
     set scale2 [expr 1.02 * $scale]     set scale2 [expr 1.02 * $scale]
  
     set rot_m $::Orient::calculated_list     set rot_m $::Orient::calculated_list
  
     set newa1 [coordtrans [lindex $rot_m 0] [lindex $I 0]]     set newa1 [coordtrans [lindex $rot_m 0] [lindex $I 0]]
     set newa2 [coordtrans [lindex $rot_m 1] [lindex $I 1]]     set newa2 [coordtrans [lindex $rot_m 1] [lindex $I 1]]
     set newa3 [coordtrans [lindex $rot_m 2] [lindex $I 2]]     set newa3 [coordtrans [lindex $rot_m 2] [lindex $I 2]]
  
     #Need to make this chunk more efficient in finding the largest axis and labeling it "1"     #set items [list [list xpriori [lindex $ranges 0]] [list ypriori [lindex $ranges 1]] [list zpriori [lindex $ranges 2]]]
     set items [list [list x [lindex $ranges 0]] [list y [lindex $ranges 1]] [list z [lindex $ranges 2]]]     #set ordered [lsort -real -index 1 $items]
     set ordered [lsort -real -index 1 $items] 
      #puts "testingggg under draw_aligment _ axis $ordered"
     set xindex [lsearch $ordered x]      #set xpriori, ypriori, zpriori variables here.
     set yindex [lsearch $ordered y]       #set [lindex $ordered 0 0] 3
     set zindex [lsearch $ordered z]      #set [lindex $ordered 1 0] 2
     if {$xindex == 0} {     #set [lindex $ordered 2 0] 1
         set a1weight "3" 
     } elseif {$xindex == 1} {     #switch [lindex $ordered 2 0] {
         set a1weight "2"     #    "xpriori" {set priority_axis "[lindex $I 0]"} 
     } elseif {$xindex == 2} {     #    "ypriori" {set priority_axis "[lindex $I 1]"}
         set a1weight "3"     #    "zpriori" {set priority_axis "[lindex $I 2]"}
     }     #}
  
     if {$yindex == 0} {     #set priority_axis $newa3
         set a2weight "3" 
     } elseif {$yindex == 1} { 
         set a2weight "2" 
     } elseif {$yindex == 2} { 
         set a2weight "3" 
     } 
     if {$zindex == 0} { 
         set a3weight "3" 
     } elseif {$zindex == 1} { 
         set a3weight "2" 
     } elseif {$zindex == 2} { 
         set a3weight "3" 
     } 
  
     graphics $mol color 20     graphics $mol color 20
     set COM [Orient::sel_com $x $y $z]     set COM [Orient::sel_com $x $y $z]
     vmd_draw_vector $mol $COM [vecscale $scale $newa1]     vmd_draw_vector $mol $COM [vecscale $scale $newa1]
     vmd_draw_vector $mol $COM [vecscale $scale $newa2]     vmd_draw_vector $mol $COM [vecscale $scale $newa2]
     vmd_draw_vector $mol $COM [vecscale $scale $newa3]     vmd_draw_vector $mol $COM [vecscale $scale $newa3]
  
     set a1weight "2" 
     set a2weight "3" 
     set a3weight "1" 
     graphics $mol color white     graphics $mol color white
     #now just drawing straight from calculated axis     #now just drawing straight from calculated axis
     graphics $mol text [vecadd $COM [vecscale $scale2 $newa1]] "$a1weight"     graphics $mol text [vecadd $COM [vecscale $scale2 $newa1]] "$xpriori stupiid "
     graphics $mol text [vecadd $COM [vecscale $scale2 $newa2]] "$a2weight"     graphics $mol text [vecadd $COM [vecscale $scale2 $newa2]] "$ypriori stupid y"
     graphics $mol text [vecadd $COM [vecscale $scale2 $newa3]] "$a3weight"     graphics $mol text [vecadd $COM [vecscale $scale2 $newa3]] "$zpriori stupid z"
     set alignment_vector [list $newa1 $newa2 $newa3]     set alignment_vector [list $newa1 $newa2 $newa3]
     return $alignment_vector     return $alignment_vector
  
 } }
  
 #prototype for drawing the alignment axis or "final position" #prototype for drawing the alignment axis or "final position"
Line 408
Line 366
     set yvec { 0 1 0}     set yvec { 0 1 0}
     set zvec { 0 0 1}     set zvec { 0 0 1}
     set vec2list [list $xvec $yvec $zvec]     set vec2list [list $xvec $yvec $zvec]
     puts "$vec2list" 
     variable calculated_list     variable calculated_list
     set calculated_list ""     set calculated_list ""
  
Line 419
Line 376
         set sine   [veclength $rotvec]         set sine   [veclength $rotvec]
         set cosine [vecdot $ivec1 $ivec2]         set cosine [vecdot $ivec1 $ivec2]
         set angle [expr atan2($sine,$cosine)]         set angle [expr atan2($sine,$cosine)]
         puts "rotvec $rotvec"        #puts "rotvec $rotvec"
         puts "sine $sine"        # puts "sine $sine"
         puts "cosine $cosine"        # puts "cosine $cosine"
         puts "angle $angle"       #  puts "angle $angle"
         puts "-------------------------------"        # puts "-------------------------------"
         lappend calculated_list [trans center $COM axis $rotvec $angle rad]         lappend calculated_list [trans center $COM axis $rotvec $angle rad]
     }     }
     #set calculated_list [transmult [lindex $calculated_list 0] [lindex $calculated_list 1] [lindex $calculated_list 2]]     #set calculated_list [transmult [lindex $calculated_list 0] [lindex $calculated_list 1] [lindex $calculated_list 2]]
     puts "done calculating rotation matrix $calculated_list"     #puts "done calculating rotation matrix $calculated_list"
 } }
  
 proc vmd_draw_arrow {mol start end} { proc vmd_draw_arrow {mol start end} {
     set scaling [expr [veclength [vecsub $end $start]]/100]     set scaling [expr [veclength [vecsub $end $start]]/100]
     # an arrow is made of a cylinder and a cone     # an arrow is made of a cylinder and a cone
     set middle [vecadd $start [vecscale 0.8 [vecsub $end $start]]]     set middle [vecadd $start [vecscale 0.8 [vecsub $end $start]]]
     graphics $mol cylinder $start $middle radius [expr 2*$scaling]     graphics $mol cylinder $start $middle radius [expr 1.4*$scaling]
     #i added this     #i added this
     #graphics $mol line $start [vecadd $start {100 100 100}] width 2 style solid     #graphics $mol line $start [vecadd $start {100 100 100}] width 2 style solid
     puts [list cone $middle $end radius [expr 5*$scaling]]     #puts [list cone $middle $end radius [expr 5*$scaling]]
     graphics $mol cone $middle $end radius [expr 5*$scaling]     graphics $mol cone $middle $end radius [expr 5*$scaling]
 } }
  
Line 456
Line 413
     }     }
     return $maxval     return $maxval
 } }
  
  puts "Done loading orient.tcl modified by jason"


Legend:
Removed in v.1.4 
changed lines
 Added in v.1.5



Made by using version 1.65 of cvs2html