ILThermoPy CookBook

ILThermo 2.0 is the biggest curated database, containing a wide varieties of experimental data on ionic liquids. This cookbook shows how this database can be accessed in automatic mode via the ILThermoPy package.

Properties

To search by property, one need either property name or ILThermo property ID. Since they are internal parameters of the ILThermo 2.0 web interface, they must be obtained via the ilt.ShowPropertyList function:

[3]:
ilt.ShowPropertyList()

# Activity, fugacity, and osmotic properties
BPpY: Activity
VjHv: Osmotic coefficient

# Composition at phase equilibrium
dNip: Composition at phase equilibrium
MbEq: Eutectic composition
lIUh: Henry's Law constant
eCTp: Ostwald coefficient
neae: Tieline
WbZo: Upper consolute composition

# Critical properties
BPNz: Critical pressure
rDNz: Critical temperature
qpSz: Lower consolute temperature
MvMG: Upper consolute pressure
bRXE: Upper consolute temperature

# Excess, partial, and apparent energetic properties
cpbY: Apparent enthalpy
teHk: Apparent molar heat capacity
rTYh: Enthalpy of dilution
aeiA: Enthalpy of mixing of a binary solvent with component
VTiT: Enthalpy of solution
brzp: Excess enthalpy
Sqxi: Partial molar enthalpy
mFmK: Partial molar heat capacity

# Heat capacity and derived properties
tnYd: Enthalpy
kthO: Enthalpy function {H(T)-H(0)}/T
qdUt: Entropy
IZSt: Heat capacity at constant pressure
KvgF: Heat capacity at constant volume
zJIE: Heat capacity at vapor saturation pressure

# Phase transition properties
CXUw: Enthalpy of transition or fusion
iaOF: Enthalpy of vaporization or sublimation
SwyC: Equilibrium pressure
ghKa: Equilibrium temperature
lnrs: Eutectic temperature
LUaF: Monotectic temperature
NmYB: Normal melting temperature

# Refraction, surface tension, and speed of sound
YQDr: Interfacial tension
bNnk: Refractive index
imdq: Relative permittivity
NlQd: Speed of sound
ETUw: Surface tension liquid-gas

# Transport properties
HooV: Binary diffusion coefficient
Ylwl: Electrical conductivity
jjnq: Self diffusion coefficient
pAFI: Thermal conductivity
KTcm: Thermal diffusivity
vBeU: Tracer diffusion coefficient
PusA: Viscosity

# Vapor pressure, boiling temperature, and azeotropic T & P
hkog: Normal boiling temperature
HwfJ: Vapor or sublimation pressure

# Volumetric properties
WxCH: Adiabatic compressibility
zNjL: Apparent molar volume
JkYu: Density
psRu: Excess volume
hXfd: Isobaric coefficient of volume expansion
Bvon: Isothermal compressibility
LNxL: Partial molar volume


If your old code raises ValueError during the property search, this indicates that the property ID and/or property name have changed in ILThermo 2.0 after update(s). In this case, simply correct the value to the actual one.

Another way around this issue is to use ilt.PropertyList object:

[4]:
plist = ilt.PropertyList()
help(plist)
Help on PropertyList in module ilthermopy.data_structs object:

class PropertyList(builtins.object)
 |  Contains info on available physico-chemical properties and their API keys
 |
 |  Attributes:
 |      properties (dict): two-level organized dictionary, interconnecting property
 |          types, properties, and their API keys
 |      key2prop (dict): maps API keys to property names
 |      prop2key (dict): maps property names to their API keys
 |
 |  Methods defined here:
 |
 |  Show(self) -> None
 |      Prints list of properties available in ILThermo 2.0 database
 |      formatted as api_key: property_name
 |
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables (if defined)
 |
 |  __weakref__
 |      list of weak references to the object (if defined)

[5]:
prop_name = 'Activity'
prop_key = plist.prop2key.get(prop_name, None)
print(prop_key)
BPpY

However, in most cases you do not need this functionality since the ilt.Search function supports the prop argument.

Retrieving data

To load data on the found entries use the ilt.GetEntry function, which takes entry ID as input:

[6]:
# random search
df = ilt.Search(n_compounds = 2, year = 2004)
# downloading first 10 entries
data = [ilt.GetEntry(idx) for idx in df.id.iloc[:10]]
# get first entry
entry = data[0]
entry
[6]:
Entry(id='srPOo', ref=Reference(full='Rebelo, L. P. N.; Najdanovic-Visak, V.; Visak, Z. P.; Nunes da Ponte, M.; Szydlowski, J.; Cerdeirina, C. A.; Troncoso, J.; Romani, L.; Esperanca, J. M. S. S.; Guedes, H. J. R.; de Sousa, H. C. (2004) Green Chem. 6(8), 369-381.'), property='Excess volume', property_type='Volumetric properties', phases=['Liquid'], components=[Compound(id='AADYJk', name='water', smiles='O'), Compound(id='AArYBF', name='1-butyl-3-methylimidazolium tetrafluoroborate', smiles='CCCC[n+]1ccn(C)c1.F[B-](F)(F)F')], num_data_points=185)

Entry object contains detailed information on the data entry, including:

  • id: data entry ID;

  • ref: reference to the source article;

  • property, property_type: measured property and its type;

  • phases: list of system’s phases;

  • components: list of system’s components;

  • num_phases, num_components, num_data_points: number of system’s components and phases, and number of measured data points;

  • expmeth: experimental method used to obtain the physchemical data;

  • solvent: solvent used in the experiment;

  • constraints: list of experimental constraints;

  • data: dataframe containing measured data;

  • header: full column names to the data, containing info on the measured property, measurement units, component, and phase;

  • footnotes: notes to the data;

  • response: original response.

Let’s illustrate the main attributes. Reference contains reference itself and the article’s title:

[7]:
entry.ref.full, entry.ref.title
[7]:
('Rebelo, L. P. N.; Najdanovic-Visak, V.; Visak, Z. P.; Nunes da Ponte, M.; Szydlowski, J.; Cerdeirina, C. A.; Troncoso, J.; Romani, L.; Esperanca, J. M. S. S.; Guedes, H. J. R.; de Sousa, H. C. (2004) Green Chem. 6(8), 369-381.',
 'A detailed thermodynamic analysis of [C4mim][BF4] + water as a case study to model ionic liquid aqueous solutions')

Each component is a Compound object and contains the following fields:

  • id: compound id;

  • name: compound name;

  • formula: chemical formula;

  • smiles: compound SMILES;

  • smiles_error: if compounds SMILES was not retrieved, this field describes the reason;

  • sample: dictionary containing info on compound’s source, purity, etc.;

  • mw: molar weight of the compound, g/mol.

[8]:
cmp1 = entry.components[0]
cmp1.id, cmp1.name, cmp1.formula, cmp1.smiles, cmp1.smiles_error, cmp1.sample, cmp1.mw
[8]:
('AADYJk',
 'water',
 'H2 O',
 'O',
 None,
 {'Source': 'commercial source',
  'Purification': 'estimated by the compiler',
  'Purity': '99.8 mass %(fractional distillation)'},
 18.02)

data field contains dataframe with measured physchemical data. Its columns has short names V1, V2, V3, etc. for all variables. If for some variable the measurement error was provided, the corresponding column will be d concatanated to the column name of the original value, e.g. V1 and dV1:

[9]:
entry.data
[9]:
V1 V2 V3 V4 dV4
0 100.0 0.0040 278.15 -3.600000e-08 1.000000e-08
1 100.0 0.0040 283.15 -3.350000e-08 1.000000e-08
2 100.0 0.0040 288.15 -3.070000e-08 1.000000e-08
3 100.0 0.0040 293.15 -2.830000e-08 1.000000e-08
4 100.0 0.0040 298.15 -2.580000e-08 1.000000e-08
... ... ... ... ... ...
180 60000.0 0.5905 298.15 4.620000e-07 1.100000e-08
181 60000.0 0.5905 303.15 4.550000e-07 1.100000e-08
182 60000.0 0.5905 313.15 4.510000e-07 1.100000e-08
183 60000.0 0.5905 323.15 5.420000e-07 1.200000e-08
184 60000.0 0.5905 333.15 5.830000e-07 1.200000e-08

185 rows × 5 columns

header field contains full names of the corresponding columns, including measured property, its measurement unit, and optionally compound and phase:

[10]:
entry.header
[10]:
{'V1': 'Pressure, kPa',
 'V2': 'Mole fraction of 1-butyl-3-methylimidazolium tetrafluoroborate => Liquid',
 'V3': 'Temperature, K',
 'V4': 'Excess volume, m<SUP>3</SUP>/mol => Liquid',
 'dV4': 'Error of excess volume, m<SUP>3</SUP>/mol => Liquid'}

Combining data entries formatted in this way is possible, albeit difficult. However, that is a problem of a particular database, and such a task is beyound the scope of this API.