Пример #1
0
def evaluate_phases(data, bulk, x, y, nphases, x_energy, y_energy, mu_z, exp_x,
                    exp_z):
    """Calculates the surface energies of each phase as a function of chemical
    potential of x and y. Then uses this data to evaluate which phase is most
    stable at that x/y chemical potential cross section.

    Parameters
    ----------
    data : :py:attr:`list`
        List containing the :py:class:`surfinpy.data.DataSet` objects for each phase
    bulk : :py:class:`surfinpy.data.ReferenceDataSet`
        Reference dataset
    x : :py:attr:`dict`
        X axis chemical potential values
    y : :py:attr:`dict`
        Y axis chemical potential values
    nphases : :py:attr:`int`
        Number of phases
    x_energy : :py:attr:`float`
        DFT 0K energy for species x
    y_energy : :py:attr:`float`
        DFT 0K energy for species y
    mu_z :  :py:attr:`float`
        Set chemical potential for species y
    exp_x : :py:attr:`float`
        Experimental correction for species x
    exp_z : :py:attr:`float`
        Experimental correction for species y
    Returns
    -------
    phase_data  : :py:attr:`array_like`
        array of ints, with each int corresponding to a phase.
    """
    xnew = ut.build_xgrid(x, y)
    ynew = ut.build_ygrid(x, y)
    znew = (xnew * 0) + mu_z
    exp_xnew = ut.build_zgrid(exp_x, x)
    exp_znew = ut.build_zgrid(exp_z, x)
    S = np.array([])
    new_data_svib = 0
    new_bulk_svib = 0
    if bulk.entropy:
        new_bulk_svib = ut.build_zgrid(bulk.avib, x)

    for k in range(0, nphases):
        if data[k].entropy:
            new_data_svib = ut.build_zgrid(data[k].avib, x)
        normalised_bulk = normalise_phase_energy(data[k], bulk)

        SE = calculate_bulk_energy(xnew, ynew, x_energy, y_energy, znew,
                                   data[k], bulk, normalised_bulk, exp_xnew,
                                   exp_znew, new_bulk_svib, new_data_svib)

        S = np.append(S, SE)

    phase_data, SE = ut.get_phase_data(S, nphases)
    return phase_data, SE
Пример #2
0
def calculate_surface_energy(AE, lnP, T, coverage, SE, nsurfaces):
    r"""Calculates the surface energy as a function of pressure and
    temperature for each surface system according to

    .. math::
        \gamma_{adsorbed, T, p} = \gamma_{bare} + (C(E_{ads, T} -
        RTln(\frac{p}{p^o})

    where :math:`\gamma_{adsorbed, T, p}` is the surface energy of the surface
    with adsorbed species at a given temperature and pressure,
    :math:`\gamma_{bare}` is the suface energy of the bare surface,
    C is the coverage of adsorbed species, :math:`E_{ads, T}` is the
    adsorption energy, R is the gas constant, T is the temperature, and
    :math:`\frac{p}{p^o}` is the partial pressure.

    Parameters
    ----------
    AE : list
        list of adsorption energies
    lnP : array like
        full pressure range
    T : array like
        full temperature range
    coverage : array like
        surface coverage of adsorbing species in each calculation
    SE : float
        surface energy of stoichiomteric surface
    data : list
        list of dictionaries containing info on each surface
    nsurfaces : int
        total number of surface

    Returns
    -------
    SE_array : array like
        array of integers corresponding to lowest surface energies
    """
    R = codata.value('molar gas constant')
    N_A = codata.value('Avogadro constant')
    SEABS = np.array([])
    xnew = ut.build_xgrid(T, lnP)
    ynew = ut.build_ygrid(T, lnP)
    for i in range(0, (nsurfaces - 1)):
        SE_Abs_1 = (SE + (coverage[i] / N_A) * (AE[i] - (ynew * (xnew * R))))
        SEABS = np.append(SEABS, SE_Abs_1)
    surface_energy_array = np.zeros(lnP.size * T.size)
    surface_energy_array = surface_energy_array + SE
    SEABS = np.insert(SEABS, 0, surface_energy_array)
    phase_data, SE = ut.get_phase_data(SEABS, nsurfaces)
    return phase_data, SE
Пример #3
0
def evaluate_phases(data, bulk, x, y, nsurfaces, x_energy, y_energy):
    """Calculates the surface energies of each phase as a function of chemical
    potential of x and y. Then uses this data to evaluate which phase is most
    stable at that x/y chemical potential cross section.

    Parameters
    ----------
    data : list
        List containing the dictionaries for each phase
    bulk : dictionary
        dictionary containing data for bulk
    x : dictionary
        X axis chemical potential values
    y : dictionary
        Y axis chemical potential values
    nsurfaces : int
        Number of phases
    x_energy : float
        DFT 0K energy for species x
    y_energy : float
        DFT 0K energy for species y

    Returns
    -------
    phase_data  : array like
        array of ints, with each int corresponding to a phase.
    """
    xnew = ut.build_xgrid(x, y)
    ynew = ut.build_ygrid(x, y)
    S = np.array([])
    for k in range(0, nsurfaces):
        xexcess = calculate_excess(data[k]['X'], data[k]['Cation'],
                                   data[k]['Area'], bulk,
                                   data[k]['nSpecies'], check=True)
        yexcess = calculate_excess(data[k]['Y'], data[k]['Cation'],
                                   data[k]['Area'], bulk)
        normalised_bulk = calculate_normalisation(data[k]['Energy'],
                                                  data[k]['Cation'], bulk,
                                                  data[k]['Area'])
        SE = calculate_surface_energy(xnew, ynew,
                                      x_energy,
                                      y_energy,
                                      xexcess,
                                      yexcess,
                                      normalised_bulk)
        S = np.append(S, SE)
    phase_data = ut.get_phase_data(S, nsurfaces)
    return phase_data
Пример #4
0
def evaluate_phases(data, bulk, x, y, nsurfaces, x_energy, y_energy):
    """Calculates the surface energies of each phase as a function of chemical
    potential of x and y. Then uses this data to evaluate which phase is most
    stable at that x/y chemical potential cross section.

    Parameters
    ----------
    data : :py:attr:`list`
        List containing the :py:class:`surfinpy.data.DataSet` for each phase
    bulk : :py:class:`surfinpy.data.DataSet`
        Data for bulk
    x : :py:attr:`dict`
        X axis chemical potential values
    y : :py:attr:`dict`
        Y axis chemical potential values
    nsurfaces : :py:attr:`int`
        Number of phases
    x_energy : :py:attr:`float`
        DFT 0K energy for species x
    y_energy : :py:attr:`float`
        DFT 0K energy for species y

    Returns
    -------
    phase_data  : :py:attr:`array_like`
        array of ints, with each int corresponding to a phase.
    """
    xnew = ut.build_xgrid(x, y)
    ynew = ut.build_ygrid(x, y)
    S = np.array([])
    for k in range(0, nsurfaces):
        xexcess = calculate_excess(data[k].x, data[k].cation,
                                   data[k].area, bulk,
                                   data[k].nspecies, check=True)
        yexcess = calculate_excess(data[k].y, data[k].cation,
                                   data[k].area, bulk)
        normalised_bulk = calculate_normalisation(data[k].energy,
                                                  data[k].cation, bulk,
                                                  data[k].area)
        SE = calculate_surface_energy(xnew, ynew,
                                      x_energy,
                                      y_energy,
                                      xexcess,
                                      yexcess,
                                      normalised_bulk)
        S = np.append(S, SE)
    phase_data, surface_energy = ut.get_phase_data(S, nsurfaces)
    return phase_data, surface_energy
Пример #5
0
def evaluate_phases(data, bulk, x, y, nphases, x_energy, y_energy):
    """Calculates the free energies of each phase as a function of chemical
    potential of x and y. Then uses this data to evaluate which phase is most
    stable at that x/y chemical potential cross section.

    Parameters
    ----------
    data : :py:attr:`list`
        List of :py:class:`surfinpy.data.DataSet` objects
    bulk : :py:class:`surfinpy.data.ReferenceDataSet` object
        Reference dataset
    x : :py:attr:`dict`
        X axis chemical potential values
    y : :py:attr:`dict`
        Y axis chemical potential values
    nphases : :py:attr:`int`
        Number of phases
    x_energy : :py:attr:`float`
        DFT 0 K energy for species x
    y_energy : :py:attr:`float`
        DFT 0 K energy for species y

    Returns
    -------
    phase_data  : :py:attr:`array_like`
        array of ints, with each int corresponding to a phase.
    """
    xnew = ut.build_xgrid(x, y)
    ynew = ut.build_ygrid(x, y)
    S = np.array([])
    for k in range(0, nphases):
        normalised_bulk = normalise_phase_energy(data[k], bulk)
        SE = calculate_bulk_energy(xnew, ynew, 
                                   x_energy,
                                   y_energy,
                                   data[k],
                                   normalised_bulk)
        S = np.append(S, SE)

    phase_data, SE = ut.get_phase_data(S, nphases)
    return phase_data, SE
Пример #6
0
 def test_build_zgrid(self):
     x = ut.build_ygrid(np.arange(10), np.arange(10))
     assert np.array_equal(x[0], np.zeros(10))