From: Teletchéa Stéphane (steletch_at_biomedicale.univ-paris5.fr)
Date: Wed Nov 19 2003 - 11:01:41 CST

Le mar 18/11/2003 à 18:26, Justin Gullingsrud a écrit :
> Hi,
>
> > Thanks, i've looked at it, and i think it could be trivial or not.
> > The title is written via the $item command, line 19 of the script:
> >
> > set input "@type xy\n@ title \"$item\"\n"
> >
> > And i suspect that $item contains an internal vmd variable designing the
> > bond, angle, ... like bond0, bond1, ...
>
> You could do something like the following:
>
> set info [lindex [label list $type] $item]
>

Thank you very much for your guidelines. I've used them and now it
works. Here is the modified procedure in tcl (extract of the file
vmd/scripts/vmd/graphlabels.tcl) :

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]

    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 0] $deb] 1]
    set sel [atomselect top "index $atom"]
    set atomname [$sel get name]
    set resid [$sel get resid]
    set resname [$sel get resname]
    append input "$resname $resid:$atomname - "
    }
    
    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
    }
  }
}

The only problem is that it produces lines like this :

GUA 15:C5 - CYT 16:C4 - <-- note there is an extra '-'

It would be better to not have this extra '-'. but since the most
important thing for me was to have atom names instead of
Bond/Angle/Dihedral, i think it is quite ok. May be i'll find a clever
way to do it tomorrow.

Could this improvement be considered to be included in 1.8.2 ?

I have not tested it with a protein, but as i used vmd own's variables,
i think it should be straightforward.

Some comments about the code :

Variables fin and deb are (in French, like this i'm sure they won't
interfere with the code ;-)) for :

fin : end
deb : début (beginning)

Thanks for your comments,
Stef

--
17:55:27 up 36 days, 4:30, 9 users, load average: 0.00, 0.01, 0.00
http://www.steletch.org
Linux 2.4.21-0.25mdk #1 Thu Jul 24 13:10:52 MDT 2003