Beispiel #1
0
 def test_get_R_adj(self):
     elements = {'H': 2}
     self.assertAlmostEqual(
         pmutt._get_R_adj(units='J/g/K', elements=elements),
         self.ans.at['test_get_R_adj', 0])
     self.assertAlmostEqual(
         pmutt._get_R_adj(units='J/mol/K', elements=elements),
         self.ans.at['test_get_R_adj', 1])
Beispiel #2
0
    def get_G(self, T, units, raise_error=True, raise_warning=True, **kwargs):
        """Calculate the Gibbs energy

        Parameters
        ----------
            T : float or (N,) `numpy.ndarray`_
                Temperature(s) in K
            units : str
                Units as string. See :func:`~pmutt.constants.R` for accepted
                units but omit the '/K' (e.g. J/mol).
            raise_error : bool, optional
                If True, raises an error if any of the modes do not have the
                quantity of interest. Default is True
            raise_warning : bool, optional
                Only relevant if raise_error is False. Raises a warning if any
                of the modes do not have the quantity of interest. Default is
                True
            kwargs : key-word arguments
                Arguments to calculate mixture model properties, if any
        Returns
        -------
            G : float or (N,) `numpy.ndarray`_
                Gibbs energy

        .. _`numpy.ndarray`: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
        """
        units = '{}/K'.format(units)
        R_adj = _get_R_adj(units=units, elements=self.elements)
        return self.get_GoRT(T=T,
                             raise_error=raise_error,
                             raise_warning=raise_warning,
                             **kwargs) * T * R_adj
Beispiel #3
0
    def get_H(self,
              units,
              T=c.T0('K'),
              raise_error=True,
              raise_warning=True,
              verbose=False,
              use_references=True,
              **kwargs):
        """Calculate the enthalpy

        Parameters
        ----------
            units : str
                Units as string. See :func:`~pmutt.constants.R` for accepted
                units but omit the '/K' (e.g. J/mol).
            T : float, optional
                Temperature in K. Default is 298.15 K
            verbose : bool, optional
                If False, returns the enthalpy. If True, returns
                contribution of each mode.
            raise_error : bool, optional
                If True, raises an error if any of the modes do not have the
                quantity of interest. Default is True
            raise_warning : bool, optional
                Only relevant if raise_error is False. Raises a warning if any
                of the modes do not have the quantity of interest. Default is
                True
            use_references : bool, optional
                If True, adds contribution from references. Default is True
            kwargs : key-word arguments
                Parameters passed to each mode
        Returns
        -------
            H : float or (N+5,) `numpy.ndarray`_
                Enthalpy. N represents the number of misc models. If
                verbose is True, contribution to each mode are as follows:
                [trans, vib, rot, elec, nucl, misc_models (if any)]

        .. _`numpy.ndarray`: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
        """
        units = '{}/K'.format(units)
        R_adj = _get_R_adj(units=units, elements=self.elements)
        return self.get_HoRT(verbose=verbose,
                             raise_error=raise_error,
                             raise_warning=raise_warning,
                             T=T,
                             use_references=use_references,
                             **kwargs) * T * R_adj
Beispiel #4
0
    def get_Cp(self,
               units,
               verbose=False,
               raise_error=True,
               raise_warning=True,
               use_references=True,
               **kwargs):
        """Calculate the heat capacity (constant P)

        Parameters
        ----------
            units : str
                Units as string. See :func:`~pmutt.constants.R` for accepted
                units.
            verbose : bool, optional
                If False, returns the total heat capacity. If True, returns
                contribution of each mode.
            raise_error : bool, optional
                If True, raises an error if any of the modes do not have the
                quantity of interest. Default is True
            raise_warning : bool, optional
                Only relevant if raise_error is False. Raises a warning if any
                of the modes do not have the quantity of interest. Default is
                True
            use_references : bool, optional
                If True, adds contribution from references. Default is True
            kwargs : key-word arguments
                Parameters passed to each mode
        Returns
        -------
            Cp : float or (N+5,) `numpy.ndarray`_
                Heat capacity. N represents the number of misc models. If
                verbose is True, contribution to each mode are as follows:
                [trans, vib, rot, elec, nucl, misc_models (if any)]

        .. _`numpy.ndarray`: https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html
        """
        R_adj = _get_R_adj(units=units, elements=self.elements)
        return self.get_CpoR(verbose=verbose,
                             raise_error=raise_error,
                             raise_warning=raise_warning,
                             use_references=use_references,
                             **kwargs) * R_adj
Beispiel #5
0
    def get_E(self,
              units,
              T=c.T0('K'),
              raise_error=True,
              raise_warning=True,
              include_ZPE=False,
              **kwargs):
        """Calculate the electronic energy

        Parameters
        ----------
            units : str
                Units as string. See :func:`~pmutt.constants.R` for accepted
                units but omit the '/K' (e.g. J/mol).
            T : float, optional
                Temperature in K. If the electronic mode is
                :class:`~pmutt.statmech.elec.GroundStateElec`, then the output is
                insensitive to this input. Default is 298.15 K
            include_ZPE : bool, optional
                If True, includes the zero point energy. Default is False
            raise_error : bool, optional
                If True, raises an error if any of the modes do not have the
                quantity of interest. Default is True
            raise_warning : bool, optional
                Only relevant if raise_error is False. Raises a warning if any
                of the modes do not have the quantity of interest. Default is
                True
            kwargs : key-word arguments
                Parameters passed to each mode
        Returns
        -------
            E : float
                Electronic energy
        """
        units = '{}/K'.format(units)
        R_adj = _get_R_adj(units=units, elements=self.elements)
        return self.get_EoRT(T=T,
                             raise_error=raise_error,
                             raise_warning=raise_warning,
                             include_ZPE=include_ZPE,
                             **kwargs) * T * R_adj