原子電荷・スピン

磁気秩序の比較

初期スピンの与え方を変えて、非磁性・強磁性・反強磁性の状態のエネルギーを比較します。

カテゴリ
原子電荷・スピン
使用する機能
atoms.arrays["spin"]spin_typescf_converged
スクリプト
magnetic_ordering.py

スピン分極計算では、SCF 計算がどの磁気状態に収束するかは初期スピンに依存します。atoms.arrays["spin"] に与える初期スピンの符号を変えることで、強磁性 (FM) や反強磁性 (AFM) の配列を指定できます。

magnetic_ordering.pyダウンロード
"""
Advance/OF-DFT example: compare magnetic orderings of bcc Fe.

The magnetic ordering is selected by the initial spins given in atoms.arrays["spin"].

Copyright (C) 2026 AdvanceSoft Corporation, All rights reserved.
"""

import numpy as np
from ase.build import bulk
from ase.units import Hartree

from aofdft.calculator import AOFDFTCalculator

VPS_DIR = "path/to/DFT_DATA19_AS/VPS"  # edit these two paths for your environment
PAO_DIR = "path/to/DFT_DATA19_AS/PAO"

params = dict(
    console   = False,
    kin_type  = "AS26",
    kin_model = "Crystal26",
    vps_dir   = VPS_DIR,
    pao_dir   = PAO_DIR,
    e_cut     = 180 * Hartree,
    n_grids   = (96, 96, 96),  # a multiple of 6, so that all atoms sit alike on the FFT grid
)

# label -> initial spins of the corner and body-center atoms of the cubic cell (None = non-magnetic)
orderings = {
    "NM" : None,
    "FM" : [1.0, 1.0],
    "AFM": [1.0, -1.0],
}

results = {}
for label, spins in orderings.items():
    atoms = bulk("Fe", "bcc", a=2.87, cubic=True).repeat((3, 3, 3))  # 54 atoms

    if spins is None:
        atoms.calc = AOFDFTCalculator(logging_file=f"fe_{label}.log", **params)
    else:
        atoms.arrays["spin"] = spins * (len(atoms) // 2)
        atoms.calc = AOFDFTCalculator(
            logging_file = f"fe_{label}.log",
            spin_type    = "polarized",
            scf_style    = "magnetic",
            **params,
        )

    results[label] = atoms.get_potential_energy() / len(atoms)

    # spins of the corner and body-center atoms, and the range of |spin| over all atoms
    spin = atoms.arrays["spin"] if spins is not None else np.zeros(len(atoms))
    print(f"{label:3s}: spins = [{spin[0]:+.3f}, {spin[1]:+.3f}], |spin| of all atoms = "
          f"{np.abs(spin).min():.3f} ... {np.abs(spin).max():.3f}, converged = {atoms.calc.scf_converged}")

print()
for label in ("NM", "AFM"):
    print(f"E({label}) - E(FM) = {(results[label] - results['FM']) * 1000.0:+.1f} meV/atom")

実行結果の例

text
NM : spins = [+0.000, +0.000], |spin| of all atoms = 0.000 ... 0.000, converged = True
FM : spins = [+1.883, +1.883], |spin| of all atoms = 1.883 ... 1.883, converged = True
AFM: spins = [+1.859, -1.859], |spin| of all atoms = 1.859 ... 1.859, converged = True

E(NM) - E(FM) = +296.5 meV/atom
E(AFM) - E(FM) = +32.7 meV/atom

3 つの状態のうち、強磁性 (FM) が最も安定という結果になっています。

ポイント

  • 初期スピンは原子ごとに符号つきで与えます。[1.0, -1.0] のように逆符号にすると、反強磁性の配列から SCF 計算が始まります。スクリプトでは、立方晶セル 1 個ぶんの 2 原子の値を、セル全体に繰り返して与えています。
  • 非磁性 (NM) の計算は、spin_type を指定しない (既定の "non-polarized") ことで行います。
  • 計算後の atoms.arrays["spin"] を確認して、意図した磁気状態に収束したかを必ず確かめてください。初期値と異なる状態へ移ることがあります。スクリプトでは、頂点と体心の原子のスピンに加えて、全原子のスピンの絶対値の範囲を出力しています。
  • 反強磁性の配列を表現するには、磁気的な単位胞に合わせたスーパーセルが必要です。ここでは bcc の立方晶セル (2 原子) を単位にして、頂点と体心のスピンを逆向きにしています。
  • セルには、立方晶セルを 3×3×3 に繰り返したもの (54 原子) を使っています。v1.0.0 では、周期の短いセルで計算すると結果が変わるためです。
  • FFT グリッドは n_grids=(96, 96, 96) で指定しています。このセルでは、グリッド数が 6 の倍数のとき、すべての原子がグリッドに対して同じ位置になります。e_cut から決まる既定のグリッド (98) ではそうならず、v1.0.0 では原子ごとにスピンの異なる状態に収束します。
  • 磁気状態間のエネルギー差は小さいことが多いため、カットオフエネルギー、グリッド、収束閾値をそろえて比較してください。bcc Fe では、全エネルギーがグリッドの細かさに強く依存します。異なるセルやグリッドで計算したエネルギーどうしは比べないでください。