Draw Corase-grained Sites

From Computational Biophysics and Materials Science Group
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

Multiple screenshots

Of course we could add a for-loop to the above code in order to let the computer do multiple graphics for you.

# #########################################
# ## Description: TCL script to draw spheres according to some coordinates. Usually use for drawing CG sites. Being modified to do multiple graphics.
# ## Author: Kevin May 2014
# ## Usage: source drawm_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
# #########################################


for {set start 1} {$start <= 37} {incr start} {
	draw delete all
	set n 1
	set i 1
	set c 0
	set x A
	set fp [open unsym+last.xyz r]
	set end [expr {$start+3}]
	set middle1 [expr {$start+1}]
	set middle2 [expr {$start+2}]
	while {[gets $fp line] >= 0} {
		# puts $line
		if {$n >=$start && $n<=$end} {
		  if {$c==2} {set c 10}
		  if {$c==6} {set c 0}
		  if {$c>=18  && $c%2==0} {incr c}
		  draw color $c
		  incr c
		  set tmp [vecadd $line {-5 6 6}]
		  draw text $tmp P${n} size 2.5 thickness 5
		  if {$i > 1} {draw cylinder $origin $line radius 0.3}
		  set origin $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

display resetview
set string "P${start}+P${middle1}+P${middle2}+P${end}+dih-top.bmp"

scale to 0.035

render Tachyon tmp.dat [format {"C:\Program Files (x86)\University of Illinois\VMD\\tachyon_WIN32.exe"  -mediumshade -trans_max_surfaces 1 tmp.dat -res 2048 1024 -format BMP -o C:/Users/ukevi/Documents/Dropbox/Quick_Work_Directory/BAR-PH/plot_bad/%s} $string]

rotate x to -90

set string "P${start}+P${middle1}+P${middle2}+P${end}+dih-side.bmp"

render Tachyon tmp.dat [format {"C:\Program Files (x86)\University of Illinois\VMD\\tachyon_WIN32.exe"  -mediumshade -trans_max_surfaces 1 tmp.dat -res 2048 1024 -format BMP -o C:/Users/ukevi/Documents/Dropbox/Quick_Work_Directory/BAR-PH/plot_bad/%s} $string]


}