|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
#include "gradient_inputs.h"#include <algorithm>#include <stdexcept>#include <vector>#include "source_lcao/module_lr/utils/lr_util.h"#include "source_lcao/module_lr/utils/lr_util_print.h"#include "zeqlin_solv.h"Go to the source code of this file.
Namespaces | |
| namespace | LR |
Functions | |
| void | LR::solve_Z_CG (double *const Z, double *R, const int &ld, const int &nstates, std::function< void(const double *const, double *const)> f_LZ, const bool test_force) |
| void | LR::solve_Z_CG (std::complex< double > *const Z, std::complex< double > *R, const int &ld, const int &nstates, std::function< void(const std::complex< double > *const, std::complex< double > *const)> f_LZ, const bool test_force) |
| template<typename THam> | |
| int | LR::zvec_global_dim (THam &hm, const int nspin_x) |
| Global length of one state's Z-vector: $\sum_\sigma n_k n_{occ,\sigma} n_{virt,\sigma}$. THam only has to expose nk, nocc and nvirt. | |
| template<typename T, typename THam> | |
| void | LR::zvec_local_to_full (THam &hm, const int nspin_x, const T *const local, T *const full) |
| Gather one state's Z-vector from the hm.pX layout (local, length ld) into the global vector full (length zvec_global_dim), replicated on every rank. Collective. | |
| template<typename T, typename THam> | |
| void | LR::zvec_full_to_local (THam &hm, const int nspin_x, const T *const full, T *const local) |
| Inverse of zvec_local_to_full: pick this rank's entries of the global vector full into the hm.pX layout local. No communication. | |
| template<typename T, typename THam> | |
| void | LR::solve_Z_lapack (T *const Z, const T *const R, const int &ld, const int &nstates, THam &hm, const int nspin_x, const bool test_force) |
| Solve the Z-vector equation with a dense LAPACK solve. | |
| template<typename T, typename THam> | |
| std::vector< T > | LR::zvec_hessian_2d (THam &hm, const int nspin_x, const int ld, const Parallel_Blkcyclic &ph) |
| Build this rank's block of the Z-vector Hessian on the 2D block-cyclic layout ph (n_global x n_global), one column at a time: column g is hm.hPsi of the g-th unit vector, i.e. exactly the operator the CG solve applies. Only O(n_global) is replicated per rank (one column in flight), instead of the O(n_global^2) of hm.matrix(). Collective: every rank walks every column, since hPsi and the gather communicate. | |
| template<typename T, typename THam> | |
| void | LR::solve_Z_2d (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x, void(*linear_solver)(T *, T *, const Parallel_Blkcyclic &, const Parallel_Blkcyclic &)) |
| Distributed dense Z-vector solve: the Hessian (zvec_hessian_2d) and the right-hand side are laid out 2D block-cyclically on the BLACS grid of hm.pX[0], and linear_solver (scalapack_linear_solver or scalapack_cholesky_linear_solver) solves them in place. | |
| template<typename T, typename THam> | |
| void | LR::solve_Z_scalapack (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x) |
| Distributed dense Z-vector solve with ScaLAPACK LU (p?gesv). Same system as solve_Z_lapack, but neither the Hessian nor the factorization is replicated. | |
| template<typename T, typename THam> | |
| void | LR::solve_Z_scalapack_chol (T *const Z, const T *const R, const int ld, const int nstates, THam &hm, const int nspin_x) |
| Distributed dense Z-vector solve with a ScaLAPACK Cholesky factorization (p?potrf), about half the flops of the LU in solve_Z_scalapack. Requires a positive-definite orbital Hessian; a factorization failure is reported on every rank. | |
| template<typename T, typename THamL> | |
| void | LR::solve_zeq_with (T *const Z, T *const R, const int ld, const int nstates, THamL &ops_L, const int nspin_x, const std::string &zvec_solver, const bool test_force) |
| Run the configured solver (and then, for testing, every supported one). Shared by the closed- and open-shell paths; THamL only needs hPsi plus what solve_Z_lapack reads. | |
| template<typename T, typename TOpsR, typename TOpsL> | |
| void | LR::build_and_solve_zeq (TOpsR &ops_R, TOpsL &ops_L, const int nspin_x, const T *const X, container::Tensor &R, T *const Z, const int nloc_per_band, const int nstates, const std::string &zvec_solver, const bool test_force, const std::vector< std::vector< ct::Tensor > > &window_density) |
| template<typename T> | |
| void | LR::Z_vector_equation (const GradientInputs< T > &inputs, const T *const X, T *const Z, const int &nstates, std::weak_ptr< PotHxcLR > pot, const std::string &spin_type, const std::string &in_dir, const bool openshell, const std::string &zvec_solver, const std::vector< std::vector< ct::Tensor > > &window_density) |