# Path: auxi/core/objects.py
# class Object(object):
#     """
#     Base class for all auxi classes.
#     """
# 
#     def __str__(self):
#         o = json.loads(jsonpickle.encode(self))
#         result = json.dumps(o, sort_keys=True, indent=4,
#                             separators=(',', ': '))
#         return result
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def _validate_params_(self):
#         pass
# 
#     def _init(self):
#         pass
# 
#     def write(self, path):
#         with open(path, 'w') as file:
#             file.write(str(self))
# 
#     @staticmethod
#     def read(path):
#         with open(path, 'r') as file:
#             s = file.read()
#         result = jsonpickle.decode(s)
#         result._init()
#         return result
# 
# class NamedObject(Object):
#     """
#     Base class for all auxi classes requiring a name and description.
# 
#     :param name: the object's name
#     :param description: the object's description
#     """
# 
#     def __init__(self, name, description=None):
#         self.name = name
#         self.description = description
# 
#     def _validate_params_(self, name, description):
#         # TODO: Enforce name format.
#         pass
# 
# Path: auxi/tools/chemistry/stoichiometry.py
# def molar_mass(self):
#     return sum(_element_dictionary_[element].molar_mass*count
#                for element, count in self.count().items())
# 
# Path: auxi/tools/physicalconstants.py
# R = 8.314462618


import os
import sys
import glob
import math
import warnings
import json
    import unittest
from auxi.core.objects import Object, NamedObject
from auxi.core.helpers import get_path_relative_to_module as get_path
from auxi.tools.chemistry.stoichiometry import molar_mass as mm
from auxi.tools.physicalconstants import R
    from auxi.tools.chemistry.thermochemistry_test import ThermoFunctionTester
    """
    List all compounds that are currently loaded in the thermo module, and
    their phases.
    """

    print('Compounds currently loaded:')
    for compound in sorted(compounds.keys()):
        phases = compounds[compound].get_phase_list()
        print('%s: %s' % (compound, ', '.join(phases)))
#        for phase in phases:
#            print(compound + '[' + phase + ']')


def get_datafile_references():
    """
    Retrieve all the references used by the datafiles.
    """
    with open(get_path(__file__, "data/references.json")) as f:
        return json.load(f)


def molar_mass(compound):
    """
    Determine the molar mass of a chemical compound.

    :param compound: Formula of a chemical compound, e.g. 'Fe2O3'.

    :returns: [kg/mol] Molar mass.
    """


# Path: auxi/core/objects.py
# class Object(object):
#     """
#     Base class for all auxi classes.
#     """
# 
#     def __str__(self):
#         o = json.loads(jsonpickle.encode(self))
#         result = json.dumps(o, sort_keys=True, indent=4,
#                             separators=(',', ': '))
#         return result
# 
#     def __hash__(self):
#         return hash(str(self))
# 
#     def _validate_params_(self):
#         pass
# 
#     def _init(self):
#         pass
# 
#     def write(self, path):
#         with open(path, 'w') as file:
#             file.write(str(self))
# 
#     @staticmethod
#     def read(path):
#         with open(path, 'r') as file:
#             s = file.read()
#         result = jsonpickle.decode(s)
#         result._init()
#         return result
# 
# class NamedObject(Object):
#     """
#     Base class for all auxi classes requiring a name and description.
# 
#     :param name: the object's name
#     :param description: the object's description
#     """
# 
#     def __init__(self, name, description=None):
#         self.name = name
#         self.description = description
# 
#     def _validate_params_(self, name, description):
#         # TODO: Enforce name format.
#         pass
# 
# Path: auxi/tools/chemistry/stoichiometry.py
# def molar_mass(self):
#     return sum(_element_dictionary_[element].molar_mass*count
#                for element, count in self.count().items())
# 
# Path: auxi/tools/physicalconstants.py
# R = 8.314462618


# Path: auxi/tools/chemistry/thermochemistry.py
import os
import sys
import glob
import math
import warnings
import json
    import unittest
from auxi.core.objects import Object, NamedObject
from auxi.core.helpers import get_path_relative_to_module as get_path
from auxi.tools.chemistry.stoichiometry import molar_mass as mm
from auxi.tools.physicalconstants import R
    from auxi.tools.chemistry.thermochemistry_test import ThermoFunctionTester

    """
    List all compounds that are currently loaded in the thermo module, and
    their phases.
    """

    print('Compounds currently loaded:')
    for compound in sorted(compounds.keys()):
        phases = compounds[compound].get_phase_list()
        print('%s: %s' % (compound, ', '.join(phases)))
#        for phase in phases:
#            print(compound + '[' + phase + ']')


def get_datafile_references():
    """
    Retrieve all the references used by the datafiles.
    """
    with open(get_path(__file__, "data/references.json")) as f:
        return json.load(f)


def molar_mass(compound):
    """
    Determine the molar mass of a chemical compound.

    :param compound: Formula of a chemical compound, e.g. 'Fe2O3'.

    :returns: [kg/mol] Molar mass.
    """


    return mm(compound) / 1000.0