This example will create a hull and plot a voltage curve from the computed phases found inside this directory.
# temporarily disables numpy deprecation warnings for CI
import warnings
warnings.filterwarnings("ignore")
from matador.hull import QueryConvexHull
from matador.scrapers.castep_scrapers import res2dict
%matplotlib inline
cursor, failures = res2dict("LiP_structures/*.res")
hull = QueryConvexHull(
cursor=cursor,
species=['Li', 'P'],
voltage=True,
volume=True,
labels=True,
plot_kwargs={"labels": True}
)
Successfully scraped 6 out of 6 files. 6 structures found within 0.0 eV of the hull, including chemical potentials. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Source !?! Pressure Cell volume Hull dist. Space group Formula # fu Prov. (GPa) (ų/fu) (meV/atom) ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── * P-CollCode150873 0.01 21.2 0.0 Cmca P 4 ICSD * LiP-ColCode23621 -0.02 173.2 0.0 I41/acd LiP₇ 8 ICSD * LiP-CollCode60774 0.02 198.4 0.0 P212121 Li₃P₇ 4 ICSD * LiP-CollCode182159 -0.02 31.3 0.0 P21/c LiP 8 ICSD * LiP-CollCode165990 -0.02 58.4 0.0 P63/mmc Li₃P 4 ICSD * Li-bcc 0.01 20.3 0.0 Pm-3m Li 16 AIRSS Constructing electrode system with active ion: Li # Li into P # Average voltage: 0.96 V # Q (mAh/g) Voltage (V) 0.00 1.51548488 123.62 1.51548488 370.87 1.19129313 865.37 0.95356375 2596.10 0.89592562 nan 0.00000000 Volume data: # Reaction 1 # P # Q (mAh/g) Volume (A^3) Volume ratio with bulk 0.00 21.24 1.00 123.62 24.75 1.16 370.87 28.34 1.33 865.37 31.29 1.47 2596.10 58.37 2.75
cursor, failures = res2dict("ternary_structures/*.res")
hull = QueryConvexHull(
cursor=cursor,
species="KSnP",
voltage=True,
capmap="Pastel2",
hull_cutoff=0.01,
summary=True,
include_elemental_electrodes=True,
volume=True,
plot_kwargs={"labels": True, "colour_points_by": "concentration"}
)
Successfully scraped 87 out of 87 files. 21 structures found within 0.01 eV of the hull, including chemical potentials. ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Source !?! Pressure Cell volume Hull dist. Space group Formula # fu Prov. Occurrences (GPa) (ų/fu) (meV/atom) ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── * K-Na-Collo 0.02 73.3 0.0 Im-3m K 1 SWAPS KP-GA-0ss21w-10x34 -0.02 144.2 6.2 P1 K₃P 6 GA * SnK-PbRb-OQMD_25009-CollCode409436 0.00 78.1 0.0 I4_1/acd KSn 16 SWAPS * PKSn-As4Na8Ti-OQMD_13161-CollC[..] 0.05 441.9 0.0 Fd-3m K₈SnP₄ 2 SWAPS KSn-fh4saz 0.01 109.1 4.7 Pm KSn₂ 2 AIRSS * KSn-GA-djgski-1x1 -0.00 508.8 0.0 P-1 K₄Sn₉ 4 GA KPSn-Na5P3Sn-OQMD_645043-CollC[..] 0.06 278.7 0.9 P2_1/c K₅SnP₃ 4 SWAPS KP-GA-oeaasw-1x78 -0.01 215.3 1.9 P-1 K₄P₃ 2 GA * KP-NaP-CollCode56530 -0.00 267.4 0.0 C2/m K₅P₄ 1 SWAPS * KSn-NaSn-CollCode248167 0.06 744.4 0.0 R-3m K₃Sn₁₇ 2 SWAPS KSn-NaSn-CollCode28123 0.03 996.8 5.4 Pm-3n K₄Sn₂₃ 2 SWAPS * KP-GA-scno1g-3x2 0.05 57.4 0.0 P1 KP 8 GA * KPSn-KSbSn-OQMD_6395-CollCode33933 0.07 90.4 0.0 P6_3mc KSnP 2 SWAPS * Sn-CollCode40039 0.02 36.4 0.0 Fd-3m Sn 2 ICSD * KP-GA-0ss21w-17x39 0.01 147.8 0.0 P1 K₂P₃ 4 GA * PKSn-As2NaSn2-OQMD_14824-CollC[..] 0.04 134.2 0.0 R-3m KSn₂P₂ 1 SWAPS * KP-Cs3P7-OQMD_57401-CollCode62259 -0.00 294.8 0.0 P4_1 K₃P₇ 4 SWAPS * P3Sn4-CollCode15014 -0.00 165.1 0.0 R-3m Sn₄P₃ 3 ICSD * KP-LiP-ColCode23621 0.01 229.8 0.0 I4_1/acd KP₇ 8 SWAPS * P3Sn-OQMD_3387-CollCode16293 0.06 85.4 0.0 R-3m SnP₃ 2 ICSD * P-CollCode150873 -0.01 21.2 0.0 Cmce P 4 ICSD Constructing electrode system with active ion: K ------------------------------ Assessing reaction 1, P: P ---> 0.143 KP₇ ---> 0.143 K₃P₇ ---> 0.333 K₂P₃ ---> KP ---> 0.25 K₅P₄ ------------------------------ Assessing reaction 2, SnP₃: SnP₃ ---> 0.25 Sn₄P₃ + 0.321 KP₇ ---> 0.25 Sn₄P₃ + 0.321 K₃P₇ ---> 0.429 K₃P₇ + Sn ---> 0.5 KSn₂P₂ + 0.286 K₃P₇ ---> 0.286 K₃P₇ + KSnP ---> KSnP + 0.667 K₂P₃ ---> KSn + K₂P₃ ---> 3.0 KP + KSn ---> 0.75 K₅P₄ + KSn ---> 0.75 K₈SnP₄ + 0.25 KSn ------------------------------ Assessing reaction 3, Sn₄P₃: Sn₄P₃ ---> 0.429 K₃P₇ + 4.0 Sn ---> 1.5 KSn₂P₂ + Sn ---> 3.0 KSnP + Sn ---> 0.059 K₃Sn₁₇ + 3.0 KSnP ---> 0.111 K₄Sn₉ + 3.0 KSnP ---> 3.0 KSnP + KSn ---> 4.0 KSn + K₂P₃ ---> 3.0 KP + 4.0 KSn ---> 0.75 K₅P₄ + 4.0 KSn ---> 0.75 K₈SnP₄ + 3.25 KSn ------------------------------ Assessing reaction 4, Sn: Sn ---> 0.059 K₃Sn₁₇ ---> 0.111 K₄Sn₉ ---> KSn ============================== 4 starting point(s) found. P, SnP₃, Sn₄P₃, Sn ============================== # K into P # Average voltage: 0.76 V # Q (mAh/g) Voltage (V) 0.00 1.84678825 123.62 1.84678825 370.87 1.24812250 576.91 0.65211200 865.37 0.31951625 1081.71 0.25383000 nan 0.00000000 # K into SnP₃ # Average voltage: 0.54 V # Q (mAh/g) Voltage (V) 0.00 1.56802407 40.71 1.56802407 122.13 1.24812250 162.84 1.11280248 171.89 0.88411300 235.21 0.86120500 295.52 0.65211200 379.96 0.34951250 506.61 0.31951625 601.60 0.25383000 791.58 0.10594250 nan 0.00000000 # K into Sn₄P₃ # Average voltage: 0.52 V # Q (mAh/g) Voltage (V) 0.00 1.11280248 60.70 1.11280248 70.81 0.88411300 141.63 0.86120500 149.96 0.85902800 162.61 0.60875939 188.84 0.46219000 283.26 0.34951250 330.47 0.31951625 365.87 0.25383000 436.69 0.10594250 nan 0.00000000 # K into Sn # Average voltage: 0.57 V # Q (mAh/g) Voltage (V) 0.00 0.85902800 39.85 0.85902800 100.35 0.60875939 225.79 0.46219000 nan 0.00000000 Volume data: # Reaction 1 # P # Q (mAh/g) Volume (A^3) Volume ratio with bulk 0.00 21.20 1.00 123.62 32.82 1.55 370.87 42.12 1.99 576.91 49.25 2.32 865.37 57.43 2.71 1081.71 66.86 3.15 Volume data: # Reaction 2 # SnP3 # Q (mAh/g) Volume (A^3) Volume ratio with bulk 0.00 85.43 1.00 40.71 115.13 1.35 122.13 136.05 1.59 162.84 162.75 1.90 171.89 151.36 1.77 235.21 174.68 2.04 295.52 188.94 2.21 379.96 225.84 2.64 506.61 250.38 2.93 601.60 278.65 3.26 791.58 350.94 4.11 Volume data: # Reaction 3 # Sn4P3 # Q (mAh/g) Volume (A^3) Volume ratio with bulk 0.00 165.13 1.00 60.70 271.93 1.65 70.81 237.76 1.44 141.63 307.71 1.86 149.96 315.10 1.91 162.61 327.85 1.99 188.84 349.40 2.12 283.26 460.08 2.79 330.47 484.62 2.93 365.87 512.90 3.11 436.69 585.18 3.54 Volume data: # Reaction 4 # Sn # Q (mAh/g) Volume (A^3) Volume ratio with bulk 0.00 36.39 1.00 39.85 43.79 1.20 100.35 56.54 1.55 225.79 78.08 2.15 Plotting ternary hull... Showing plot...