From: Axel Kohlmeyer (
Date: Wed Sep 10 2008 - 10:23:18 CDT

On Wed, 10 Sep 2008, Marcelo Carignano wrote:

MC> Hi all,

MC> I am trying to display s system with (several) unusually long bonds.
MC> The pickbond script allows me to create those bonds using the mouse.
MC> However, that information is lost if I save the state of my work using the
MC> VND Main window.
MC> - Is there any way to save those bonds for future use?

you can write out a .psf file using:

animate write psf mystruc.psf

this will be incomplete and thus not be sufficient for simulations
_but_ contains all bonding information. next time you load the
coordinate file (.pdb?) you first load the .psf file and then
VMD will not try to guess bonds, but use the information from the
.psf file.

MC> - or, even better, if I have the list of atoms that should be bonded
MC> (their index numbers)
MC> how can I create those bonds in an automatic way from the console?

you can do this from scripts using atom selections. example (assuming
a water molecule with atoms stored in the order OHH, i.e. bonds between
0 and 1 and 0 and 2:

set mysel [atomselect top "index 0 1 2"]
$mysel setbonds "{1 2} {0} {0}"

-> you have to have a list with one entry for each
   atom in the selection. and then each entry is a
   list with the atoms the specific atom is bonded to.
   the entry will result in "half a bond".

you can check the results with:

puts "bond list: [$mysel getbonds]"

more details should be in the VMD user's guide.

hope that helps,

MC> Many thanks,
MC> Marcelo Carignano

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.