# How to add a bond between two atoms in VMD?

I want to add a bond between specific atoms. I found on VMD page that one can use topotools (e.g. topo addbond 1 2 ), but I have a lot of residues so this method didn't work with me. I need to select the two residues and then build a bond between the two atoms of the two different residues. Does anyone have an idea how to do this?

topo addbond x y should do the trick. where x is the index of the atom of an residue in which you are interested.
if you want a more automated way, then you need to know the exact atom name and the residue number.

Let's say, the residue number you are interested in is 250 and the atom name is HG1, and you want to add a bond to atom name OG1 of residue 267.

set a [atomselect top "residue 250 and name HG1"]
set aindex [$a get index] set a1 [atomselect top "residue 267 and name OG1"] set a1index [$a1 get index]

topo addbond $$aindex$$a1index


if you have a list of atom names and a list of residue numbers, you can just do a foreach loop and keep the above code in the loop, in that way you can add bonds to all the desired atoms at once.

• Thank you for your comment. This method is ok now, but why VMD didn't draw the bond in the visualization. I have the two atoms without a bond between. Jan 15 at 9:03
• That's unusual, It should form a bond. Are you sure you are looking at the correct indices? Jan 15 at 10:55
• Yes and I checked the index in the PDB file, and it was right, but there is no bond formed Jan 15 at 10:58
• @Abd-ElazeemMohamed Be cautious. Indices in VMD start from 0, where as in PDB it starts from 1. Did you take that into account? Jan 15 at 11:04
• @Vasista In general, we have tried to avoid making new chat rooms when possible, see this Meta discussion. By using a few rooms about existing topics, it's easier for users to find these discussion later and avoids a large number of unused rooms that get hidden after a short amount of time. It's not a huge problem, but in the future don't follow the prompt to make an automatic room. The instructions in that Meta post explain how to move comments to an existing room.
– Tyberius
Jan 15 at 13:41