CosmoRSSpeciesDatabase¶
- class CosmoRSSpeciesDatabase¶
- categories()¶
- Returns:
A list of the chemical categories used in the database.
- Return type:
list of str
- deleteSpecies(name)¶
Delete the the given named entry from the database. This can only be done for user-added entries.
- Parameters:
name (str) – The name of the species to delete.
- exportSpecies(name)¶
Return the CosmoRealSpecies for the given named entry.
- Parameters:
name (str) – The name of the species to return.
- findSpecies(category=None, formula=None, smiles=None)¶
Return the list of the names of the available species. Different selection criteria can be used to return subsets of species names.
- Parameters:
category (str) – Return only species that are in the given category.
formula (str) – Return only species that have the given chemical formula.
smiles (str) – Return only species whose bond graph matches the bond graph given by the SMILES string. Note that this does not distinguish between cis/trans isomers or stereoisomers.
- Returns:
A list names of species that match the given selection criteria.
- Return type:
list of str
- importSpecies(name, cosmo_data, category=None, description=None, melting_point=None, enthalpy_of_fusion=None, specific_heat_capacity_change=None, antoine_a=None, antoine_b=None, antoine_c=None, boiling_point=None, flash_point=None, density=None)¶
Add a new configuration to the COSMO-RS database.
- Parameters:
name (str) – The name of the data entry.
cosmo_data (
CosmoRS
|CosmoRealSpecies
) – The COSMO data including solvent and gas phase DFT calculations.category (str) – The classification category of the configuration.
description (str) – A text description of the database entry.
melting_point (
PhysicalQuantity
of type temperature) – The melting point of the pure substance.enthalpy_of_fusion (
PhysicalQuantity
of type energy) – The enthalpy or heat of fusion of the pure substance.specific_heat_capacity_change (
PhysicalQuantity
of type energy per temperature) – The difference in the molar isobaric specific heat capacity between the liquid and solid phase.antoine_a (
PhysicalQuantity
of type pressure) – The A parameter of the Antoine equation. The units indicate the pressure units in the equation.antoine_b (
PhysicalQuantity
of type temperature) – The B parameter of the Antoine equation.antoine_c (
PhysicalQuantity
of type temperature) – The C parameter of the Antoine equation.boiling_point (
PhysicalQuantity
of type temperature) – The boiling point of the pure substance.flash_point (
PhysicalQuantity
of type temperature) – Minimum temperature required for the vaporized pure substance to be combustible in air.density (
PhysicalQuantity
of type density) – The liquid density of the pure substance.
Usage Examples¶
Find names of molecules in the COSMO-RS database by category, chemical formula and bond graph.
# Load the COSMO database
database = CosmoRSSpeciesDatabase()
# Find all species with the chemical formula C4H8O
species_names = database.findSpecies(formula='C4H8O')
nlprint(species_names)
# Find specifically the molecule tetrahydrofuran
species_names = database.findSpecies(formula='C4H8O', smiles='O1CCCC1')
nlprint(species_names)
Load water and SO2 molecules from the database and calculate the solubility of SO2 in water.
# Load the COSMO species
database = CosmoRSSpeciesDatabase()
water = database.exportSpecies('water')
sulfur_dioxide = database.exportSpecies('sulfur dioxide')
# Determine the gas solubility.
gas_solubility = GasSolubility(
sulfur_dioxide,
water,
solvent_density=1*kiloGram/liter,
temperature=298*Kelvin,
parameters=CosmoRSParameters(),
)
# Retrieve the Henry constant.
h_cp = gas_solubility.henryConstantCP()[0].convertTo(molar/bar)
nlprint(f'The Henry constant of SO2 in water is {h_cp}')
# Retrieve the Henry volatility.
h_px = gas_solubility.henryVolatilityPX()[0].convertTo(bar)
nlprint(f'The Henry volatility of SO2 in water is {h_px}')
Add and then remove an azide (ammonia) molecule.
# Create the COSMO-RS object
solvation_energy = SolvationEnergy(
configuration=azane
)
azane_cosmo_rs = CosmoRS(
configuration=azane,
solvation_energy=solvation_energy
)
# Load the database
database = CosmoRSSpeciesDatabase()
# Add the molecule to the database
database.importSpecies(
'azane',
azane_cosmo_rs,
category='Inorganic bases',
description='Added as example of COSMO-RS molecular database',
boiling_point=239.81*Kelvin,
melting_point=195.42*Kelvin,
density=0.682*kiloGram/liter,
antoine_a=4.86886*bar,
antoine_b=1113.928*Kelvin,
antoine_c=-10.409*Kelvin,
)
# Remove the species from the database
database.deleteSpecies('azane')
Notes¶
The CosmoRSSpeciesDatabase
object provides a script interface to the molecule database
in the Cosmo-RS Analyzer. Through this class CosmoRealSpecies
objects can be exported
from the database using the exportSpecies
method. These CosmoRealSpecies
objects
can then be used directly in a COSMO-RS calculation. CosmoRealSpecies
or
CosmoRS
objects can also be saved into the database using the importSpecies
method.
As well as the data object, the importSpecies
method can optionally take a category label,
a description or a range of experimental data that may be used in COSMO-RS calculations. These
data can also be set when running the COSMO-RS calculation. Configurations that have been added to
the database can also be removed by the deleteSpecies
method. Configuration entries that are
shipped with QuantumATK cannot be deleted.
In the database species have a name as a primary key. This is often the common name for the
molecule, rather than the systematic IUPAC name. Specific molecules can be searched for using a
combination of classification class, chemical formula and SMILES string in the findSpecies
method. Classification class and chemical formula match all records with the same data. SMILES
strings use graph matching to match all records that have the same bond graph. Note that this does
not distinguish between cis and trans isomers. The findSpecies
method returns the name of all
records that match the given criteria.