7.2 磁性计算2

Sym4state Manual

1
CurrentModule = Sym4state.ModCore
pre_and_post
1
2
using PrintFileTree
local pair_mat, coeff_array

bilinear Heisenberg model can be described by

$\mathcal{H} = \sum_{i < j} S_i \cdot \mathcal{J}{i j} \cdot S_j + \sum{i} S_i \cdot \mathcal{A} \cdot S_i - m \sum_{i} S_i \cdot \vec{B}$

where the symbol $\mathcal{J}_{ij}$ denotes the exchange interaction matrix between two spins, $S_i$ and $S_j$, the matrix $\mathcal{A}$ represents the single-ion anisotropy. 四态法计算磁耦合,需要计算4种不同的磁基态,allowing the extraction of individual components for the exchange matrix.

想计算每一个元素的交换矩阵,就需要计算36个能量,由于一些结构的等价性,手动分析对称性筛选很有挑战,而且有遗漏的风险。

Pre-process

One can use our program to streamline the simpilifing and calculating process easily. For example, with a POSCAR file of monolayer CrI3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Cr2 I6                                  
1.00000000000000
7.1131374882967124 0.0000000000000000 0.0000000000000000
-3.5565687441483571 6.1601577654763897 0.0000000000000000
0.0000000000000000 0.0000000000000000 18.0635365764484419
Cr I
2 6
Direct
0.6666666666666643 0.3333333333333357 0.5000000247180765
0.3333333333333357 0.6666666666666643 0.5000000501683317
0.6415738047516142 0.9999977877949036 0.4116659127023310
0.3584239830432894 0.3584261952483858 0.4116659127023310
0.0000022122051035 0.6415760169567106 0.4116659127023310
0.3584241488090230 0.9999980859273947 0.5883340783387269
0.6415739371183646 0.6415758511909699 0.5883340783387269
0.0000019140726053 0.3584260628816354 0.5883340783387269

合适设置 INCAR, POTCAR and KPOINTS 用于磁性自洽计算, 可以用 Sym4state.jl 产生所有的输入文件用于计算最近邻交换作用和单离子各向异性,过程如下:

pre_and_post
1
2
3
4
5
6
7
8
using Sym4state
cd("CrI3") do # hide
Sym4state.pre_process(
"./POSCAR",
[24], # Take Cr element as magnetic
5.0 # There exists an interaction between atoms within a distance of 5 Å.
)
end # hide

它将会构建超胞,满足两个任意原子无相互作用。给定的单层 ${CrI3}$ with a cutoff radius of 5 Å, a $2 \times 2 \times 1$ supercell will provide sufficient size. The supercell diagram below labels all the ${Cr}$ atoms:

Within the 5 Å cutoff radius, the monolayer of \ce{CrI3} exhibits two distinct groups of interactions. The first group corresponds to interactions between nearest neighbors, whereas the second group pertains to interactions arising from single-ion anisotropy. It is important to note that all atom pairs within the same group are considered equivalent. This equivalence implies the existence of symmetric operations that can transform one interaction matrix into another, highlighting the underlying symmetry of the system.

pre_process function的输出结果中,1组包含6对等价,第2组有2对等价。尽管简化了计算,还是要计算几种磁结构。 在考虑最近邻情况下,至少计算9个磁基态,相反在处理单离子各向异性需要2个。
不同参数和能量的关系储存在 cal.jld2. 另外该功能会生成几个目录储存对应输入文件。

pre_and_post
1
printfiletree("CrI3")   # hide

所有的目录储存在 cal_list, 后续提交任务即可。 Slurm‘s job array by submitting a shell like:

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

#SBATCH -n 144
#SBATCH --array=1-11%2

module load vasp-6.3.2-optcell

target_dir=$(sed -n "${SLURM_ARRAY_TASK_ID}p" cal_dir_list)

cd ${target_dir}

srun vasp_ncl

这个 shell 脚本创建 Slurm job array 计算所有 11 magnetic configurations, while efficiently managing computational resources by allowing a maximum of 2 jobs to run simultaneously.

Post-process

计算完成后 post_process function 提取不同磁结构的能量,最终创建交换矩阵。

pre_and_post
1
2
3
4
5
6
7
8
9
cd("CrI3") do   # hide
global pair_mat, coeff_array # hide
mv("../oszicar.tar.gz", "./oszicar.tar.gz") # hide
run(`tar -xvzf oszicar.tar.gz`) # hide
for (idx, dir_name) in enumerate(readlines("cal_dir_list")) # hide
cp("oszicar/OSZICAR_$(idx)", dir_name * "OSZICAR") # hide
end # hide
pair_mat, coeff_array = Sym4state.post_process("./cal.jld2")
end # hide

我们可以测试 the dimensions of pair_mat and coeff_array, 它分别存储了不同原子对的起始点和结束点的索引及其对应的相互作用矩阵。

pre_and_post
1
2
size(pair_mat)
size(coeff_array)

因此我们看到共有8个相互作用在cutoff radius of 5 Å. 让我们检查pair_mat中的一个特定条目,它包含表示原子对的索引:

pre_and_post
1
pair_mat[:, 1]

初始数字和最终数字分别对应于起点原子和终点原子的指数。第二个和第三个数字表示原始单元格沿x轴和y轴的偏移量。

Monte Carlo Simulation

前面 pair_mat and coeff_array的结果,可以通过 Monte Carlo simulation 计算 phase transition temperature or magnetic texture :

pre_and_post
1
2
3
4
5
6
7
8
9
10
11
using Unitful, UnitfulAtomic
mcconfig = Sym4state.MC.MCConfig{Float32}(
lattice_size=[128, 128],
magmom_vector=[3.5, 3.5],
pair_mat=pair_mat,
interact_coeff_array=coeff_array,
temperature=collect(150:-2:0),
magnetic_field=zeros(3),
equilibration_step_num=100_000,
measuring_step_num=100_000
)

In the aforementioned code snippet, we have configured a simulated annealing simulation, commencing at a temperature of 150 K and progressively reducing it to 0 K in steps of 2 K. The simulation operates on a $128 \times 128$ supercell of ${CrI3}$ using the previously computed interaction matrix. To assess the system, we perform a preliminary equilibration phase consisting of 100000 sweeps, followed by a measurement phase comprising 100000 sweeps for acquiring physical quantities. It is worth noting that the magnetic field is absent, rendering the magmom_vector inconsequential.

With the created mcconfig, one can initiate a Monte Carlo simulation as follows:

1
2
3
4
5
6
7
8
9
10
11
(
states_over_env,
norm_mean_mag_over_env,
susceptibility_over_env,
specific_heat_over_env
) = Sym4state.MC.mcmc(
mcconfig,
backend=Sym4state.MC.CPU()
progress_enabled=false,
log_enabled=false
)

The parameter backend can be configured to employ CUDABackend() provided by CUDA.jl or any other backends supported by KernelAbstractions.jl to enhance performance utilizing the GPU.

The MCConfig can also be stored into a .toml file by:

pre_and_post
1
2
3
cd("CrI3") do   # hide
Sym4state.MC.save_config("CrI3.toml", mcconfig)
end # hide

or it can also be restored by:

pre_and_post
1
2
3
cd("CrI3") do   # hide
mcconfig = Sym4state.MC.load_config("CrI3.toml")
end # hide

Functions

1
2
3
4
reduce_interact_mat_for_a_pair
supercell_check
pre_process
post_process
1
2
rm("CrI3", recursive=true)
nothing

手册

当前模块

Sym4state.ModCore 使用 PrintFileTree 本地 pair_matcoeff_array

对于磁体的磁性特性的理论探索,双线性海森堡模型被证明是表示磁相互作用的有用框架,可以用以下公式描述:
$$
\mathcal{H} = -\sum_{i,j} \mathcal{J}_{ij} \mathbf{S}_i \cdot \mathbf{S}j + \sum{i} \mathcal{A} \mathbf{S}_i^2
$$
其中符号 \mathcal{J}_{ij} 表示两个自旋 S_iS_j 之间的交换相互作用矩阵,矩阵 \mathcal{A} 表示单离子各向异性。为了确定磁相互作用矩阵元素,研究人员通常采用四态方法 1 2 3。该方法涉及计算四种不同的磁配置的能量,从而提取交换矩阵的各个分量。将此方法扩展到交换矩阵的每个元素需要计算总共 36 种能量,以获得完整的矩阵。需要注意的是,由于材料的对称性,一些能量是简并的。尽管如此,进行手动对称分析以简化能量计算的数量仍然是一项具有挑战性的工作,因为存在遗漏或误解某些对称操作的潜在风险。

预处理

可以使用我们的程序轻松简化和计算过程。例如,使用 \ce{CrI3} 的 POSCAR 文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Cr2 I6
1.00000000000000
7.11313748829671 0.00000000000000 0.00000000000000
-3.55656874414836 6.16015776547639 0.00000000000000
0.00000000000000 0.00000000000000 18.06353657644844
Cr I2 6
Direct
0.66666666666666 0.33333333333333 0.50000002471808
0.33333333333333 0.66666666666666 0.50000005016833
0.64157380475161 0.99999778779490 0.41166591270233
0.35842398304329 0.35842619524839 0.41166591270233
0.00000221220510 0.64157601695671 0.41166591270233
0.35842414880902 0.99999808592739 0.58833407833873
0.64157393711836 0.64157585119097 0.58833407833873
0.00000191407261 0.35842606288164 0.58833407833873

以及适当设置的 INCAR、POTCAR 和 KPOINTS 文件以进行 SCF 计算,可以简单地使用 Sym4state.jl 生成所有输入文件以计算最近的交换相互作用和单离子各向异性相互作用,如下所示:

1
2
3
4
5
6
using Sym4state
cd("CrI3") do
Sym4state.pre_process("./POSCAR", [24], # 以 Cr 元素作为磁性
5.0 # 存在一个距离为 5 Å 的原子间相互作用
)
end

此函数将利用 supercell_check 方法为提供的结构创建超晶胞。超晶胞应足够大,以确保在指定的截止半径内,任何两个原子之间不超过一个连接。对于给定的 \ce{CrI3} 单层,截止半径为 5 Å,2 \times 2 \times 1 的超晶胞将提供足够的大小。下图标记了所有的 \ce{Cr} 原子:

单层 \ce{CrI3} 的俯视图

在 5 Å 的截止半径内,单层 \ce{CrI3} 显示出两组不同的相互作用。第一组对应于最近邻之间的相互作用,而第二组则涉及单离子各向异性引起的相互作用。需要注意的是,同一组内的所有原子对被视为等效。这种等效性意味着存在对称操作,可以将一个相互作用矩阵转换为另一个,突显了系统的潜在对称性。

根据 pre_process 函数获得的输出,初始组包含 6 对等效的原子对,而第二组则包含 2 对等效的原子对。尽管通过使用对称操作简化涉及各种相互作用矩阵的计算的潜力存在,但仍然有一个特定的相互作用矩阵需要计算最少数量的配置。在最近邻相互作用的情况下,必须计算至少 9 种磁配置的能量。相反,在处理单离子各向异性相互作用时,需要评估至少 2 种磁配置的能量。

该函数将恢复不同能量和配置之间的所有关系到文件 cal.jld2 中。此外,该函数将生成多个目录以存储与各种磁配置相对应的输入文件。

1
printfiletree("CrI3")

所有这些目录的路径存储在文件 cal_list 中,可以使用该文件通过提交如下的 shell 创建 Slurm 的作业数组:

1
2
3
4
5
6
7
#!/bin/sh
#SBATCH -n 144
#SBATCH --array=1-11%2
module load vasp-6.3.2-opt
celltarget_dir=$(sed -n "${SLURM_ARRAY_TASK_ID}p" cal_dir_list)
cd ${target_dir}
srun vasp_ncl

该 shell 脚本旨在创建一个 Slurm 作业数组,以计算所有 11 种磁配置的能量,同时通过允许最多 2 个作业同时运行来有效管理计算资源。

后处理

一旦所有计算都已收敛,可以利用 post_process 函数提取与不同配置相关的能量。此过程最终导致构建相互作用矩阵。

1
2
3
4
5
6
7
8
9
cd("CrI3") do
global pair_mat, coeff_array
mv("../oszicar.tar.gz", "./oszicar.tar.gz") # 隐藏
run(`tar -xvzf oszicar.tar.gz`) # 隐藏
for (idx, dir_name) in enumerate(readlines("cal_dir_list")) # 隐藏
cp("oszicar/OSZICAR_$(idx)", dir_name * "OSZICAR") # 隐藏
end # 隐藏
pair_mat, coeff_array = Sym4state.post_process("./cal.jld2")
end # 隐藏

我们可以检查 pair_matcoeff_array 的维度,这些存储了各种原子对的起始和结束点的索引及其对应的相互作用矩阵。

1
2
size(pair_mat)
size(coeff_array)

因此,我们观察到在 5 Å 的截止半径内存在总共 8 种相互作用。让我们检查 pair_mat 中的一个特定条目,该条目包含表示原子对的索引:

初始和最终数字对应于起始和结束点原子的索引,第二和第三个数字表示沿 x 轴和 y 轴的原始单元的偏移量。

蒙特卡罗模拟

利用前面的结果 pair_matcoeff_array,我们可以设置一个蒙特卡罗模拟的配置,以确定相变温度或磁纹理,如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
using Unitful, UnitfulAtomic

mcconfig = Sym4state.MC.MCConfig{Float32}(
lattice_size=[128, 128],
magmom_vector=[3.5, 3.5],
pair_mat=pair_mat,
interact_coeff_array=coeff_array,
temperature=collect(150:-2:0),
magnetic_field=zeros(3),
equilibration_step_num=100_000,
measuring_step_num=100_000
)

在上述代码片段中,我们配置了一个模拟退火模拟,从 150 K 开始,逐渐降低到 0 K,步长为 2 K。模拟在 \ce{CrI3}128 \times 128 超晶胞上运行,使用先前计算的相互作用矩阵。为了评估系统,我们进行初步的平衡阶段,包含 100000 次扫掠,随后是包含 100000 次扫掠的测量阶段,以获取物理量。值得注意的是,磁场缺失,因此 magmom_vector 并不重要。

使用创建的 mcconfig,可以如下启动蒙特卡罗模拟:

1
2
(states_over_env, norm_mean_mag_over_env, susceptibility_over_env, specific_heat_over_env) = 
Sym4state.MC.mcmc(mcconfig, backend=Sym4state.MC.CPU(), progress_enabled=false, log_enabled=false)

参数 backend 可以配置为使用 CUDABackend() 提供的 GPU 加速,或任何其他由 KernelAbstractions.jl 支持的后端,以提高性能。

MCConfig 还可以存储到 .toml 文件中:

1
2
3
cd("CrI3") do
Sym4state.MC.save_config("CrI3.toml", mcconfig)
end # 隐藏

或者也可以通过以下方式恢复:

1
2
3
cd("CrI3") do
mcconfig = Sym4state.MC.load_config("CrI3.toml")
end # 隐藏

函数

  • reduce_interact_mat_for_a_pair
  • supercell_check
  • pre_process
  • post_process
  • rm("CrI3", recursive=true)

参考文献

  1. Xiang, H. J., et al. “Predicting the spin-lattice order of frustrated systems from first principles.” Physical Review B 84.22 (2011): 224429.
  2. Šabani, D., C. Bacaksiz, and M. V. Milošević. “Ab initio methodology for magnetic exchange parameters: Generic four-state energy mapping onto a Heisenberg spin Hamiltonian.” Physical Review B 102.1 (2020): 014457.
  3. Xiang, Hongjun, et al. “Magnetic properties and energy-mapping analysis.” Dalton Transactions 42.4 (2013): 823-853.

SAXIS

默认值: SAXIS = (0, 0, 1)

描述

设置全局自旋量子化轴相对于笛卡尔坐标系的方向。

SAXIS 指定由泡利矩阵生成的自旋子空间的相对方向。默认情况下,SAXIS(0, 0, 1),即自旋量子化轴沿 z 轴方向。

重要性

在包含自旋轨道耦合时(LSORB = True),自旋量子化轴的相对方向与真实空间的关系变得重要。所有由 VASP 写入或读取的磁矩和类自旋量子数都以自旋子空间的基底表示。

坐标系统

坐标系统

图 1. 欧拉角 $\alpha$ 和 $\beta$ 的定义。

默认方向为 $\sigma_1=\hat x$,$\sigma_2=\hat y$,$\sigma_3 = \hat z

Automag

An automatic workflow software for calculating the ground collinear magnetic state of a given structure and for estimating the critical temperature of the magnetically ordered to paramagnetic phase transition.
用于计算共线磁基态的自动工作流程软件,并用于估计磁相变温度。

Installation安装

Automag is meant to be run on a computing cluster. The first step in the installation is to clone the repository
Automag 旨在运行在计算集群上。第一步 installation 是克隆存储库

git clone https://github.com/michelegalasso/automag.git

I assume that you have Python 3 installed on your system, accessible through the python command, with the wheel and the venv packages installed. After cloning, go to the automag directory which has appeared and initialize a Python virtual environment
我假设您的系统上安装了 Python 3,可通过 python 命令,安装了 wheel 和 venv 包。 克隆后,转到已出现的 automag 目录并初始化 Python 虚拟环境

1
2
cd automag
python -m venv .venv

After that, activate your virtual environment. If you are working on an Unix-like system, you can do it with the command
之后,激活您的虚拟环境。如果您正在使用类 Unix 系统,您可以使用命令

source .venv/bin/activate

Finally, you need to install all the necessary Python dependencies for Automag with the command
最后,您需要为 Automag 安装所有必要的 Python 依赖项 使用命令

pip install -r requirements.txt

Before using Automag, make sure that enumlib is installed on your system and that that your command line has access to the commands enum.x and makeStr.py. In addition, Automag needs to know how to use VASP, so you need to edit the file automag/ase/run_vasp.py for Automag to correctly load the MKL and MPI libraries (if needed) and call the vasp_std executable on your system. Then add the following lines to your ~/.bashrc file
在使用 Automag 之前,请确保系统上已安装 enumlib 并且 您的命令行可以访问命令 enum.x 和 makeStr.py。 此外,Automag 需要知道如何使用 VASP,因此您需要编辑文件 automag/ase/run_vasp.py 用于 Automag 正确加载 MKL 和 MPI 库 (如果需要)并调用系统上的 vasp_std 可执行文件。然后添加以下几行添加到您的 ~/.bashrc 文件

1
2
3
4
export PYTHONPATH=/PATH/TO/automag:$PYTHONPATH
export VASP_SCRIPT=/PATH/TO/automag/ase/run_vasp.py
export VASP_PP_PATH=/PATH/TO/pp
export AUTOMAG_PATH=/PATH/TO/automag

obviously replacing /PATH/TO with the actual path to these files or directories. The pp folder is the VASP pseudopotential library and it should contain two subfolders named, respectively, potpaw_LDA and potpaw_PBE.
显然将 /PATH/TO 替换为这些文件或目录的实际路径。 pp 文件夹是 VASP 赝势库,它应该包含两个子文件夹分别命名为 potpaw_LDA 和 potpaw_PBE。

Before starting to use Automag, you should also make sure to have the FireWorks library correctly pointing to a MongoDB database and configured for launching jobs through a queue management system (for more detailed information refer to the FireWorks documentation). Last but not least, open the file automag/common/SubmitFirework.py and edit line 23 with the location of your my_launchpad.yaml file. Now you are ready to use Automag.
在开始使用 Automag 之前,您还应该确保拥有 FireWorks 库正确指向 MongoDB 数据库并配置为启动作业(有关更多详细信息,请参阅 添加到 FireWorks 文档)。最后打开文件 automag/common/SubmitFirework.py 并编辑第 23 行编辑 my_launchpad.yaml 文件。现在,您可以开始使用 Automag。

Convergence tests收敛测试

When studying a magnetic structure, you may want to start from convergence tests. Automag allows you to check for convergence of the VASP parameter ENCUT, which is the energy cut-off of the plane wave basis set, and to simultaneously check for convergence of the two parameters SIGMA and kpts, which are the electronic smearing parameter and the k-mesh resolution parameter for Brillouin zone sampling, respectively.
在研究磁性结构时,您可能希望从收敛测试开始。 Automag 允许您检查 VASP 参数 ENCUT 的收敛性,该参数是平面波基组的能量截止,并同时检查 SIGMA 和 kpts 这两个参数的收敛,它们是电子的用于布里渊区采样的涂抹参数和 k-mesh 分辨率参数, 分别。

In order to run convergence tests, go to the folder 0_conv_tests and insert the following input parameters in the file input.py:
要运行收敛测试,请转到文件夹 0_conv_tests 并插入文件 input.py 中的以下输入参数:

  • mode can be “encut” for convergence tests with respect to ENCUT or “kgrid” for convergence tests with respect to SIGMA and kpts;
    mode可以是 “ENCUT” 用于关于 ENCUT 或 “kgrid” 的收敛测试 用于 SIGMA 和 kpts 的收敛测试;

  • poscar_file is the name of the file in POSCAR format which contains the input geometry and which has been put in the folder automag/geometries;
    poscar_file 是包含输入的 POSCAR 格式文件的名称 geometry 的 ,并且已放入文件夹 automag/geometries;

  • params is a collection of VASP parameters to be used during single-point energy calculations.
    params 是要在单点期间使用的 VASP 参数的集合 能量计算。
    In addition, the following optional parameters can be specified:
    此外,还可以指定以下可选参数:

  • magnetic_atoms contains the atomic types to be considered magnetic (defaults to transition metals);
    magnetic_atoms 包含要被视为磁性的原子类型(默认值 过渡到过渡金属);

  • configuration is the magnetic configuration to use for convergence tests (defaults to ferromagnetic high-spin);
    configuration 是用于收敛测试的磁性配置 (默认为铁磁高自旋);

  • encut_values contains the trial values for ENCUT (defaults to the interval [500, 1000] eV at steps of 10 eV);
    encut_values 包含 ENCUT 的 trial 值(默认为区间 [500, 1000] eV,步长为 10 eV);

  • sigma_values contains the trial values for SIGMA (defaults to the interval [0.05, 0.20] eV at steps of 0.05 eV);
    sigma_values包含 SIGMA 的试验值(默认为区间 [0.05, 0.20] eV,步长为 0.05 eV);

  • kpts_values contains the trial values for kpts (defaults to the interval [20, 100] A^-1 at steps of 10 A^-1).
    kpts_values 包含 kpts 的试验值(默认为区间 [20, 100]A^-1 以 10 A^-1 为步长)。
    Once you have inserted the input parameters in the file input.py, launch the script 1_submit.py using the python executable of your virtual environment and a number of workflows containing single-point VASP calculations will be saved in your remote database. These calculations need to be run in a separate directory called CalcFold. You can enter it and then submit the jobs with the following commands, being in the automag directory
    在文件 input.py 中插入输入参数后,启动使用虚拟环境的 python 可执行文件1_submit.py,以及 许多包含单点 VASP 计算的工作流将保存在您的远程数据库。这些计算需要在单独的目录中运行 称为 CalcFold。您可以输入它,然后使用以下内容提交作业 命令, 位于 automag 目录中

    1
    2
    cd CalcFold
    nohup qlaunch -r rapidfire -m 10 --nlaunches=infinite &

    This will enter the directory CalcFold and it will invoke the qlaunch command in the background, which constantly checks for new calculations in the remote database and submits them to the queue management system of your cluster. The command line option -m 10 means that qlaunch will allow a maximum number of 10 jobs to be in the queue of your system at the same time. If 10 or more jobs are waiting or running in your queue, qlaunch will not submit more jobs until their total number becomes less than 10. If you wish, you can change this parameter to a different number. In the following, I assume that the qlaunch process is always working in the background.
    这将进入 CalcFold 目录,并将调用 qlaunch 命令,该命令会不断检查 remote 数据库,并将其提交到集群的队列管理系统。 命令行选项 -m 10 表示 qlaunch 将允许最大数量 的 10 个作业同时位于您的系统队列中。如果 10 或更多作业正在等待或正在您的队列中运行,qlaunch 不会提交更多作业 直到它们的总数小于 10。如果您愿意,您可以更改此 参数设置为不同的数字。在下文中,我假设 qlaunch 进程始终在后台运行。

After all calculations have been completed, you can launch the script named 2_plot_results.py in the 0_conv_tests folder. It will read the output file that Automag wrote in CalcFold and it will produce a plot of the parameters under study versus energy. In addition, the script will also print on screen the values of the parameters under study for which the error in energy is less than 1 meV/atom with respect to the most accurate result.
完成所有计算后,您可以启动名为 2_plot_results.py 0_conv_tests 文件夹中。它将读取输出文件 Automag 在 CalcFold 中写入的,它将生成参数图 正在研究与能源。此外,脚本还将在屏幕上打印能量误差小于 1 meV/atom 相对于最准确的结果。

Calculation of the electronic correlation parameter U by linear response通过线性响应计算电子相关参数 U

The linear response formalism for the calculation of the Hubbard U is based on the application of a series of small perturbations to the first magnetic atom. During the whole process, the perturbed atom must be treated independently from the other atoms of the same species, and we achieve this using a simple trick: we change the chemical identity of the atom to which we want to apply perturbations to a dummy atomic species, but we place the POTCAR file of the original atomic species in the pp folder corresponding to the dummy atom. For example, if we are calculating the value of the Hubbard U for Fe in the system Fe12O18 and we choose Zn as dummy atom, we need to ensure that the same POTCAR file of Fe is used also for Zn in order to have, instead of Zn, a Fe atom that is treated independently from the others. This can be achieved with the following commands
用于计算 Hubbard U 的线性响应形式基于对第一个磁性原子施加一系列小扰动。 在整个过程中,必须独立于同一物种的其他原子,我们用一个简单的技巧来实现这一点:我们更改我们要施加扰动的原子的化学性质添加到虚拟原子种类中,但我们将原始原子的 POTCAR 文件物种。例如,如果我们是 计算系统 Fe12O18 中 Fe 的哈伯德 U 值,我们选择 Zn 作为虚拟原子,我们需要确保也使用相同的 Fe 的 POTCAR 文件 对于 Zn,以便有一个独立处理的 Fe 原子,而不是 Zn 从其他人那里。这可以通过以下命令来实现

1
2
3
cd $VASP_PP_PATH/potpaw_PBE/Zn
mv POTCAR _POTCAR
cp ../Fe/POTCAR .

In this way the Automag code, and in particular the ASE library, will treat the system as if it was ZnFe11O18, but when they will look for the POTCAR file in the Zn folder, they will find the POTCAR of Fe, so the system will remain Fe12O18. Before launching this calculation, go to the directory 1_lin_response and set the necessary parameters in the file input.py:
通过这种方式,Automag 代码,特别是 ASE 库,将处理系统,就好像它是 ZnFe11O18 一样,但是当他们将在 Zn 文件夹中,他们会找到 Fe 的 POTCAR,因此系统将保持 Fe12O18。 在启动此计算之前,请转到目录 1_lin_response 并设置 文件中的必要参数 input.py:

  • poscar_file is the name of the file in POSCAR format which contains the input geometry and which has been put in the folder automag/geometries;
    poscar_file 是包含输入的 POSCAR 格式文件的名称 geometry 的 ,并且已放入文件夹 automag/geometries;
  • dummy_atom is the name of the dummy atomic species to use for the atom which is subject to perturbations (do not forget to manually put the right POTCAR file in the pp folder for this atom);
    dummy_atom 是用于原子的虚拟原子种类的名称,其中 会受到干扰(不要忘记手动放置正确的 POTCAR 文件 在此原子的 pp 文件夹中);
  • dummy_position is the position of the dummy atom in your POSCAR file (from 0 to N - 1, where N is the number of atoms in the unit cell);
    dummy_position 是虚拟原子在 POSCAR 文件中的位置(从 0 到 N - 1,其中 N 是晶胞中的原子数);
  • perturbations contains the values of the perturbations to apply to the chosen atom in eV;
    perturbations 包含要应用于所选 原子在 eV 中;
    params is a collection of VASP parameters to be used during * single-point energy calculations.
    params 是要在单点期间使用的 VASP 参数的集合能量计算。

In addition, the following optional parameters can be specified:
此外,还可以指定以下可选参数:

  • magnetic_atoms contains the atomic types to be considered magnetic (defaults to transition metals);
    magnetic_atoms 包含要被视为磁性的原子类型(默认值 过渡到过渡金属);
  • configuration is the magnetic configuration to use for U calculation (defaults to ferromagnetic high-spin).
    configuration 是用于 U 计算的磁性配置(默认值 到铁磁高自旋)。

Once the input parameters have been inserted in the file input.py, you can launch the script 1_submit.py in order to save the necessary VASP jobs to the remote database. You will see that the instance of qlaunch which is running in the background will immediately send these jobs to the queue management system of your cluster. When all calculations are completed, you will find in CalcFold the file charges.txt, containing the amount of electrons on the partially occupied shell of the chosen atom for each value of the applied perturbation, for both the selfconsistent and the non-selfconsistent runs. Now you can execute the script 2_plot_results.py, which will plot the selfconsistent and the non-selfconsistent responses, it will interpolate them as straight lines to the least squares and it will calculate their slopes. The value of U is obtained from U = 1/X - 1/X0, where X and X0 are the selfconsistent and the non-selfconsistent slopes, respectively.
将输入参数插入文件 input.py 后,您可以 启动脚本1_submit.py,以便将必要的 VASP 作业保存到 远程数据库。您将看到在 后台会立即将这些作业发送到队列管理系统 的集群。完成所有计算后,您将在 CalcFold 中找到 该文件charges.txt,其中包含部分 所选原子的占用壳,用于施加扰动的每个值, 对于自洽和非自洽游程。现在您可以执行 脚本2_plot_results.py,它将绘制 selfconsistent 和 nonself-align 响应,它会将它们作为直线插入到 最小二乘法,它将计算它们的斜率。U 的值由 U = 1/X - 1/X0,其中 X 和 X0 是自洽和非自洽 slopes 的 Slope 值。

Search for the most stable magnetic state寻找最稳定的磁态

The search for the ground collinear magnetic state consists in generating a number of trial configurations and in computing their single-point energy, in order to determine which is the most thermodynamically stable. The trial configurations differ from each other only by the choice of the unit cell and by the initialization of the magnetic moments. Note that the value of the magnetic moment on each atom can change during the single-point energy calculation. Automag generates trial configurations by separately initializing each Wyckoff position occupied by magnetic atoms in a ferromagnetic (FM), antiferromagnetic (AFM) or non magnetic (NM) fashion, taking into account all possible combinations. A completely non-magnetic (NM) configuration is also generated. In this way, overall ferrimagnetic (FiM) states are allowed if the magnetic atoms occupy more than one Wyckoff position. For each magnetic atom, one or two absolute values for the magnetization can be given in input. In the first case, the given value is used for initializing all the spin-up and spin-down states in the configurations generated by Automag. Conversely, if two separate values are given for high-spin (HS) and low-spin (LS) states, then each Wyckoff position occupied by that magnetic atom is separately initialized in a HS or LS fashion, taking into account all possible combinations. In order to run such a calculation, go to the directory 2_coll and set the necessary input parameters in the file input.py:
对共线磁基态的搜索包括生成一个 试验配置的数量和计算它们的单点能量,在 order 来确定哪个是最热力学稳定的。审判 配置彼此之间唯一的区别在于晶胞的选择和 磁矩的初始化。请注意,磁性 在单点能量计算过程中,每个原子上的矩都会发生变化。 Automag 通过单独初始化每个 Wyckoff 来生成试验配置 铁磁 (FM) 中磁性原子占据的位置, 反铁磁 (AFM) 或非磁性 (NM) 方式,同时考虑所有可能的组合。 还会生成完全无磁性 (NM) 配置。这样, 如果磁性原子占据更多,则允许整体亚铁磁性 (FiM) 状态 比一个 Wyckoff 位置。对于每个磁性原子,一个或两个 磁化强度可以在 input 中给出。在第一种情况下,给定值为 用于初始化配置中的所有 spin-up 和 spin-down 状态 由 Automag 生成。相反,如果为 high-spin 给定两个单独的值 (HS) 和低自旋 (LS) 状态,则每个 Wyckoff 位置都由该 磁性原子以 HS 或 LS 方式单独初始化,同时考虑到 所有可能的组合。要运行此类计算,请转到目录 2_coll并设置必要的输入参数:

poscar_file is the name of the file in POSCAR format which contains the input geometry and which has been put in the folder automag/geometries;
poscar_file 是包含输入的 POSCAR 格式文件的名称 geometry 的 ,并且已放入文件夹 automag/geometries;
supercell_size is the maximum supercell size for generating distinct magnetic configurations, in multiples of the input structure;
supercell_size 是产生不同磁性元件的最大超级单元大小 配置,以输入结构的倍数;
spin_values a maximum of two values (HS and LS) of the magnetization in Bohr magnetons for each magnetic atom, used to initialize spin-up and spin-down states;
spin_values玻尔的磁化强度最多两个值(HS 和 LS) 每个磁性原子的磁子,用于初始化自旋上升和自旋下降状态;
params is a collection of VASP parameters to be used during single-point energy calculations.
params 是要在单点期间使用的 VASP 参数的集合 能量计算。
In addition, the following optional parameter can be specified:
此外,还可以指定以下可选参数:

lower_cutoff is the minimum value in Bohr magnetons to which a magnetic moment can fall in order for the corresponding configuration to be used for estimating the critical temperature of the material (defaults to zero).
lower_cutoff 是磁矩达到的玻尔磁子的最小值 可以进行 材料的临界温度(默认为零)。
Once the input parameters have been inserted in the file input.py, you can launch the script 1_submit.py in order to save the necessary VASP jobs to the remote database. The running instance of qlaunch will send these jobs to the queue management system of your cluster. Once all calculations have been completed, you can launch the script 2_plot_results.py which will produce a number of files containing the histogram plot of the obtained energies for all trial configurations that successfully completed the single-point energy calculation. The script also prints on screen the name of the configuration with lowest energy.
将输入参数插入文件 input.py 后,您可以 启动脚本1_submit.py,以便将必要的 VASP 作业保存到 远程数据库。正在运行的 qlaunch 实例会将这些作业发送到 集群的队列管理系统。一旦所有计算都已完成 complete,您可以启动脚本2_plot_results.py,这将生成一个 包含所有所得能量的直方图的文件数 成功完成单点能量的 Trial 配置 计算。该脚本还会在屏幕上打印配置的名称 以最低的能量。

Calculation of the critical temperature
临界温度的计算
Automag can calculate the critical temperature of the magnetically ordered to paramagnetic phase transition from a Monte Carlo simulation of the effective Hamiltonian which describes the magnetic interaction. Automag computes the coupling constants of the corresponding Heisenberg model and provides all the necessary input files to run the Monte Carlo simulation with the VAMPIRE software package. The simulation itself needs to be run by the user, while Automag can be used to plot and to fit the results. The accuracy of the Heisenberg model is evaluated by computing the Pearson Correlation Coefficient (PCC) between the DFT energies and the predicted energies of a control group of magnetic configurations. It is worth noting that this approach can be applied only if all magnetic atoms have the same absolute value of the magnetization. In order to estimate the critical temperature with Automag, go to the folder 3_monte_carlo and set the necessary parameters in the file input.py:
Automag 可以计算出磁力排序的临界温度 顺磁相变来自蒙特卡洛模拟的有效 描述磁相互作用的哈密顿量。Automag 计算 耦合常量,并提供所有 使用 VAMPIRE 软件运行 Monte Carlo 模拟所需的输入文件 包。仿真本身需要由用户运行,而 Automag 可以 用于绘制和拟合结果。海森堡模型的精度为 通过计算 DFT 能量和磁控制组的预测能量 配置。值得注意的是,只有在所有 磁性原子具有相同的磁化绝对值。为了 使用 Automag 估计临界温度,转到 3_monte_carlo 并在 file input.py 中设置必要的参数:

configuration is the name of the magnetic configuration to use for the Monte Carlo simulation (usually you want to put here the name of the configuration with lowest energy, obtained at the previous step);
configuration 是用于 Monte 的磁性配置的名称 Carlo 模拟(通常您希望在此处使用 最低能量,在上一步获得);
cutoff_radius is the maximum distance between two magnetic atoms to be considered as interacting neighbors;
cutoff_radius 是两个磁性原子之间的最大距离 被视为互动邻居;
control_group_size is the relative size of the control group used to evaluate the accuracy of the Heisenberg model;
control_group_size 是用于评估的对照组的相对大小 海森堡模型的准确性;
append_coupling_constants is a boolean flag which tells Automag whether or not to append the computed values of the coupling constants to the file input.py, which are needed by the script 2_write_vampire_ucf.py.
append_coupling_constants 是一个布尔标志,它告诉 Automag 是否 要将耦合常量的计算值附加到文件 input.py, 脚本2_write_vampire_ucf.py需要。
In addition, the following optional parameter can be specified:
此外,还可以指定以下可选参数:

magnetic_atoms contains the atomic types to be considered magnetic (defaults to transition metals).
magnetic_atoms 包含要被视为磁性的原子类型(默认值 过渡到过渡金属)。
Once the input parameters have been inserted in the file input.py, you can launch the script 1_coupling_constants.py. It will compute the coupling constants for the given cutoff radius and it will print their values on screen. In addition, it will create a file model.png, which contains a plot of the Heisenberg model energies versus the DFT energies for all the configurations in the control group. The values of the distances between neighbors, the amounts of neighboring pairs of magnetic atoms in the unit cell at each distance and the value of the PCC are also printed on screen.
将输入参数插入文件 input.py 后,您可以 1_coupling_constants.py启动脚本。它将计算耦合 常量,它将在屏幕上打印它们的值。 此外,它还将创建一个文件model.png,其中包含 海森堡模型能量与 DFT 能量的关系 Control 组。相邻要素之间的距离值、 晶胞中每个距离处的相邻磁原子对和 PCC 的值也打印在屏幕上。

We suggest to run the script 1_coupling_constants.py a couple of times with the append_coupling_constants flag set to False and with different values of the cutoff_radius, in order to investigate how many neighbors you need to include for obtaining a well-converged Heisenberg model. Once you are satisfied with the model’s accuracy, run the script a last time with the append_coupling_constants flag set to True and Automag will append the values of the coupling constants and the distances between neighbors to the file input.py. Now you are ready to run the script 2_write_vampire_ucf.py, which will read the file input.py and will produce a VAMPIRE unit cell file vamp.ucf. Now you can run VAMPIRE on your cluster using the unit cell file written by Automag, an input file and a material file specific for your problem. Automag contains a sample input file and a sample material file in the folder 3_monte_carlo/vampire_input, which can be simply edited and adapted to the problem under study. Once the VAMPIRE run is done, you can copy the output file in the folder 3_monte_carlo and run the last script 3_plot_results.py. It will produce a plot of the mean magnetization length (of the spin-up channel for antiferromagnetic materials) versus temperature obtained from the Monte Carlo simulation and it will fit the data using the analytical expression of the mean magnetization length, obtaining the values of the critical temperature and of the critical exponent. The fitted values of these two parameters are printed on screen.
1_coupling_constants.py我们建议使用 append_coupling_constants标志设置为 False,并且 cutoff_radius,为了调查您需要包含多少个邻居 获得收敛良好的 Heisenberg 模型。一旦您对 model 的 accuracy 时,请使用 append_coupling_constants flag 设置为 True 将附加耦合常量的值 以及 input.py 的邻居之间的距离。现在您已准备好 运行脚本 2_write_vampire_ucf.py,它将读取文件 input.py 将生成一个 VAMPIRE 晶胞文件 vamp.ucf。现在,您可以在 使用 Automag 编写的晶胞文件、输入文件和材质的簇 特定于您的问题的文件。Automag 包含一个样本输入文件和一个样本 material 文件,可以是 3_monte_carlo/vampire_input 文件夹中,也可以是简单的 编辑并改编了正在研究的问题。VAMPIRE 运行完成后,您 可以复制 3_monte_carlo 文件夹中output文件并运行最后一个脚本 3_plot_results.py。它将生成平均磁化长度 (的 反铁磁材料的自旋向上通道)与温度的关系 来自 Monte Carlo 模拟,它将使用分析来拟合数据 平均磁化长度的表达式,得到临界 温度和临界指数。这两个的拟合值 参数打印在屏幕上。