# 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

    def __init__(self, dictionary):
        self.name = dictionary['Symbol']
        """The phase's name, e.g. solid, liquid, gas, etc."""

        self.symbol = dictionary['Symbol']
        """The phase's symbol, e.g. S1 = solid 1, L = liquid, etc."""

        self.Tref = 298.15
        """[K] The reference temperature of the phase."""

        self.DHref = dictionary['DHref']
        """[J/mol] The formation enthalpy of the phase at Tref."""

        self.Sref = dictionary['Sref']
        """[J/mol/K] The standard entropy of the phase at Tref."""

        if 'magnetic' in dictionary:
            self.Tc_mag = ['magnetic']['Tc']
            """The critical temperature, which is the Curie temperature for
            ferromagnetic materials or the Neel temperature for
            antiferromagnetic materials."""

            self.beta0_mag = ['magnetic']['beta0']
            """The average magnetic moment per atom."""

            self.p_mag = ['magnetic']['p']
            """This value can be thought of as the fraction of the magnetic
            enthalpy absorbed above the critical. It depends on structure."""


# 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


    def __init__(self, dictionary):
        self.name = dictionary['Symbol']
        """The phase's name, e.g. solid, liquid, gas, etc."""

        self.symbol = dictionary['Symbol']
        """The phase's symbol, e.g. S1 = solid 1, L = liquid, etc."""

        self.Tref = 298.15
        """[K] The reference temperature of the phase."""

        self.DHref = dictionary['DHref']
        """[J/mol] The formation enthalpy of the phase at Tref."""

        self.Sref = dictionary['Sref']
        """[J/mol/K] The standard entropy of the phase at Tref."""

        if 'magnetic' in dictionary:
            self.Tc_mag = ['magnetic']['Tc']
            """The critical temperature, which is the Curie temperature for
            ferromagnetic materials or the Neel temperature for
            antiferromagnetic materials."""

            self.beta0_mag = ['magnetic']['beta0']
            """The average magnetic moment per atom."""

            self.p_mag = ['magnetic']['p']
            """This value can be thought of as the fraction of the magnetic
            enthalpy absorbed above the critical. It depends on structure."""


        self._Cp_records = {}