materials project
matminer.data_retrieval.retrieve_MP.MPDataRetrieval获取materials project数据
from matminer.data_retrieval.retrieve_MP import MPDataRetrieval
mpdr=MPDataRetrieval(api_key='')
#得到所有元素材料的密度,例如那些包含一个元素的材料
df=mpdr.get_dataframe(criteria={
'nelements':1},
properties=['density','pretty_formula'])
print('there are %d enties on MP with 1 element'%(df['density'].count()))
0%| | 0/716 [00:00<?, ?it/s]
there are 716 enties on MP with 1 element
获取大于4.0 eV 的所有带隙
带隙是 band_gap,大于4怎么写呢? 是 greater than, 缩写成 gt. 在 matminer中要写成 $gt
df=mpdr.get_dataframe({
'band_gap':{
'$gt':4.0}},['pretty_formula','band_gap'])
0%| | 0/8285 [00:00<?, ?it/s]
df.head()
pretty_formula | band_gap | |
---|---|---|
material_id | ||
mp-10080 | PrGeBO5 | 4.0136 |
mp-1020145 | Na2Ge(S2O7)3 | 4.0030 |
mp-1021327 | KLiICl | 4.0542 |
mp-1029718 | CsC2N3 | 4.0731 |
mp-1029920 | Y2(CN2)3 | 4.0364 |
Get all VRH shear and bulk moduli from the “elasticity” sub-document for which no warnings are found
存在弹性常数信息用 “elasticity”: {“$exists”: True} 表示,没有警告信息用 一个空列表表示:“elasticity.warnings”: []
df=mpdr.get_dataframe({
"elasticity":{
"$exists":True}},
['pretty_formula','elasticity.K_VRH','elasticity.G_VRH'])
0%| | 0/13172 [00:00<?, ?it/s]
df.head()
pretty_formula | elasticity.K_VRH | elasticity.G_VRH | |
---|---|---|---|
material_id | |||
mp-10003 | Nb4CoSi | 191.0 | 97.0 |
mp-1001023 | BeC2 | 83.0 | 45.0 |
mp-1001788 | ZrB6 | 179.0 | 41.0 |
mp-1002122 | HfIr | 202.0 | 12.0 |
mp-1002206 | SiC | 241.0 | 176.0 |
除了上次的搜索条件外,我们想搜索包含 Pb 和 Te 的材料:“elements”: {“KaTeX parse error: Expected '}', got 'EOF' at end of input: …above_hull": {"lt”: 1e-6}
df=mpdr.get_dataframe(criteria={
"elasticity":{
'$exists':True},
'elasticity.warnings':[],
'elements':{
'$all':['Pb','Te']},
'e_above_hull':{
'$lt':1e-6}},
properties=['elasticity.K_VRH','elasticity.G_VRH',
'pretty_formula','e_above_hull','bandstructure',
'dos'])
让我们来看看
这些稳定化合物的能带结构和状态密度,这些化合物包含 Pb 和 Te,这对热电学应用很有意思:
df.head()
elasticity.K_VRH | elasticity.G_VRH | pretty_formula | e_above_hull | bandstructure | dos | |
---|---|---|---|---|---|---|
material_id | ||||||
mp-19717 | 40.0 | 24.0 | TePb | 0 | <pymatgen.electronic_structure.bandstructure.B... | Complete DOS for Full Formula (Te1 Pb1)\ |