mol new solv2_center.gro set sel [atomselect top "not water"] # Open a file for binary writing set fileID [open "output.dat" w] # Loop through the elements and write them to the file foreach line [$sel get {index radius x y z} ] { # Format the data for this iteration set out [format "%d %f %f %f %f\n" [lindex $line 0] [lindex $line 1] [lindex $line 2] [lindex $line 3] [lindex $line 4]] # Write the formatted string to the file puts -nonewline $fileID $out } close $fileID