def convert_babel_to_system(mol):
    """
    Convert a BigDFT fragment to an open babel molecule.

    Args:
      mol (openbabel.OBMol): the molecule to convert.

    Returns:
      (BigDFT.Systems.System): bigdft system.
    """
    from BigDFT.IO import read_mol2
    from openbabel.openbabel import OBConversion
    # py2 workaround
    from sys import version_info
    if version_info[0] < 3:
        from io import BytesIO as StringIO
    else:
        try:
            from io import StringIO
        except ImportError:
            from StringIO import StringIO

    conv = OBConversion()
    conv.SetOutFormat("mol2")

    sval = StringIO(conv.WriteString(mol))
    return read_mol2(sval)
def compute_smiles(sys):
    """
    Computes the SMILES representation of a given system.

    Args:
      sys (BigDFT.System.Systems): the system to compute the
        representation of.

    Return:
      (str): the smiles representation of this molecule.
    """
    from openbabel.openbabel import OBConversion

    conv = OBConversion()
    mol = convert_system_to_babel(sys)
    conv.SetOutFormat("SMI")

    retstr = conv.WriteString(mol)
    retstr = retstr.replace("\n", "")
    retstr = retstr.replace("\t", "")

    return retstr