CosmoRSMixture¶
- class CosmoRSMixture(mixture_components=None)¶
Create a mixture to be used as input in COSMO-RS methods. This object takes a list of tuples of input. Each tuple specifies first mixture component as either a
CosmoRealSpecies
or aMoleculeConfiguration
. Secondly the mole fraction of the component is given, as a float ranging from 0 to 1. The mole fractions must add to 1.- Parameters:
mxiture_components (Sequence of tuples.) – The list of mixture components.
- addMixtures(ratio, other)¶
Add two mixtures with a given ratio into a new mixture. Duplicates are added together into the one component.
- Parameters:
ratio (float) – The fraction of the current mixture in the final one. The ratios of the two components should add to 1.
other ([type]) – The other component to be added to the new mixture.
- Returns:
The new mixture created by adding the given two together. If both mixtures share a common component, these will be added together in the new mixture.
- Return type:
- componentMoleFraction(index)¶
Return a specific component mole fraction.
- Parameters:
index (int) – The index of the mole fraction to return.
- Returns:
The requested mole fraction.
- Return type:
float
- componentSpecies(index)¶
Return a specific component species.
- Parameters:
index (int) – The index of the component to return.
- Returns:
The requested species.
- Return type:
- components()¶
- Returns:
The components in the mixture, given as tuples of species and mole fraction.
- Return type:
Sequence of tuples
- density()¶
- Returns:
The molar mass weighted density of the mixture.
- Return type:
PhysicalQuantity of type mass per volume
- molarMass()¶
The mole fraction weighted molar mass of the mixture.
- Returns:
The mole fraction weighted molar mass of the mixture.
- Return type:
PhysicalQuantity of type mass per mole.
- molarVolume()¶
The mole fraction weighted molar volume of the mixture.
- Returns:
The mole fraction weighted molar mass of the mixture.
- Return type:
PhysicalQuantity of type mass per mole.
- moleFractions()¶
- Returns:
The mole fractions of each component.
- Return type:
Sequence of float
- numberOfComponents()¶
- Returns:
The number of components in the mixture.
- Return type:
int
- species()¶
- Returns:
The species included in the mixture.
- Return type:
Sequence of
CosmoRealSpecies
- uniqueString()¶
Return a unique string representing the state of the object.
Usage Examples¶
Create a CosmoRSMixture
object.
# Create a mixture.
mixture = CosmoRSMixture([
(water, 0.6), (methanol, 0.4)
])
# Get the mixture density.
density = mixture.density()
nlprint(f'The density of the mixture is {density}')
# Get the molar volume.
molar_volume = mixture.molarVolume()
nlprint(f'The molar volume of the mixture is {molar_volume}')
# Get the molar mass.
molar_mass = mixture.molarMass()
nlprint(f'The molar mass of the mixture is {molar_mass}')
# Create another mixture.
another_mixture = CosmoRSMixture([
(methanol, 0.4), (acetonitrile, 0.6)
])
# Combine them to create a new mixture.
new_mixture = mixture.addMixtures(0.5, another_mixture)
for i, x in enumerate(new_mixture.moleFractions()):
nlprint(f'The mole fraction of component {i} is {x}')
Notes¶
The CosmoRSMixture
object contains information about a mixture composition. The object can
be passed on to any other solvent related COSMO-RS object such as LiquidEquilibrium
.
The molar mass of the mixture is defined as the weighted molar mass of the mixture, \(\overline{M}\).
Here \(M\) is the molar mass and \(x\) the mole fraction of component species \(i\).
It is also possible to calculate the weighted molar volume of a solvent mixture \(\overline{V_m}\). \(V_m\) is defined as the volume occupied by 1 mole of species. This property can be determined based on the individual component densities their respective mole fractions.
If all of the component species are provided with densities, the molar volume is calculated as
Here \(\rho\) is the density. If the density is not given for a species the molar volume is approximated from the COSMO cavity volume.
\(N_A\) is Avogadro constant.
The mixture density is then calculated based on the previous properties.
Finally, CosmoRSMixture
objects may be combined to form a new mixture. This is done
using addMixtures
method where a mixture ratio is also needed. If the mixtures have a
component species in common this will be added together to form a single component of the new
mixture.