From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Jul 21 2009 - 08:43:21 CDT

On Tue, 2009-07-21 at 13:49 +0200, Michael Kreim wrote:
> Hello,
>
> I have (again) some trouble in using python 2.2.3 inside vmd 1.8.6.

michael,

please install the latest VMD beta version and try again or send john
or me a complete "working" failing input example. please do so as
quickly as possible since VMD-1.8.7 is about to be released any day
now, and we'd like to have as many bugs squashed as possible. there
were a lot of python problems that were fixed in between, but also
there are in general quite few python bug reports.

thanks,
    axel.

>
> I want to save each segment of a pdb file in an own pdb file. I am doing
> this using this function:
>
> def split_PDB_into_Segments(pdb):
> import Molecule
> import atomsel
> mid=Molecule.Molecule()
> mid.load(pdb, filetype='pdb', first=0, last=-1, step=1, waitfor=-1)
> sorted_segnames = _uniq(atomsel.atomsel("all").get("segname"))
> for seg in sorted_segnames:
> segstr = "segname " + seg
> sel_seg = atomsel.atomsel(segstr)
> mid.save(seg+".pdb", filetype='pdb', first=0, last=-1, step=1,
> waitfor=-1, sel=sel_seg)
> mid.delete()
>
> (_uniq() is a small function that works similar as the unix uniq command)
>
> If I run this code, I get the following error:
>
> Traceback (most recent call last):
> File "VMD", line 30, in ?
> File "/x/x.py", line 45, in split_PDB_into_Segments
> mid.save(seg+".pdb", filetype='pdb', first=0, last=-1, step=1,
> waitfor=-1, sel=sel_seg)
> File "/x/vmd/linux/vmd_amd64/lib/vmd/scripts/python/Molecule.py", line
> 121, in save
> if isinstance(sel, VMD.AtomSel.AtomSel):
> AttributeError: 'module' object has no attribute 'AtomSel'
>
> Maybe somebody can help me in how to use the Molecule.save() routine
> correctly. I followed the documentation given by help(Molecule).
>
> Thanks a lot.
>
> Best regards,
>
> Michael

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.