Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
电池材料界面反应热力学分析
pymatgen
reaction analysis
pymatgen reaction analysis
dengb@dp.tech
Wenshuo Liang
发布于 2023-09-25
推荐镜像 :Basic Image:ubuntu20.04-py3.10
推荐机型 :c2_m4_cpu
赞 2
4
ions(v1)

在pymatgen中进行电池材料界面反应计算

代码
文本

在固态电池的研究中,固态电解质和电极材料的界面热稳定性一直是关注点。硫化物电解质不仅拥有较高的离子电导率,同时它的弹性模量和断裂韧性也适中,在抑制锂枝晶的同时也能较好地维持电解质与电极的紧密接触。然而, 基于硫化物固态电解质的固态电池的开发仍然面临着硫化物对空气稳定性差、电极/电解质界面的化学和电化学稳定性等重大挑战。本文以Li3PS4和Li反应为例,演示了如何在pymatgen中实现获取两种固体物质接触时界面反应的信息。

数据有两种来源方式:

  1. 用户可使用Materials Project API来获取化合物的能量,需要用户提供自己MP账户的API—KEY。
  2. 用户可使用本文中的链接数据集,作者已经从MP中下载并重新组织,以se_reactions.csv命名。
代码
文本

1. 安装pymatgen并导入相关模块

代码
文本
[1]
# 首先安装pymatgen及其依赖
!pip install pymatgen --quiet
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
代码
文本
[2]
# 导入反应计算模块ComputedEntry
# from pymatgen.analysis.interface_reactions import InterfacialReactivity, GrandPotentialInterfacialReactivity
# from pymatgen.analysis.phase_diagram import GrandPotentialPhaseDiagram, PhaseDiagram
from pymatgen.core import Composition, Element
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.analysis.reaction_calculator import ComputedReaction
from pymatgen.core.units import FloatWithUnit
#from pymatgen.ext.matproj import MPRester
import pandas as pd
# %matplotlib inline
代码
文本

2.读取多组元体系中的化合物数据

首先,为了读取se_reactions.csv中的数据,我们先定义一个函数df_to_entries(df),将csv的数据读入pandas,并转换为pymatgen中要求的entries条目格式,注意entries是一个list。

代码
文本
[3]
# 通过API-KEY来获取Li-Co-O-P-S五元系中的化合物数据
#from pymatgen.ext.matproj import MPRester
# mpr = MPRester()
# Chemical formulae for two solid reactants.
# reactant1 = "LiCoO2"
# reactant2 = "Li3PS4"
# Get the compositions of the reactants
# comp1 = Composition(reactant1)
# comp2 = Composition(reactant2)

# Gather all elements involved in the chemical system.
# elements = [e.symbol for e in comp1.elements + comp2.elements]
# if grand:
# elements.append(open_el)
# elements = list(set(elements)) # Remove duplicates

# Get all entries in the chemical system
# entries = mpr.get_entries_in_chemsys(elements)
代码
文本
[4]
# 将entries中的条目读入pandas的dataframe中,更好的展示
#def get_df_from_entries(entries):
# formulas = [e.composition.reduced_formula for e in entries]
# energies = [e.energy_per_atom for e in entries]
# spacegroups = [e.structure.get_space_group_info()[0] for e in entries]
# structures = [e.structure for e in entries]

# data = {"formula": formulas, "energy": energies, "spacegroup": spacegroups, "entry":entries}

# df = pandas.DataFrame(data).sort_values("energy")

# return df
代码
文本
[5]
# 函数df_to_entries(df)用于将pandas的dataframe数据转换为pymatgen中的entries
def df_to_entries(df):
entries = []
for i in range(len(df)):
#print(df.loc[i, "formula"], df.loc[i, "energy"])
entry = ComputedEntry(df.loc[i, "formula"],float(df.loc[i, "energy"]))
entries.append(entry)
return entries
代码
文本
[6]
# 读取se_reactions.csv,里面包括Li-P-S-Co-O五元系中的所有化合物数据条目
df = pd.read_csv('/bohr/se-ynn5/v1/se_reactions.csv')
print(df)
entries = df_to_entries(df)
     Unnamed: 0    formula    energy spacegroup  \
0           576  Co3(PO4)2 -7.680226     P2_1/c   
1           165    Co2P2O7 -7.678860     P2_1/c   
2           168    Co2P2O7 -7.675357     P2_1/c   
3           105    Co2P2O7 -7.669239         P1   
4           125    Co2P2O7 -7.668915         P1   
..          ...        ...       ...        ...   
937          45          P -1.894303     P4/nmm   
938         438         Li -1.890345     P6/mmm   
939         441         Li -1.853543       Cmce   
940         445         Li -1.647124     P4_132   
941         226   LiCoP2O7 -1.574601         P1   

                                                 entry  
0    mp-19264-GGA+U ComputedStructureEntry - Co6 P4...  
1    mp-20274-GGA+U ComputedStructureEntry - Co8 P8...  
2    mp-550468-GGA+U ComputedStructureEntry - Co4 P...  
3    mp-550886-GGA+U ComputedStructureEntry - Co4 P...  
4    mp-20283-GGA+U ComputedStructureEntry - Co4 P4...  
..                                                 ...  
937  mp-723897-GGA ComputedStructureEntry - P4     ...  
938  mp-1063005-GGA ComputedStructureEntry - Li3   ...  
939  mp-1103107-GGA ComputedStructureEntry - Li12  ...  
940  mp-604313-GGA ComputedStructureEntry - Li4    ...  
941  mp-727147-GGA+U ComputedStructureEntry - Li4 C...  

[942 rows x 5 columns]
代码
文本
[7]
# 由于同一种化学式对应多个计算结果,需找到给定化学组成下最稳定的结构和能量,作为反应物和生成物。因此定义一个函数get_most_stable_entry(formula)
def get_most_stable_entry(formula):
relevant_entries = [
entry
for entry in entries
if entry.composition.reduced_formula == Composition(formula).reduced_formula
]
relevant_entries = sorted(relevant_entries, key=lambda e: e.energy_per_atom)
return relevant_entries[0]
代码
文本

以Li3PS4和Li反应为例,Wu2023等在Thermal Stability of Sulfide Solid Electrolyte with Lithium Metal中给出了反应方程式,我们将利用pymatgen计算如下方程式的反应能量: image.png

代码
文本

3.找到最稳定的化合物

在Li-P-S-Co-O五元系中找到给定化学组成(Li,Li3PS4,Li3P,Li2S,LiP,Li3P7,LiP7,P)最稳定的化合物

代码
文本
[8]
Li = get_most_stable_entry("Li")
Li3PS4 = get_most_stable_entry("Li3PS4")
Li3P = get_most_stable_entry("Li3P")
Li2S = get_most_stable_entry("Li2S")
LiP = get_most_stable_entry("LiP")
Li3P7 = get_most_stable_entry("Li3P7")
LiP7 = get_most_stable_entry("LiP7")
P = get_most_stable_entry("P")
print(Li,Li3PS4,Li3P,Li2S,LiP,Li3P7,LiP7,P)
None ComputedEntry - Li1          (Li)
Energy (Uncorrected)     = -1.9089   eV (-1.9089  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -1.9089   eV (-1.9089  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li3 P1 S4    (Li3PS4)
Energy (Uncorrected)     = -4.6433   eV (-0.5804  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -4.6433   eV (-0.5804  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li3 P1       (Li3P)
Energy (Uncorrected)     = -3.4816   eV (-0.8704  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -3.4816   eV (-0.8704  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li2 S1       (Li2S)
Energy (Uncorrected)     = -4.1552   eV (-1.3851  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -4.1552   eV (-1.3851  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li1 P1       (LiP)
Energy (Uncorrected)     = -4.1844   eV (-2.0922  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -4.1844   eV (-2.0922  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li3 P7       (Li3P7)
Energy (Uncorrected)     = -4.7216   eV (-0.4722  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -4.7216   eV (-0.4722  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - Li1 P7       (LiP7)
Energy (Uncorrected)     = -5.1305   eV (-0.6413  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -5.1305   eV (-0.6413  eV/atom)
Energy Adjustments:
  None
Parameters:
Data: None ComputedEntry - P1           (P)
Energy (Uncorrected)     = -5.4133   eV (-5.4133  eV/atom)
Correction               = 0.0000    eV (0.0000   eV/atom)
Energy (Final)           = -5.4133   eV (-5.4133  eV/atom)
Energy Adjustments:
  None
Parameters:
Data:
代码
文本

4.定义反应方程式并计算反应能

代码
文本

定义第一个反应:反应物为Li和Li3PS4,生成物为Li3P和Li2S,计算反应能

代码
文本
[9]
reaction1 = ComputedReaction([Li, Li3PS4], [Li3P,Li2S])
energy = FloatWithUnit(reaction1.calculated_reaction_energy, "eV atom^-1")
print("Caculated")
print(reaction1)
print("Reaction energy = {}".format(energy.to("kJ mol^-1")))
Caculated
8 Li + Li3PS4 -> Li3P + 4 Li2S
Reaction energy = -18.11612066404043 kJ mol^-1
<function print>
代码
文本

定义第二个反应:反应物为Li和Li3PS4,生成物为LiP和Li2S,计算反应能

代码
文本
[10]
reaction2 = ComputedReaction([Li, Li3PS4], [LiP,Li2S])
energy = FloatWithUnit(reaction2.calculated_reaction_energy, "eV atom^-1")
print("Caculated")
print(reaction2)
print("Reaction energy = {}".format(energy.to("kJ mol^-1")))
Caculated
6 Li + Li3PS4 -> LiP + 4 Li2S
Reaction energy = -454.2896983267883 kJ mol^-1
<function print>
代码
文本

定义第三个反应:反应物为Li和Li3PS4,生成物为Li3P7和Li2S,计算反应能

代码
文本
[11]
reaction3 = ComputedReaction([Li, Li3PS4], [Li3P7,Li2S])
energy = FloatWithUnit(reaction3.calculated_reaction_energy, "eV atom^-1")
print("Caculated")
print(reaction3)
print("Reaction energy = {}".format(energy.to("kJ mol^-1")))
Caculated
38 Li + 7 Li3PS4 -> Li3P7 + 28 Li2S
Reaction energy = -1546.2120547856664 kJ mol^-1
<function print>
代码
文本

定义第四个反应:反应物为Li和Li3PS4,生成物为LiP7和Li2S,计算反应能

代码
文本
[12]
reaction4 = ComputedReaction([Li, Li3PS4], [LiP7,Li2S])
energy = FloatWithUnit(reaction4.calculated_reaction_energy, "eV atom^-1")
print("Caculated")
print(reaction4)
print("Reaction energy = {}".format(energy.to("kJ mol^-1")))
Caculated
36 Li + 7 Li3PS4 -> LiP7 + 28 Li2S
Reaction energy = -1954.0343558785878 kJ mol^-1
<function print>
代码
文本

定义第五个反应:反应物为Li和Li3PS4,生成物为P和Li2S,计算反应能

代码
文本
[13]
reaction5 = ComputedReaction([Li, Li3PS4], [P,Li2S])
energy = FloatWithUnit(reaction5.calculated_reaction_energy, "eV atom^-1")
print("Caculated")
print(reaction5)
print("Reaction energy = {}".format(energy.to("kJ mol^-1")))
Caculated
5 Li + Li3PS4 -> P + 4 Li2S
Reaction energy = -757.0471304616628 kJ mol^-1
<function print>
代码
文本

5. 总结:

本文以Li3PS4和Li反应为例,介绍了如何在pymatgen中进行反应能的计算,读者可以基于上述数据集尝试计算Li-Co-O-P-S体系中其他的化学反应,以加深理解。

代码
文本
pymatgen
reaction analysis
pymatgen reaction analysis
已赞2
本文被以下合集收录
材料计算
虚白
更新于 2024-08-25
20 篇5 人关注
固态电解质
JackeyHall
更新于 2024-06-19
3 篇0 人关注
推荐阅读
公开
AI+电芯 | 基于LSTM和GRU模型的SOH预测¶
AI+电芯中文锂电池
AI+电芯中文锂电池
JiaweiMiao
发布于 2023-09-14
2 赞2 转存文件
公开
SEI碰上电解液:剪不断,理还乱
中文电化学测试对比学习
中文电化学测试对比学习
深水鱼
发布于 2023-10-20
4 赞3 转存文件