# VERSION 1.0 - 01-10-2012 # "................................................................................" # "................................................................................" # ".............OOO,...OOO........ZOOOOOOO........................................." # ".............OOO...,OO8.......=OOO.............................................." # ".............OOO...?OOZ........OOZ.............................................." # ".............OOO...OOOZ........:OOO8............................................" # ".............OOO...OOO=..........8OOO:.........................................." # ".............OOO...OOO.............OOOO........................................." # ".............OOO...OOO..............OOO........................................." # ".............OOO...OOO8OOOOOZ.O8Z,0OOOO........................................." # ".............OOO...OOOOOOOOOO.8OOOOOO..........................................." # "................................................................................" # "................................................................................" # ".......................................,........................................" # ".....7OOOO.............................OO,......................................" # ".....OO.OOO..........,,.........~......OO..........................=..........:." # "....OO...OO ....OO+OOOOOO...OO7,.OOO...OO..OOO....OO..OOOOOOO..,OO8,8OO...OOOOO?" # "...OOO...OOO....OOO....OOI.......ZOO...OO..,OO...OOI.....OOO...OO....OOO..OOO..." # "..OOOOOOOOOO....OO.....OO,..,OOOOOOO...OO...OO0.ZOO.....OOZ...OOOOOOOOOO.,OO...." # ".OOO .....OOO...OO.....OO..OOO...,OO..7OO....OO.OO....ZOO.....?OO .......7OO...." # "~OO:.......OO=.ZOO.....OO..OOO...ZOO..OOO....OOOO....OOOI+??0..OOO?...O..OOO...." # "OOO........OOO.OOO.....O8...OOOO.OOO..OOO.....OOO....OOOOOOOZ....OOOOOO..OOO...." # ".............................................OOO................................" # "..........................................OOOOO................................." # "................................................................................" # "................................................................................" # "........................by...Juan.Bustamante..Victoria.Dumas..&..Marcelo.Marti.." # "..........................................................................2012.." set pasos 600; puts "Enter the initial coordinates separated by 'q'"; set j [gets stdin]; set fields [split $j "q"]; set crd_ini(0) [lindex $fields 0]; set crd_ini(1) [lindex $fields 1]; set crd_ini(2) [lindex $fields 2]; puts "Enter the final coordinates separated by 'q'"; set j [gets stdin]; set fields [split $j "q"]; set crd_fin(0) [lindex $fields 0]; set crd_fin(1) [lindex $fields 1]; set crd_fin(2) [lindex $fields 2]; puts "Enter the references coordinates to the X axis for the energetic curve graphic separated by 'q'"; set j [gets stdin]; set fields [split $j "q"]; set xref [lindex $fields 0]; set yref [lindex $fields 1]; set zref [lindex $fields 2]; puts "\nDo you want to enter a threshold? (Y or N)"; puts "this value set a weight based on distance between initial and final minima to the possible pathway that connects them. By this way, if you set a value of '1.3', you are allowing to calculating pathway go in some steps acquiring a distance at least 30% more than the initial distance between minima"; puts "Default threshold: 1.3"; set decision [gets stdin]; puts "\n"; if {[string compare $decision "Y"] == 0 || [string compare $decision "y"] == 0} \ { puts "Enter the thershold:"; set threshold [gets stdin]; } else { set threshold 1.3; } puts "\nYou can set other threshold.. (Y or N)"; puts "If you think or if you know that the barrier is big, sets this value up to 1. Try with differents thersholds to reach the desired pathway."; puts "Default threshold: 1.0"; set decision2 [gets stdin]; puts "\n"; if {[string compare $decision2 "Y"] == 0 || [string compare $decision2 "y"] == 0} \ { puts "Enter the threshold:"; set thresholdBarrier [gets stdin]; } else { set thresholdBarrier 1.0; } set ini_pos(0) [expr int([expr (($crd_ini(0) - $xOrigen) / $xdelta)])]; set ini_pos(1) [expr int([expr (($crd_ini(1) - $yOrigen) / $ydelta)])]; set ini_pos(2) [expr int([expr (($crd_ini(2) - $zOrigen) / $zdelta)])]; set fin_pos(0) [expr int([expr (($crd_fin(0) - $xOrigen) / $xdelta)])]; set fin_pos(1) [expr int([expr (($crd_fin(1) - $yOrigen) / $ydelta)])]; set fin_pos(2) [expr int([expr (($crd_fin(2) - $zOrigen) / $zdelta)])]; set posic(0) $ini_pos(0); set posic(1) $ini_pos(1); set posic(2) $ini_pos(2); set camino 0; set iter 0; set minimo 0; puts "\nComputing..."; #------------------------------------------------------------------------------- #------------------------------- PATHWAY MAPPING ------------------------------- #------------------------------------------------------------------------------- set semaforo 0; set dirx [expr $fin_pos(0) - $ini_pos(0)]; set diry [expr $fin_pos(1) - $ini_pos(1)]; set dirz [expr $fin_pos(2) - $ini_pos(2)]; set disprev [expr sqrt( pow($dirx, 2) + pow($diry, 2) + pow($dirz, 2) )]; while {($posic(0) != $fin_pos(0) || $posic(1) != $fin_pos(1) || $posic(2) != $fin_pos(2)) && $semaforo < $pasos} \ { set best 1000; set bestx 0; set besty 0; set bestz 0; for {set i -1} {$i <= 1} {incr i} \ { for {set j -1} {$j <= 1} {incr j} \ { for {set k -1} {$k <= 1} {incr k} \ { set dirfx [expr $fin_pos(0) - [expr $posic(0)+$i]]; set dirfy [expr $fin_pos(1) - [expr $posic(1)+$j]]; set dirfz [expr $fin_pos(2) - [expr $posic(2)+$k]]; set vecdis [expr sqrt( pow($dirfx, 2) + pow($dirfy, 2) + pow($dirfz, 2) )]; set pase 0; for {set a 0} {$a < $semaforo} {incr a} \ { if {$caminox($a) == [expr $posic(0)+$i] && $caminoy($a) == [expr $posic(1)+$j] && $caminoz($a) == [expr $posic(2)+$k]} \ { set pase 1; } } if {$best >= [expr $grilla([expr $posic(0)+$i],[expr $posic(1)+$j],[expr $posic(2)+$k]) * $thresholdBarrier] && ($i!=0 || $j!=0 || $k!=0) && $vecdis < [expr $disprev* $threshold] && $pase == 0}\ { set best $grilla([expr $posic(0)+$i],[expr $posic(1)+$j],[expr $posic(2)+$k]); set bestx $i; set besty $j; set bestz $k; } } } } set caminot($semaforo) $best; set caminox($semaforo) [expr $posic(0)+$bestx]; set caminoy($semaforo) [expr $posic(1)+$besty]; set caminoz($semaforo) [expr $posic(2)+$bestz]; set posic(0) [expr $posic(0)+$bestx]; set posic(1) [expr $posic(1)+$besty]; set posic(2) [expr $posic(2)+$bestz]; incr semaforo; } puts "Pathway traced..." puts "Saving pathway..." set guardar [open pathway.pdb w] for {set g 0} {$g < $semaforo} {incr g} \ { set pos_x [expr $xOrigen + ($caminox($g)) * $xdelta]; set pos_y [expr $yOrigen + ($caminoy($g)) * $ydelta]; set pos_z [expr $zOrigen + ($caminoz($g)) * $zdelta]; if {$g < 10} \ { puts $guardar "ATOM $g WAY WAY $g $pos_x $pos_y $pos_z $caminot($g) 0.00"; } elseif {$g >= 10 || $g < 100 } { puts $guardar "ATOM $g WAY WAY $g $pos_x $pos_y $pos_z $caminot($g) 0.00"; } else { puts $guardar "ATOM $g WAY WAY $g $pos_x $pos_y $pos_z $caminot($g) 0.00";} } close $guardar; unset guardar; for {set g 0} {$g < $semaforo} {incr g} \ { set posicion [ expr sqrt( pow( ($xOrigen + $caminox($g) * $xdelta) - $xref,2) + pow( ($yOrigen + $caminoy($g) * $ydelta) - $yref,2) + pow( ($zOrigen + $caminoz($g) * $zdelta) - $zref,2) )]; set barrera1($g) $posicion; set barrera2($g) $caminot($g); } array set barrera1b {}; array set barrera1bX {}; set guardardat_ord [open pathway.dat w] foreach {k v} [array get barrera1] { if {$v < 10} \ { lappend barrera1bX($v) $k; } else {lappend barrera1b($v) $k;} } foreach va [lsort -decreasing [array names barrera1b]] { foreach ka $barrera1b($va) { puts $guardardat_ord "$va $barrera2($ka)"; } } foreach vab [lsort -decreasing [array names barrera1bX]] { foreach kab $barrera1bX($vab) { puts $guardardat_ord "$vab $barrera2($kab)"; } } close $guardardat_ord; puts "\n\nDone. Enjoy it!" mol new {pathway.pdb} type {pdb} first 0 last -1 step 1 waitfor 1 unset guardardat_ord; unset pasos fields j crd_ini crd_fin xref yref zref decision threshold thresholdBarrier ini_pos fin_pos posic camino iter minimo best bestx besty bestz i k disprev dirfx dirfy dirfz vecdis pase a caminot caminox caminoy caminoz semaforo g posicion barrera1 barrera2 barrera1b v barrera1bX;