def __init__(self, infile, finalOutputDir=None, finalOutputName=None, workdir=None, verbose=True): """Initialize the class REQUIRED INPUTS infile the stating *.pdb, *.gro, etc. file to initialize the system OPTIONAL INPUTS finalOutputDir directory to save final *.trp, *.gro files for an MD simulation. Defaults to './out' finalOutputName basename (*) to name the final *.trp, *.gro files for an MD simulation. Defaults to 'out' workdir directory to perform gmx preprocessing. If not specified, work will be done in a unique temporary directory. """ self.verbose = verbose # finalOutDir # the name of the directory to write the final prepared gmx files if finalOutputDir == None: self.finalOutputDir = os.path.abspath( os.path.join(os.curdir, 'out')) else: self.finalOutputDir = os.path.abspath(finalOutputDir) # finalOutDir # the root name of the files written in the final prepared gmx files if finalOutputName == None: self.finalOutputName = 'out' else: self.finalOutputName = finalOutputName # workdir # The working directory for the simulation preparation if workdir == None: self.workdir = tempfile.mkdtemp() else: self.workdir = workdir # files # An object for keeping track of a series of filenames self.files = PrepFilenames(infile, self.workdir) # status self.status = PrepStatus() self.checkForFatalErrors = True # these will be set by the prepare method self.mockrun = False # A set of paths to look in for mdpfiles self.mdpPaths = [] self.mdpPaths.append( os.path.join(os.environ['MMTOOLSPATH'], 'gromacstools/devel/SimulationPreparation/mdp')) ##################################### # Start Building the GROMACS project print "GROMACS files %s.tpr and %s.gro, etc. will be written to directory %s..." % ( self.finalOutputName, self.finalOutputName, self.finalOutputDir) print "Building GROMACS project in temporary directory %s..." % self.workdir output = commands.getoutput( 'cp %s %s' % (self.files.infile, os.path.join(self.workdir, self.files.infile_basename))) print output # show a listing of all the current gmx files if (self.verbose): self.files.show()