我现在想用VASP计算的RuO2,并实现输出wannier90的输入文件。我目前的INCAR如下: ...

创建于:2026年2月24日

使用 GPT-5.2 Thinking 回答 Chat01

问题

我现在想用VASP计算的RuO2,并实现输出wannier90的输入文件。我目前的INCAR如下:
SYSTEM = RuO2
NPAR = 8
KPAR = 8
ISTART = 0
ICHARG = 2
ISMEAR = 1
SIGMA = 0.15
ENCUT = 520
EDIFF = 1E-8
GGA = PE
LORBIT = 11
PREC = A
AMIX = 0.2
BMIX = 0.01
AMIX_MAG = 0.8
BMIX_MAG = 0.04
NEDOS = 2400
NELMIN = 6
NELM = 100
LMAXMIX = 4
LREAL = .FALSE
LWAVE = .FALSE
LCHARG = .TRUE
ADDGRID = .TRUE
GGA_COMPAT = .FALSE.

NSW = 0
IBRION = -1
POTIM = 0.2
ISIF = 2
EDIFFG = -0.001

NBANDS = 64
ISPIN = 2
MAGMOM = 2 -2 4*0
LWANNIER90 = .TRUE.
POSCAR如下:
RuO2
1.00000000000000
4.6515700000000004 0.0000000000000000 0.0000000000000000
0.0000000000000000 4.6515700000000004 0.0000000000000000
0.0000000000000000 0.0000000000000000 2.9695930000000001
Ru O
2 4
Direct
0.5000000000000000 0.5000000000000000 0.5000000000000000
-0.0000000000000000 0.0000000000000000 0.0000000000000000
0.2014855089968415 0.7985144910031586 0.5000000000000000
0.7985144910031586 0.2014855089968415 0.5000000000000000
0.7014855089968414 0.7014855089968414 0.0000000000000000
0.2985144910031585 0.2985144910031585 -0.0000000000000000

0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
我该怎么修改我的INCAR?(我希望Ru投影d轨道,O投影p轨道)

思考

Providing modified INCAR for SCF and NSCF

Let’s clarify the changes to the INCAR, especially since the user just wanted modifications. For the SCF calculations, minimal changes include setting ISYM=0, LWRITE_MMN_AMN=.TRUE., and NUM_WANN=22. Also, remember that LREAL should be .FALSE. with the period.

For the NSCF calculations, we recommend the following INCAR:

text
ISTART=1 ICHARG=11 NELM=1 ISYM=0 LWANNIER90=.TRUE. LWRITE_MMN_AMN=.TRUE. LWRITE_UNK=.TRUE. (optional) NUM_WANN=22 NBANDS=64

Additionally, set LWANNIER90_RUN=.FALSE. for file extraction (default is false).

Explaining projection setup in VASP for Wannier90

To set projections in VASP, you have two options:

  1. Create an external wannier90.win, adding the projections block manually:

    text
    num_wann = 22 begin projections Ru:d O:p end projections
  2. In VASP >= 6.2, use the WANNIER90_WIN tag in the INCAR file:

    text
    WANNIER90_WIN = " begin projections Ru:d O:p end projections "

For spin-polarized systems, you may need separate wannier90.up.win and wannier90.dn.win. If RuO2 is nonmagnetic, set ISPIN=1 and remove MAGMOM to avoid spin manifolds.

Clarifying VASP setup for Wannier90 projections

To ensure everything works smoothly, use a full Monkhorst-Pack grid for KPOINTS, not an irreducible one. Set ISYM=0 to avoid symmetry reduction. Also, set GGA_COMPAT=.FALSE. and ensure you've compiled VASP with Wannier support.

For Wannier extraction, adjust ISTART=1 and ICHARG=11 to use the converged charge and wavefunction. Setting LWAVE=.TRUE. in SCF will allow restarting later.

In terms of unnecessary settings, LORBIT=11 isn't needed but harmless.

Finalizing the INCAR snippet for Wannier90 interface

For the NSW parameter, it's fine whether you keep or remove ionic tags since NSW=0 disables ion movement. Here's the proposed INCAR snippet for the NSCF Wannier run:

text
# -------- Wannier90 interface (NSCF) -------- ISTART = 1 ICHARG = 11 NELM = 1 ISYM = 0 LWANNIER90 = .TRUE. LWRITE_MMN_AMN = .TRUE. NBANDS = 64 LWAVE = .FALSE. LCHARG = .FALSE.

Note: If you use ICHARG=11, ensure CHGCAR is available since VASP reads from it. You can keep LCHARG=.FALSE. to avoid rewriting CHGCAR.

Thought for 3m 29s

回答

你现在的 INCAR 里已经有 LWANNIER90 = .TRUE.,但要稳定地让 VASP 把 Wannier90 所需输入文件(wannier90.win/mmn/amn/eig 等)写出来,以及实现你要的 Ru:d、O:p 投影,建议按下面做(尤其是金属体系 RuO2_2):


1) 关键点:Ru:d、O:p 不是在 INCAR 里写,而是在 wannier90.win(或 WANNIER90_WIN)里写

VASP 在 LWANNIER90=.TRUE. 时会写出 wannier90.win, wannier90.mmn, wannier90.amn, wannier90.eig 等文件;并且如果你在 wannier90.win 里提供 projections 块,VASP 会按这个投影去生成 amn(投影矩阵)。 (vasp.at)
Wannier90 的投影语法本身支持 s/p/d/f 等角动量投影。 (wannier90.readthedocs.io)


2) 推荐两步走:先 SCF,再用 NSCF 专门导出 Wannier 输入

(A) 第一步:正常 SCF(你现在这套基本可以)

唯一强烈建议:把波函数写出来,给第二步复用

ini
LWAVE = .TRUE. LCHARG = .TRUE.

(你现在 LWAVE=.FALSE.,第二步就没法 ISTART=1 复用 WAVECAR 了。)

另外你这行建议修正一下小拼写:LREAL = .FALSELREAL = .FALSE.(少了最后那个点在一些版本会出问题)


(B) 第二步:NSCF(固定电荷密度)+ 写 Wannier90 文件(重点改 INCAR)

把第一步生成的 WAVECARCHGCAR 复制/保留到当前目录,然后用下面这套 INCAR 跑一次:

ini
# --- restart / nscf --- ISTART = 1 ICHARG = 11 NELM = 1 # --- wannier interface --- LWANNIER90 = .TRUE. LWRITE_MMN_AMN = .TRUE. # 如果你还想输出 UNK 用来画 Wannier 函数(可选) # LWRITE_UNK = .TRUE. # --- symmetry (important for k-mesh based wannier) --- ISYM = 0 # --- band / wannier number --- NBANDS = 64 NUM_WANN = 22

说明:

  • LWANNIER90 会让 VASP 写出 wannier90 所需文件。 (vasp.at)
  • 若你后面不是让 VASP 内部直接跑 wannier_run,而是想拿到 mmn/amn 在外部单独跑 wannier90,显式加上 LWRITE_MMN_AMN=.TRUE. 最稳妥。 (vasp.at)
  • NUM_WANN=22 对应你要的投影数量:
    • 2 个 Ru × 5 个 d = 10
    • 4 个 O × 3 个 p = 12
    • 合计 22
      并且从 VASP 6.2.0 起,NUM_WANN 也会用于 wannier90,并写进 wannier90.win 里的 num_wann。 (vasp.at)
  • ISYM=0 一般用于避免对 k 点做对称性约化,减少 Wannier 接口里邻接关系/权重相关的坑(尤其新手阶段很推荐)。

小提示:如果你使用 KPAR>1 有时会遇到 wannier 文件不全/接口异常(取决于 VASP 版本和编译选项),排查时先把 KPAR=1 试一下最省事。


3) 写投影:给一个最小 wannier90.win 模板(你要的 Ru:d + O:p)

在第二步跑之前,在目录里放一个 wannier90.win(这样 VASP 就会按你的投影生成 amn): (vasp.at)

text
num_wann = 22 begin projections Ru:d O:p end projections

Wannier90 投影语法本身支持这种按元素+角动量的写法(p/d 等)。 (wannier90.readthedocs.io)


4) 可选:不用单独建 wannier90.win,而是在 INCAR 里写 WANNIER90_WIN(VASP≥6.2.0)

如果你是 VASP 6.2.0 或更新版本,可以直接在 INCAR 写多行字符串,让 VASP 生成/补全 wannier90.win: (vasp.at)

ini
WANNIER90_WIN = " begin projections Ru:d O:p end projections "

如果你告诉我你用的 VASP 版本号、以及 KPOINTS 的网格(比如 8×8×12 之类),我可以顺手帮你把 wannier90.win 里 disentanglement(dis_win_* / dis_froz_*)窗口也按 RuO2_2 金属体系的常见做法配得更稳。

问题

它报了一个警告:

| |
| W W AA RRRRR N N II N N GGGG !!! |
| W W A A R R NN N II NN N G G !!! |
| W W A A R R N N N II N N N G !!! |
| W WW W AAAAAA RRRRR N N N II N N N G GGG ! |
| WW WW A A R R N NN II N NN G G |
| W W A A R R N N II N N GGGG !!! |
| |
| The wannier interface is returning 22 projections while NUM_WANN is |
| 34. I will continue by using NUM_WANN but you should probably |
| change NUM_WANN or the wannier90 input file. |
| |


| |
| W W AA RRRRR N N II N N GGGG !!! |
| W W A A R R NN N II NN N G G !!! |
| W W A A R R N N N II N N N G !!! |
| W WW W AAAAAA RRRRR N N N II N N N G GGG ! |
| WW WW A A R R N NN II N NN G G |
| W W A A R R N N II N N GGGG !!! |
| |
| The value of zona was manually set in the Wannier90 input file (see |
| wannier90 manual). Note that in 5.4.4 < vasp < 6.3 this was assumed |
| to be in Bohr^{-1} wich is not the case (it is defined in |
| Angstroem^{-1}). If you want to compare the current results with |
| results produced by one of these versions of vasp please multiply |
| the values of zona used on those runs by 1.88972599 |
| |

Wannier90 mode
Computing MMN (overlap matrix elements)
Abort(1) on node 47 (rank 47 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 47

问题

它报了一个警告:

| |
| W W AA RRRRR N N II N N GGGG !!! |
| W W A A R R NN N II NN N G G !!! |
| W W A A R R N N N II N N N G !!! |
| W WW W AAAAAA RRRRR N N N II N N N G GGG ! |
| WW WW A A R R N NN II N NN G G |
| W W A A R R N N II N N GGGG !!! |
| |
| The wannier interface is returning 22 projections while NUM_WANN is |
| 34. I will continue by using NUM_WANN but you should probably |
| change NUM_WANN or the wannier90 input file. |
| |


| |
| W W AA RRRRR N N II N N GGGG !!! |
| W W A A R R NN N II NN N G G !!! |
| W W A A R R N N N II N N N G !!! |
| W WW W AAAAAA RRRRR N N N II N N N G GGG ! |
| WW WW A A R R N NN II N NN G G |
| W W A A R R N N II N N GGGG !!! |
| |
| The value of zona was manually set in the Wannier90 input file (see |
| wannier90 manual). Note that in 5.4.4 < vasp < 6.3 this was assumed |
| to be in Bohr^{-1} wich is not the case (it is defined in |
| Angstroem^{-1}). If you want to compare the current results with |
| results produced by one of these versions of vasp please multiply |
| the values of zona used on those runs by 1.88972599 |
| |

Wannier90 mode
Computing MMN (overlap matrix elements)
Abort(1) on node 47 (rank 47 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 47
我不理解为什么它会默认num_wannier=34

思考

Addressing NUM_WANN default and KPAR troubleshooting

The search didn’t directly link KPAR with LWANNIER90, but I think KPAR might cause issues with mmn due to communication needs between kpoint groups. As a fix, I’ll suggest setting KPAR=1. For the default 34 issue, VASP sets NUM_WANN to NBANDS by default, which could explain the value. To avoid mismatches, make sure NUM_WANN is consistently set to 22.

Minimizing mismatch by aligning INCAR and wannier90 settings

To avoid the default of 34, set NUM_WANN=22 in INCAR and make sure num_bands=64 in the wannier90.win file. VASP will write num_bands=NBANDS automatically, but if you're providing wannier90.win, it won’t check existing blocks. Keep the file minimal so VASP can fill in the rest.

Clarifying NUM_WANN and win behavior

It's fine to let VASP set num_wann, but if wannier90.win doesn’t exist, VASP will create a template with num_wann = NBANDS. If you want 22, create wannier90.win with num_wann = 22. Setting NUM_WANN=22 might still result in NBANDS=64, but VASP writes the template with num_wann = NBANDS.

Thought for 2m 56s

回答

这个 34 并不是“凭空默认出来的”,它几乎肯定来自 NBANDS

为什么会变成 34?

在 VASP 的 wannier90 接口里有两件事会把“wannier 个数”绑到 NBANDS 上:

  1. NUM_WANN 的默认值就是 NBANDS(你不写 NUM_WANN 时,VASP 会取 NUM_WANN=NBANDS)。 (VASP)
  2. 如果目录里 没有现成的 wannier90.win,VASP 会自动生成一个模板,并把里面的
    num_wann = NBANDS 写进去。 (VASP)

所以你现在看到 “NUM_WANN is 34”,最常见原因就是:你这一次 wannier 这步实际用的 NBANDS=34(可能是你改过,或该步没写 NBANDS 让 VASP 自动给了 34),于是 NUM_WANN 也跟着变成 34。

而你 projections(Ru:d + O:p)只有 22 个投影,所以 VASP 才提示:

returning 22 projections while NUM_WANN is 34


你要的 Ru:d + O:p(22 个)怎么改才对?

A. 把 INCAR 里显式写死 NUM_WANN=22(关键)

用于 wannier 的那一步(通常是 NSCF,ICHARG=11)建议至少包含:

ini
ISTART = 1 ICHARG = 11 NELM = 1 LWANNIER90 = .TRUE. LWRITE_MMN_AMN = .TRUE. NUM_WANN = 22 NBANDS = 64 # 只要 >= 22 且满足你的能窗/纠缠需求即可 ISYM = -1 KPAR = 1
  • NUM_WANN=22:和你的投影数一致
  • ISYM=-1:完全关闭对称性/时间反演约化,避免 k 点不全导致 mmn 邻接出问题 (VASP)
  • 强烈建议先用 KPAR=1 排除并行导致的接口崩溃(你现在就是在 “Computing MMN” 时 MPI_Abort)。

B. wannier90.win 也保持一致(推荐)

用最小骨架文件就行(让 VASP 自动补 kpoints/mp_grid):

text
num_wann = 22 num_bands = 64 begin projections Ru:d O:p end projections

重点:不要在 win 里手动放 kpoints block(或者把它删掉)。VASP 明确说过:如果它发现 win 里已经有 kpoints block,它不会检查是否和你这次 VASP 的 KPOINTS 一致。 (VASP)
kpoints 不一致是导致 mmn 生成阶段直接崩的高频原因之一。


顺带解释一下 zona 的警告

那条只是说:你在 win 里手动设了 zona,而 VASP 5.4.4~6.3 之间对单位的历史假设有坑,用于提醒“和老版本结果对比时要换单位”;本身不等于出错。


你现在这次最可能的“根因”组合

  1. wannier 这步实际 NBANDS=34 → 触发默认 NUM_WANN=34 (VASP)
  2. projections 只有 22 → 报 mismatch
  3. mmn 计算时 MPI_Abort → 很常见于 kpoints block 不一致KPAR 并行接口不稳(先用 KPAR=1 + 删 win 里 kpoints block 最快定位)

如果你把你 wannier 那一步的 INCAR(尤其 NBANDS/NUM_WANN/ISYM/KPAR)和你当前目录的 wannier90.win 前 50 行贴出来,我可以直接指出到底是哪一条把它变成了 34,以及导致 MMN 崩溃的最具体原因。

问题

我现在想用wannier90做一个Berry曲率的空间分布图,但我发现我似乎无法输出各个位置的berry曲率,你有什么办法吗?

思考

Addressing k-space versus real-space Berry curvature

For real-space Berry curvature distribution, you’d compute the local Chern marker using PythTB or custom code based on Wannier90 data, commonly for 2D systems. In k-space, you can use kslice to map the curvature. Also, for magnetic systems, including SOC is crucial for non-zero curvature. In your case, RuO2 might feature symmetries that lead to zero curvature.

Clarifying Berry curvature considerations

To get nonzero Berry curvature, you generally need a symmetry-breaking mechanism like time-reversal (TR) or inversion. In nonmagnetic systems, TR symmetry cancels Berry curvature, but k-space maps can still show nonzero values. For RuO2, check if SOC is included; it's crucial for AHE. I'll now guide on tool usage and file review.

Explaining the process for 3D Berry curvature

If you want to compute Berry curvature on a full 3D grid in reciprocal space, you can use the berry option with berry_task; however, this doesn't output Ω(k) directly—it’s for integrals. For a 3D dataset, use WannierBerri to evaluate and output Ω(k). Make sure to start with seedname.chk.

Steps for plotting Berry curvature on the k-plane

To analyze the spatial distribution of Berry curvature across a 2D k-plane:

  1. Use the kslice module in postw90, remembering to include parameters like fermi_energy and berry_curv_unit.
  2. After running postw90.x seedname, check the outputs: seedname-kslice-coord.dat and seedname-kslice-curv.dat. Python scripts should also be generated for further analysis.

Steps for analyzing Berry curvature in postw90

  1. For 2D distribution on the k-plane, use postw90's kslice module with relevant keywords for Berry curvature and Fermi energy.
  2. Run postw90.x seedname, and check outputs in seedname-kslice-coord.dat and seedname-kslice-curv.dat. Postw90 will also generate Python scripts for further analysis.
  3. For 1D path analysis, use the kpath module.
  4. For 3D, note that postw90 doesn't output Ω(k) directly in 3D, focusing mainly on integrals like AHC.

Providing guidance on Berry curvature in Wannier90 and WannierBerri

To tabulate Ω(k) on a 3D grid, you can use WannierBerri by installing with pip install wannierberri. Here's a general approach using System_w90, but ensure you're verifying the API and check resources like tutorials. For local Chern markers in real space, you can use tight-binding methods with tools like PythTB. Always cite relevant documentation sources!

Thought for 4m 33s

回答

你碰到的“无法输出各个位置的 Berry 曲率”,多数情况下是把“空间分布”理解成实空间 r 了;但 Wannier90 / postw90 默认能直接给的是 k 空间(布里渊区里每个 k 点)的 Berry 曲率分布。下面给你两条路:** (A) k 空间分布图(Wannier90 原生支持)(B) 实空间“局域分布”(Wannier90 不原生输出,需要换定义/换工具)**。


A) 你要的是 k 空间“分布图”(最常见):用 postw90kslicekpath

1)做 2D 平面热力图:kslice_task = curv

seedname.win(例如 RuO2.win)里加这些(关键字在 postw90 参数表里就有:kslice_corner/b1/b2/kslice_2dkmesh 等) (Wannier90)

text
fermi_energy = <填你的费米能> # 金属必须给;单位 eV(通常) berry_curv_unit = bohr2 # 可选:输出单位 kslice = true kslice_task = curv # 只画 Berry 曲率热图 # kslice_task = curv+fermi_lines # 也可以叠加费米线(如果你想看“热点”在费米面附近) # 用“约化坐标”(reduced coordinates)定义一个 BZ 平面: kslice_corner = 0.0 0.0 0.0 kslice_b1 = 1.0 0.0 0.0 kslice_b2 = 0.0 1.0 0.0 # 平面网格密度(越大越细) kslice_2dkmesh = 301 301

这会生成“在你指定平面上的每个 k 点”的 Berry 曲率数据。

2)运行:

bash
postw90.x RuO2

3)你真正要找的“各个位置(k点)的输出文件”就在这里

postw90kslice 会明确写出这些文件名: (wannier.org)

  • RuO2-kslice-coord.dat:每个网格点的 (k_x, k_y) 坐标(用于画图定位)
  • RuO2-kslice-curv.dat:每个网格点的 Berry 曲率(按分量写出;脚本会用列号读取)
  • 同时它还会在运行时自动生成 python 画图脚本,比如 RuO2-kslice-curv_x.py / _y.py / _z.py 或带 +fermi_lines 的版本 (wannier.org)

小细节:kslice 模块里写的是“输出 minus the Berry curvature(负号)并对占据态求和”,所以你看到的热图可能是 -Ω(k)(这不是你错了,是它的定义/输出约定)。(wannier.org)


4)做 1D 路径分布:kpath_task = bands+curv

如果你要的是沿高对称线的 Ω(k),用 kpath 更合适。Wannier90 教程 18 就是这么做的: (Wannier90)

text
fermi_energy = <填你的费米能> kpath = true kpath_task = bands+curv kpath_num_points = 1000

B) 如果你说的“空间分布”是 实空间 r 上的 Berry 曲率:Wannier90 本身不直接给

严格地讲,Berry 曲率是定义在 k 空间的几何量(Ω_n(k))。Wannier90/postw90 的 “berry / kslice / kpath”模块也是在 k-space 工作的 (Wannier90)。

如果你想画“实空间中哪里贡献大”的那种图,一般需要换成局域拓扑标记的定义,例如 Bianco–Resta local Chern marker(局域陈数标记),它能在实空间格点/原子附近给出“局域拓扑贡献”。PythTB 就有现成教程示例可以直接把 marker 画成 real-space map: (pythtb.readthedocs.io)

典型工作流是:

  1. wannier90_hr.dat(Wannier 哈密顿量)构建紧束缚模型/超胞(可开边界)
  2. 计算 local Chern marker(或相关局域 marker)
  3. 在实空间画图(原子/格点着色)

你现在最可能卡住的点(快速自查)

  • 你有没有跑过 wannier90.x RuO2 得到 RuO2.chkpostw90 需要它。
  • 你要的是 k 空间分布还是 实空间分布
    • k 空间:按上面的 kslice,你一定会得到 RuO2-kslice-curv.dat + RuO2-kslice-coord.dat (wannier.org)
    • 实空间:要换 local marker(Wannier90 不直接输出)

如果你把你现在的 RuO2.win 里和 postw90 相关的部分(以及你想看的平面:比如 kz=0ky=0)贴出来,我可以直接帮你把 kslice_corner/b1/b2 按你的晶格方向写成“对的那张切片”。

问题

那我怎么得到不同kslice的mapping呢?我现在的win文件如下,这个程序可以跑通:
dis_num_iter = 100
num_iter = 100
dis_win_min = -22
dis_win_max = 15
dis_froz_min = -9
dis_froz_max = 5.5

begin projections
O:p
Ru:d
end projections

fermi_energy = 6.700615
berry_curv_unit = bohr2
berry = true
berry_task = curv
kpath = true
kpath_num_points = 1000

num_bands = 64
num_wann = 22
剩下的部分都是原子位置以及k点位置

思考

Explaining curvature, kslice, and parsing

It turns out that berry_task doesn’t include 'curv,' and perhaps the file is misinterpreted as related to something else, like kubo. Whatever the case, we can simplify this: to get different kslice mappings, set kslice_task = curv and optionally add +fermi_lines. I’ll show how to parse and reconstruct the coordinates by using grid indexing formulas.

Providing code for kslice and curvature analysis

I’ll cite specific lines of code to explain the use of reduced coordinates. I’ll also give a Python snippet that generates a table for kpt and related data, reading from the coord and curvature files. For different kslice mapping at various kz values, I can propose a bash script to loop through and generate outputs with different .win files.

Proposing a workflow for kslice mapping

I can suggest a workflow where we fix RuO2.chk, use a template .win file, and loop through with bash to generate files for each kslice iteration, running postw90.x. The recommended grid is 200x200, and I’ll mention potential complications with Berry curvature for metals and antiferromagnets like RuO2.

Crafting response and workflow explanation

To clarify the kslice setup: set kslice=true and define kslice_*. For each slice mapping, use kslice_corner, run postw90, and generate output files. For kz slices in a tetragonal cell, use specific corner and reciprocal vectors. Include code to generate k-point mappings—along with a bash script for scanning slices and a python script for saving. Note that berry=true berry_task=curv isn’t needed and can be omitted for efficiency. Make sure to include citations in the response.

Thought for 3m 31s

回答

你现在这个 .win 跑通的是 kpath 上的 Berry 曲率kpath=true),所以只能得到“沿路径”的数据;如果你要的是 某个 BZ 平面上的 2D mapping(热力图),要用 kslice 模块kslice=true)。

下面把“怎么得到不同 kslice 的 mapping”讲清楚:怎么定义切片、怎么批量扫不同切片、以及怎么把每个网格点对应回 3D k 点


1) 在你的 win 里加入 kslice(你现在还没开)

kslice_task=curv 会输出 2D 平面上每个网格点的 Berry 曲率,并生成画图脚本与数据文件:seedname-kslice-coord.dat + seedname-kslice-curv.dat (Wannier90)

建议你在现有内容基础上加:

text
kslice = true kslice_task = curv # 或 curv+fermi_lines(叠加费米线更直观) kslice_2dkmesh = 201 201 # 网格 (N1+1)x(N2+1),越大越细 # 下面三行决定“切哪个平面”(reduced coordinates) kslice_corner = 0.0 0.0 0.0 kslice_b1 = 1.0 0.0 0.0 kslice_b2 = 0.0 1.0 0.0

注意:kslice_corner / b1 / b2约化坐标(reduced coordinates),也就是用倒格矢基矢表示的系数;文档里就是这么定义的 (Wannier90)

你现有的 berry=true / berry_task=curv 其实不必保留(berry_task 的合法项主要是 kubo/kdotp 等),做 kslice 时通常可以把 berry=false,只保留 kpath 和/或 kslice,更干净 (Wannier90)


2) “不同 kslice”怎么做:改 corner 就行(最常见是扫不同 kz)

对你这个四方/金红石结构(晶轴和坐标轴对齐),最常用的是固定 kz = 常数 的切片:

  • kz = 0 平面:

    text
    kslice_corner = 0.0 0.0 0.0 kslice_b1 = 1.0 0.0 0.0 kslice_b2 = 0.0 1.0 0.0
  • kz = 0.25 平面:

    text
    kslice_corner = 0.0 0.0 0.25 kslice_b1 = 1.0 0.0 0.0 kslice_b2 = 0.0 1.0 0.0
  • kz = 0.5 平面:

    text
    kslice_corner = 0.0 0.0 0.5 ...

同理,如果你要 ky=0 平面(kx–kz):

text
kslice_corner = 0.0 0.0 0.0 kslice_b1 = 1.0 0.0 0.0 kslice_b2 = 0.0 0.0 1.0

b1/b2 只要线性无关就行,否则会报错 (wannier.org)


3) “mapping”的核心:每个网格点到底对应哪个 3D k 点?

Wannier90 的 kslice 网格是按整数索引 (i1,i2)(i_1,i_2) 扫描的,系数是

  • k1=i1/N1k_1 = i_1/N_1k2=i2/N2k_2 = i_2/N_2(这里 N1,N2N_1,N_2 就是 kslice_2dkmesh
  • 3D(约化坐标)k 点:
k=kcorner+k1b1+k2b2\mathbf{k} = \mathbf{k}_\text{corner} + k_1 \mathbf{b}_1 + k_2 \mathbf{b}_2

这就是源码里直接写的:kpt = kslice_corner + k1*kslice_b1 + k2*kslice_b2 (wannier.org)

而输出文件中:

  • seedname-kslice-curv.dat:按同样顺序写出每个点的 Ωx,Ωy,Ωz\Omega_x,\Omega_y,\Omega_z(curv 时是三分量) (Wannier90)
  • seedname-kslice-coord.dat:写的是切片平面上的 2D “笛卡尔坐标” (kpt_x,kpt_y),用于画图(不是 3D k) (wannier.org)

所以如果你想要“每个点的 3D k + Berry 曲率”表格,最稳的方法是:用你自己按上面的公式把 3D k 算出来,再跟 curv.dat 拼起来

下面给你一个直接可用的 Python(假设 kslice_2dkmesh = N1 N2):

python
import numpy as np N1, N2 = 201, 201 # 改成你的 kslice_2dkmesh corner = np.array([0.0, 0.0, 0.25]) # 改成你的 kslice_corner b1 = np.array([1.0, 0.0, 0.0]) # 改成你的 kslice_b1 b2 = np.array([0.0, 1.0, 0.0]) # 改成你的 kslice_b2 coord = np.loadtxt("RuO2-kslice-coord.dat") # (Nk,2) : kpt_x, kpt_y curv = np.loadtxt("RuO2-kslice-curv.dat") # (Nk,3) : Omega_x, Omega_y, Omega_z Nk = (N1+1)*(N2+1) assert coord.shape[0] >= Nk and curv.shape[0] >= Nk kred = np.zeros((Nk,3)) idx = 0 for i2 in range(N2+1): for i1 in range(N1+1): k1 = i1 / float(N1) k2 = i2 / float(N2) kred[idx,:] = corner + k1*b1 + k2*b2 idx += 1 out = np.hstack([kred, coord[:Nk,:], curv[:Nk,:]]) np.savetxt("RuO2_kslice_mapping.dat", out, header="kred1 kred2 kred3 kpt_x kpt_y Omega_x Omega_y Omega_z") print("Wrote RuO2_kslice_mapping.dat")

4) 批量扫很多个切片(不同 kz)怎么自动化?

最简单:写个 bash 循环,每次改 kslice_corner,跑 postw90.x,然后把输出文件改名保存(避免覆盖)。

示例(扫 kz = 0.0, 0.05, …, 0.5):

bash
for kz in 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50; do sed "s/^kslice_corner.*/kslice_corner = 0.0 0.0 ${kz}/" RuO2.win > RuO2_tmp.win mv RuO2_tmp.win RuO2.win postw90.x RuO2 mkdir -p slices mv RuO2-kslice-*.dat RuO2-kslice-*.py slices/ # 你也可以在这里调用上面的 python 脚本生成 mapping.dat done

如果你告诉我你具体想扫的是:

  • 固定 kz 的一系列切片?还是想切某个“斜平面”(比如 (110) 面那种)?

我可以直接帮你把 kslice_corner/b1/b2 写成你要的那组平面定义(保证是 reduced coords、且画出来形状正常)。

问题

它输出了5个文件,名字分别是:wannier90_up-kslice-coord.dat wannier90_up-kslice-curv.dat wannier90_up-kslice-curv_x.py wannier90_up-kslice-curv_y.py wannier90_up-kslice-curv_z.py
这分别代表什么意思?

思考

Explaining coordinate and script functionality

I can explain the coordinate construction now: kpt_x and kpt_y are computed using the k1, k2 and b1, b2 lengths and angles. For the scripts, they load data from curv.dat and use specific columns corresponding to x, y, z. These scripts, like curv_x.py, create PDFs with heatmaps outputted as files like "seedname-kslice-curv_x.pdf". I'll include citations from the relevant documentation and code lines.

Explaining kslice-curv.dat format and coordinate mapping

The kslice-curv.dat file stores the negative Berry curvature summed over occupied bands, writing 3 components per line. It uses a format of 4E16.8, which could write 3 numbers, despite expecting 4. The coordinate file has 2 columns for each k-point, with the order of points corresponding to the i1, i2 loop.

Explaining the file contents

  • wannier90_up-kslice-coord.dat contains 2 columns with kpt_x and kpt_y coordinates in the slice plane (in reciprocal space, along b1, etc.), where each row corresponds to a k-point.

  • wannier90_up-kslice-curv.dat stores Berry curvature values at each grid point over the occupied bands. It has 3 columns: -Ω_x, -Ω_y, -Ω_z, with units like bohr^-2. Curvature is divided by bohr^2 when allowing for bohr^(-2) units.

Explaining the Python scripts and plotting

The Python scripts curv_x.py, curv_y.py, and curv_z.py are auto-generated and used for plotting heatmaps of each Berry curvature component. They load the corresponding columns from curv.dat and generate a PDF showing the results. The script may apply log scaling for large values and outputs PDFs like 'seedname-kslice-curv_x.pdf' (for 'x', 'y', 'z'). Citations are provided for reference and you may also directly use the .dat files in your own plotting.

Explaining files and variables:

To clarify: the 'square' variable is part of the code but not really crucial. As for the five outputs, they don't include fermi_lines or bands unless you specify those in the kslice_task settings. If requesting both curvature and fermi_lines, you'd get related scripts. I’ll explain the files clearly, including how they use k1, k2 for mapping.

Thought for 2m 14s

回答

这 5 个文件都是 postw90 的 kslice 模块在做“BZ 平面切片上的 Berry 曲率热图”时自动生成的;前缀 wannier90_up 说明你现在跑的是 自旋上(spin-up)通道对应的 seedname(通常自旋下会是 wannier90_dn,如果你也做了它的话)。

下面逐个解释它们是什么、里面是什么数据、怎么用:


1) wannier90_up-kslice-coord.dat

这是 切片平面上每个网格点的 2D 坐标文件:两列数据 (kpt_x,  kpt_y)(kpt\_x,\;kpt\_y)

  • 这两个坐标是 postw90 把每个 3D 的 kk 点投到切片平面后,转换成的 二维“笛卡尔坐标”(x 轴沿你定义的 kslice_b1 方向)。源码里明确写了它就是 “Convert to (kpt_x,kpt_y), the 2D Cartesian coordinates”。(wannier.org)
  • 它主要用于画热力图:让你在二维平面上有“横纵坐标”。

2) wannier90_up-kslice-curv.dat

这是 切片平面上每个网格点的 Berry 曲率数值文件。

  • 每一行对应 -kslice-coord.dat 里同一行的那个网格点。(wannier.org)
  • kslice_task = curv,它写的是 三分量(通常可理解为 Ωx,Ωy,Ωz\Omega_x,\Omega_y,\Omega_z),并且在代码里是把曲率 对占据能带求和之后再输出的。(wannier.org)
  • 重要小坑:它输出的是 “负的 Berry 曲率”(代码里直接写了 my_zdata = -curv,注释也写 “Print minus the Berry curvature”)。所以你图上看到的是 Ω(k)-\Omega(\mathbf{k}) 的分布,这是程序约定,不是你算错。(wannier.org)
  • 你设置了 berry_curv_unit = bohr2 时,程序会做相应单位换算(代码里会除以 bohr**2)。(wannier.org)

3) wannier90_up-kslice-curv_x.py

4) wannier90_up-kslice-curv_y.py

5) wannier90_up-kslice-curv_z.py

这三个是 自动生成的画图脚本:分别画 Ωx-\Omega_xΩy-\Omega_yΩz-\Omega_z 的二维热力图。

  • 脚本会从 -kslice-curv.dat 里按列读取(x/y/z 分量),并输出对应的 pdf(比如 wannier90_up-kslice-curv_x.pdf)。(wannier.org)
  • 你直接运行例如:
    bash
    python wannier90_up-kslice-curv_z.py
    就会出图(并保存成 pdf)。

额外:如果你想要“每个点对应的 3D k(约化坐标)+ 曲率”

coord.dat 给的是二维投影坐标,不是 k=(k1,k2,k3)k=(k_1,k_2,k_3)。postw90 在内部用的是

k=kslice_corner+i1N1kslice_b1+i2N2kslice_b2k = kslice\_corner + \frac{i_1}{N_1}kslice\_{b1} + \frac{i_2}{N_2}kslice\_{b2}

(源码就是这么生成的)。(wannier.org)
所以你可以用这个公式把每一行的 3D kk 重建出来,再和 curv.dat 拼成你自己的 mapping 表。

如果你把你当前的 kslice_corner / kslice_b1 / kslice_b2 / kslice_2dkmesh 贴一下,我可以按你的参数把“行号 → 3D k → Ω(k)”的 mapping 脚本写成可直接跑的版本。

分享这个问答