p>
この記事では材料研究に非常に有用なPythonライブラリ「Pymatgen」のインストール方法を紹介します。
※この記事はPymatgenの使用法・実例をまとめたPymatgenの使い方の一部です。
実行環境
- windows10 home edition
- RAM: 8GB
- SSD: 250GB
- conda: 4.9.0
- python: 3.7.4(Anaconda)
Python環境の整備
PymatgenはPythonライブラリです。当然Pythonが必要ですが、環境構築の容易さなどからAnacondaのインストールを推奨します。
Anacondaのインストール方法を参考にインストールします。ここで注意点が一つ。Pythonファイルをダブルクリックして実行したい場合、セットアップ内の「Add Anaconda3 to my PATH environment variable」にチェックを入れる必要があります。
インストールできたらAnaconda Promptを開きましょう。

Pymatgenのインストール
- Anaconda Promptで
conda install --channel conda-forge pymatgen
を入力してEnter
- Proceed ([y]/n)?にyで答える

これでインストール完了です。
正常にインストールされたか確認
Anaconda Prompt上でPython
と打ちます。
するとインタラクティブモードになりました。この状態では、1行ずつPythonプログラムを実行できます。

ここでimport pymatgen
と打ちましょう。暫くして次の行に移動すれば、インストール完了です。

また試しにpymatgen.Element("Si").atomic_mass
と打ってみましょう。

Siの原子量が出てきました。
その他のPymatgenの使用法についてはPymatgenの使い方をご覧ください。
※この記事はPymatgenの使用法・実例をまとめたPymatgenの使い方の一部です。
目次
実行環境
Python環境の整備
PymatgenはPythonライブラリです。当然Pythonが必要ですが、環境構築の容易さなどからAnacondaのインストールを推奨します。
Anacondaのインストール方法を参考にインストールします。ここで注意点が一つ。Pythonファイルをダブルクリックして実行したい場合、セットアップ内の「Add Anaconda3 to my PATH environment variable」にチェックを入れる必要があります。
インストールできたらAnaconda Promptを開きましょう。

Pymatgenのインストール
conda install --channel conda-forge pymatgen
を入力してEnterこれでインストール完了です。
正常にインストールされたか確認
Anaconda Prompt上で
Python
と打ちます。するとインタラクティブモードになりました。この状態では、1行ずつPythonプログラムを実行できます。

ここで

import pymatgen
と打ちましょう。暫くして次の行に移動すれば、インストール完了です。また試しに

pymatgen.Element("Si").atomic_mass
と打ってみましょう。Siの原子量が出てきました。
その他のPymatgenの使用法についてはPymatgenの使い方をご覧ください。