Hi Robert,

        Actually, PDB atom ordering is deep inside the C core. I just
glanced at the code...it should be possible to add this capability, but
it is not a trivial task.  There's currently no way to force PyMOL to do
this, and it may or may not make it into the next version.

        For the time being, I can only suggest a workaround, which
requires overwriting the B-factor field:

alter all,b=ID/100.0
save test.pdb

Now you can reorder the output PDB file based on the B-factor field.  It
should be possible to write a short Python script which does this, while
at the same time renumbering the PDB.

For example:

f=open("test.pdb")
l = f.readlines()
f.close()

l = filter(lambda x:x[0:6] in ('HETATM','ATOM  '),l)
l = map(lambda x:(float(x[60:66]),x),l)
l.sort()
l = map(lambda x:x[1],l)
c=1
ll = []
for a in l:
   a = a[0:6] + "%5d"%c + a[11:]
   c = c + 1
   ll.append(a)

g=open("reorder.pdb","w")
g.write(string.join(ll,''))
g.close()
   
Cheers,
Warren

--
mailto:war...@delanoscientific.com
Warren L. DeLano
Principal
DeLano Scientific LLC
Voice (650)-346-1154 
Fax   (650)-593-4020

-----Original Message-----
From: pymol-users-ad...@lists.sourceforge.net
[mailto:pymol-users-ad...@lists.sourceforge.net] On Behalf Of Robert
Havlin
Sent: Saturday, May 17, 2003 10:26 AM
To: pymol-users@lists.sourceforge.net
Subject: [PyMOL] Atom Ordering when Saving

I was curious how I might prevent Pymol from re-ordering the atoms when 
saving to a pdb file.
I am using a .pml script to output a large number of peptide files for 
use in gaussian, but I need to preserve the atom
order in the output file.

I am not a python expert, but it seems like it should be in 
exporting.py..  But it is not obvious where the atom reordering is done.

Thanks,
Bob



-------------------------------------------------------
This SF.net email is sponsored by: If flattening out C++ or Java
code to make your application fit in a relational database is painful, 
don't do it! Check out ObjectStore. Now part of Progress Software.
http://www.objectstore.net/sourceforge
_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users


Reply via email to