原子電荷・スピン

スピンモーメントを固定した計算

セル全体のスピンモーメントを固定して SCF 計算を行い、磁化に対するエネルギーの変化を調べます。

カテゴリ
原子電荷・スピン
使用する機能
total_spine_fermi_upe_fermi_dwspin_type
スクリプト
fixed_spin_moment.py

total_spin を指定すると、セル全体のスピンモーメントをその値に固定したまま SCF 計算を行います (Fixed Spin Moment 法)。磁化の関数としてエネルギーを求めることで、磁気状態の安定性を調べられます。

fixed_spin_moment.pyダウンロード
"""
Advance/OF-DFT example: fixed spin moment calculation (energy versus magnetization).

`total_spin` fixes the total spin moment of the cell. The up and down electrons
then have different Fermi energies.

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

import matplotlib.pyplot as plt
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"

# spin moment per atom: 0 - 2.0, with a finer step near the energy minimum
moments = np.concatenate([np.arange(0.0, 1.5, 0.25), np.arange(1.5, 2.01, 0.05)])
rows    = []

for moment in moments:
    atoms = bulk("Fe", "bcc", a=2.87).repeat((3, 3, 3))  # 3x3x3 primitive cells, 27 atoms
    atoms.arrays["spin"] = [moment] * len(atoms)

    atoms.calc = AOFDFTCalculator(
        console      = False,
        logging_file = f"fe_fsm_{moment:.2f}.log",
        kin_type     = "AS26",
        kin_model    = "Crystal26",
        vps_dir      = VPS_DIR,
        pao_dir      = PAO_DIR,
        e_cut        = 180 * Hartree,
        spin_type    = "polarized",
        scf_style    = "magnetic",
        total_spin   = moment * len(atoms),  # total spin moment of the cell is fixed
    )

    energy = atoms.get_potential_energy() / len(atoms)
    calc   = atoms.calc
    rows.append((moment, energy, calc.e_fermi_up, calc.e_fermi_dw))

# energy relative to the minimum, in meV/atom
relative = (np.array([row[1] for row in rows]) - min(row[1] for row in rows)) * 1000.0

print(" M/atom | E - E_min (meV/atom) | E_F(up) (eV) | E_F(down) (eV)")
for (moment, _, e_up, e_dw), e_rel in zip(rows, relative):
    print(f" {moment:6.2f} | {e_rel:20.2f} | {e_up:12.4f} | {e_dw:14.4f}")

plt.plot(moments, relative, marker="o")
plt.xlabel("Spin moment per atom")
plt.ylabel("Relative energy (meV/atom)")
plt.tight_layout()
plt.savefig("fe_fixed_spin_moment.png", dpi=150)
print("Saved fe_fixed_spin_moment.png")

実行結果の例

v1.0.0 (Crystal26) の結果です。エネルギーは、最小の値を基準にした 1 原子あたりの差です。

text
 M/atom | E - E_min (meV/atom) | E_F(up) (eV) | E_F(down) (eV)
   0.00 |               309.06 |     -13.1893 |       -13.1893
   0.25 |               298.46 |     -13.2295 |       -13.0994
   0.50 |               270.92 |     -13.2361 |       -12.9934
   0.75 |               231.18 |     -13.2293 |       -12.8892
   1.00 |               180.30 |     -13.2041 |       -12.7844
   1.25 |               123.53 |     -13.1555 |       -12.6859
   1.50 |                62.18 |     -13.0364 |       -12.5767
   1.55 |                50.65 |     -13.0005 |       -12.5554
   1.60 |                39.60 |     -12.9580 |       -12.5341
   1.65 |                29.22 |     -12.9072 |       -12.5129
   1.70 |                20.09 |     -12.8468 |       -12.4930
   1.75 |                11.05 |     -12.7658 |       -12.4681
   1.80 |                 5.10 |     -12.6697 |       -12.4496
   1.85 |                 0.84 |     -12.5372 |       -12.4298
   1.90 |                 0.00 |     -12.3369 |       -12.4064
   1.95 |                 5.28 |     -11.9807 |       -12.3835
   2.00 |                27.78 |      -7.4269 |       -12.3609
Saved fe_fixed_spin_moment.png
bcc Fe のスピンモーメントに対する相対エネルギー (v1.0.0、Crystal26)。原子あたり 1.9 付近で最小になります。
bcc Fe のスピンモーメントに対する相対エネルギー (v1.0.0、Crystal26)。原子あたり 1.9 付近で最小になります。

エネルギーは、原子あたり 1.85〜1.90 で最小になります。スピンモーメントを固定しない計算で得られるスピン (1.88、スピン分極計算 (bcc Fe) を参照) と一致します。アップスピンとダウンスピンのフェルミエネルギーの大小は、この位置で入れ替わっています。

v1.0.0 (Crystal26) の bcc Fe では、固定するスピンモーメントが原子あたり 2.0 を超えると、全エネルギーが大きく低下します (2.05 で 0.19 eV/atom、2.5 で 1.9 eV/atom)。この範囲は現バージョンのモデルでは正しく扱えないため、この例では 0〜2.0 の範囲を計算しています。

ポイント

  • total_spin はセル全体のスピンモーメント (アップスピンとダウンスピンの電子数の差) です。原子あたりの値ではない点にご注意ください。
  • スピンモーメントを固定すると、アップスピンとダウンスピンの電子数がそれぞれ保存されるため、フェルミエネルギーがスピンごとに別の値になります。calc.e_fermi_up と calc.e_fermi_dw で取得できます。両者の差は、その磁化を保つために必要な有効磁場に対応します。
  • total_spin=None (既定) ではスピンモーメントは固定されず、e_fermi_up と e_fermi_dw は None になります。
  • 初期スピン atoms.arrays["spin"] は、固定する値と整合するように与えると収束が安定します。
  • 原子あたり 2.0 では、アップスピンの電子が原子あたりちょうど 5 個になります。この点でアップスピンのフェルミエネルギーが大きく変わり、エネルギーの増え方も急になっています。
  • セルには、bcc の基本単位格子を 3×3×3 に繰り返したもの (27 原子) を使っています。v1.0.0 では、周期の短いセルで計算すると結果が変わるためです。