Author: bugman Date: Sat Oct 11 23:55:21 2008 New Revision: 7625 URL: http://svn.gna.org/viewcvs/relax?rev=7625&view=rev Log: Converted execute() to the new design. Modified: 1.3/generic_fns/palmer.py Modified: 1.3/generic_fns/palmer.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/palmer.py?rev=7625&r1=7624&r2=7625&view=diff ============================================================================== --- 1.3/generic_fns/palmer.py (original) +++ 1.3/generic_fns/palmer.py Sat Oct 11 23:55:21 2008 @@ -502,26 +502,30 @@ def execute(dir, force, binary): - """Function for executing Modelfree4. + """Execute Modelfree4. BUG: Control-C during execution causes the cwd to stay as dir. + + + @param dir: The optional directory where the script is located. + @type dir: str or None + @param force: A flag which if True will cause any pre-existing files to be overwritten by + Modelfree4. + @type force: bool + @param binary: The name of the Modelfree4 binary file. This can include the path to the + binary. + @type binary: str """ # Alias the current data pipe. cdp = pipes.get_pipe() - # Arguments. - self.pipe = pipe - self.dir = dir - self.force = force - self.binary = binary - # The current directory. orig_dir = getcwd() # The directory. if dir == None: - dir = pipe + dir = pipes.cdp_name() if not access(dir, F_OK): raise RelaxDirError, ('Modelfree4', dir) @@ -548,7 +552,7 @@ # Test if the 'PDB' input file exists. if cdp.diff_tensor.type != 'sphere': - pdb = cdp.structure.file_name.split('/')[-1] + pdb = cdp.structure.file_name[0] if not access(pdb, F_OK): raise RelaxFileError, ('PDB', pdb) else: @@ -561,18 +565,18 @@ remove(file) # Test the binary file string corresponds to a valid executable. - test_binary(self.binary) + test_binary(binary) # Execute Modelfree4 (inputting a PDB file). if pdb: - status = spawnlp(P_WAIT, self.binary, self.binary, '-i', 'mfin', '-d', 'mfdata', '-p', 'mfpar', '-m', 'mfmodel', '-o', 'mfout', '-e', 'out', '-s', pdb) + status = spawnlp(P_WAIT, binary, binary, '-i', 'mfin', '-d', 'mfdata', '-p', 'mfpar', '-m', 'mfmodel', '-o', 'mfout', '-e', 'out', '-s', pdb) if status: raise RelaxProgFailError, 'Modelfree4' # Execute Modelfree4 (without a PDB file). else: - status = spawnlp(P_WAIT, self.binary, self.binary, '-i', 'mfin', '-d', 'mfdata', '-p', 'mfpar', '-m', 'mfmodel', '-o', 'mfout', '-e', 'out') + status = spawnlp(P_WAIT, binary, binary, '-i', 'mfin', '-d', 'mfdata', '-p', 'mfpar', '-m', 'mfmodel', '-o', 'mfout', '-e', 'out') if status: raise RelaxProgFailError, 'Modelfree4'