battery Package

battery Package

This package contains all battery-related application classes, including representations of InsertionElectrodes and ConversionElectrodes.

battery_abc Module

This module defines the abstract base classes for battery-related classes. Regardless of the kind of electrode, conversion or insertion, there are many common definitions and properties, e.g., average voltage, capacity, etc. which can be defined in a general way. The Abc for battery classes implements some of these common definitions to allow sharing of common logic between them.

class AbstractElectrode[source]

Bases: _abcoll.Sequence, pymatgen.serializers.json_coders.MSONable

An Abstract Base Class representing an Electrode. It is essentially a sequence of VoltagePairs. Generally, subclasses only need to implement three abstract properties: voltage_pairs, working_ion and working_ion_entry.

The general concept is that all other battery properties such as capacity, etc. are derived from voltage pairs.

One of the major challenges with representing battery materials is keeping track of the normalization between different entries. For example, one entry might be TiO2 with one unit cell whereas another is LiTi2O4 with two unit cells. When computing battery properties, it is needed to always use a universal reference state otherwise you have normalization errors (e.g., the energy of LiTi2O4 must be divided by two to be compared with TiO2).

For properties such as volume, mass, or mAh transferred within the voltage pair, a universal convention is necessary. AbstractElectrode can query for extrinsic properties of several different AbstractVoltagePairs belonging to a single charge/discharge path and be confident that the normalization is being carried out properly throughout, even if more AbstractVoltagePairs are added later.

The universal normalization is defined by the reduced structural framework of the entries, which is common along the entire charge/discharge path. For example, LiTi2O4 has a reduced structural framework of TiO2. Another example is Li9V6P16O58 which would have a reduced structural framework of V3P8O29. Note that reduced structural frameworks need not be charge-balanced or physical, e.g. V3P8O29 is not charge-balanced, they are just a tool for normalization.

Example: for a LiTi2O4 -> TiO2 AbstractVoltagePair, extrinsic quantities like mAh or cell volumes are given per TiO2 formula unit.

Developers implementing a new battery (other than the two general ones already implemented) need to implement a VoltagePair and an Electrode.

get_average_voltage(min_voltage=None, max_voltage=None)[source]

Average voltage for path satisfying between a min and max voltage.

Args:
min_voltage:
the minimum allowable voltage for a given step
max_voltage:
the maximum allowable voltage allowable for a given step
Returns:
Average voltage in V across the insertion path (a subset of the path can be chosen by the optional arguments)
get_capacity_grav(min_voltage=None, max_voltage=None, use_overall_normalization=True)[source]

Get the gravimetric capacity of the electrode.

Args:
min_voltage:
The minimum allowable voltage for a given step.
max_voltage:
The maximum allowable voltage allowable for a given step.
use_overall_normalization:
If False, normalize by the discharged state of only the voltage pairs matching the voltage criteria. if True, use default normalization of the full electrode path.
Returns:
Gravimetric capacity in mAh/g across the insertion path (a subset of the path can be chosen by the optional arguments).
get_capacity_vol(min_voltage=None, max_voltage=None, use_overall_normalization=True)[source]

Get the volumetric capacity of the electrode.

Args:
min_voltage:
the minimum allowable voltage for a given step
max_voltage:
the maximum allowable voltage allowable for a given step
use_overall_normalization:
If False, normalize by the discharged state of only the voltage pairs matching the voltage criteria. If True, use default normalization of the full electrode path.
Returns:
Volumetric capacity in mAh/cc across the insertion path (a subset of the path can be chosen by the optional arguments)
get_energy_density(min_voltage=None, max_voltage=None, use_overall_normalization=True)[source]
Args:
min_voltage:
The minimum allowable voltage for a given step
max_voltage:
The maximum allowable voltage allowable for a given step
use_overall_normalization:
If False, normalize by the discharged state of only the voltage pairs matching the voltage criteria. If True, use default normalization of the full electrode path.
Returns:
Energy density in Wh/L across the insertion path (a subset of the path can be chosen by the optional arguments).
get_specific_energy(min_voltage=None, max_voltage=None, use_overall_normalization=True)[source]

Returns the specific energy of the battery in mAh/g.

Args:
min_voltage:
the minimum allowable voltage for a given step
max_voltage:
the maximum allowable voltage allowable for a given step
use_overall_normalization:
if False, normalize by the discharged state of only the voltage pairs matching the voltage criteria. if True, use default normalization of the full electrode path.
Returns:
Specific energy in Wh/kg across the insertion path (a subset of the path can be chosen by the optional arguments)
max_delta_volume[source]

Maximum volume change along insertion

max_voltage[source]

Highest voltage along insertion

max_voltage_step[source]

Maximum absolute difference in adjacent voltage steps

min_voltage[source]

Lowest voltage along insertion

normalization_mass[source]
normalization_volume[source]
num_steps[source]

The number of distinct voltage steps in from fully charge to discharge based on the stable intermediate states

voltage_pairs[source]

Returns all the VoltagePairs

working_ion[source]

The working ion as an Element object

working_ion_entry[source]

The working ion as an Entry object

class AbstractVoltagePair[source]

Bases: object

An Abstract Base Class for a Voltage Pair.

frac_charge[source]
frac_discharge[source]
mAh[source]
mass_charge[source]
mass_discharge[source]
vol_charge[source]
vol_discharge[source]
voltage[source]
working_ion_entry[source]

conversion_battery Module

This module contains the classes to build a ConversionElectrode.

class ConversionElectrode(voltage_pairs, working_ion_entry, initial_comp)[source]

Bases: pymatgen.apps.battery.battery_abc.AbstractElectrode

Class representing a ConversionElectrode.

General constructor for ConversionElectrode. However, it is usually easier to construct a ConversionElectrode using one of the static constructors provided.

Args:
voltage_pairs:
The voltage pairs making up the Conversion Electrode.
working_ion_entry:
A single ComputedEntry or PDEntry representing the element that carries charge across the battery, e.g. Li.
initial_comp:
Starting composition for ConversionElectrode.
composition[source]
static from_composition_and_entries(comp, entries_in_chemsys, working_ion_symbol='Li')[source]

Convenience constructor to make a ConversionElectrode from a composition and all entries in a chemical system.

Args:
comp:
Starting composition for ConversionElectrode, e.g., Composition(“FeF3”)
entries_in_chemsys:
Sequence containing all entries in a chemical system. E.g., all Li-Fe-F containing entries.
working_ion_symbol:
Element symbol of working ion. Defaults to Li.
static from_composition_and_pd(comp, pd, working_ion_symbol='Li')[source]

Convenience constructor to make a ConversionElectrode from a composition and a phase diagram.

Args:
comp:
Starting composition for ConversionElectrode, e.g., Composition(“FeF3”)
pd:
A PhaseDiagram of the relevant system (e.g., Li-Fe-F)
working_ion_symbol:
Element symbol of working ion. Defaults to Li.
classmethod from_dict(d)[source]
get_sub_electrodes(adjacent_only=True)[source]

If this electrode contains multiple voltage steps, then it is possible to use only a subset of the voltage steps to define other electrodes. For example, an LiTiO2 electrode might contain three subelectrodes: [LiTiO2 –> TiO2, LiTiO2 –> Li0.5TiO2, Li0.5TiO2 –> TiO2] This method can be used to return all the subelectrodes with some options

Args:
adjacent_only:
Only return electrodes from compounds that are adjacent on the convex hull, i.e. no electrodes returned will have multiple voltage steps if this is set true
Returns:
A list of ConversionElectrode objects
get_summary_dict(print_subelectrodes=True)[source]
Args:
print_subelectrodes:
Also print data on all the possible subelectrodes
Returns:
a summary of this electrode”s properties in dictionary format
is_super_electrode(conversion_electrode)[source]

Checks if a particular conversion electrode is a sub electrode of the current electrode. Starting from a more lithiated state may result in a subelectrode that is essentially on the same path. For example, a ConversionElectrode formed by starting from an FePO4 composition would be a super_electrode of a ConversionElectrode formed from an LiFePO4 composition.

to_dict[source]
voltage_pairs[source]
working_ion[source]

The working ion as an Element object

working_ion_entry[source]
class ConversionVoltagePair(balanced_rxn, voltage, mAh, vol_charge, vol_discharge, mass_charge, mass_discharge, frac_charge, frac_discharge, entries_charge, entries_discharge, working_ion_entry)[source]

Bases: pymatgen.apps.battery.battery_abc.AbstractVoltagePair

A VoltagePair representing a Conversion Reaction with a defined voltage. Typically not initialized directly but rather used by ConversionElectrode.

Args:
balanced_rxn:
BalancedReaction for the step
voltage:
Voltage for the step
mAh:
Capacity of the step
vol_charge:
Volume of charged state
vol_discharge:
Volume of discharged state
mass_charge:
Mass of charged state
mass_discharge:
Mass of discharged state
frac_charge:
Fraction of working ion in the charged state
frac_discharge:
Fraction of working ion in the discharged state
entries_charge:
Entries present in the charged state
entries_discharge:
Entries present in discharged state
working_ion_entry:
Entry of the working ion.
entries_charge[source]
entries_discharge[source]
frac_charge[source]
frac_discharge[source]
classmethod from_dict(d)[source]
static from_steps(step1, step2, normalization_els)[source]

Creates a ConversionVoltagePair from two steps in the element profile from a PD analysis.

Args:
step1:
Starting step
step2:
Ending step
normalization_els:
Elements to normalize the reaction by. To ensure correct capacities.
mAh[source]
mass_charge[source]
mass_discharge[source]
rxn[source]
to_dict[source]
vol_charge[source]
vol_discharge[source]
voltage[source]
working_ion[source]
working_ion_entry[source]

insertion_battery Module

This module is used for analysis of materials with potential application as intercalation batteries.

class InsertionElectrode(entries, working_ion_entry)[source]

Bases: pymatgen.apps.battery.battery_abc.AbstractElectrode

A set of topotactically related compounds, with different amounts of a single element, e.g. TiO2 and LiTiO2, that can be used to define an insertion battery electrode.

Create a new InsertionElectrode.

Args:
entries:
A list of ComputedStructureEntries (or subclasses) representing the different topotactic states of the battery, e.g. TiO2 and LiTiO2.
working_ion_entry:
A single ComputedEntry or PDEntry representing the element that carries charge across the battery, e.g. Li.
classmethod from_dict(d)[source]
fully_charged_entry[source]

The most charged entry along the topotactic path.

fully_discharged_entry[source]

The most discharged entry along the topotactic path.

get_all_entries(charge_to_discharge=True)[source]

Return all entries input for the electrode.

Args:
charge_to_discharge:
order from most charge to most discharged state? Defaults to True.
Returns:
A list of all entries in the electrode (both stable and unstable), ordered by amount of the working ion.
get_max_instability(min_voltage=None, max_voltage=None)[source]

The maximum instability along a path for a specific voltage range.

Args:
min_voltage:
The minimum allowable voltage.
max_voltage:
The maximum allowable voltage.
Returns:
Maximum decomposition energy of all compounds along the insertion path (a subset of the path can be chosen by the optional arguments)
get_max_muO2(min_voltage=None, max_voltage=None)[source]

Maximum critical oxygen chemical potential along path.

Args:
min_voltage:
The minimum allowable voltage.
max_voltage:
The maximum allowable voltage.
Returns:
Maximum critical oxygen chemical of all compounds along the insertion path (a subset of the path can be chosen by the optional arguments).
get_min_instability(min_voltage=None, max_voltage=None)[source]

The minimum instability along a path for a specific voltage range.

Args:
min_voltage:
The minimum allowable voltage.
max_voltage:
The maximum allowable voltage.
Returns:
Minimum decomposition energy of all compounds along the insertion path (a subset of the path can be chosen by the optional arguments)
get_min_muO2(min_voltage=None, max_voltage=None)[source]

Minimum critical oxygen chemical potential along path.

Args:
min_voltage:
the minimum allowable voltage for a given step
max_voltage:
the maximum allowable voltage allowable for a given step
Returns:
Minimum critical oxygen chemical of all compounds along the insertion path (a subset of the path can be chosen by the optional arguments).
get_stable_entries(charge_to_discharge=True)[source]
Args:
charge_to_discharge:
order from most charge to most discharged state? Default to True.
Returns:
A list of stable entries in the electrode, ordered by amount of the working ion.
get_sub_electrodes(adjacent_only=True, include_myself=True)[source]

If this electrode contains multiple voltage steps, then it is possible to use only a subset of the voltage steps to define other electrodes. For example, an LiTiO2 electrode might contain three subelectrodes: [LiTiO2 –> TiO2, LiTiO2 –> Li0.5TiO2, Li0.5TiO2 –> TiO2] This method can be used to return all the subelectrodes with some options

Args:
adjacent_only:
Only return electrodes from compounds that are adjacent on the convex hull, i.e. no electrodes returned will have multiple voltage steps if this is set True.
include_myself:
Include this identical electrode in the list of results.
Returns:
A list of InsertionElectrode objects
get_unstable_entries(charge_to_discharge=True)[source]

Returns the unstable entries for the electrode.

Args:
charge_to_discharge:
order from most charge to most discharged state? Defaults to True.
Returns:
A list of unstable entries in the electrode, ordered by amount of the working ion.
to_dict[source]
to_dict_summary(print_subelectrodes=True)[source]
Args:
print_subelectrodes:
Also print data on all the possible subelectrodes.
Returns:
A summary of this electrode”s properties in dict format.
voltage_pairs[source]
working_ion[source]

The working ion as an Element object

working_ion_entry[source]
class InsertionVoltagePair(entry1, entry2, working_ion_entry)[source]

Bases: pymatgen.apps.battery.battery_abc.AbstractVoltagePair

Defines an Insertion Voltage Pair.

Args:
entry1:
Entry corresponding to one of the entries in the voltage step.
entry2:
Entry corresponding to the other entry in the voltage step.
working_ion_entry:
A single ComputedEntry or PDEntry representing the element that carries charge across the battery, e.g. Li.
frac_charge[source]
frac_discharge[source]
mAh[source]
mass_charge[source]
mass_discharge[source]
vol_charge[source]
vol_discharge[source]
voltage[source]
working_ion_entry[source]

plotter Module

This module provides plotting capabilities for battery related applications.

class VoltageProfilePlotter(xaxis='capacity')[source]

Bases: object

A plotter to make voltage profile plots for batteries.

Args:
xaxis:
The quantity to use as the xaxis. Can be either capacity (the default), or the frac_x.
add_electrode(electrode, label=None)[source]

Add an electrode to the plot.

Args:
electrode:
An electrode. All electrodes satisfying the AbstractElectrode interface should work.
label:
A label for the electrode. If None, defaults to a counting system, i.e. ‘Electrode 1’, ‘Electrode 2’, ...
get_plot(width, height)[source]

Returns a plot object.

Args:
width:
Width of the plot.
height:
Height of the plot.
Returns:
A matplotlib plot object.
get_plot_data(electrode)[source]
save(filename, image_format='eps', width=8, height=6)[source]

Save the plot to an image file.

Args:
filename:
Filename to save to.
image_format:
Format to save to. Defaults to eps.
show(width=8, height=6)[source]

Show the voltage profile plot.

Args:
width:
Width of the plot. Defaults to 8 in.
height:
Height of the plot. Defaults to 6 in.

Table Of Contents

This Page