pymatgen.analysis.cost.cost module

This module is used to estimate the cost of various compounds. Costs are taken from the a CostDB instance, for example a CSV file via CostDBCSV. For compounds with no cost listed, a Phase Diagram style convex hull optimization is performed to determine a set of compositions that can be mixed to give the desired compound with lowest total cost.

class CostAnalyzer(costdb)[source]

Bases: object

Given a CostDB, figures out the minimum cost solutions via convex hull

get_cost_per_kg(comp)[source]

Get best estimate of minimum cost/kg based on known data

Parameters:comp – Composition as a pymatgen.core.structure.Composition
Returns:float of cost/kg
get_cost_per_mol(comp)[source]

Get best estimate of minimum cost/mol based on known data

Parameters:comp – Composition as a pymatgen.core.structure.Composition
Returns:float of cost/mol
get_lowest_decomposition(composition)[source]

Get the decomposition leading to lowest cost

Parameters:composition – Composition as a pymatgen.core.structure.Composition
Returns:amount}
Return type:Decomposition as a dict of {Entry
class CostDB[source]

Bases: object

Abstract class for representing a Cost database. Can be extended, e.g. for file-based or REST-based databases

get_entries(chemsys)[source]

For a given chemical system, return an array of CostEntries

Parameters:chemsys – array of Elements defining the chemical system.
Returns:array of CostEntries
class CostDBCSV(filename)[source]

Bases: pymatgen.analysis.cost.cost.CostDB

Read a CSV file to get costs Format is formula,cost_per_kg,name,BibTeX

get_entries(chemsys)[source]
class CostEntry(composition, cost, name, reference)[source]

Bases: pymatgen.phasediagram.entries.PDEntry

Extends PDEntry to include a BibTeX reference and include language about cost

Parameters:
  • composition – Composition as a pymatgen.core.structure.Composition
  • cost – Cost (per mol, NOT per kg) of the full Composition
  • name – Optional parameter to name the entry. Defaults to the reduced chemical formula as in PDEntry.
  • reference – Reference data as BiBTeX string