Save sep

From PyMOLWiki
Revision as of 11:45, 4 June 2009 by Inchoate (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Saves all objects as separate PDB files. Useful if you want to do things like combine separate *.pse files.


from pymol import cmd
import glob
import re

def save_sep(prefix=''):
  save_sep <prefix>

  saves multiple objects into multiple files using an optional prefix name.

  e.g. save_sep prefix
  obj_list = cmd.get_names("all")

  if obj_list:
    for i in range(len(obj_list)):
      obj_name = "%s%s.pdb" % (prefix, obj_list[i]), obj_list[i])
      print "Saving %s" %  obj_name
    print "No objects found"