#!/usr/bin/env __XPLOR_DIR__/bin/pyXplor import sys argv = sys.argv dele =0 usage = '''usage: %s generates a psf file from the given pdb file. the psf file is written in a filename derived the input filename. options are-: -delUnknown - to delete the unknown atoms from the PDB file before the psf file is been written. The option is off if not specified. -help-script - prints out the usage of the script this is a work in progress. Please report problems to xplor-nih@nmr.cit.nih.gov ''' % argv[0] (opts,pdbfile)=xplor.parseArguments(["delUnknown:0","help-script:0"]) for op in opts: if(op[0]=='help-script'): print usage sys.exit(0) if(op[0]=='delUnknown'): dele=1 pass infile=pdbfile[0] if not open(infile): print "file not found or not readable: %s" % infile sys.exit(1) pass from string import join try: if len(infile.split('.')) == 1: outfile=infile else: outfile=join(infile.split('.')[:-1],'.') except: outfile=infile pass outfile += '.psf' from psfGen import pdbToPSF pdbToPSF(open(infile).read()) if (dele==1): import protocol protocol.initCoords(files=infile) xplor.simulation.deleteAtoms("not known") psfFilename=outfile xplor.command("write psf output=%s end" % psfFilename)