LoginSignup
3
5

More than 3 years have passed since last update.

【pymatgen】まずは元素と化合物の情報ぐらい取得したいよね!

Last updated at Posted at 2021-03-27

はじめに

ということで、pymatgenを使っての元素と化合物の情報の取得について解説していきます。

※マテリアルズインフォマティクス関係の内容を他にも投稿していますので、よろしければこちらの一覧から他の投稿も見て頂けますと幸いです。

pymatgenを使っての情報の取得

環境

  • windows10
  • conda 4.9.2
  • python 3.7.1
  • pymatgen 2020.4.29

元素の情報の取得

例として鉄(Fe)の情報を取得していきます。

# ライブラリのインポート
# pymatgen.core.periodic_table moduleのElementクラス
from pymatgen.core.periodic_table import Element

# 鉄Feを指定する
fe = Element("Fe")

鉄に関する情報を見ていきます。

fe.data
出力結果
{'Atomic mass': 55.845,
 'Atomic no': 26,
 'Atomic orbitals': {'1s': -254.225505,
  '2p': -25.551766,
  '2s': -29.56486,
  '3d': -0.295049,
  '3p': -2.187523,
  '3s': -3.360621,
  '4s': -0.197978},
 'Atomic radius': 1.4,
 'Atomic radius calculated': 1.56,
 'Boiling point': '3134 K',
 'Brinell hardness': '490 MN m<sup>-2</sup>',
 'Bulk modulus': '170 GPa',
 'Coefficient of linear thermal expansion': '11.8 x10<sup>-6</sup>K<sup>-1</sup>',
 'Common oxidation states': [2, 3],
 'Critical temperature': 'no data K',
 'Density of solid': '7874 kg m<sup>-3</sup>',
 'Electrical resistivity': '10 10<sup>-8</sup> &Omega; m',
 'Electronic structure': '[Ar].3d<sup>6</sup>.4s<sup>2</sup>',
 'ICSD oxidation states': [2, 3],
 'Ionic radii': {'2': 0.92, '3': 0.785},
 'Ionic radii hs': {'2': 0.92, '3': 0.785},
 'Ionic radii ls': {'2': 0.75, '3': 0.69, '4': 0.725, '6': 0.39},
 'Liquid range': '1323 K',
 'Melting point': '1811 K',
 'Mendeleev no': 61,
 'Mineral hardness': '4.0',
 'Molar volume': '7.09 cm<sup>3</sup>',
 'Name': 'Iron',
 'Oxidation states': [-2, -1, 1, 2, 3, 4, 5, 6],
 'Poissons ratio': '0.29',
 'Reflectivity': '65 %',
 'Refractive index': 'no data',
 'Rigidity modulus': '82 GPa',
 'Shannon radii': {'2': {'IV': {'High Spin': {'crystal_radius': 0.77,
     'ionic_radius': 0.63}},
   'IVSQ': {'High Spin': {'crystal_radius': 0.78, 'ionic_radius': 0.64}},
   'VI': {'Low Spin': {'crystal_radius': 0.75, 'ionic_radius': 0.61},
    'High Spin': {'crystal_radius': 0.92, 'ionic_radius': 0.78}},
   'VIII': {'High Spin': {'crystal_radius': 1.06, 'ionic_radius': 0.92}}},
  '3': {'IV': {'High Spin': {'crystal_radius': 0.63, 'ionic_radius': 0.49}},
   'V': {'': {'crystal_radius': 0.72, 'ionic_radius': 0.58}},
   'VI': {'Low Spin': {'crystal_radius': 0.69, 'ionic_radius': 0.55},
    'High Spin': {'crystal_radius': 0.785, 'ionic_radius': 0.645}},
   'VIII': {'High Spin': {'crystal_radius': 0.92, 'ionic_radius': 0.78}}},
  '4': {'VI': {'': {'crystal_radius': 0.725, 'ionic_radius': 0.585}}},
  '6': {'IV': {'': {'crystal_radius': 0.39, 'ionic_radius': 0.25}}}},
 'Superconduction temperature': 'no data K',
 'Thermal conductivity': '80 W m<sup>-1</sup> K<sup>-1</sup>',
 'Van der waals radius': 'no data',
 'Velocity of sound': '4910 m s<sup>-1</sup>',
 'Vickers hardness': '608 MN m<sup>-2</sup>',
 'X': 1.83,
 'Youngs modulus': '211 GPa',
 'NMR Quadrupole Moment': {'Fe-57': 160.0},
 'Metallic radius': 1.277,
 'iupac_ordering': 64,
 'IUPAC ordering': 64}

原子軌道や熱力学的・光学的な様々な情報が取得できたことが分かります。各情報の意味については公式ドキュメントに詳細が記載されています。例として"atomic_orbitals"に関する情報を以下のコードで取得してみます。

fe.atomic_orbitals
出力結果
{'1s': -254.225505,
 '2p': -25.551766,
 '2s': -29.56486,
 '3d': -0.295049,
 '3p': -2.187523,
 '3s': -3.360621,
 '4s': -0.197978}

なお"atomic_orbitals"の意味を公式ドキュメントから引用します。

Atomic Orbitals. Energy of the atomic orbitals as a dict. E.g., The orbitals energies in eV are represented as {‘1s’: -1.0, ‘2s’: -0.1} Data is obtained from https://www.nist.gov/pml/data/atomic-reference-data-electronic-structure-calculations The LDA values for neutral atoms are used

原子軌道のエネルギーがeV単位でdict型で保持されていることが分かります。

化合物の情報の取得

続いて、酸化鉄(Fe2O3)の情報を取得していきます。

# ライブラリのインポート
from pymatgen.core.composition import Composition

# 酸化鉄Fe2O3を指定する
comp = Composition("Fe2O3")

compがどのような情報を保持しているかは公式ドキュメントに詳しく書かれています。例として、以下でいくつかcompの情報を取得してみます。

# 酸化鉄Fe2O3の総電子を確認する
comp.total_electrons
出力結果
76.0
# 酸化鉄Fe2O3の原子数を確認する
comp.num_atoms
出力結果
5.0
# 酸化鉄Fe2O3の構成元素数を確認する
comp.formula
出力結果
'Fe2 O3'

Materials Projectからの化合物データの取得

比較としてMaterials ProjectのAPI経由で化合物情報を取得してみます。

from pymatgen.ext.matproj import MPRester

# Materials Project の API キーの入力
API_KEY = 'Your API'

with MPRester(API_KEY) as m:
    comp2 = m.get_data('Fe2O3',data_type='vasp')

取得したFe2O3の数を確認します。

len(comp2)
出力結果
25

この25個という数はMaterials ProjectでFe2O3を検索してヒットした数と一致します。

fe2o3.png

一番最初のFe2O3のデータを例として、どのようなデータが保持されているのか確認します。

comp2[0]
出力結果
{'energy': -65.81149931,
 'energy_per_atom': -6.581149931000001,
 'volume': 147.9870645187782,
 'formation_energy_per_atom': -1.7389439480000006,
 'nsites': 10,
 'unit_cell_formula': {'Fe': 4.0, 'O': 6.0},
 'pretty_formula': 'Fe2O3',
 'is_hubbard': True,
 'elements': ['Fe', 'O'],
 'nelements': 2,
 'e_above_hull': 0.16812650900000037,
 'hubbards': {'Fe': 5.3, 'O': 0.0},
 'is_compatible': True,
 'spacegroup': {'symprec': 0.1,
  'source': 'spglib',
  'symbol': 'C2/c',
  'number': 15,
  'point_group': '2/m',
  'crystal_system': 'monoclinic',
  'hall': '-C 2yc'},
 'task_ids': ['mp-1181824', 'mp-1928540'],
 'band_gap': 1.6876999999999998,
 'density': 3.5836712544749023,
 'icsd_id': None,
 'icsd_ids': [],
 'cif': "# generated using pymatgen\ndata_Fe2O3\n_symmetry_space_group_name_H-M   'P 1'\n_cell_length_a   14.68425139\n_cell_length_b   5.35504845\n_cell_length_c   7.80977045\n_cell_angle_alpha   131.67234255\n_cell_angle_beta   160.07180482\n_cell_angle_gamma   44.99101443\n_symmetry_Int_Tables_number   1\n_chemical_formula_structural   Fe2O3\n_chemical_formula_sum   'Fe4 O6'\n_cell_volume   147.98706452\n_cell_formula_units_Z   2\nloop_\n _symmetry_equiv_pos_site_id\n _symmetry_equiv_pos_as_xyz\n  1  'x, y, z'\nloop_\n _atom_site_type_symbol\n _atom_site_label\n _atom_site_symmetry_multiplicity\n _atom_site_fract_x\n _atom_site_fract_y\n _atom_site_fract_z\n _atom_site_occupancy\n  Fe  Fe0  1  0.57774500  0.10514000  0.50515800  1\n  Fe  Fe1  1  0.42225500  0.89486000  0.49484200  1\n  Fe  Fe2  1  0.07258600  0.60514000  0.49484200  1\n  Fe  Fe3  1  0.92741400  0.39486000  0.50515800  1\n  O  O4  1  0.25110200  0.99687300  0.99731600  1\n  O  O5  1  0.23728400  0.25000000  0.47456700  1\n  O  O6  1  0.74621400  0.50312700  0.99731600  1\n  O  O7  1  0.74889800  0.00312700  0.00268400  1\n  O  O8  1  0.76271600  0.75000000  0.52543300  1\n  O  O9  1  0.25378600  0.49687300  0.00268400  1\n",
 'total_magnetization': 9.99999055,
 'material_id': 'mp-1181824',
 'oxide_type': 'oxide',
 'tags': [],
 'elasticity': None,
 'piezo': None,
 'diel': None,
 'deprecated': False,
 'full_formula': 'Fe4O6'}

各情報の意味はこちらの投稿にまとめています。Materials Projectから取得されるデータは個別のFe2O3に着目するときに有用な印象を受けました。

まとめ

pymatgenを使っての元素と化合物の情報の取得について解説いたしました。

参考

3
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
5