pmutt.statmech.StatMech
- class pmutt.statmech.StatMech(name=None, trans_model=<pmutt.statmech.EmptyMode object>, vib_model=<pmutt.statmech.EmptyMode object>, rot_model=<pmutt.statmech.EmptyMode object>, elec_model=<pmutt.statmech.EmptyMode object>, nucl_model=<pmutt.statmech.EmptyMode object>, misc_models=None, elements=None, references=None, smiles=None, notes=None, **kwargs)
Bases:
_ModelBase
Base class for statistical mechanic models.
- trans_model
Deals with translational modes. Default is
EmptyMode
- Type:
pmutt.statmech.trans object, optional
- vib_model
Deals with vibrational modes. Default is
EmptyMode
- Type:
pmutt.statmech.vib object, optional
- rot_model
Deals with rotational modes. Default is
EmptyMode
- Type:
pmutt.statmech.rot object, optional
- elec_model
Deals with electronic modes. Default is
EmptyMode
- Type:
pmutt.statmech.elec object, optional
- nucl_model
Deals with nuclear modes. Default is
EmptyMode
- Type:
pmutt.statmech.nucl object
- elements
Composition of the species. Default is None. Keys of dictionary are elements, values are stoichiometric values in a formula unit. e.g. CH3OH can be represented as: {‘C’: 1, ‘H’: 4, ‘O’: 1,}.
- Type:
dict, optional
- references
Contains references to adjust
HoRT
. If not specified then HoRT_dft will be used without adjustment. Default is None- Type:
References
, optional
- misc_models
Extra models that do not fit in the above attributes. Commonly used models would be
pmutt.statmech
andpmutt.mixture
models- Type:
list of pmutt model objects, optional
- notes
Any additional details you would like to include such as computational set up. Default is None
- Type:
str, optional
- __init__(name=None, trans_model=<pmutt.statmech.EmptyMode object>, vib_model=<pmutt.statmech.EmptyMode object>, rot_model=<pmutt.statmech.EmptyMode object>, elec_model=<pmutt.statmech.EmptyMode object>, nucl_model=<pmutt.statmech.EmptyMode object>, misc_models=None, elements=None, references=None, smiles=None, notes=None, **kwargs)
Methods
__init__
([name, trans_model, vib_model, ...])from_dict
(json_obj)Recreate an object from the JSON representation.
get_Cp
(units[, verbose, raise_error, ...])Calculate the heat capacity (constant P)
get_CpoR
([verbose, raise_error, ...])Dimensionless heat capacity (constant P)
get_Cv
(units[, verbose, raise_error, ...])Calculate the heat capacity (constant V)
get_CvoR
([verbose, raise_error, ...])Dimensionless heat capacity (constant V)
get_E
(units[, T, raise_error, ...])Calculate the electronic energy
get_EoRT
([T, include_ZPE, raise_error, ...])Dimensionless electronic energy
get_F
(units[, T, verbose, raise_error, ...])Calculate the Helmholtz energy
get_FoRT
([verbose, raise_error, ...])Dimensionless Helmholtz energy
get_G
(units[, T, verbose, raise_error, ...])Calculate the Gibbs energy
get_GoRT
([verbose, raise_error, ...])Dimensionless Gibbs energy
get_H
(units[, T, raise_error, ...])Calculate the enthalpy
get_HoRT
([verbose, raise_error, ...])Dimensionless enthalpy
get_S
(units[, verbose, raise_error, ...])Calculate the entropy
Calculate the dimensionless entropy of the elements in the molecule
get_SoR
([verbose, raise_error, ...])Dimensionless entropy
get_U
(units[, T, verbose, raise_error, ...])Calculate the internal energy
get_UoRT
([verbose, raise_error, ...])Dimensionless internal energy
get_q
([verbose, raise_error, raise_warning, ...])Partition function
get_quantity
(method_name[, raise_error, ...])Generic method to get any quantity from modes.
to_dict
()Represents object as dictionary with JSON-accepted datatypes
- classmethod from_dict(json_obj)
Recreate an object from the JSON representation.
- Parameters:
json_obj (dict) – JSON representation
- Returns:
StatMech
- Return type:
StatMech object
- get_Cp(units, verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Calculate the heat capacity (constant P)
- Parameters:
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 – 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_CpoR(verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Dimensionless heat capacity (constant P)
- Parameters:
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:
CpoR – Dimensionless 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_Cv(units, verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Calculate the heat capacity (constant V)
- Parameters:
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:
Cv – 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_CvoR(verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Dimensionless heat capacity (constant V)
- Parameters:
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:
CvoR – Dimensionless 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_E(units, T=298.15, raise_error=True, raise_warning=True, include_ZPE=False, **kwargs)
Calculate the electronic energy
- Parameters:
units (str) – Units as string. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol).T (float, optional) – Temperature in K. If the electronic mode is
GroundStateElec
, then the output is insensitive to this input. Default is 298.15 Kinclude_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 – Electronic energy
- Return type:
- get_EoRT(T=298.15, include_ZPE=False, raise_error=True, raise_warning=True, **kwargs)
Dimensionless electronic energy
- Parameters:
T (float, optional) – Temperature in K. If the electronic mode is
GroundStateElec
, then the output is insensitive to this input. Default is 298.15 Kinclude_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 electronic mode
- Returns:
EoRT – Dimensionless electronic energy
- Return type:
- get_F(units, T=298.15, verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Calculate the Helmholtz energy
- Parameters:
units (str) – Units as string. See
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 Helmholtz energy. 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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
F – Helmholtz energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_FoRT(verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Dimensionless Helmholtz energy
- Parameters:
verbose (bool, optional) – If False, returns the total Helmholtz energy. 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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
FoRT – Dimensionless Helmoltz energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_G(units, T=298.15, verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Calculate the Gibbs energy
- Parameters:
verbose (bool, optional) – If False, returns the Gibbs energy. If True, returns contribution of each mode.
units (str) – Units as string. See
R()
for accepted units but omit the ‘/K’ (e.g. J/mol).T (float, optional) – Temperature in K. Default is 298.15 K
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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
G – Gibbs energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_GoRT(verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Dimensionless Gibbs energy
- Parameters:
verbose (bool, optional) – If False, returns the total Gibbs energy. 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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
GoRT – Dimensionless Gibbs energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_H(units, T=298.15, raise_error=True, raise_warning=True, verbose=False, use_references=True, **kwargs)
Calculate the enthalpy
- Parameters:
units (str) – Units as string. See
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 – 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_HoRT(verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Dimensionless enthalpy
- Parameters:
verbose (bool, optional) – If False, returns the total 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:
HoRT – Dimensionless 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_S(units, verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Calculate the entropy
- Parameters:
verbose (bool, optional) – If False, returns the entropy. 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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
S – Entropy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_Selements()
Calculate the dimensionless entropy of the elements in the molecule
- Parameters:
None –
- Returns:
SoR – Entropy
- Return type:
- get_SoR(verbose=False, raise_error=True, raise_warning=True, use_references=True, S_elements=None, **kwargs)
Dimensionless entropy
- Parameters:
verbose (bool, optional) – If False, returns the total entropy. If True, returns contribution of each mode.
kwargs (key-word arguments) – Parameters passed to 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
S_elements (bool, optional) – Includes the entropy of the elements to compute an entropy of formation. Defauly is None
- Returns:
SoR – Dimensionless entropy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_U(units, T=298.15, verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Calculate the internal energy
- Parameters:
units (str) – Units as string. See
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 internal energy. 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:
U – Internal energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_UoRT(verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Dimensionless internal energy
- Parameters:
verbose (bool, optional) – If False, returns the total internal energy. 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:
UoRT – Dimensionless internal energy. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_q(verbose=False, raise_error=True, raise_warning=True, use_references=True, **kwargs)
Partition function
- Parameters:
verbose (bool, optional) – If False, returns the product of partition functions. If True, returns contributions 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:
q – Partition function. 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)]
- Return type:
float or (N+5,) numpy.ndarray
- get_quantity(method_name, raise_error=True, raise_warning=True, operation='sum', verbose=False, use_references=True, **kwargs)
Generic method to get any quantity from modes.
- Parameters:
method_name (str) – Name of method to use to calculate quantity. Calculates any quantity as long as the relevant objects have the same method name
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
operation (str, optional) –
Operation to apply when combining the modes. Supported options include:
sum (Default)
prod
use_references (bool, optional) – If True, adds contribution from references. Default is True
verbose (bool, optional) – If False, returns the total Gibbs energy. If True, returns contribution of each mode.
kwargs (key-word arguments) – Parameters passed to each mode
- Returns:
quantity – Desired quantity. N represents the number of misc models. If verbose is True, contribution to each mode are as follows: [trans, vib, rot, elec, nucl, references, misc_models (if any)]
- Return type:
float or (N+6,) numpy.ndarray