Package schrodinger :: Package application :: Package mopac :: Module utils
[hide private]
[frames] | no frames]

Module utils

Functions [hide private]
 
open_file(basename, suffix)
Open a file with a unique name based on basename and suffix in the form "basename-<index>.suffix", where "<index>" is an integer that is incremented until the file can be created.
 
make_scratch_dir(tmpdir, basename)
Make a separate directory for the job to enable easy cleanup.
 
run_cleanup(results, start_dir, scr_dir, jobname, save_output_file, scratch_cleanup)
Cleanup from a subdirectory run.
 
is_mopac_file(filename)
Determine if the file provided is a MOPAC input file or not.
 
get_mopac_jobname(pathname)
Get the MOPAC jobname that will be used.
 
cleanup_external(inputfile, start_dir)
If the input file has a relative path specification for an EXTERNAL file, rewrite it to the local dir, then copy the original file to the current directory.
 
convert_sparse_dict_to_list(sdict)
@type sdict: dict @param sdict: dictionary keys must be integers.
Variables [hide private]
  _logger = log.get_logger("schrodinger.application.mopac")
  REMOVE = 'remove'
  SAVE = 'save'
  ZIP = 'zip'
  __package__ = 'schrodinger.application.mopac'
Function Details [hide private]

open_file(basename, suffix)

 

Open a file with a unique name based on basename and suffix in the form "basename-<index>.suffix", where "<index>" is an integer that is incremented until the file can be created. Return the opened file object.

make_scratch_dir(tmpdir, basename)

 

Make a separate directory for the job to enable easy cleanup.

Parameters:
  • basename (str) - A name that will be used to generate a scratch dir name. The name used will either be basename or basename.1, basename.2, etc.
  • tmpdir (str) - A directory that will hold the scratch directory.
Returns:
The name of the directory that was created.

run_cleanup(results, start_dir, scr_dir, jobname, save_output_file, scratch_cleanup)

 

Cleanup from a subdirectory run.

This will completely nuke the scratch dir and cd to the start_dir.

Parameters:
  • results (MopacResults) - A MopacResults object, in which output filename and zipped_output filenames are stored if available.
  • start_dir (str) - The launch directory for the job.
  • scr_dir (str) - The scratch directory for the job as an absolute path.
  • jobname (str) - The base job name.
  • save_output_file (bool) - If True, copy the output file from the scratch dir back to the starting directory.
  • scratch_cleanup (enum) - If REMOVE, simply remove the scratch dir at the end of the job; if ZIP, create a zip file of the scratch directory contents; if SAVE, do no cleanup.

is_mopac_file(filename)

 

Determine if the file provided is a MOPAC input file or not. Returns True or False.

convert_sparse_dict_to_list(sdict)

 

@type sdict: dict
@param sdict: dictionary keys must be integers.

@return list with non-key elements as None.

e.g. { 2:'a', 4:'b', 5:'c'} returns
     [None, 'a', None, 'b', 'c']