Skip to content

Commit 44597d0

Browse files
committed
DeltaP cleanup: fix run_deltap_lambda_loop + deprecation markers
#3 run_deltap_lambda_loop: add deltap_corr gate, document Phase D plan #4 GPU stubs: already have explanatory comments (d89800f) #5 deltap_solver.h: mark deprecated, unused by any code path #6 deltap_common.h: note 3/4 functions unused, kept for future refactoring BN LCAO + PW regression pass.
1 parent 7de8597 commit 44597d0

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

source/source_esolver/deltap_common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
* Separates the linear algebra of lambda updates, constraint matrix handling,
88
* and residual computation from the basis-specific Hamiltonian application
99
* and gamma computation.
10+
*
11+
* Currently only compute_dp_escon() is used (by LCAO). The other functions
12+
* are kept for future constraint-matrix / total-mode refactoring.
1013
*/
1114

1215
#include <vector>
@@ -27,6 +30,9 @@ namespace deltap_common {
2730
* @param mixing Damping factor (0 = no mixing, 1 = full step).
2831
* @param lambda_out Effective per-atom lambda [n_atoms] (output).
2932
* @return Max residual norm (for convergence check).
33+
* @note This function is currently unused — both LCAO and PW paths
34+
* implement lambda updates inline. Kept for future total/constraint-matrix
35+
* refactoring.
3036
*/
3137
inline double update_lambda(
3238
const std::vector<std::vector<double>>& C,

source/source_esolver/deltap_solver.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
/**
44
* @file deltap_solver.h
55
* @brief Solver callback interface for DeltaP inner loop.
6+
* @deprecated This file is not used by any code path. The inner-loop
7+
* logic for both LCAO and PW is implemented directly in the ESolver
8+
* classes (esolver_ks_lcao.cpp, deltap_pw.cpp). This file may be
9+
* removed in a future cleanup.
10+
*/
611
*
712
* The inner BFGS loop needs to apply trial lambda values and re-solve
813
* the KS equation with frozen charge density. This is basis-specific:

source/source_pw/module_pwdft/deltap_pw.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,15 @@ bool run_deltap_lambda_loop(const int iter,
7575
const double drho,
7676
const Input_para& inp)
7777
{
78-
if (!inp.deltap_switch)
78+
if (!inp.deltap_switch || !inp.deltap_corr)
7979
return false;
8080

8181
set_deltap_pw_active(true);
82+
83+
// Phase A: no inner loop — always run normal HSolver.
84+
// Lambda is updated in deltap_iter_finish() after charge convergence.
85+
// Phase D (deferred): inner BFGS with subspace diag, would return true
86+
// to skip HSolver and run cal_hs_subspace + diag_responce instead.
8287
return false;
8388
}
8489

0 commit comments

Comments
 (0)