Customized Parameter Screening¶
The Python API allows for custom parameter screenings to be conducted beyond the simple one-dimensional sweeps performed by the web interface.
For this tutorial, we will illustrate the analysis of host-guest compositions using the API submissions.
Create a Composition Template¶
We will be using the basic materials created during the previous tutorial.
We start by creating a default composition using 1% of dye.
mixture = bb_client.new("composition")
mixture.name = "CBP-Irppy3"
mixture.add_fraction(0.99, host.id)
mixture.add_fraction(0.01, dye.id)
mixture.create()
Create a Stack¶
We use this composition to create a stack.
stack = bb_client.new("stack")
stack.name = "TAPC-CBP-Irppy3-TPBi"
stack.add_layer("HTL", 20, pure_htl.id)
stack.add_layer("EMI", 30, mixture.id)
stack.add_layer("ETL", 20, pure_etl.id)
stack.create()
Create a Parameter Set¶
We configure the parameter set for a 5V simulation.
parameter_set = bb_client.new("param_set")
parameter_set.name = "SingleVoltage-CBP-Irppy"
parameter_set.stack_id = stack.id
parameter_set.fermi_level_left = htl.homo + 0.2
parameter_set.fermi_level_right = etl.lumo - 0.2
parameter_set.voltage = 5
parameter_set.create()
Submitting Multiple Simulations¶
We will perform a screening of multiple compositions. By calling the update
method, we are able to automatically link each new composition to the stack and parameter sets defined earlier.
# Define a list of dye fractions
fractions = [0.01, 0.03, 0.05, 0.1, 0.15, 0.25]
# Create and submit a composition for each dye fraction
for dye_fraction in fractions:
# Modify the template composition using the new values
composition.name = "CBP-Irppy3-{}".format(100 * dye_fraction)
composition.fractions[0].fraction = 1.0 - dye_fraction
composition.fractions[1].fraction = dye_fraction
composition.update()
# Submit a new simulation
simulation = bb_client.new("simulation")
simulation.name = "Screening-" + composition.name
simulation.add_sweep(parameter_set.id, first_disorder=1, final_disorder=5)
simulation.create()
Simulation Output¶
The output for each host-guest composition is stored in a unique simulation. The results for each composition can be accessed by calling the available
method.
for simulation in simulations:
print(simulation.name)
simulation.results.available()
Specific results can now be collated in order to analyze the output for custom parameter screenings.
Note
The results
methods included in the API only support output extraction for the limited set of pre-defined screening parameters found in the web interface. By storing your custom screening sets in distinct simulation objects, the default post-processing remains accessible to aid in automated data extraction from the Bumblebee output.
Multi-dimensional Parameter Screenings¶
The Python API can be used to construct screenings of multiple parameters during a single run. Possible implementation strategies include:
Nesting iterators for multiple variables (e.g. using multiple
for
-loops), orCreating a list of specific parameter combinations that you wish to test
This approach can be used to investigate variations in e.g. multi-component compositions, device dimensions, different layer morphologies, degradation scenarios, etc.