# 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
        h = h + self.Cp(Tmax)*(T - Tmax)
        s = s + self.Cp(Tmax)*math.log(T / Tmax)

        return h - T * s + self.G_mag(T)

    def G_mag(self, T):
        """
        Calculate the phase's magnetic contribution to Gibbs energy at the
        specified temperature.

        :param T: [K] temperature

        :returns: [J/mol] The magnetic Gibbs energy of the compound phase.

        Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),
        317–425. http://doi.org/10.1016/0364-5916(91)90030-N
        """

        tau = T / self.Tc_mag

        if tau <= 1.0:
            g = 1 - (self._A_mag/tau +
                     self._B_mag*(tau**3/6 + tau**9/135 + tau**15/600)) /\
                    self._D_mag
        else:
            g = -(tau**-5/10 + tau**-15/315 + tau**-25/1500)/self._D_mag

        return R*T*math.log(self.beta0_mag + 1)*g



# 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

        h = h + self.Cp(Tmax)*(T - Tmax)
        s = s + self.Cp(Tmax)*math.log(T / Tmax)

        return h - T * s + self.G_mag(T)

    def G_mag(self, T):
        """
        Calculate the phase's magnetic contribution to Gibbs energy at the
        specified temperature.

        :param T: [K] temperature

        :returns: [J/mol] The magnetic Gibbs energy of the compound phase.

        Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),
        317–425. http://doi.org/10.1016/0364-5916(91)90030-N
        """

        tau = T / self.Tc_mag

        if tau <= 1.0:
            g = 1 - (self._A_mag/tau +
                     self._B_mag*(tau**3/6 + tau**9/135 + tau**15/600)) /\
                    self._D_mag
        else:
            g = -(tau**-5/10 + tau**-15/315 + tau**-25/1500)/self._D_mag

        return R*T*math.log(self.beta0_mag + 1)*g



class Compound(Object):