|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
Classes | |
| class | SubspaceCache |
| Owning cache of PW subspace H/S/becp data plus the lambda snapshot. More... | |
Functions | |
| void | cal_mi_pw (ScState &state, void *psi, elecstate::ElecState *pelec) |
| Calculate atomic magnetic moments using projector overlap (PW basis). | |
| void | calculate_delta_hcc (ScState &state, const SubspaceCache &cache, elecstate::ElecState *pelec, std::complex< double > *h_tmp, const std::complex< double > *becp_k, const ModuleBase::Vector3< double > *delta_lambda, const int nbands, const int nkb, const int *nh_iat, const int ik, const bool full_update) |
| Compute DeltaSpin correction to a subspace Hamiltonian. | |
| void | update_psi_charge_pw_cpu (ScState &state, SubspaceCache &cache, void *psi, void *p_hamilt, elecstate::ElecState *pelec, ModulePW::PW_Basis_K *pw_wfc, const ModuleBase::Vector3< double > *delta_lambda, bool pw_solve, bool full_update) |
| CPU implementation of PW wavefunction and charge density update. | |
| void spinconstrain::pw::cal_mi_pw | ( | ScState & | state, |
| void * | psi, | ||
| elecstate::ElecState * | pelec ) |
Calculate atomic magnetic moments using projector overlap (PW basis).
For each k-point: tabulate atomic projectors, compute becp = <alpha|psi> via OnsiteProjector::overlap_proj_psi, then decompose becp into magnetic moments. Finally Mi is summed across all MPI k-pool ranks.
| state | Constraint state; its magnetic moments are filled in place. |
| psi | PW wavefunctions (psi::Psi<std::complex<double>>, passed as void to keep this header free of the Device template parameter). |
| pelec | Electronic state (provides wg weights and k-list spin signs). |
| void spinconstrain::pw::calculate_delta_hcc | ( | ScState & | state, |
| const SubspaceCache & | cache, | ||
| elecstate::ElecState * | pelec, | ||
| std::complex< double > * | h_tmp, | ||
| const std::complex< double > * | becp_k, | ||
| const ModuleBase::Vector3< double > * | delta_lambda, | ||
| const int | nbands, | ||
| const int | nkb, | ||
| const int * | nh_iat, | ||
| const int | ik, | ||
| const bool | full_update ) |
Compute DeltaSpin correction to a subspace Hamiltonian.
Adds H += becp^dagger * ps, where ps = delta_lambda * becp. For npol=2 uses the full 2x2 Pauli matrix; for npol=1 uses the z-component with spin_sign.
| state | Constraint state (npol, Mi size, lambda snapshot via cache). |
| cache | PW subspace cache; supplies lambda_in_sub() for full_update. |
| pelec | Electronic state (for collinear spin_sign lookup). |
| h_tmp | Subspace Hamiltonian (nbands x nbands, modified in place). |
| becp_k | Projector coefficients for k-point ik. |
| delta_lambda | Lambda change per atom (or full lambda if full_update). |
| nbands | Number of bands. |
| nkb | Total number of projectors. |
| nh_iat | Number of projectors per atom. |
| ik | K-point index (for collinear spin_sign lookup). |
| full_update | If true, compute delta = lambda_current - lambda_at_save. |
| void spinconstrain::pw::update_psi_charge_pw_cpu | ( | ScState & | state, |
| SubspaceCache & | cache, | ||
| void * | psi, | ||
| void * | p_hamilt, | ||
| elecstate::ElecState * | pelec, | ||
| ModulePW::PW_Basis_K * | pw_wfc, | ||
| const ModuleBase::Vector3< double > * | delta_lambda, | ||
| bool | pw_solve, | ||
| bool | full_update ) |
CPU implementation of PW wavefunction and charge density update.
Frees the subspace cache after use (allocated in cal_mw_from_lambda).
| state | Constraint state. |
| cache | PW subspace cache (released here). |
| psi | PW wavefunctions (psi::Psi<std::complex<double>>, as void). |
| p_hamilt | Hamiltonian (hamilt::Hamilt<std::complex<double>>, as void). |
| pelec | Electronic state. |
| pw_wfc | PW basis for wavefunction storage. |
| delta_lambda | Lambda change for incremental H correction. |
| pw_solve | If true, run full PW solver; if false, just update weights. |
| full_update | If true, apply full lambda (not delta) to H correction. |