VMD comes with a full-blown scripting language, namely Tcl with VMD-specific extensions (which are described in the VMD Users Guide).
These commands are entered as text commands on the Tcl command line. Open
.The label command has the syntax for adding a new Bonds
label add Bonds $molID1/$atomID1 $molID2/$atomID2
where $molID
refers to the molecule number (e.g., 0
) and
$atomID
is the internal atom index that VMD assigns to each
atom. Getting this atom index is a bit convoluted and uses the
atomselect command. In the following example, we create a bond
distance between the CB atoms of residues Ile52 and Lys145:
set molID1 0
set molID2 0
set atomID1 [[atomselect $molID1 "protein and resid 52 and name CB"] list]
set atomID2 [[atomselect $molID2 "protein and resid 145 and name CB"] list]
# show the atom indices (optional)
puts "Ile 52 CB: $atomID1"
puts "Lys 145 CB: $atomID2"
# create the label
label add Bonds $molID1/$atomID1 $molID2/$atomID2
The bond label between I52 and K145 should appear now.