schrodinger.application.mopac.utils module

schrodinger.application.mopac.utils.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.

schrodinger.application.mopac.utils.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.

schrodinger.application.mopac.utils.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.

schrodinger.application.mopac.utils.is_mopac_file(filename)

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

schrodinger.application.mopac.utils.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.

schrodinger.application.mopac.utils.convert_sparse_dict_to_list(sdict)
Parameters

sdict (dict) – 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’]