atomppgen.invert
半局域势反演
从 TM 伪轨道反演半局域势 V_l(r),使用径向 Schrödinger 方程:
V_l(r) = ε + (1/2) · u''(r)/u(r) - l(l+1)/(2r²)
技术要点: - 内区(r ≤ rc):使用 TM 解析导数,数值稳定 - 外区(r > rc):使用样条法导数 - 节点保护:检测零点并插值或掩码
主要功能
invert_semilocal_potential : 反演半局域势 InvertResult : 存储反演结果的数据类
参考文献
Troullier & Martins, PRB 43, 1993 (1991) Giannozzi, Notes on pseudopotential generation (2019)
Functions
|
从 TM 伪轨道反演半局域势 |
Classes
|
势反演结果 |
- class atomppgen.invert.InvertResult(V_l, r, l, rc, eps, diagnostics)[源代码]
势反演结果
- V_l
半局域势 V_l(r)(Hartree)
- Type:
np.ndarray
- r
径向网格(Bohr)
- Type:
np.ndarray
- diagnostics
诊断信息: - n_nodes : 节点数 - V_max : 最大势值 - V_min : 最小势值 - V_at_rc : rc 处势值 - method_inner : 内区方法 ('analytical') - method_outer : 外区方法 ('spline')
- Type:
Dict
- atomppgen.invert.invert_semilocal_potential(tm_result, r, u_ps=None, node_tol=1e-10, V_max_clip=1000.0, smooth_rc=False, smooth_width=0.1)[源代码]
从 TM 伪轨道反演半局域势
- 使用径向 Schrödinger 方程反演:
V_l(r) = ε + (1/2) · u''(r)/u(r) - l(l+1)/(2r²)
内区(r ≤ rc)使用 TM 解析导数,外区使用样条法导数。
- 参数:
tm_result (TMResult) -- TM 伪化结果(包含 a_coeff, rc, eps, l)
r (np.ndarray) -- 径向网格(Bohr)
u_ps (np.ndarray, optional) -- 伪轨道,若不提供则从 tm_result.u_ps 获取
node_tol (float, default=1e-10) -- 节点检测阈值(|u| < node_tol 视为节点)
V_max_clip (float, default=1000.0) -- 势的裁剪上限(防止除零发散)
smooth_rc (bool, default=False) -- 是否在 rc 处应用平滑过渡(内外区势值混合)
smooth_width (float, default=0.1) -- 平滑区域半宽度(Bohr),仅在 smooth_rc=True 时有效 平滑范围为 [rc-smooth_width, rc+smooth_width]
- 返回:
包含反演势和诊断信息
- 返回类型:
- 抛出:
ValueError -- 如果网格与 tm_result 不匹配
备注
示例
>>> from atomppgen import solve_ae_atom, tm_pseudize >>> ae = solve_ae_atom(Z=13, spin_mode='LDA', lmax=0) >>> tm = tm_pseudize(r=ae.r, w=ae.w, u_ae=ae.u_by_l[0][2], ... eps=ae.eps_by_l[0][2], l=0, rc=2.0) >>> inv = invert_semilocal_potential(tm, ae.r) >>> print(inv.diagnostics['V_at_rc']) # rc 处势值