From: Garold Murdachaew (g.murdachaew_at_gmail.com)
Date: Mon Feb 27 2017 - 10:35:04 CST

Dear VMD Community,

I would like to place some user-defined labels near atomic positions.
I am using these commands:

proc label_atom {selection_string label_string} {
  set sel [atomselect top $selection_string]
  if {[$sel num] != 1} {
      error "label_atom: '$selection_string' must select 1 atom"
  }
  # get the coordinates of the atom
  lassign [$sel get {x y z}] coord
  # and draw the text
  draw color purple
  draw text $coord $label_string size 0.6 thickness 3
}

graphics top delete all

set mylabel [format "%s \n %7.3f" C168 0.134]
label_atom index=168 $mylabel
set mylabel [format "%s \n %7.3f" C223 0.123]
label_atom index=223 $mylabel

However, I am finding that the newline character \n, which should work
in tcl, has no effect. I have also tried vertical tab, \v, also to no
effect.

Is there a way to vertically space labels? I need to do this to make
the figure legible.

Doing this in a separate program by hand would be quite tedious (I
need to do this for a few frames of a number of trajectories, about 20
labels per frame), and prone to error. Thus I would like to automate
this as much as possible.

Thank you in advance for your suggestions,
Garold