From: Giacomo Fiorin (
Date: Thu Nov 30 2017 - 09:13:09 CST

Hi Sergio, the closest option that I see among the sub-commands of the
"label" Tcl command (which lets you create and manipulate labels from the
command line) is a "label textformat" command that allows you to change the
format of the atom label:

vmd > label textformat Atoms 0 *# print the format of the 1st Atom label*
%R%d:%a *# default Atom label format: resname,resnumber:atomname*
vmd > label textformat Atoms 0 %a *# set 1st label format to atomname only*

*Note:* you won't find this command on the VMD user's guide, it is only for
the VIPs! Just kidding: it was probably added as a backend for one of the
plugins and not meant to be used by common folk. Here is a list of codes
(from GeometryMol.C) that you can use to build a new text format:

// '%a' atom name
// '%d' resid
// '%i' atom index (0-based)
// '%1i' atom index (1-based)
// '%e' atomic element
// '%b' beta
// '%c' chain
// '%C' conformation
// '%f' user-applied force
// '%F' current trajectory frame
// '%m' mass
// '%n' molecule index
// '%N' molecule name
// '%o' occupancy
// '%p' atom periodic element number
// '%q' atom charge
// '%R' resname in upper-case
// '%1R' 1-char resname in upper-case
// '%r' resname in camel case
// '%s' segname
// '%t' atom type
// '%T' physical time
// '%x', '%y', '%z'

But you can also put a new string yourself, for example with the bond
length formatted as you please:
vmd > label textformat Atoms 0 *[format "%.1f" [measure bond bla bla]]*

Unfortunately this is only possible for the Atom label, and you cannot
change the format for the Bond, Angle, Dihedral, ... labels: they will
ignore the format string.

You may think about using a DynamicBonds representation to display the bond
itself, and adding a custom Atom label to one of the two atoms, with the
formatted bond length as the textformat. If you want the label to sit in
between the two atoms, you can probably use a dummy atom positioned there
(shown a graphical representation such that it's effectively hidden) and
label that.


On Thu, Nov 30, 2017 at 5:40 AM, <> wrote:

> Dear vmd comunity,
> I am using label Atom to show the beta value. Is there a way to change the
> format of the label such that it shows only one decimal? (%.2f or alike). I
> know how to change the text thickness and size with the label command but I
> am not sure it is possible to change the format.
> Thank you very much for your help!
> Sincerily,
> Sergio

Giacomo Fiorin
Associate Professor of Research, Temple University, Philadelphia, PA
Contractor, National Institutes of Health, Bethesda, MD