proc colordisplace {chain start end shift} { puts "calculating displacements of atoms on residues for a given chain with shifted residues (opt)" # # by Ch. Fufezan in 2006 - www.fufezan.net/sci_scripts.php # set selector "chain $chain" set al1 [atomselect 0 "$selector"] set al2 [atomselect 1 "$selector"] #$al1 set beta 0 for {set i $start} {$i <$end} {incr i} { set w 0 set tmp "chain $chain and resid $i" set aa1 [atomselect 0 "$tmp"] ##-> if wrongly numbered if {$shift != 0} { set numba [expr $i + $shift] set tmp "chain $chain and resid $numba" } ##---------------------- set aa2 [atomselect 1 "$tmp"] if {$i == $start} { set res1 [$aa1 get {resname resid}] set res2 [$aa2 get {resname resid}] puts "Shift align puts $res1 with $res2" } if {[$aa1 num] - [$aa2 num] != 0} { set a0 [$aa1 num] set a1 [$aa2 num] puts "-> Resid $i 0:$a0 / 1:$a1" } else { set calf "alpha and (chain $chain and resid $i)" set calff [atomselect 0 "$calf"] foreach v0 [$aa1 get {x y z}] v1 [$aa2 get {x y z}] idx1 [$aa1 get {index}] { #graphics 0 color red #graphics 0 cylinder $v0 $v1 radius 0.2 set dx [expr [lindex $v0 0] - [lindex $v1 0]] set dy [expr [lindex $v0 1] - [lindex $v1 1]] set dz [expr [lindex $v0 2] - [lindex $v1 2]] set displace [expr (sqrt($dx*$dx + $dy*$dy + $dz*$dz))] set enhanced [expr (10 * $displace)] if {$enhanced >= $w} { set w $enhanced $calff set beta $w } set aim "index $idx1" set target [atomselect 0 "$aim"] $target set beta $enhanced } } } }