Parameter library

In this example, we show how to use the Library to access parameter values to use in pipelines, either as known values or initial guesses for optimization. The library is currently small, and only contains thermodynamic parameters for the MSMR model for a handful of materials. The library will be expanded in the future, and users can add new materials for use in their own pipelines.

import ionworkspipeline as iwp

First we create a Library object.

lib = iwp.Library()

We can get a list of the materials in the library using the materials attribute.

lib.materials
['Graphite (Coal derived) - Paul 2024',
 'Graphite (Commercial) - Paul 2024',
 'Graphite - Verbrugge 2017',
 'LFP - Verbrugge 2017',
 'Manganese oxide - Verbrugge 2017',
 'NMC - Verbrugge 2017',
 'Silicon (delithiation) - Verbrugge 2017',
 'Silicon (lithiation) - Verbrugge 2017']

We can search for a material in the library using the search_materials method,

lib.search_materials("si")
Results for 'si': ['Silicon (delithiation) - Verbrugge 2017', 'Silicon (lithiation) - Verbrugge 2017']

and access the parameters for a material using by indexing the library with the material name.

si = lib["Silicon (lithiation) - Verbrugge 2017"]

si is a Material object with attributes for the name, description and parameter values.

Parameters are stored in a dictionary and can be accessed using the parameter_values attribute.

si.parameter_values
{'U0_n_0': 0.08216,
 'X_n_0': 0.21834,
 'w_n_0': 0.70934,
 'U0_n_1': 0.2329,
 'X_n_1': 0.23264,
 'w_n_1': 0.9597,
 'U0_n_2': 0.12606,
 'X_n_2': 0.42492,
 'w_n_2': 3.02803,
 'U0_n_3': 0.42638,
 'X_n_3': 0.1241,
 'w_n_3': 4.68406}

We can also access the name

si.name
'Silicon (lithiation) - Verbrugge 2017'

and description.

si.description
'Thermodynamic parameters for Lithiation of LixSi4.4 from Mark Verbrugge et al 2017 J.Electrochem.Soc. 164 E3243'

We can search the materials for a specific parameter using the search_parameters method.

si.search_parameters("U")
No matches found for 'U'

We can also search for parameters across the entire library.

lib.search_parameters("U")
Graphite (Coal derived) - Paul 2024
No matches found for 'U'
Graphite (Commercial) - Paul 2024
No matches found for 'U'
Graphite - Verbrugge 2017
No matches found for 'U'
LFP - Verbrugge 2017
No matches found for 'U'
Manganese oxide - Verbrugge 2017
No matches found for 'U'
NMC - Verbrugge 2017
No matches found for 'U'
Silicon (delithiation) - Verbrugge 2017
No matches found for 'U'
Silicon (lithiation) - Verbrugge 2017
No matches found for 'U'

New Material objects can be created by passing in a dictionary with keys “name”, “description” and “parameter_values” to the Material class. The parameters can contain functions and scalar values.

def myfun(x):
    return x**2


my_material_dict = {
    "name": "My Material",
    "description": "This is a material I made",
    "parameter values": {"U": 1.0, "D": 2.0, "fun": myfun},
}

my_material = iwp.Material(my_material_dict)

We can check that the stored parameters are those we passed in,

my_material.parameter_values
{'U': 1.0, 'D': 2.0, 'fun': <function __main__.myfun(x)>}

and we can search as before.

my_material.search_parameters("U")
Results for 'U': ['U', 'fun']
U -> 1.0
fun -> <function myfun at 0x705b58fc0d60>

New materials can be added to the library using entry points, as described in the documentation.