template_pymatgen プログラム仕様
Pymatgenライブラリの各種機能を実演するスクリプトです。
本スクリプトは、CIFファイルを読み込み、その構造に対して様々な解析(基本情報、対称性、XRDシミュレーション、密度計算、空間群操作など)を実行します。 Pymatgenの主要なクラスである`Structure`, Element, Composition, SpacegroupAnalyzer, `XRDCalculator`などの利用方法を示します。
関連リンク: template_pymatgen.py 技術ドキュメント
- crystal.template_pymatgen.analyze_detailed_cif_info(structure: Structure)[ソース]
Structureオブジェクトから、元の構造と対称化された構造の詳細情報(格子、対称操作、サイト)を表示します。
`SpacegroupAnalyzer`を使用して構造の対称性を解析し、`_print_structure_details`ヘルパー関数を呼び出します。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure
- crystal.template_pymatgen.analyze_element_and_composition()[ソース]
Structureオブジェクトに依存しない、`Element`と`Composition`クラスの操作をテストし、表示します。
`Element`の基本的なプロパティ、`Composition`の還元化学式と`almost_equals`メソッドの利用を示します。
- crystal.template_pymatgen.analyze_sites_and_neighbors(structure: Structure)[ソース]
構造内のサイトを反復処理し、特定の原子種(金属)のサイトを抽出し、その近傍原子を検索します。
Pymatgenの`site.specie.is_metal`プロパティと`structure.get_neighbors()`メソッドを使用します。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure
- crystal.template_pymatgen.analyze_structure_basic(structure: Structure)[ソース]
Structureオブジェクトの基本的なプロパティ(格子、空間群、組成)を表示します。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure
- crystal.template_pymatgen.classify_symop_spg(op: SymmOp, tol=1e-05)[ソース]
SymmOpを受け取り、その対称操作を分類して文字列で返します。
回転行列の行列式と並進ベクトルの有無に基づいて、Identity、Pure Translation、Inversion、 Rotation (or Screw)、Mirror (or Glide) のいずれかに分類します。
:param : :type : param op: 分類するPymatgenのSymmOpオブジェクト。 :param : :type : type op: SymmOp :param : :type : param tol: 浮動小数点比較の許容誤差。 :param : :type : type tol: float, optional
- 戻り値:
returns: 対称操作の種類を表す文字列。
rtype: str
- crystal.template_pymatgen.expand_coordinates(ispg: int, xyz_str: str, rmin: float = 1e-05) List[ndarray][ソース]
指定された空間群の対称操作で分率座標を展開し、重複を排除して表示します。
:param : :type : param ispg: 空間群の国際数(International Number)。 :param : :type : type ispg: int :param : :type : param xyz_str: 展開する分率座標の文字列 (例: "0.1, 0.2, 0.3")。 :param : :type : type xyz_str: str :param : :type : param rmin: 重複を判断するための最小距離許容値 (トーラス距離)。 :param : :type : type rmin: float, optional
- 戻り値:
returns: 独立な展開座標のNumPy配列のリスト。
rtype: List[numpy.ndarray]
- crystal.template_pymatgen.format_transform_spg(matrix, translation_vector)[ソース]
回転行列と並進ベクトルを座標変換の数式としてフォーマットします。
例: (x, y, z) -> (x+0.5, -y, z+0.5)
:param : :type : param matrix: 3x3の回転行列。 :param : :type : type matrix: numpy.ndarray or list[list[float]] :param : :type : param translation_vector: 3要素の並進ベクトル。 :param : :type : type translation_vector: numpy.ndarray or list[float]
- 戻り値:
returns: フォーマットされた座標変換の数式文字列。
rtype: str
- crystal.template_pymatgen.guess_oxidation_states(structure: Structure)[ソース]
組成に基づいて酸化数と総電荷を推定し、表示します。
Pymatgenの`composition.oxi_state_guesses()`メソッドを使用して、可能な酸化数の組み合わせを試行します。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure
- crystal.template_pymatgen.main()[ソース]
CIFファイルを読み込み、すべての解析関数を順次実行します。
コマンドライン引数からCIFファイルを指定でき、デフォルトでは`ZnO.cif`を使用します。 ファイルが見つからない場合や解析中にエラーが発生した場合は、適切なエラーメッセージを表示して終了します。
- crystal.template_pymatgen.perform_primitive_conversion(structure: Structure, sym_tol: float = 0.01, density_eps: float = 0.0001)[ソース]
元の構造を Primitive Standard Structureに変換し、変換前後で密度が一致するか検証します。
`SpacegroupAnalyzer.get_primitive_standard_structure()`を使用して原始単位格子を抽出し、 `report_structure_density`ヘルパー関数で密度を比較します。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure :param : :type : param sym_tol: 対称性を判断するための許容誤差。 :param : :type : type sym_tol: float, optional :param : :type : param density_eps: 変換前後の密度比較における許容誤差。 :param : :type : type density_eps: float, optional
- crystal.template_pymatgen.print_matrix(m)[ソース]
3x3行列を見やすいフォーマットで出力します。
:param : :type : param m: 出力する3x3の行列。 :param : :type : type m: list[list[float]] or numpy.ndarray
- crystal.template_pymatgen.report_structure_density(struct: Structure, label: str) Tuple[float, float][ソース]
構造の格子情報、サイト情報、密度をレポートします。
:param : :type : param struct: PymatgenのStructureオブジェクト。 :param : :type : type struct: Structure :param : :type : param label: 出力セクションのラベル。 :param : :type : type label: str
- 戻り値:
returns: 原子密度 (atoms/ų) と質量密度 (g/cm³) のタプル。
rtype: Tuple[float, float]
- crystal.template_pymatgen.simulate_xrd(structure: Structure)[ソース]
StructureオブジェクトからX線回折 (XRD) パターンを計算し、主要なピークを表示します。
Pymatgenの`XRDCalculator`クラスを使用して、Cu Kα線による回折パターンをシミュレーションします。
:param : :type : param structure: 解析対象のPymatgenのStructureオブジェクト。 :param : :type : type structure: Structure
- crystal.template_pymatgen.site_effective_occupancy_and_mass_amu(site) Tuple[float, float][ソース]
サイトの有効占有数 ($Sigma$ occ) と総質量 (amu) を計算します。
:param : :type : param site: PymatgenのSiteオブジェクト。 :param : :type : type site: pymatgen.core.sites.Site
- 戻り値:
returns: 有効占有数の合計とサイトの総質量 (amu) のタプル。
rtype: Tuple[float, float]