예제 #1
0
파일: utils.py 프로젝트: alanwilter/acpype
def checkOpenBabelVersion():
    "check openbabel version"
    import warnings

    import openbabel as obl

    warnings.filterwarnings("ignore")
    return int(obl.OBReleaseVersion().replace(".", ""))
예제 #2
0
파일: utilities.py 프로젝트: mbprend/RMG-Py
def _check_openbabel():
    """Check for OpenBabel"""
    missing = False

    try:
        import openbabel
    except ImportError:
        print('{0:<30}{1}'.format(
            'OpenBabel',
            'Not found. Necessary for SMILES/InChI functionality for nitrogen compounds.'
        ))
        missing = True
    else:
        version = openbabel.OBReleaseVersion()
        location = openbabel.__file__
        print('{0:<15}{1:<15}{2}'.format('OpenBabel', version, location))

    return missing
예제 #3
0
def check_dependencies():
    """
    Checks for and locates major dependencies that RMG requires.
    """
    missing = False

    print '\nChecking vital dependencies...\n'
    print '{0:<15}{1:<15}{2}'.format('Package', 'Version', 'Location')

    # Check for symmetry
    try:
        result = subprocess.check_output('symmetry -h',
                                         stderr=subprocess.STDOUT,
                                         shell=True)
    except subprocess.CalledProcessError:
        print '{0:<30}{1}'.format(
            'symmetry', 'Not found. Please install in order to use QM.')
        missing = True
    else:
        match = re.search(r'\$Revision: (\S*) \$', result)
        version = match.group(1)
        if platform.system() == 'Windows':
            location = subprocess.check_output('where symmetry', shell=True)
        else:
            location = subprocess.check_output('which symmetry', shell=True)

        print '{0:<15}{1:<15}{2}'.format('symmetry', version, location.strip())

    # Check for RDKit
    try:
        import rdkit
        from rdkit import Chem
    except ImportError:
        print '{0:<30}{1}'.format(
            'RDKit',
            'Not found. Please install RDKit version 2015.03.1 or later with InChI support.'
        )
        missing = True
    else:
        try:
            version = rdkit.__version__
        except AttributeError:
            version = False
        location = rdkit.__file__
        inchi = Chem.inchi.INCHI_AVAILABLE

        if version:
            print '{0:<15}{1:<15}{2}'.format('RDKit', version, location)
            if not inchi:
                print 'RDKit installed without InChI Support. Please install with InChI.'
                missing = True
        else:
            print 'RDKit version out of date, please install RDKit version 2015.03.1 or later with InChI support.'
            missing = True

    # Check for OpenBabel
    try:
        import openbabel
    except ImportError:
        print '{0:<30}{1}'.format(
            'OpenBabel',
            'Not found. Necessary for SMILES/InChI functionality for nitrogen compounds.'
        )
        missing = True
    else:
        version = openbabel.OBReleaseVersion()
        location = openbabel.__file__
        print '{0:<15}{1:<15}{2}'.format('OpenBabel', version, location)

    # Check for lpsolve
    try:
        import lpsolve55
    except ImportError:
        print '{0:<30}{1}'.format(
            'lpsolve55',
            'Not found. Necessary for generating Clar structures for aromatic species.'
        )
        missing = True
    else:
        location = lpsolve55.__file__
        print '{0:<30}{1}'.format('lpsolve55', location)

    # Check for pyrdl
    try:
        import py_rdl
    except ImportError:
        print '{0:<30}{1}'.format(
            'pyrdl', 'Not found. Necessary for ring perception algorithms.')
        missing = True
    else:
        location = py_rdl.__file__
        print '{0:<30}{1}'.format('pyrdl', location)

    if missing:
        print """
There are missing dependencies as listed above. Please install them before proceeding.

Using Anaconda, these dependencies can be individually installed from the RMG channel as follows:

    conda install -c rmg [package name]

You can alternatively update your environment and install all missing dependencies as follows:

    conda env update -f environment_[linux/mac/windows].yml  # Choose the correct file for your OS

Be sure to activate your conda environment (rmg_env by default) before installing or updating.
"""
    else:
        print """
예제 #4
0
 def version( self ) :
     return str( openbabel.OBReleaseVersion() ).strip()