<commit_before>import os
import re
import external.cclib as cclib
import logging
from subprocess import Popen
import distutils.spawn

from rmgpy.molecule import Molecule
from qmdata import CCLibData
from molecule import QMMolecule


class Mopac:
    """
    A base class for all QM calculations that use MOPAC.
    
    Classes such as :class:`MopacMol` will inherit from this class.
    """

    inputFileExtension = '.mop'
    outputFileExtension = '.out'
    
    mopacEnv = os.getenv('MOPAC_DIR', default="/opt/mopac")
    if os.path.exists(os.path.join(mopacEnv , 'MOPAC2012.exe')):
        executablePath = os.path.join(mopacEnv , 'MOPAC2012.exe')
    elif os.path.exists(os.path.join(mopacEnv , 'MOPAC2009.exe')):
        executablePath = os.path.join(mopacEnv , 'MOPAC2009.exe')
    else:
        executablePath = distutils.spawn.find_executable('mopac') or \
                         distutils.spawn.find_executable('MOPAC2009.exe') or \
                         distutils.spawn.find_executable('MOPAC2012.exe') or \
                         os.path.join(mopacEnv , '(MOPAC 2009 or 2012)')

    usePolar = False #use polar keyword in MOPAC
    
    "Keywords for the multiplicity"
    multiplicityKeywords = {
                            1: '',
                            2: 'uhf doublet',
                            3: 'uhf triplet',
                            4: 'uhf quartet',
                            5: 'uhf quintet',
                            6: 'uhf sextet',
                            7: 'uhf septet',
                            8: 'uhf octet',
                            9: 'uhf nonet',
                           }
    
    #: List of phrases that indicate failure
    #: NONE of these must be present in a succesful job.
    failureKeys = [
                   'IMAGINARY FREQUENCIES',
                   'EXCESS NUMBER OF OPTIMIZATION CYCLES',
                   'NOT ENOUGH TIME FOR ANOTHER CYCLE',
                   ]
    #: List of phrases to indicate success.
    #: ALL of these must be present in a successful job.
    successKeys = [
                   'DESCRIPTION OF VIBRATIONS',<commit_msg>Enabled anaconda-installed mopac to be found (within eclipse)<commit_after>import os
import re
import external.cclib as cclib
import logging
from subprocess import Popen
import distutils.spawn

from rmgpy.molecule import Molecule
from qmdata import CCLibData
from molecule import QMMolecule


class Mopac:
    """
    A base class for all QM calculations that use MOPAC.
    
    Classes such as :class:`MopacMol` will inherit from this class.
    """

    inputFileExtension = '.mop'
    outputFileExtension = '.out'
    
    mopacEnv = os.getenv('MOPAC_DIR', default="/opt/mopac")
    if os.path.exists(os.path.join(mopacEnv , 'MOPAC2012.exe')):
        executablePath = os.path.join(mopacEnv , 'MOPAC2012.exe')
    elif os.path.exists(os.path.join(mopacEnv , 'MOPAC2009.exe')):
        executablePath = os.path.join(mopacEnv , 'MOPAC2009.exe')
    elif os.path.exists(os.path.join(mopacEnv , 'mopac')):
        executablePath = os.path.join(mopacEnv , 'mopac')
    else:      
        executablePath = distutils.spawn.find_executable('mopac') or \
                         distutils.spawn.find_executable('MOPAC2009.exe') or \
                         distutils.spawn.find_executable('MOPAC2012.exe') or \
                         os.path.join(mopacEnv , '(MOPAC 2009 or 2012)')

    usePolar = False #use polar keyword in MOPAC
    
    "Keywords for the multiplicity"
    multiplicityKeywords = {
                            1: '',
                            2: 'uhf doublet',
                            3: 'uhf triplet',
                            4: 'uhf quartet',
                            5: 'uhf quintet',
                            6: 'uhf sextet',
                            7: 'uhf septet',
                            8: 'uhf octet',
                            9: 'uhf nonet',
                           }
    
    #: List of phrases that indicate failure
    #: NONE of these must be present in a succesful job.
    failureKeys = [
                   'IMAGINARY FREQUENCIES',
                   'EXCESS NUMBER OF OPTIMIZATION CYCLES',
                   'NOT ENOUGH TIME FOR ANOTHER CYCLE',
                   ]
    #: List of phrases to indicate success.
    #: ALL of these must be present in a successful job.
    successKeys = [
                   'DESCRIPTION OF VIBRATIONS',
{'fraction_non_alphanumeric': 0.08996617812852312, 'fraction_numerical': 0.018489289740698984, 'mean_word_length': 1.65947242206235, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3695374', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1309, 'n_words': 348}