VMD-L Mailing List
From: Justin Gullingsrud (justin_at_ks.uiuc.edu)
Date: Fri Mar 22 2002 - 11:55:45 CST
- Next message: Liu, Zhanwu: "RE: Help on script"
- Previous message: John Stone: "Re: Test release of VMD movie maker"
- In reply to: Sonja M. Schwarzl: "drawing bonds with vmd/python interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi Sonja,
Your code does seem to work for me, even when the atoms are in different
segments. I tried your code with the brH.pdb molecule that comes with VMD:
import AtomSel
sel=AtomSel.AtomSel('index 3400 3715')
print sel.get('segid')
bonds = sel.getbonds()
print bonds
if 3715 not in bonds[0]:
bonds[0].append(3715)
bonds[1].append(3400)
sel.setbonds(bonds)
This looks fine in when drawn as lines. What I'm guessing is going on is
that you're trying to draw in Tubes or some other kind of high-level rep.
Even though you've changed a bond, VMD doesn't automatically recalculate the
topology of the molecule based on the new connectivity; I can see how there
should be a command to make it do so, just like the command to recalculate
secondary structure.
What I could suggest for you now is to try to build a structure file for
your molecule, rather than letting VMD guess the bonds. This can be done in
a variety of ways, including with the psfgen structure building tool that comes
with VMD 1.7.1. More documentation can be found in the psfgen directory,
which will be something like /usr/local/lib/vmd/plugins/LINUX/tcl/psfgen1.0/
depending on how VMD was installed. There's a pdf file (ug.pdf) in that
directory which explains how to go about it. Let us know if you need more
assistance.
Justin
vmd_at_ks.uiuc.edu
On Fri, Mar 22, 2002 at 04:36:46PM +0100, Sonja M. Schwarzl wrote:
> Hello,
>
> I want to draw a bond that is not automatically shown when loading the
> molecule into vmd. To do this, I make use of the vmd/python interface.
> The code to connect the atoms indexes 7887 and 7888 is:
>
> sel = AtomSel.AtomSel(selection='index 7887 7888', molid=mol_id, frame=frame_number)
> bonds = sel.getbonds()
> if 7888 not in bonds[0]:
> bonds[0].append(7888)
> bonds[1].append(7887)
> sel.setbonds(bonds)
>
> The source of my structures is a CHARMM trajectory. If
> the atoms to be connected belong to the same CHARMM segment, I do not have
> any problems. However, if they belong to different segments, the bond will
> not be shown. How can I overcome this problem?
>
> Sonja
>
> --
> _______________________________________________________________________
>
> Sonja M. Schwarzl sonja.schwarzl_at_iwr.uni-heidelberg.de
> IWR - Biocomputing
> Im Neuenheimer Feld 368 Tel.: +49/6221/54-8801
> 69120 Heidelberg Fax: +49/6221/54-8868
> Germany
> _______________________________________________________________________
-- Justin Gullingsrud 3111 Beckman Institute H: (217) 384-4220 I got a million ideas that I ain't even rocked yet... W: (217) 244-8946 -- Mike D
- Next message: Liu, Zhanwu: "RE: Help on script"
- Previous message: John Stone: "Re: Test release of VMD movie maker"
- In reply to: Sonja M. Schwarzl: "drawing bonds with vmd/python interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]