From: Justin Gullingsrud (
Date: Tue Nov 18 2003 - 11:26:41 CST


> 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]

The variable info will now contain a list of elements of the form

  {{mol1 atom1} {mol2 atom2} value status}

where mol0 and mol1 are the molecule id's of the bond label and atom0
and atom1 are the atom id's, which use a index beginning from zero.

The commands
  set atom1 [lindex [lindex $info 0] 1]
  set atom2 [lindex [lindex $info 2] 1]
will extract this info, which you can then put into the title.

If you want more information than atom indices, your only option is to
create an atom selection using these indices:

  set sel [atomselect top "index $atom1 $atom2"

and then extract information about the atoms:

  set atomnames [$sel get name]
  set resnames [$sel get resname]
  set resids [$sel get resid]

That should be all you need to get you started. Also, the easiest way
to define your own graphing command is to copy the xmgr command in that
graphlabel.tcl file, then define your own command called vmd_labelcb_user.
If VMD finds that a command with that name is defined, it will use it
instead of the default. You could put your command in a file
and source that file from your .vmdrc file.

Hope this helps,

> So the trivial way of doing it is replacing bond0 by a more explicit
> description like : RESNAME1(ATOMNAME1)-RESNAME1(ATOMNAME1) for a bond,
> angle,
> The problem may arise from changing the vmd nomenclature ($item may be
> used elsewhere ?) in that case, i would define a new one like $item_name
> containing the above way of numbering (or a better one, i'm really
> open).
> I'm ready to help, but i think i would search for :
> 1 - variable defining bond/angles/dihedral (as they are in the box, i
> think it is quite easy to find them)
> 2 - define $item with them
> or
> 2' - define $item_name with them
> 3 - change nothing in the script
> or
> 3' - change like 19 of script vmd/scripts/vmd/graphlabels.tcl to
> set input "@type xy\n@ title \"$item_name\"\n"
> I don't know how complicate this is, but i'll appreciate very much this
> feature. I i can help more, i'm ready.
> Stef
> PS : If you can tell me which variables contain the atom names, etc or
> where i can find them, it will be a pleasure for me to implement it.
> --
> 17:27:50 up 35 days, 4:02, 7 users, load average: 0.01, 0.04, 0.06
> Linux 2.4.21-0.25mdk #1 Thu Jul 24 13:10:52 MDT 2003