ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
cal_mw_from_lambda.cpp File Reference

Core computational functions for DeltaSpin. More...

Include dependency graph for cal_mw_from_lambda.cpp:

Detailed Description

Core computational functions for DeltaSpin.

calculate_delta_hcc
Computes the DeltaSpin correction to the subspace Hamiltonian: H_corrected = H_original + becp^† * delta_lambda * becp

For npol=2 (non-collinear), coefficients use the spin-block order {up-up, down-up, up-down, down-down}: coeff0 = (lambda_z, 0) coeff1 = (lambda_x, lambda_y) coeff2 = (lambda_x, -lambda_y) coeff3 = (-lambda_z, 0) Applied as: ps_up = coeff0 * becp_up + coeff2 * becp_dn ps_dn = coeff1 * becp_up + coeff3 * becp_dn

For npol=1 (collinear), only the z-component: ps = lambda_z * spin_sign * becp

update_psi_charge_pw_cpu/gpu
Two-stage process for PW basis:
  1. Subspace diagonalization: apply DeltaSpin correction, rotate psi
  2. Full-space update: either run HSolverPW (pw_solve=true) or update weights (pw_solve=false)
cal_mw_from_lambda
The central workflow function called repeatedly during lambda optimization: LCAO: update lambda in operator -> solve HSolverLCAO -> compute Mi PW: save subspace data (first call) -> apply H correction -> diagonalize in subspace -> compute Mi from becp
Error conditions
  • assert(sub_h_save != nullptr): cal_mw_from_lambda() must be called before update_psi_charge_pw(). Failure means the workflow order is wrong. Solution: Ensure cal_mw_from_lambda() is called at the start of each SCF step.