From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Nov 20 2003 - 09:51:04 CST

Hey Stephane,
  Sure, go ahead and make the script available on your site.
For the short-term I'd prefer to leave the default behavior in
VMD 1.8.2, but we can see about putting this into the version
after that. (too many changes at the last minute are a bad idea...)

Along these lines, if people have graphing scripts for packages besides
XmGrace, please let us know!

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Thu, Nov 20, 2003 at 01:53:21PM +0100, Teletchéa Stéphane wrote:
> Le jeu 20/11/2003 à 09:54, Teletchéa Stéphane a écrit :
> Here a corrected version of the script :
> 1 - molecules ID are now taken correctly into account
> 2 - bond/angle/dihedral number are correct (before only the first
> bond/angle/dihedral was correctly labelled)
> 3 - the extra '- ' is removed, thanks to Justin.
>
> I've tested it with one or two molecules, DNA and/or protein.
> It should work completely by now.
>
> Can i make it available via my website ?
>
> Stef
>
> The modified script :
>
> ############################################################################
> #cr
> #cr (C) Copyright 1995-2003 The Board of Trustees of
> the
> #cr University of
> Illinois
> #cr All Rights
> Reserved
> #cr
> ############################################################################
>
> # Callback for plotting values of labels. Triggered by the "graph"
> button
> # on the Labels menu.
>
> # This callback sends data to xmgr, one dataset at a time. If xmgrace
> is
> # not found, it reverts to the save dialog.
> proc vmd_labelcb_xmgr { args } {
> global vmd_graph_label
> foreach item $vmd_graph_label {
> foreach { type id } $item { break }
> set data [label graph $type $id]
> set info [label list $type]
> set ind [lindex $item 1]
>
> switch [lindex $item 0] {
> "Bonds" {
> set fin 2
> }
> "Angles" {
> set fin 3
> }
> "Dihedrals" {
> set fin 4
> }
> }
>
> set input "@type xy\n@ title \""
>
> for {set deb 0} { $deb < $fin } {incr deb 1} {
>
> set atom [lindex [lindex [lindex $info $ind] $deb] 1]
> set mol [lindex [lindex [lindex $info $ind] $deb] 0]
> set sel [atomselect $mol "index $atom"]
> set atomname [$sel get name]
> set resid [$sel get resid]
> set resname [$sel get resname]
> append input "$resname $resid:$atomname - "
> }
>
> set input [string trimright $input "- "]
> append input "\"\n"
>
> set i 0
> foreach elem $data {
> append input " $i $elem\n"
> incr i
> }
> set rc [catch {exec xmgrace -pipe << $input &} msg]
> if { $rc } {
> vmd_labelcb_save
> }
> }
> }
>
> # This callback simply saves the data to a file of the user's choice
> using
> # the Tk dialog box if available, otherwise through the text interface.
> proc vmd_labelcb_save { args } {
> global vmd_graph_label tk_version
> foreach item $vmd_graph_label {
> foreach { type id } $item { break }
> set data [label graph $type $id]
> set title "Enter filename to save label data for $item"
> if [info exists tk_version] {
> set fname [tk_getSaveFile -title $title]
> } else {
> puts $title
> gets stdin fname
> }
> if { [string length $fname] } {
> set fd [open $fname w]
> foreach elem $data { puts $fd $elem }
> close $fd
> }
> }
> }
>
> # Choose a callback based on the platform: xmgr for unix, save for
> everyone
> # else (for now). Exception: if a command named vmd_labelcb_user is
> defined,
> # use that one instead of the default.
> proc vmd_labelcb { args } {
> global tcl_platform
> if { [llength [info commands vmd_labelcb_user]] } {
> vmd_labelcb_user $args
> } else {
> switch $tcl_platform(platform) {
> unix {
> # Set the display variable to :0.0, unless it's already been set
> global env
> if { ![info exists env(DISPLAY)] } {
> puts "Setting DISPLAY environment variable to :0.0."
> set env(DISPLAY) :0.0
> }
> vmd_labelcb_xmgr $args
> }
> default {
> vmd_labelcb_save $args
> }
> }
> }
> }
>
> trace variable vmd_graph_label w vmd_labelcb
>
>
>
> --
> 13:50:19 up 37 days, 24 min, 10 users, load average: 0.60, 0.49, 0.39
> http://www.steletch.org
> Linux 2.4.21-0.25mdk #1 Thu Jul 24 13:10:52 MDT 2003

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078