ae_atom - 全电子原子解
本模块封装了 AtomSCF,用于获取全电子原子的自洽场解。
全电子(All-Electron, AE)原子求解器封装
调用 AtomSCF 进行 LDA 自洽场计算,获取各角动量通道的径向波函数和本征能量。 用于赝势生成流程中的参考 AE 解。
重要:优先使用变量变换方法(transformed)+ 指数网格,精度提升约 7 倍。
主要接口
solve_ae_atom : 求解全电子原子的 LDA-DFT AEAtomResult : 存储 AE 解的结果数据类
参考
AtomSCF 文档: ../AtomSCF/docs/
变量变换方法: AtomSCF/docs/source/algorithm/numerical_methods.rst
- class atomppgen.ae_atom.AEAtomResult(Z, xc, r, w, eps_by_l, u_by_l, n_total, energies, converged, scf_iterations, grid_params=None)[源代码]
基类:
object全电子原子求解结果
- 参数:
- r
径向网格,单位 Bohr
- Type:
np.ndarray
- w
径向积分权重
- Type:
np.ndarray
- n_total
总电子密度(自旋求和),单位 e/Bohr³
- Type:
np.ndarray
- grid_params
网格参数(如 delta, Rp),用于变量变换方法
- Type:
Optional[Dict]
- __init__(Z, xc, r, w, eps_by_l, u_by_l, n_total, energies, converged, scf_iterations, grid_params=None)
- atomppgen.ae_atom.solve_ae_atom(Z, xc='PZ81', lmax=2, grid_type='exp_transformed', grid_params=None, scf_params=None, spin_mode='LDA')[源代码]
求解全电子原子的 LDA 自洽场解
推荐配置:使用 grid_type="exp_transformed" + eig_solver="transformed" 以获得最高精度(相比 FD5 方法精度提升约 7 倍)。
赝势生成注意:必须使用 `spin_mode="LDA"`(自旋无关势),这是标准 赝势格式(如 UPF)的要求。
- 参数:
Z (int) -- 原子序数(例如 Al 为 13)
xc (str, optional) -- 交换关联泛函,"PZ81" 或 "VWN",默认 "PZ81"
lmax (int, optional) -- 最大角动量量子数,默认 2(包含 s, p, d)
grid_type (str, optional) -- 网格类型: - "exp_transformed": 指数变换网格 + 变量变换求解器(推荐,最高精度) - "linear": 线性等距网格 + FD5 求解器 - "log": 对数网格 + Numerov/FD5 求解器
grid_params (dict, optional) -- 网格参数,例如: - exp_transformed: {"n": 2000, "rmin": 0.0, "rmax": 150.0, "total_span": 7.0} - linear: {"n": 1200, "rmin": 1e-6, "rmax": 50.0} - log: {"n": 1000, "rmin": 1e-6, "rmax": 50.0}
scf_params (dict, optional) -- SCF 参数,例如: - {"tol": 1e-6, "maxiter": 150, "mix_alpha": 0.3}
spin_mode (str, optional) -- 自旋模式: - "LDA": 强制自旋对称(n_up = n_dn),赝势生成必须用此模式 - "LSDA": 自旋极化(n_up ≠ n_dn),适合开壳层原子的全电子计算 默认 "LDA"
- 返回:
包含各角动量通道的波函数、能量、网格等
- 返回类型:
- 抛出:
ValueError -- 如果 xc 不是 "PZ81" 或 "VWN" 如果 grid_type 不支持 如果 spin_mode 不是 "LDA" 或 "LSDA"
示例
>>> # 推荐用法:LDA 模式(赝势生成) >>> result = solve_ae_atom(Z=13, spin_mode="LDA", grid_type="exp_transformed") >>> print(f"3s energy: {result.eps_by_l[0][2]:.6f} Ha") >>> print(f"3p energy: {result.eps_by_l[1][2]:.6f} Ha")
备注
LDA vs LSDA: - LDA 强制 n_up = n_dn,产生自旋无关势(UPF 格式要求) - LSDA 允许 n_up ≠ n_dn,更适合描述开壳层原子 - 对于闭壳层原子(如 C),两者结果相同
与 NIST 参考数据的差异: AtomSCF 当前精度约 1.5-2.5%(相对于 NIST LSD 数据)。 对于赝势生成,价层轨道相对精度(~0.03 Ha)通常已足够。
引用
变量变换方法:AtomSCF/docs/source/algorithm/numerical_methods.rst
NIST 原子数据:https://www.nist.gov/pml/atomic-reference-data-electronic-structure-calculations
主要函数
- atomppgen.ae_atom.solve_ae_atom(Z, xc='PZ81', lmax=2, grid_type='exp_transformed', grid_params=None, scf_params=None, spin_mode='LDA')[源代码]
求解全电子原子的 LDA 自洽场解
推荐配置:使用 grid_type="exp_transformed" + eig_solver="transformed" 以获得最高精度(相比 FD5 方法精度提升约 7 倍)。
赝势生成注意:必须使用 `spin_mode="LDA"`(自旋无关势),这是标准 赝势格式(如 UPF)的要求。
- 参数:
Z (int) -- 原子序数(例如 Al 为 13)
xc (str, optional) -- 交换关联泛函,"PZ81" 或 "VWN",默认 "PZ81"
lmax (int, optional) -- 最大角动量量子数,默认 2(包含 s, p, d)
grid_type (str, optional) -- 网格类型: - "exp_transformed": 指数变换网格 + 变量变换求解器(推荐,最高精度) - "linear": 线性等距网格 + FD5 求解器 - "log": 对数网格 + Numerov/FD5 求解器
grid_params (dict, optional) -- 网格参数,例如: - exp_transformed: {"n": 2000, "rmin": 0.0, "rmax": 150.0, "total_span": 7.0} - linear: {"n": 1200, "rmin": 1e-6, "rmax": 50.0} - log: {"n": 1000, "rmin": 1e-6, "rmax": 50.0}
scf_params (dict, optional) -- SCF 参数,例如: - {"tol": 1e-6, "maxiter": 150, "mix_alpha": 0.3}
spin_mode (str, optional) -- 自旋模式: - "LDA": 强制自旋对称(n_up = n_dn),赝势生成必须用此模式 - "LSDA": 自旋极化(n_up ≠ n_dn),适合开壳层原子的全电子计算 默认 "LDA"
- 返回:
包含各角动量通道的波函数、能量、网格等
- 返回类型:
- 抛出:
ValueError -- 如果 xc 不是 "PZ81" 或 "VWN" 如果 grid_type 不支持 如果 spin_mode 不是 "LDA" 或 "LSDA"
示例
>>> # 推荐用法:LDA 模式(赝势生成) >>> result = solve_ae_atom(Z=13, spin_mode="LDA", grid_type="exp_transformed") >>> print(f"3s energy: {result.eps_by_l[0][2]:.6f} Ha") >>> print(f"3p energy: {result.eps_by_l[1][2]:.6f} Ha")
备注
LDA vs LSDA: - LDA 强制 n_up = n_dn,产生自旋无关势(UPF 格式要求) - LSDA 允许 n_up ≠ n_dn,更适合描述开壳层原子 - 对于闭壳层原子(如 C),两者结果相同
与 NIST 参考数据的差异: AtomSCF 当前精度约 1.5-2.5%(相对于 NIST LSD 数据)。 对于赝势生成,价层轨道相对精度(~0.03 Ha)通常已足够。
引用
变量变换方法:AtomSCF/docs/source/algorithm/numerical_methods.rst
NIST 原子数据:https://www.nist.gov/pml/atomic-reference-data-electronic-structure-calculations
数据类
- class atomppgen.ae_atom.AEAtomResult(Z, xc, r, w, eps_by_l, u_by_l, n_total, energies, converged, scf_iterations, grid_params=None)[源代码]
全电子原子求解结果
- 参数:
- r
径向网格,单位 Bohr
- Type:
np.ndarray
- w
径向积分权重
- Type:
np.ndarray
- n_total
总电子密度(自旋求和),单位 e/Bohr³
- Type:
np.ndarray
- grid_params
网格参数(如 delta, Rp),用于变量变换方法
- Type:
Optional[Dict]
- __init__(Z, xc, r, w, eps_by_l, u_by_l, n_total, energies, converged, scf_iterations, grid_params=None)
使用示例
基础用法
from atomppgen import solve_ae_atom
# 求解 Al 原子
result = solve_ae_atom(
Z=13,
xc="PZ81",
lmax=2,
grid_type="exp_transformed",
grid_params={"n": 800, "rmax": 100.0},
scf_params={"tol": 1e-6, "maxiter": 150}
)
# 查看结果
print(f"SCF 收敛: {result.converged}")
print(f"迭代次数: {result.scf_iterations}")
print(f"3s 能级: {result.eps_by_l[0][2]:.6f} Ha")
print(f"3p 能级: {result.eps_by_l[1][2]:.6f} Ha")
不同网格类型
# 指数变换网格(推荐,最高精度)
result_exp = solve_ae_atom(
Z=13,
grid_type="exp_transformed",
grid_params={"n": 1200, "rmax": 120.0, "total_span": 6.5}
)
# 线性网格
result_linear = solve_ae_atom(
Z=13,
grid_type="linear",
grid_params={"n": 1200, "rmin": 1e-6, "rmax": 50.0}
)
# 对数网格
result_log = solve_ae_atom(
Z=13,
grid_type="log",
grid_params={"n": 1000, "rmin": 1e-6, "rmax": 50.0}
)
访问波函数和密度
result = solve_ae_atom(Z=13, xc="PZ81", lmax=2)
# 获取 3s 轨道
r = result.r
u_3s = result.u_by_l[0][2] # l=0(s),第3个态(n=3)
# 总电子密度
n_total = result.n_total
# 能量分解
print(f"总能量: {result.energies['E_total']:.6f} Ha")
print(f"交换能: {result.energies['E_x']:.6f} Ha")
print(f"关联能: {result.energies['E_c']:.6f} Ha")
技术细节
网格-求解器兼容性
网格类型 |
推荐求解器 |
注意事项 |
|---|---|---|
|
|
最高精度(~7x 提升),需要 delta/Rp 参数 |
|
|
等距网格,可用对称 FD 矩阵 |
|
|
非等距,ln(r) 等差 |
与 NIST 数据对比
当前实现为非相对论 LSDA,与 NIST LSD 参考数据存在系统性差异:
项目 |
AtomSCF |
NIST LSD |
差异 |
|---|---|---|---|
总能量 (Ha) |
-237.30 |
-241.32 |
~4 Ha |
1s (Ha) |
-54.27 |
-55.15 |
~0.88 Ha |
3s (Ha) |
-0.25 |
-0.30 |
~0.05 Ha |
说明:
差异来源可能包括数值方法、泛函实现细节等
价层轨道(3s, 3p)相对差异较小(~0.03-0.05 Ha)
对于赝势生成,价层相对精度通常已足够