磁性(第2部分)

第 2 部分:比较共线磁性结构的能量差#


5 使用 DFT+U 计算 NiO 的海森堡(Heisenberg)模型#

通过本教程,你将能够:

  • 确定 NiO 海森堡模型中最近邻和次近邻的耦合参数
  • 根据单胞尺寸缩放能量和 k 点网格

5.1 任务#

基于 U=8eV, J=0.95eV 的 LDA+U 计算,计算 NiO 海森堡模型中包含最近邻和次近邻的交换相互作用参数。

一个考虑了最近邻 $\langle i,j \rangle$ 和次近邻 $\langle\langle i,j \rangle\rangle$ 相互作用 $J_1$ 和 $J_2$ 的 NiO 海森堡模型可以写为

$$ H = -J_1 \sum_{\langle i,j \rangle} \vec{e}_i \cdot \vec{e}_j - J_2 \sum_{\langle\langle i,j \rangle\rangle} \vec{e}_i \cdot \vec{e}_j, $$

其中 $\vec{e}_i, \vec{e}_j$ 是沿原位磁矩方向的单位矢量。我们希望考虑一种铁磁(FM)序和两种反铁磁(AFM)序,一种是对 $(001)/(110)$ 平面进行排序的序(AF1),另一种是对 $(111)$ 平面进行排序的序(AF2)。海森堡模型下的每个配方单位的能量为

$$ E_{FM} = E_0 - 6J_1 - 3 J_2, $$$$ E_{AF1} = E_0 + 2J_1 - 3 J_2, $$$$ E_{AF2} = E_0 + 3 J_2. $$

这组方程可用于根据 FM、AF1 和 AF2 序的总能量来表示交换相互作用参数 $J_1$ 和 $J_2$:

$$ J_1 = \frac{1}{8} \left(E_{AF1}-E_{FM}\right), $$$$ J_2 = \frac{1}{24} \left(4E_{AF2}-3E_{AF1}-E_{FM}\right). $$

使用共线磁性第一性原理计算,我们可以获得这些总能量,从而提供模型参数。如果可以通过求解模型哈密顿量来获取临界温度等其他性质,这一点尤其有用。

详细讨论可在 Archer 等人的文献中找到,PRB 84, 115114 (2011)。

5.2 输入#

运行此示例所需的输入文件准备在 $TUTORIALS/magnetism/e05_NiO_Heisenberg 中。快去看看吧!

AFM2/POSCAR


AFM  NiO                                
   4.11908875913573               
     1.0000000000000000    0.5000000000000000    0.5000000000000000
     0.5000000000000000    1.0000000000000000    0.5000000000000000
     0.5000000000000000    0.5000000000000000    1.0000000000000000
   Ni   O 
     2     2
Direct
  0.0000000000000000  0.0000000000000000  0.0000000000000000
  0.5000000000000000  0.5000000000000000  0.5000000000000000
  0.2500000000000000  0.2500000000000000  0.2500000000000000
  0.7500000000000000  0.7500000000000000  0.7500000000000000

AFM1/POSCAR, FM/POSCAR


NiO
  4.11908875913573                   
     1.0000000000000000   0.0000000000000000    0.0000000000000000                      
     0.0000000000000000   1.0000000000000000    0.0000000000000000                      
     0.0000000000000000   0.0000000000000000    1.0000000000000000                                         
   Ni   O
   4    4
Direct
   0.0000000000000000         0.0000000000000000         0.0000000000000000         
   0.5000000000000000         0.5000000000000000         0.0000000000000000         
   0.5000000000000000         0.0000000000000000         0.5000000000000000         
   0.0000000000000000         0.5000000000000000         0.5000000000000000        
   0.5000000000000000         0.0000000000000000         0.0000000000000000         
   0.0000000000000000         0.5000000000000000         0.0000000000000000        
   0.0000000000000000         0.0000000000000000         0.5000000000000000         
   0.5000000000000000         0.5000000000000000         0.5000000000000000

AFM2/INCAR


SYSTEM   = NiO

ISTART   = 0

# Magnetism AFM2
ISPIN    = 2 
MAGMOM   = 5.0 -5.0 2*0 
LASPH    = T 

# FFT grid
ENCUT    = 450 
PREC     = Acc

# Convergence criterion
EDIFF    = 1E-7

# Smearing/k integration
ISMEAR   = -5
EFERMI   = MIDGAP

# Algorithm and density mixing
ALGO     = Normal
IMIX     = 4
AMIX     = 0.8
BMIX     = 0.00001
AMIX_MAG = 0.8
BMIX_MAG = 0.00001
LMAXMIX  = 4

# compute bandgap
BANDGAP = WEIGHT

# compute on-site moment
LORBIT  = 11

# Exchange-correlation functional
XC        = CA
LDAU      = .TRUE.
LDAUTYPE  = 2
LDAUL     = 2 -1
LDAUU     = 8.00 0.00
LDAUJ     = 0.95 0.00
LDAUPRINT = 1

AFM1/INCAR


SYSTEM   = NiO

ISTART   = 0

# Magnetism AFM1
ISPIN    = 2 
MAGMOM   = 2*-5.0  2*5.0 4*0
LASPH    = T 

# FFT grid
ENCUT    = 450 
PREC     = Acc

# Convergence criterion
EDIFF    = 1E-7

# Smearing/k integration
ISMEAR   = -5
EFERMI   = MIDGAP

# Algorithm and density mixing
ALGO     = Normal
IMIX     = 4
AMIX     = 0.8
BMIX     = 0.00001
AMIX_MAG = 0.8
BMIX_MAG = 0.00001
LMAXMIX  = 4

# compute bandgap
BANDGAP = WEIGHT

# compute on-site moment
LORBIT  = 11

# Exchange-correlation functional
XC        = CA
LDAU      = .TRUE.
LDAUTYPE  = 2
LDAUL     = 2 -1
LDAUU     = 8.00 0.00
LDAUJ     = 0.95 0.00
LDAUPRINT = 1

FM/INCAR


SYSTEM   = NiO

ISTART   = 0

# Magnetism FM
ISPIN    = 2 
MAGMOM   = 4*5.0 4*0
LASPH    = T 

# FFT grid
ENCUT    = 450 
PREC     = Acc

# Convergence criterion
EDIFF    = 1E-7

# Smearing/k integration
ISMEAR   = -5
EFERMI   = MIDGAP

# Algorithm and density mixing
ALGO     = Normal
IMIX     = 4
AMIX     = 0.8
BMIX     = 0.00001
AMIX_MAG = 0.8
BMIX_MAG = 0.00001
LMAXMIX  = 4

# compute bandgap
BANDGAP = WEIGHT

# compute on-site moment
LORBIT  = 11

# Exchange-correlation functional
XC        = CA
LDAU      = .TRUE.
LDAUTYPE  = 2
LDAUL     = 2 -1
LDAUU     = 8.00 0.00
LDAUJ     = 0.95 0.00
LDAUPRINT = 1

AFM2/KPOINTS


Regular k-point mesh
       0
Gamma  
 5 5 5

AFM1/KPOINTS, FM/KPOINTS


Regular k-point mesh
       0
Gamma  
 4 4 4

POTCAR


赝势:Ni_sv_GW 和 O_s。


INCAR 文件设置了 DFT+U 计算的基本参数。为了保持教程的计算量较小,此处的截断能和 k 点网格密度并未完全收敛。在实际应用中应进行通常的收敛性测试。为了获得精确的总能量,我们建议通过设置 ISMEAR = -5 使用四面体法(tetrahedron method),并设置较严格的收敛标准 EDIFF。INCAR 文件之间的区别在于由 MAGMOM 设置的磁构型的初始猜测。MAGMOM 用于确定最终结果的对称性操作,因此 AFM1 和 FM 子目录中的计算收敛到不同的最终磁构型也就不足为奇了。然而,在实践中,即使没有对称性约束,最终的磁构型通常也接近初始磁构型。在这里,这是一种优势,但通常意味着磁基态非常难以确定。还要注意

MAGMOM = 4*5 4*0

是以下内容的简写

MAGMOM = 5 5 5 5 0 0 0 0

在 KPOINTS 文件中定义 k 点网格的细分数是根据晶格矢量长度的倒数来选择的,这产生了一个可比的 k 点网格密度。为了获得精确的总能量,收敛每个计算的 k 点网格密度比使用可比的 k 点网格更重要。考虑一个极端的例子:如果一个磁性结构是金属性的而另一个是带隙结构,预期长程相互作用(以及由此产生的更精细的 k 点网格)对金属体系更相关。

5.3 计算#

打开终端并导航到该示例的目录,通过输入以下内容来运行它:

现在,使用总能量来计算交换相互作用参数:

import py4vasp

EFM = py4vasp.Calculation.from_path("e05_NiO_Heisenberg/FM").energy.read()["free energy    TOTEN"]/4
EAFM1 = py4vasp.Calculation.from_path("e05_NiO_Heisenberg/AFM1").energy.read()["free energy    TOTEN"]/4
EAFM2 = py4vasp.Calculation.from_path("e05_NiO_Heisenberg/AFM2").energy.read()["free energy    TOTEN"]/2

J1 = (EAFM1-EFM)/8
J2 = (4*EAFM2-3*EAFM1-EFM)/24
print("J1 in meV: ",J1*1000)
print("J2 in meV: ",J2*1000)
J1 in meV:  1.4324714983331432
J2 in meV:  -18.231236327096667

请注意,磁构型的单胞不同。因此,必须先对从文件读取的总能量进行相应缩放,才能用于计算交换耦合参数。

5.4 问题#

  1. MAGMOM = 2*3 是否等同于 MAGMOM = 6?
  2. 对于精确的总能量,哪种 ISMEAR 设置最好?
  3. 在比较总能量时,使用可比的 k 点网格密度重要吗?

6 通过引入 BCC Fe 体相的自旋-轨道耦合来打破空间群对称性#

通过本教程,你将能够:

  • 开启自旋-轨道耦合(SOC)
  • 决定何时使用 vasp_ncl 而非 vasp_std

6.1 任务#

计算 BCC Fe 包含自旋-轨道耦合(沿高对称路径 H$_3$-Γ-H)的能带结构。

为了包含自旋-轨道耦合(SOC),我们需要采用自旋密度泛函理论框架,该框架用于描述非共线磁性,参见 Hobbs 等人的 PRB 62, 11556 (2000)。因此,该系统用一个 $2\times2$ 自旋密度矩阵来描述,其元素为

$$ n(\vec{r}) = \begin{pmatrix} n_{\uparrow \uparrow}(\vec{r}) & n_{\uparrow \downarrow}(\vec{r}) \\ n_{\downarrow \uparrow}(\vec{r}) & n_{\downarrow \downarrow}(\vec{r}) \end{pmatrix}. $$

零阶正则近似(ZORA)中的 SOC 项为

$$ \hat{H}_{SO}= \frac{1}{(2c)^2} \frac{K^2(r)}{r} \frac{\text{d}V(r)}{\text{d}r} \vec{\sigma} \cdot \vec{L}, $$$$ K(r) = \frac{1}{ 1 - \frac{V(r)}{2c^2}} $$

单位为高斯 CGS 单位,参见 Lenthe 等人的 J Chem Phys 99, 4597 (1993),Steiner 等人的 PRB 93, 224425 (2016) 以及 Speelman 等人 arXiv:2504.17380 中的公式 (19)。

SOC 的能量标度很小,但可以产生实质性的后果。在这里,例如,在没有 SOC 的情况下,BCC Fe 中的高对称路径 Γ-H$_3$ 和 Γ-H 将是等价的,而包含 SOC 的计算显示了典型的包含 SOC 的能带结构中的所谓能带反交叉(anticrossings)。

6.2 输入#

运行此示例的输入文件准备在 $TUTORIALS/magnetism/e06_bcc_Fe_SOC 中。快去看看吧!

POSCAR


BCC Fe
1.4315177495
  -1.0000000000000000    1.0000000000000000    1.0000000000000000
   1.0000000000000005   -1.0000000000000000    1.0000000000000000
   1.0000000000000000    1.0000000000000000   -1.0000000000000000
Fe
1
direct
   0.0000000000000000    0.0000000000000000    0.0000000000000000 Fe

INCAR


ENCUT = 300     
EDIFF = 1e-8

ALGO = Normal

ISMEAR = 0    
SIGMA = 0.05   

LNONCOLLINEAR = T
LSORBIT       = T
MAGMOM        = 0.0 0.0 2.0
LASPH         = T
LMAXMIX       = 4

AMIX     = 0.2
BMIX     = 0.0001 ! almost zero, but 0 will crash some versions
AMIX_MAG = 0.8
BMIX_MAG = 0.0001 ! almost zero, but 0 will crash some versions

LORBIT = 11

KPOINTS



0
Gamma
12 12 12

KPOINTS_OPT


k points for band structure
141  ! intersections 
line mode
reciprocal
    0.5000000000     0.5000000000    -0.5000000000 H3
    0.0000000000     0.0000000000     0.0000000000 Γ

    0.0000000000     0.0000000000     0.0000000000 Γ
    0.5000000000    -0.5000000000     0.5000000000 H

POTCAR


赝势:Fe。


查看 LNONCOLLINEAR、LSORBIT 标签,并注意 MAGMOM 的格式是如何相应改变的!

在 KPOINTS 文件中提供了一个均匀 k 网格,并在 KPOINTS_OPT 文件中设置了高对称路径。因此,我们将执行一次计算来计算能带结构,而无需重启。

6.3 计算#

打开终端,导航到该示例的目录,并输入以下内容运行 VASP:

注意,这里我们使用可执行文件 vasp_ncl。ncl 是非共线(noncollinear)的缩写,指代为了描述非共线磁性(对于 SOC 也是如此)所需的处理完整 $2\times2$ 自旋密度矩阵的事实。

使用 py4vasp 绘制能带结构!请记住,费米能级需要在均匀 k 网格上计算。因此,当需要解释沿 k 路径的本征值时,该值需要作为参数提供。这在下面的 Python 代码中完成:

import py4vasp as pv

# 读取计算
calc = pv.Calculation.from_path("e06_bcc_Fe_SOC")

# 费米能级
ef = calc.band.to_dict()['fermi_energy']

# 绘制能带结构
calc.band.plot("kpoints_opt", fermi_energy=ef)

放大费米能级周围以查看能带反交叉。比较 Γ-H$_3$ 和 Γ-H 之间的路径!能带反交叉出现在不同的点。因此,结晶学上等价的方向在磁空间群对称性方面现在是不同的。SOC 的引入引入了自旋自由度和晶格自由度的耦合,因此仅执行共线自旋极化计算不足以获得 Γ-H$_3$ 和 Γ-H 之间的差异。

未提供该图片的描述

6.4 问题#

  1. 可以使用 vasp_std 包含自旋-轨道耦合吗?
  2. 能带结构中的能带反交叉是什么?

7 FeO 中的磁各向异性#

通过本教程,你将能够:

  • 定义旋量空间相对于笛卡尔空间的取向
  • 从共线计算重启非共线计算
  • 计算共线磁性结构的磁各向异性能(MAE)

7.1 任务#

使用 LDA+U (U = 4eV) 计算体相 FeO 的磁各向异性能,针对两个角度 $\phi=0$ 和 $\phi=90$ 扫描不同的 $\theta$ 值,其中 $\theta=0$ 对应于立方晶系的 [1,1,1] 方向,$\phi=0$ 位于立方晶系的 $(1,\bar{1},0)$ 平面内。

磁各向异性是一种由于自旋-轨道耦合(SOC)引起的相对论效应。FeO 具有岩盐型晶体结构,由于轻微畸变而变成了单斜结构。对于基态磁结构,$(1,1,1)$ 平面呈 AFM 排序。MnO、FeO、CoO 和 NiO 的磁各向异性能已由 Schrön、Rödl 和 Bechstedt 进行了详细讨论,PRB 86, 115134 (2012)。这里,我们重现图 5 (a) 的结果。

MAE 计算的工作流为:

  1. 使用 vasp_std 进行 SCF 计算,设置 ISPIN=2, ISYM=-1。
  2. 以固定的共线电荷密度重启非共线计算 (ICHARG=11),包含 SOC 并沿 MAE 路径旋转 SAXIS。

这种方法的优点是可以在不担心计算会收敛到不同磁化方向的情况下改变磁化方向。但它依赖于 SOC 是一个微扰这一事实,因此 SOC 不会显著改变电荷密度和磁化强度。该工作流预设了原位轨道角动量基于晶体场进行有序化,而不是跟随原位磁矩的方向。

7.2 输入#

创建输入和运行此示例的资源准备在 $TUTORIALS/magnetism/e07_FeO_bulk_MAE 中。我们将详细讨论如何设置计算。

MAE 计算的路径可以用极角 $\theta$ 和 $\phi$ 来表征。我们选择与 Schrön 等人 相同的方式设置角度:

  • 如果磁化平行于立方晶系的 [111] 方向,则 $\theta=0$
  • 如果磁化位于 $(1\bar{1}0)$ 平面内,则 $\phi=0$。

找到正确的路径有点棘手,因为 FeO 略有畸变,变成了单斜结构而不是立方结构。让我们逐步完成确定 MAE 路径的过程:

  1. 从立方结构的常规单胞开始,创建一个 2x2x2 超胞。
  2. 应用 $q=(1/2,1/2,1/2)$ 自旋波和单斜畸变。
  3. 获得原始磁性单胞。
  4. 识别立方晶系的 [111] 方向,并在畸变结构的超胞中定义立方晶系 $(1\bar{1}0)$ 平面内的旋转。
  5. 计算路径的 SAXIS 列表,其中 $\phi=0$ 和 $\phi=90$ 时 $\theta\in[0,\pi]$。

7.2.1 立方结构#

你可以从材料项目网站下载 FeO 的 Fm$\bar{3}$m FCC 岩盐结构。本示例目录中准备了相应的 CIF 文件:e07_FeO_bulk_MAE/FeO-rock-salt.cif。使用 Python 包 ASE 读取文件,构建超胞并绘制它。

from ase.io import read, write
from ase.build import make_supercell
import numpy as np
import spglib
from ase import Atoms
from ase.visualize.plot import plot_atoms

# 加载岩盐结构
atoms = read("e07_FeO_bulk_MAE/FeO-rock-salt.cif")

# 构建可以容纳 q=(1/2,1/2,1/2) 自旋波的超胞
q=np.array([0.5,0.5,0.5]) # AFM2
supercell = make_supercell(atoms, np.diag([1/q[0], 1/q[1], 1/q[2]]))

# 绘图
plot_atoms(supercell,radii=0.3,rotation=('-20x,20y,-0z'))
<Axes: >

未提供该图片的描述

7.2.2 自旋波和畸变#

步骤 2 是应用 $q=(1/2,1/2,1/2)$ 自旋波和单斜畸变。在下面你可以看到一个包含可应用于 FCC 晶格的不同畸变类型的函数。畸变后,我们可以使用 Spglib 获得新的空间群:

def apply_distortion(lattice, case):
    # 参见 Schrön 等人表 II
    if case=="FeO":
        # FeO 的单斜畸变
        r=0.0014; e=0.0253; t=0.0251
    elif case=="MnO":
        # MnO 的菱方畸变
        e, t = 0, 0 ; r=-0.0063
    elif case=="tetragonal":
        # 四方畸变
        r, e = 0, 0 ; t = 0.004
    elif case=="orthorhombic":
        # 正交畸变
        r = 0; e, t = 0.001, 0.001
    elif case==None:
        # 无畸变
        r, e, t = 0, 0, 0
    strain_tensor=np.array([ [-0.5*t, 0.5*e + r, r], [0.5*e + r, -0.5*t, r], [r,r,t] ])
    return (strain_tensor + np.diag([1, 1, 1])) @ lattice
    
# 应用畸变到晶格
lattice=supercell.get_cell()
distorted_lattice=apply_distortion(lattice, "FeO")

# 计算立方超胞和单斜超胞的体积
# 注意体积并未完全保持,但变化很小。
a1, a2, a3 = lattice
print("Supercell volume:", np.dot(a1,np.cross(a2,a3)))
a1, a2, a3 = distorted_lattice
print("Distorted supercell volume:", np.dot(a1,np.cross(a2,a3)))

# 为畸变超胞创建 ASE 结构: distorted_supercell_atoms
distorted_supercell_atoms = Atoms(
        cell=distorted_lattice,
        scaled_positions=supercell.get_scaled_positions(),
        numbers=supercell.get_atomic_numbers(),
        pbc=True
    )

# 确定畸变结构的空间群
cell = (
    distorted_supercell_atoms.get_cell(),
    distorted_supercell_atoms.get_scaled_positions(),
    distorted_supercell_atoms.get_atomic_numbers()
)
symmetry = spglib.get_spacegroup(cell, symprec=1e-5)
print("Space group:", symmetry)

# 绘图
plot_atoms(distorted_supercell_atoms,radii=0.3,rotation=('-20x,20y,-0z'))
Supercell volume: 619.5284080743
Distorted supercell volume: 619.1103953950483
Space group: C2/m (12)
<Axes: >

未提供该图片的描述

为了应用自旋波,我们将自旋向下位点的原子类型 Fe 更改为 Mn 作为占位符:

# 分配 AFM 矩 (q = (1/2, 1/2, 1/2))
positions = distorted_supercell_atoms.get_scaled_positions()
numbers = []
for i, atom in enumerate(distorted_supercell_atoms):
    if atom.symbol == "Fe":
        R=2*positions[i][:]
        sign = np.cos(2*np.pi*np.dot(R, q))
        number = 25  if round(sign) < 0 else 26
    else:
        number = 8
    numbers.append(number)

distorted_spinwave_atoms = Atoms(
        cell=distorted_supercell_atoms.get_cell(),
        scaled_positions=distorted_supercell_atoms.get_scaled_positions(),
        numbers=numbers,
        pbc=True
    )

# 确定畸变结构的磁空间群
cell = (
    distorted_spinwave_atoms.get_cell(),
    distorted_spinwave_atoms.get_scaled_positions(),
    distorted_spinwave_atoms.get_atomic_numbers()
)
symmetry = spglib.get_spacegroup(cell, symprec=1e-5)
print("Space group:", symmetry)

plot_atoms(distorted_spinwave_atoms,radii=0.3,rotation=('-20x,20y,-0z'))
Space group: C2/m (12)
<Axes: >

未提供该图片的描述

7.2.3 原始磁性单胞#

虽然在常规单胞的超胞中可视化磁结构很容易,但使用原始单胞计算成本更低。获得 AFM 结构的原始磁性单胞的变换是众所周知的,并在第 1 部分示例 4 中用于 NiO 的立方系统。同样的变换也用于畸变单胞,位置通过以下方式获得:

$$ A_{prim} = P \cdot A_{conv}. $$

因此,位置通过转置逆矩阵进行变换:

$$ \vec{v}_{prim}=(P^{-1})^T \cdot \vec{v}_{conv}. $$

必须过滤位置,以便获得原始单胞中的原子列表。然后我们可以检查空间群是否仍然是我们期望的。我们还将 Mn 还原回 Fe 并按原子种类对原子进行排序,以便写入 POSCAR 文件。最后,我们为对应于 POSCAR 文件的 AFM 结构编写 MAGMOM 并绘制结构。

lattice, positions, numbers = cell

def filter(pos,prec=8):
    if np.all(np.round(pos,prec)>=0) and np.all(np.round(pos,prec)<1):
        return pos
    else:
        pass

# 新的晶格矢量(参见 NiO 第 1 部分示例 4)
a1 = 0.5 * (lattice[0] + 0.5 * (lattice[1] + lattice[2]))
a2 = 0.5 * (lattice[1] + 0.5 * (lattice[2] + lattice[0]))
a3 = 0.5 * (lattice[2] + 0.5 * (lattice[0] + lattice[1]))
new_lattice = np.array([a1, a2, a3])

print("Primitive lattice:")
print(new_lattice)
print("a:", np.linalg.norm(a1), "b:", np.linalg.norm(a2), "c:", np.linalg.norm(a3))
print("Volume:",np.dot(a1,np.cross(a2,a3)))

# 新位置和数字(即应用变换的转置逆矩阵并过滤)
P = np.dot(new_lattice, np.linalg.inv(lattice))
P_inv_T = np.linalg.inv(P).T
new_positions = []
new_numbers = []
for i, pos_conv in enumerate(positions):
    pos_prim = filter(P_inv_T @ pos_conv)
    if pos_prim is None:
        pass
    else:
        new_positions.append(pos_prim)
        new_numbers.append(numbers[i])
        print("Atom", i, pos_conv, filter(pos_prim), numbers[i])

# 确保原始单胞的空间群仍然是期望的空间群
prim_cell = (
    new_lattice,
    new_positions,
    new_numbers
)
symmetry = spglib.get_spacegroup(prim_cell, symprec=1e-5)
print("Space group:", symmetry)

# 排序原子类型,将 Mn 还原为 Fe 并创建相应的 MAGMOM
def revert_type(n):
    if n==25:
        n=26
    return n
    
def get_m(n):
    if n==8:
        m=0
    elif n==25:
        m=4
    elif n==26:
        m=-4
    return m

sorted_index = np.argsort(new_numbers)
new_positions = [new_positions[i] for i in sorted_index]
magmom = np.array([[0,0,get_m(new_numbers[i])] for i in sorted_index])

new_numbers = [revert_type(new_numbers[i]) for i in sorted_index]

print("MAGMOM = ", ' '.join( map(str,magmom[:,2]     )) )
print("MAGMOM = ", ' '.join( map(str,magmom.flatten())) )

# 原始磁性单胞的 ASE 原子结构
primitive_atoms = Atoms(
        cell=new_lattice,
        scaled_positions=new_positions,
        numbers=new_numbers,
        pbc=True
    )

# 写入 POSCAR
primitive_atoms.write("e07_FeO_bulk_MAE/POSCAR.prim")

# 绘图
plot_atoms(primitive_atoms,radii=0.3,rotation=('-20x,20y,-0z'))
Primitive lattice:
[[4.24186201 2.16733819 2.19365869]
 [2.16733819 4.24186201 2.19365869]
 [2.14037834 2.14037834 4.37538258]]
a: 5.244319463402735 b: 5.244319463402735 c: 5.320377011501908
Volume: 38.69439971219052
Atom 0 [0. 0. 0.] [0. 0. 0.] 26
Atom 6 [0.25 0.25 0.25] [0.25 0.25 0.25] 8
Atom 56 [0.5 0.5 0.5] [0.5 0.5 0.5] 25
Atom 62 [0.75 0.75 0.75] [0.75 0.75 0.75] 8
Space group: C2/m (12)
MAGMOM =  0 0 4 -4
MAGMOM =  0 0 0 0 0 0 0 0 4 0 0 -4
<Axes: >

未提供该图片的描述

为了初步了解原始单胞和常规超胞的相对取向,将它们绘制在一起!另外标出立方晶系的 [1,1,1] 和 [1,1,0] 方向。

import plotly.graph_objects as go

def add_cell_plot(fig,atoms,color,inv_scale):
    # 绘制晶格矢量作为畸变超胞的线
    origin = np.zeros(3)
    colors = ["red", "green", "blue"]
    A = atoms.get_cell()
    for i in range(3):
        vec = A[i]
        fig.add_trace(go.Scatter3d(
            x=[origin[0], vec[0]],
            y=[origin[1], vec[1]],
            z=[origin[2], vec[2]],
            mode='lines',
            line=dict(color=colors[i], width=4),
            name=f'a{i+1}'
        ))
    # 绘制畸变超胞的原子
    positions = [ np.dot(v,A) for v in atoms.get_scaled_positions()]
    numbers = atoms.get_atomic_numbers()
    for i, atom in enumerate(atoms):
        fig.add_trace(go.Scatter3d(
            x=[positions[i][0]], y=[positions[i][1]], z=[positions[i][2]],
            mode='markers',
            marker=dict(size=numbers[i]/inv_scale, color=color),
            name=atom.symbol
        ))

def add_direction(fig, direction, name, color="black"):
    fig.add_trace(go.Scatter3d(
    x=[0, direction[0]],
    y=[0, direction[1]],
    z=[0, direction[2]],
    mode='lines+text',
    line=dict(color=color, width=5, dash='dash'),
    name=name,
    text=['', name],
    textposition='top center'
        ))

# 绘图
fig = go.Figure()
add_cell_plot(fig, distorted_supercell_atoms,"red",4)
add_cell_plot(fig, primitive_atoms,"blue",8)
add_direction(fig, distorted_supercell_atoms.get_positions()[6], "[1 1 1]")
add_direction(fig, distorted_supercell_atoms.get_positions()[3], "[1 1 0]")

# 布局和显示
fig.update_layout(
    scene=dict(
        xaxis_title='X (Å)',
        yaxis_title='Y (Å)',
        zaxis_title='Z (Å)',
        aspectmode='data'
    ),
    title="原始单胞和常规超胞及其晶格矢量和立方晶体学方向",
    template="plotly_white"
)

fig.show()

7.2.4 立方 [111] 方向和 (1-10) 平面#

让我们分析如何识别在常规单胞以及原始单胞中已知的方向和平面。

[1,1,1] 方向指的是从原点指向分数坐标 [h,k,l] 点的方向。 很容易识别出立方超胞中的 [1,1,1] 方向从原点指向第 7 个原子。由于应用畸变时顺序没有改变,畸变超胞中的 [1,1,1] 方向也指向第 7 个原子。

$(1\bar{1}0)$ 平面指的是常规单胞中的密勒指数 (hkl),它们与晶轴截距成反比,其中 $\bar{1}$ 对应于 $-1$。因此,$(1\bar{1}0)$ 平面:

  • 在 $1$ 处切 x 轴(以晶格常数为单位),
  • 在 $−1$ 处切 y 轴,
  • 平行于 z 轴(因为 0 意味着无穷大截距)。

注意 [1,1,1] 方向在 $(1\bar{1}0)$ 平面上。在该平面内的另一个方向是 [1,1,0] 方向,我们可以在立方和畸变单胞中找到第 4 个原子。在 $(1\bar{1}0)$ 平面内旋转矢量的旋转轴是 $[-1,1,0]$ 方向。参见上一节的最后一张图!

确定畸变常规超胞中 $[-1,1,0]$ 方向的笛卡尔坐标!如何用原始晶格表示晶体学方向?

lattice_prim = primitive_atoms.get_cell()
lattice_distorted = distorted_spinwave_atoms.get_cell()

P = np.dot(lattice_prim, np.linalg.inv(lattice_distorted))
P_inv_T = np.linalg.inv(P).T

vec_conv = np.array([-1,1,0])

vec_prim = P_inv_T @ vec_conv

print( "Crystallographic", vec_conv, "direction in conventional cell: ")
print( "                            Cartesian coordinates ", np.dot(vec_conv,lattice_distorted))
print( "Crystallographic", np.round(vec_prim,4), "direction in primitiv cell: ")
print( "                            Cartesian coordinates ", np.dot(vec_prim,lattice_prim))
Crystallographic [-1  1  0] direction in conventional cell: 
                            Cartesian coordinates  [-8.29809528  8.29809528  0.        ]
Crystallographic [-4.  4. -0.] direction in primitiv cell: 
                            Cartesian coordinates  [-8.29809528e+00  8.29809528e+00  3.19061695e-16]

有了这些知识,我们可以定义函数来获取立方单胞晶体学方向的笛卡尔坐标。以及其他获取单位矢量和两个矢量之间角度的函数。使用这些函数获取沿 [1,1,1]、[-1,1,0]、[1,1,0] 和 [0,0,-1] 方向的单位矢量并检查角度。

def cartesian_of(conventional_direction):
    """ 返回常规单胞中定义的晶体学方向的笛卡尔坐标。 """
    return np.dot(conventional_direction,distorted_supercell_atoms.get_cell())

def unit_vector(vector):
    """ 返回矢量的单位矢量。 """
    return vector / np.linalg.norm(vector)

def angle_between(v1, v2):
    """ 返回矢量 'v1' 和 'v2' 之间的角度(弧度)::

            >>> angle_between((1, 0, 0), (0, 1, 0))
            90.0
            >>> angle_between((1, 0, 0), (1, 0, 0))
            0.0
            >>> angle_between((1, 0, 0), (-1, 0, 0))
            180.0
    """
    v1_u = unit_vector(v1)
    v2_u = unit_vector(v2)
    return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))/np.pi*180
e111  = unit_vector( cartesian_of( [1,1,1]) )
e_110 = unit_vector( cartesian_of([-1,1,0]) )
e110  = unit_vector( cartesian_of( [1,1,0]) )
e00_1  = unit_vector( cartesian_of( [0,0,-1]) )

print("Unit vector of  [1,1,1] direction in Cartesian coordinates: ", e111 )
print("Unit vector of [-1,1,0] direction in Cartesian coordinates: ", e_110 )
print("Unit vector of  [1,1,0] direction in Cartesian coordinates: ", e110 )

print("")
print("Check angle between [1,1,1] direction and [-1,1,0] direction is 90:", angle_between(e111, e_110))
print("Note: The angle theta that rotates SAXIS from [1,1,1] to [1,1,0] is", angle_between(e111, e_110))
print("Note: The angle theta that rotates SAXIS from [1,1,1] to [0,0,-1] is", angle_between(e111, e00_1))
Unit vector of  [1,1,1] direction in Cartesian coordinates:  [0.57255358 0.57255358 0.58682603]
Unit vector of [-1,1,0] direction in Cartesian coordinates:  [-0.70710678  0.70710678  0.        ]
Unit vector of  [1,1,0] direction in Cartesian coordinates:  [0.7071054  0.7071054  0.00197693]

Check angle between [1,1,1] direction and [-1,1,0] direction is 90: 90.0
Note: The angle theta that rotates SAXIS from [1,1,1] to [1,1,0] is 35.818825983468564
Note: The angle theta that rotates SAXIS from [1,1,1] to [0,0,-1] is 126.0427578829796

7.2.5 沿 MAE 路径的 SAXIS#

磁化强度将通过使用 SAXIS 标签改变自旋量子化轴来间接旋转。阅读 VASP 维基上关于 SAXIS 的文档!

对于 FeO,为了增加 $\phi=0$ 的角度 $\theta$,我们需要绕 e_110(沿 [-1,1,0] 方向的单位矢量)旋转 e111(沿 [1,1,1] 方向的单位矢量)。对于 $\phi=90$,旋转轴 e_110 首先需要绕 e111 旋转 $\pi/2$,随后可以通过绕新的 rotated_e_110 旋转来增加 $\theta$。我们使用 Scipy 创建 SAXIS 的值列表。

from scipy.spatial.transform import Rotation as R
print("Create saxis list for a rotation axis:", e_110)

# 定义 phi=0 的旋转轴和步长
rotvec = -e_110*5/180*np.pi
r = R.from_rotvec(rotvec)

# 为 phi=0 创建 36 个自旋量子化轴方向的列表;theta 在 [0,180]
saxis_list = []
saxis = e111
for i in range(2*18+1):
    saxis_list.append(saxis)
    saxis = r.apply(saxis, inverse=True)

# 定义并应用 90 的旋转轴和步长以旋转至 phi=90
rotvec1 = -e111*90/180*np.pi
r1 = R.from_rotvec(rotvec1)
rotated_e_110 = r1.apply(e_110, inverse=True)
print("Create saxis_list90 for a rotation axis:", rotated_e_110 )

# 定义 phi=90 的第二个旋转轴和步长
rotvec2 = -rotated_e_110*5/180*np.pi
r2 = R.from_rotvec(rotvec2)

# 为 phi=90 创建 36 个自旋量子化轴方向的列表;theta 在 [0,180]
saxis_list90 = []
saxis = e111
for i in range(2*18+1):
    saxis_list90.append(saxis)
    saxis = r2.apply(saxis, inverse=True)
Create saxis list for a rotation axis: [-0.70710678  0.70710678  0.        ]
Create saxis_list90 for a rotation axis: [-0.41494867 -0.41494867  0.80971304]

在单胞中绘制 SAXIS 的值!靠近原点仔细观察,可以看到对应于 $\phi = 0 °$ 和 $\phi = 90 °$ 的黑色和红色平面。

import plotly.graph_objects as go

# 绘图
fig = go.Figure()
for i, saxis in enumerate(saxis_list):    
    add_direction(fig, saxis, " ", color="red")
    add_direction(fig, saxis_list90[i], " ")
add_cell_plot(fig, distorted_supercell_atoms,"red",4)
add_cell_plot(fig, primitive_atoms,"blue",8)

# 布局和显示
fig.update_layout(
    scene=dict(
        xaxis_title='X (Å)',
        yaxis_title='Y (Å)',
        zaxis_title='Z (Å)',
        aspectmode='data'
    ),
    title="红色: phi=0, 黑色: phi=90",
    template="plotly_white"
)

fig.show()

最后,我们打印一个 bash 数组来编写一个运行脚本,扫描 SAXIS 的所有值:

def print_saxis_for_bash(saxis_list, str=""):
    print( "declare -a saxis"+str+"=(")
    for saxis in saxis_list:
        theta = angle_between(saxis,e111)
        print("\"SAXIS=", saxis[0], saxis[1], saxis[2] ,"  # theta= ", round(theta),"\"")
    print(")")

print("# phi=0")
print_saxis_for_bash(saxis_list)

print("# phi=90")
print_saxis_for_bash(saxis_list90, "90")

(此处省略了长 bash 数组输出)

7.2.6 VASP 输入文件#

根据上面的讨论,我们有一个包含原始单胞的 POSCAR 文件、用于共线和非共线计算的 $q=(1/2,1/2,1/2)$ AFM 结构的 MAGMOM,以及包含 SAXIS 值的 bash 数组形式的 MAE 路径。这现在结合起来运行共线 LDA+U 计算以及沿该路径的多个 ncl 计算。

POSCAR


O  Fe  
 1.0000000000000000
     4.2032711140995955    2.2376441116844221    2.3233554199863908
     2.2376441116844221    4.2032711140995955    2.3233554199863908
     2.1592266873017891    2.1592266873017891    4.6099460038514311
 O   Fe  
   2   2   
Cartesian
  2.1500354782714526  2.1500354782714517  2.3141642109560534
  6.4501064348143577  6.4501064348143577  6.9424926328681602
  4.3000709565429034  4.3000709565429025  4.6283284219121050
  0.0000000000000000  0.0000000000000000  0.0000000000000000

INCAR.ispin2


SYSTEM   = FeO 

ENCUT    = 520 
PREC     = Acc 

NBANDS   = 32

ISPIN = 2 
LNONCOLLINEAR = F 
LSORBIT    = F 
MAGMOM     = 0 0 4 -4

LASPH      = T 
GGA_COMPAT = F 

EDIFF    = 1E-8

ISMEAR   = 0 
SIGMA    = 0.01
EFERMI   = MIDGAP

ALGO     = Normal

IMIX     = 4 
AMIX     = 0.8 
BMIX     = 0.00001
AMIX_MAG = 0.8 
BMIX_MAG = 0.00001

LMAXMIX  = 4 

XC = CA
LDAU      = .TRUE.
LDAUTYPE  = 2 
LDAUL     = -1 2 
LDAUU     = 0.00 4.00
LDAUJ     = 0.00 0.00

INCAR.path


SYSTEM   = FeO 

ENCUT    = 520 
PREC     = Acc 

NBANDS   = 64

ISPIN = 1 
LNONCOLLINEAR = T 
LSORBIT    = T 
MAGMOM     =  0 0 0 0 0 0 0 0 4 0 0 -4

LASPH      = T 
GGA_COMPAT = F 

EDIFF    = 1E-8

ISMEAR   = -5
EFERMI   = MIDGAP

ALGO     = Normal

IMIX     = 4 
AMIX     = 0.8 
BMIX     = 0.00001
AMIX_MAG = 0.8 
BMIX_MAG = 0.00001

LMAXMIX  = 4 

XC = CA
LDAU      = .TRUE.
LDAUTYPE  = 2 
LDAUL     = -1 2 
LDAUU     = 0.00 4.00
LDAUJ     = 0.00 0.00

LORBMOM = T 
LORBIT = 11
LCHARG = F 

ICHARG   = 11

KPOINTS


k points
 0
gamma
 4  4  4
 0  0  0

POTCAR


O 和 Fe 的赝势。


检查 INCAR 文件中设置的标签。从共线计算重启非共线计算可以通过读取电荷密度和磁化强度来完成。这意味着截断能(由 ENCUT 设置)必须相同,以便 FFT 网格保持不变。共线计算中的能带数(由 NBANDS 设置)是为自旋向上和向下设置的。因此,它应该是非共线运行中能带数的两倍,以跨越相同的空间。在从电荷密度重启时改变 k 点密度在技术上是可能的,但在这里电荷密度是固定的(ICHARG),因此建议使用相同的 k 网格。

7.3 计算#

打开终端,导航到该示例的目录,并输入以下内容运行 VASP:

其中 run 包含

(此处为 Python 绘图代码)

点击查看答案!

不,因为存在单斜畸变。

7.4 问题#

  1. 轨道磁矩定义在哪个坐标系中?
  2. 哪个标签控制旋量空间相对于笛卡尔空间的取向?
  3. MAE 计算的工作流包含哪些步骤?

干得好!你已经完成了磁性教程的第 2 部分!#

返回顶部 $\uparrow$