LiquidEquilibrium¶
- class LiquidEquilibrium(solvent_components_a, solvent_components_b, mole_fractions=None, temperature=None, parameters=None)¶
Calculate the thermodynamics of mixing of two different liquids.
- Parameters:
solvent_components_a (
CosmoRealSolvent
|MoleculeConfiguration
|CosmoRSMixture
) – The components of the first solvent in the mixture.solvent_components_b (
CosmoRealSolvent
|MoleculeConfiguration
|CosmoRSMixture
) – The components of the second solvent in the mixture.mole_fractions (Sequence of float) – The mole fractions of the first solvent in the mixture. Default: (0, 0.25, 0.5, 0.75, 1)
temperature (PhysicalQuantity of type temperature) – The mixture temperature. Default:
298 * Kelvin
parameters (
CosmoRSParameters
) – The COSMO real solvent parameters
- activities()¶
- Returns:
The list of the activity of each species. This is indexed by the order of the species in the mix going from solvent A to B, and then by the mixture mole fractions.
- Return type:
ndarray of floats size (number_of_species x number_of_mole_fractionss)
- activityCoefficients()¶
- Returns:
The list of activity coefficients. This is indexed by the order of the species in the mix going from solvent A to B, and then by the mixture mole fractions.
- Return type:
ndarray of floats size (number_of_species x number_of_mole_fractionss)
- excessEnergy()¶
- Returns:
The excess energy at each specified mole fraction.
- Return type:
Sequence of PhysicalQuantity of type energy
- freeEnergyOfMixing()¶
- Returns:
The mixing free energy at each specified mole fraction.
- Return type:
Sequence of PhysicalQuantity of type energy
- moleFractions()¶
- Returns:
The list of mole fractions at which the equilibrium is calculated.
- Return type:
list of floats
- numberOfMoleFractions()¶
- Returns:
The number of points at which the mixing is calculated.
- Return type:
int
- numberOfUniqueSpecies()¶
- Returns:
The number of unique species in the mixture.
- Return type:
int
- parameters()¶
- Returns:
The COSMO-RS parameters
- Return type:
- solventComponentsA()¶
- Returns:
The components of the first solvent in the mixture.
- Return type:
- solventComponentsB()¶
- Returns:
The components of the second solvent in the mixture.
- Return type:
- temperature()¶
- Returns:
The mixture temperature.
- Return type:
PhysicalQuantity of type temperature
- uniqueSpecies()¶
- Returns:
A list of the unique species in the mixture.
- Return type:
Sequence of
CosmoRSMixture
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Examples¶
Calculate the thermodynamic properties of mixing solvent water with a mixture of methanol and acetonitrile.
# Load the COSMO species
database = CosmoRSSpeciesDatabase()
water = database.exportSpecies('water')
methanol = database.exportSpecies('methanol')
acetonitrile = database.exportSpecies('acetonitrile')
# Create the mixtures.
solvent_a = CosmoRSMixture([(water, 1)])
solvent_b = CosmoRSMixture([(methanol, 0.25), (acetonitrile, 0.75)])
# Define the mole fractions of solvent_a.
mole_fractions = (0, 0.5, 1)
# Create the liquid equilibrium object.
liquid_equilibrium = LiquidEquilibrium(
solvent_a,
solvent_b,
mole_fractions=mole_fractions,
temperature=298*Kelvin,
parameters=CosmoRSParameters(),
)
# Get the excess Gibbs free energy.
excess_energy = liquid_equilibrium.excessEnergy()
for x, energy in zip(mole_fractions, excess_energy):
nlprint(f'The excess energy at x = {x} is {energy}')
# Get the Gibbs free of mixing.
energy_of_mixing = liquid_equilibrium.freeEnergyOfMixing()
for x, energy in zip(mole_fractions, energy_of_mixing):
nlprint(f'The energy of mixing at x = {x} is {energy}')
# Get the activity coefficients of water.
activity_coeffs = liquid_equilibrium.activityCoefficients()[0]
for x, activity_coeff in zip(mole_fractions, activity_coeffs):
nlprint(f'The activity coefficient of water at x = {x} is {activity_coeff}')
# Get the activity of water.
activities = liquid_equilibrium.activities()[0]
for x, activity in zip(mole_fractions, activities):
nlprint(f'The activity of water at x = {x} is {activity}')
Notes¶
The LiquidEquilibrum
object allows calculation of a number of liquid-liquid
equilibrium (LLE) properties. First is the excess Gibbs free energy \(G^E\) which is given as:
The excess Gibbs free energy estimates the change in free energy resulting from the different
molecular interactions in the liquid and solvated states.
Here \(i\) represents the species in the mixed solution. \(\mu_i^{solv}\) is the solvation chemical
potential of species \(i\). \(\mu_i^{liq}\) is the solvation chemical potential of the pure
species. \(x_i\) is the mole fraction. \(G^E\) can be retrieved from the object using the excessEnergy
method.
Second is the free energy of mixing
\(R\) is the ideal gas constant and \(T\) the temperature of the system. Note that the second term
originates from the ideal Gibbs free energy of mixing, which is added to the excess Gibbs free energy.
\(\Delta G_{mix}\) can be retrieved from the object using the freeEnergyOfMixing
method.
Third is the activity coefficient
Here \(\gamma_i\) respresents the acitivity coefficient of species \(i\) in the solution. The activity
coefficient is a quantity that encompasses the deviation of species from ideality. \(\gamma\) can be
retrieved from the object using the activityCoefficients
method. The result is in dimensions of
number of components in the mixed solution and number of mole fraction steps.
Fourth is the activity which closely relates to the acitivity coefficient
\(a_i\) may be considered as the effective mole fraction of a species \(i\) in solution. \(a_i\) can be
retrieved from the object using the activities
method. Likewise, the result is in dimensions of
number of components in the mixed solution and number of mole fraction steps.