Feature&Refactor: support SCF restarts from given density matrices and several minor fixes#11
Conversation
不再检查并记录HDF5文件中数据集是否已存在的警告日志,直接覆盖写入
允许compute方法接收外部Poisson接口对象作为参数,避免重复创建 当scf为true时,可选择使用传入的Poisson接口或新建接口 计算完成后返回Poisson接口对象供后续使用
添加缺失的文档说明,包括类参数和属性的详细描述
There was a problem hiding this comment.
Pull request overview
This PR updates the NEGF workflow to better support SCF restarts from an externally prepared Poisson interface, while also aligning electronic-temperature settings with Fermi-level smearing and applying a few minor configuration/doc fixes.
Changes:
- Wire
ele_T(electronic temperature) into Fermi-level smearing temperature during lead Fermi-level calculation. - Add optional
pcond: Interface3Dinput toNEGF.compute()to allow starting Poisson-NEGF SCF from an externally provided Poisson state (and return it for reuse). - Extend Poisson dielectric-region input support to allow one additional dielectric region; silence some HDF5 “already exists” warnings.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
dpnegf/utils/argcheck.py |
Extends accepted dielectric region keys (supports one more region). |
dpnegf/runner/NEGF.py |
Uses ele_T for smearing temperature; adds compute(pcond=...) restart path and return value. |
dpnegf/negf/poisson_init.py |
Minor docstring whitespace/formatting adjustments. |
dpnegf/negf/lead_property.py |
Comments out warnings during HDF5 write/merge for self-energy caching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # if dset_name in grp: | ||
| # log.warning(f"Dataset {dset_name} already exists in group {group_name}. Skipping it.") |
There was a problem hiding this comment.
write_to_hdf5 no longer guards against an existing dataset name. With h5py.File(..., "a"), reruns/resumes can hit the same (E,k) and grp.create_dataset(...) will raise (dataset already exists), aborting the self-energy workflow. If the goal is to silence warnings, keep the existence check but skip (or explicitly overwrite via del grp[dset_name] / use require_dataset).
| # if dset_name in grp: | |
| # log.warning(f"Dataset {dset_name} already exists in group {group_name}. Skipping it.") | |
| if dset_name in grp: | |
| log.warning(f"Dataset {dset_name} already exists in group {group_name}. Skipping it.") | |
| return |
What's changed
pcondas the initial guess of the Poisson-NEGF SCF