Beispiel #1
0
def calculate(stoich,
              data,
              SE,
              adsorbant,
              thermochem,
              max_t=1000,
              min_p=-13,
              max_p=5.5,
              coverage=None,
              transform=True):
    '''Collects input variables and intitialises the calculation.

    Parameters
    ----------
    stoich : :py:class:`surfinpy.data.DataSet`
        information about the stoichiometric surface
    data : :py:attr:`list`
        list of :py:class:`surfinpy.data.DataSet` objects on the "adsorbed" surfaces
    SE : :py:attr:`float`
        surface energy of the stoichiomteric surface
    adsorbant : :py:attr:`float`
        dft energy of adsorbing species
    coverage : :py:attr:`array_like` (default None)
        Numpy array containing the different coverages of adsorbant.
    thermochem : :py:attr:`array_like`
        Numpy array containing thermochemcial data downloaded from NIST_JANAF
        for the adsorbing species.
    max_t : :py:attr:`int`
        Maximum temperature in the phase diagram
    min_p : :py:attr:`int`
        Minimum pressure of phase diagram
    max_p : :py:attr:`int`
        Maximum pressure of phase diagram

    Returns
    -------
    system : :py:class:`surfinpy.plotting.PTPlot`
        plotting object
    '''
    if coverage is None:
        coverage = ut.calculate_coverage(data)
    lnP, logP, T, adsorbant_t = inititalise(thermochem, adsorbant, max_t,
                                            min_p, max_p)
    nsurfaces = len(data) + 1
    AE = adsorption_energy(data, stoich, adsorbant_t)
    SE_array, SEABS = calculate_surface_energy(AE, lnP, T, coverage, SE,
                                               nsurfaces)
    ticks = np.unique([SE_array])
    if transform is True:
        SE_array = ut.transform_numbers(SE_array, ticks)

    phase_grid = np.reshape(SE_array, (lnP.size, T.size))
    SEABS = np.reshape(SEABS, (lnP.size, T.size))
    data.insert(0, stoich)
    y = logP
    x = T
    z = phase_grid
    system = plotting.PTPlot(x, y, z)
    return system
Beispiel #2
0
def calculate(stoich,
              data,
              SE,
              adsorbant,
              thermochem,
              max_t=1000,
              min_p=-13,
              max_p=5.5,
              coverage=None):
    '''Collects input variables and intitialises the calculation.

    Parameters
    ----------
    stoich : dictionary
        information about the stoichiometric surface
    data : list
        list of dictionaries containing information on the "adsorbed" surfaces
    SE : float
        surface energy of the stoichiomteric surface
    adsorbant : float
        dft energy of adsorbing species
    coverage : array like (default None)
        Numpy array containing the different coverages of adsorbant.
    thermochem : array like
        Numpy array containing thermochemcial data downloaded from NIST_JANAF
        for the adsorbing species.
    max_t : int
        Maximum temperature in the phase diagram
    min_p : int
        Minimum pressure of phase diagram
    max_p : int
        Maximum pressure of phase diagram

    Returns
    -------
    system : class object
        plotting object
    '''
    if coverage is None:
        coverage = ut.calculate_coverage(data)
    lnP, logP, T, adsorbant_t = inititalise(thermochem, adsorbant, max_t,
                                            min_p, max_p)
    nsurfaces = len(data) + 1
    AE = adsorption_energy(data, stoich, adsorbant_t)
    SE_array, SE = calculate_surface_energy(AE, lnP, T, coverage, SE,
                                            nsurfaces)
    ticks = np.unique([SE_array])
    SE_array = ut.transform_numbers(SE_array, ticks)
    phase_grid = np.reshape(SE_array, (lnP.size, T.size))
    data.insert(0, stoich)
    y = logP
    x = T
    z = phase_grid
    system = pvt_plot.PVTPlot(x, y, z)
    return system, SE
Beispiel #3
0
def calculate_surface_energy(stoich,
                             data,
                             SE,
                             adsorbant,
                             thermochem,
                             T,
                             P,
                             coverage=None):
    """Calculate the surface energy at a specific temperature
    and pressure.

    Parameters
    ----------
    stoich : :py:class:`surfinpy.data.ReferenceDataSet`
        information about the stoichiometric surface
    data : :py:attr:`list`
        list of dictionaries containing information on the "adsorbed" surfaces
    SE : :py:attr:`float`
        surface energy of the stoichiomteric surface
    adsorbant : :py:attr:`float`
        dft energy of adsorbing species
    coverage : :py:attr:`array_like`
        Numpy array containing the different coverages of adsorbant.
    thermochem : :py:attr:`array_like`
        Numpy array containing thermochemcial data downloaded from NIST_JANAF
        for the adsorbing species.
    T : :py:attr:`float`
        Temperature to calculate surface energy
    P : :py:attr:`float`
        Pressure to calculate the surface energy
    coverage : :py:attr:`array_like` 
        Coverage of adsorbed specied on the surface.

    Returns
    -------
    SEs : :py:attr:`array_like`
        surface energies for each surface at T/P
    """
    if coverage is None:
        coverage = ut.calculate_coverage(data)
    R = value('molar gas constant')
    N_A = value('Avogadro constant')
    lnP = np.log(10**P)
    adsorbant = temperature_correction(T, thermochem, adsorbant)
    AE = pt.adsorption_energy(data, stoich, adsorbant)
    SEs = np.array([SE])
    for i in range(0, len(data)):
        S = SE + (coverage[i] / N_A) * (AE[i] - (lnP * (T * R)))
        SEs = np.append(SEs, S)
    return SEs
Beispiel #4
0
 def test_calculate_coverage(self):
     H20 = data.DataSet(cation=24,
                        x=48,
                        y=2,
                        area=60.22,
                        energy=-570.00,
                        label="One",
                        nspecies=1)
     H2O_2 = data.DataSet(cation=24,
                          x=48,
                          y=4,
                          area=60.22,
                          energy=-570.00,
                          label="Two",
                          nspecies=1)
     dataset = [H20, H2O_2]
     x = ut.calculate_coverage(dataset)
     expected = np.array([1.66057788 * 10**18, 3.32115576 * 10**18])
     assert_approx_equal(expected[0], x[0], significant=8)
     assert_approx_equal(expected[1], x[1], significant=8)
Beispiel #5
0
 def test_calculate_coverage(self):
     H2O = {
         'M': 24,
         'X': 48,
         'Y': 2,
         'Area': 60.22,
         'Energy': -621.877140,
         'Label': '1.66 - $Ce^{4+}$'
     }
     H2O_2 = {
         'M': 24,
         'X': 48,
         'Y': 4,
         'Area': 60.22,
         'Energy': -670.229520,
         'Label': '3.32 - $Ce^{4+}$'
     }
     data = [H2O, H2O_2]
     x = ut.calculate_coverage(data)
     expected = np.array([1.66057788 * 10**18, 3.32115576 * 10**18])
     assert_approx_equal(expected[0], x[0], significant=8)
     assert_approx_equal(expected[1], x[1], significant=8)
Beispiel #6
0
from surfinpy import utils as ut
from surfinpy import p_vs_t

adsorbant = -14.00
SE = 1.40

stoich = {'Cation': 24, 'X': 48, 'Y': 0, 'Area': 60.22, 'Energy': -575.00, 'Label': 'Bare'}
H2O =    {'Cation': 24, 'X': 48, 'Y': 2, 'Area': 60.22, 'Energy': -605.00, 'Label': '1 Water'}
H2O_2 =  {'Cation': 24, 'X': 48, 'Y': 8, 'Area': 60.22, 'Energy': -695.00, 'Label': '2 Water'}
data = [H2O, H2O_2]

coverage = ut.calculate_coverage(data)

thermochem = ut.read_nist("H2O.txt")

system = p_vs_t.calculate(stoich, data, SE, adsorbant, thermochem, coverage)
system.plot(output="Example_4.png",)