Draw Corase-grained Sites

From Computational Biophysics and Materials Science Group
Revision as of 17:39, 20 May 2014 by Kevin (Talk | contribs)

Jump to: navigation, search
PH-B9.png
# #########################################
# ## Description: TCL script to draw spheres according to some coordinates. Usually use for drawing CG sites.
# ## Author: Kevin May 2014
# ## Usage: source draw_coor.tcl
# ## Input: 3-column-matrix coordinate file, x y z
# ## Output: nice drawing of CG sites
# ## Units: 
# ## Other Notes: modify according to your needs
# #########################################

set n 1
set i 1
set c 0
set x A
set fp [open unsym+last.xyz r]
while {[gets $fp line] >= 0} {
	
	if {$n <=40} {
	  incr c
	  # if {$c==2} {incr c}
	  # if {$c==6} {incr c}
	  if {$c==8} {incr c}
	  if {$c>=18  && $c%2==0} {incr c}
	  draw color $c
	  # set tmp [vecadd $line {0 0 6}]
	  set tmp [vecadd $line {0 6 0}]
	  draw text $tmp P${x}${i} size 2.5 thickness 5
	  if {$i > 1} {draw cylinder $start $line radius 0.3}
	  set start $line
	  incr i
	  } else {
	      set c 6
		  draw color $c
		  incr i
		  # draw text $tmp PB${i} size 2.5 thickness 1.5
	    }

	draw sphere $line radius 2
	
	if {$n == 21} {
	  set i 1
	  set c 0
	  set x B
	}
	incr n
}
close $fp