# Script to read and draw triangulated surface. It reads text file with 9 columns of data, containing coordinates of a triangle, separated by single spaces (x1 y1 z1 x2 y2 z2 x3 y3 z3). Useful when you have some surface calculated in the external program, e.g. Matlab, and want to overlap it exactly with the structure in VMD. # Andriy Anishkin (anishkin@icqmail.com) UMCP #set filename "test_tri.txt" set filename "test_triangles.txt" set filename "test_triangles-2.txt" # open the file set file_look [open $filename r] # material add Material2 # material change ambient Material2 0.000000 # material change specular Material2 0.050000 # material change diffuse Material2 0.710000 # material change shininess Material2 0.000000 # material change opacity Material2 1.000000 # read until the end of file draw color red #draw material Material2 #get coordinates of the triangle vertices while {[gets $file_look line] > 0} { # Read the coordiantes of the point set point1 "[lindex $line 0] [lindex $line 1] [lindex $line 2]" set point2 "[lindex $line 3] [lindex $line 4] [lindex $line 5]" set point3 "[lindex $line 6] [lindex $line 7] [lindex $line 8]" #draw triangle draw triangle $point1 $point2 $point3 }