HPhi++
3.1.0
|
Functions to perform calculations with the localy optimal block (preconditioned) conjugate gradient method. More...
#include "Common.hpp"
#include "xsetmem.hpp"
#include "mltply.hpp"
#include "FileIO.hpp"
#include "wrapperMPI.hpp"
#include "expec_cisajs.hpp"
#include "expec_cisajscktaltdc.hpp"
#include "expec_totalspin.hpp"
#include "expec_energy_flct.hpp"
#include "phys.hpp"
#include <cmath>
#include "mltplyCommon.hpp"
#include "./common/setmemory.hpp"
Go to the source code of this file.
Functions | |
void | debug_print (int num, std::complex< double > *var) |
void | zheevd_ (char *jobz, char *uplo, int *n, std::complex< double > *a, int *lda, double *w, std::complex< double > *work, int *lwork, double *rwork, int *lrwork, int *iwork, int *liwork, int *info) |
void | zgemm_ (char *transa, char *transb, int *m, int *n, int *k, std::complex< double > *alpha, std::complex< double > *a, int *lda, std::complex< double > *b, int *ldb, std::complex< double > *beta, std::complex< double > *c, int *ldc) |
static int | diag_ovrp (int nsub, std::complex< double > *hsub, std::complex< double > *ovlp, double *eig) |
Solve the generalized eigenvalue problem \[ {\hat H} |\phi\rangle = \varepsilon {\hat O} |\phi\rangle \] with the Lowdin's orthogonalization. More... | |
static double | calc_preshift (double eig, double res, double eps_LOBPCG) |
Compute adaptively shifted preconditionar written in S. Yamada, et al., Transactions of JSCES, Paper No. 20060027 (2006). More... | |
static void | Initialize_wave (struct BindStruct *X, std::complex< double > **wave) |
static void | Output_restart (struct BindStruct *X, std::complex< double > **wave) |
Output eigenvectors for restart LOBPCG method. More... | |
int | LOBPCG_Main (struct BindStruct *X) |
Core routine for the LOBPCG method This method is introduced in
| |
int | CalcByLOBPCG (struct EDMainCalStruct *X) |
Driver routine for LOB(P)CG method. More... | |
Functions to perform calculations with the localy optimal block (preconditioned) conjugate gradient method.
Definition in file CalcByLOBPCG.cpp.
|
static |
Compute adaptively shifted preconditionar written in S. Yamada, et al., Transactions of JSCES, Paper No. 20060027 (2006).
[in] | eig | Eigenvalue in this step |
[in] | res | Residual 2-norm in this step |
[in] | eps_LOBPCG | Convergence threshold |
Definition at line 139 of file CalcByLOBPCG.cpp.
Referenced by LOBPCG_Main().
int CalcByLOBPCG | ( | struct EDMainCalStruct * | X | ) |
Driver routine for LOB(P)CG method.
If this run is for spectrum calculation, eigenvectors are not computed and read from files.
Compute & Output physical variables to a file the same function as FullDiag [phys()] is used.
[in,out] | X |
Definition at line 643 of file CalcByLOBPCG.cpp.
References EDMainCalStruct::Bind, DefineList::CDataFileHead, BindStruct::Check, childfopenALL(), childfopenMPI(), BindStruct::Def, PhysList::doublon, PhysList::energy, exitMPI(), DefineList::iCalcModel, CheckList::idim_max, DefineList::iFlgGeneralSpin, DefineList::iInputEigenVec, DefineList::initial_iv, initial_mode, DefineList::iOutputEigenVec, LargeList::itr, DefineList::k_exct, BindStruct::Large, LOBPCG_Main(), myrank, phys(), BindStruct::Phys, DefineList::St, stdoutMPI, step_i, PhysList::Sz, TimeKeeper(), and v1.
Referenced by main().
void debug_print | ( | int | num, |
std::complex< double > * | var | ||
) |
Definition at line 34 of file CalcByLOBPCG.cpp.
|
static |
Solve the generalized eigenvalue problem
\[ {\hat H} |\phi\rangle = \varepsilon {\hat O} |\phi\rangle \]
with the Lowdin's orthogonalization.
(1) Compute \({\hat O}^{-1/2}\) with diagonalizing overrap matrix
\[ {\hat O}^{-1/2} = \left(\frac{|O_1\rangle}{\sqrt{o_1}}, \frac{|O_2\rangle}{\sqrt{o_2}}, ...\right) \\ {\hat O} |O_i\rangle = o_i |O_i\rangle \]
if \(o_i\) is very small that dimension is ignored. Therefore \({\hat O}^{-1/2}\) is nsub*nsub2 matrix.
(2) Transform \({\hat H}'\equiv {\hat O}^{-1/2 \dagger}{\hat H}{\hat O}^{-1/2}\). \({\hat H}'\) is nsub2*nsub2 matrix.
(3) Diagonalize \({\hat H}'\). It is the standard eigenvalue problem.
\[ {\hat H}' |\phi'_i\rangle = \varepsilon_i |\phi'_i\rangle \]
(4) Transform eigenvector into the original nsub space as
\[ |\phi_i\rangle = {\hat O}^{-1/2} |\phi'_i\rangle \]
[in] | nsub | Original dimension of subspace |
[in,out] | hsub | (nsub*nsub) subspace hamiltonian -> eigenvector |
[in,out] | ovlp | (nsub*nsub) Overrap matrix -> \({\hat O}^{1/2}\) |
[out] | eig | (nsub) Eigenvalue |
Definition at line 53 of file CalcByLOBPCG.cpp.
References zgemm_(), and zheevd_().
Referenced by LOBPCG_Main().
|
static |
(A) For restart: Read saved eigenvector files (as binary files) from each processor
(B) For scratch (including the case that restart files are not found): initialize eigenvectors in the same way as TPQ and Lanczos.
[in,out] | X | |
[out] | wave | [CheckList::idim_max][exct] initial eigenvector |
Definition at line 165 of file CalcByLOBPCG.cpp.
References BcastMPI_li(), BindStruct::Check, childfopenALL(), BindStruct::Def, exitMPI(), I(), CheckList::idim_max, DefineList::iInitialVecType, DefineList::initial_iv, initial_mode, DefineList::iReStart, LargeList::iv, DefineList::k_exct, BindStruct::Large, myrank, NormMPI_dv(), nproc, nthreads, stdoutMPI, and SumMPI_li().
Referenced by LOBPCG_Main().
int LOBPCG_Main | ( | struct BindStruct * | X | ) |
Core routine for the LOBPCG method This method is introduced in
Set initial guess of wavefunction: \({\bf x}=\)initial guess
Scale convergence threshold with the absolute value of eigenvalue for numerical stability
Compute residual vectors: \({\bf w}={\bf X}-\mu {\bf x}\)
Preconditioning (Point Jacobi): \({\bf w}={\hat T}^{-1} {\bf w}\)
Normalize residual vector: \({\bf w}={\bf w}/|w|\)
Convergence check
\({\bf W}={\hat H}{\bf w}\)
Compute subspace Hamiltonian and overrap matrix: \({\hat H}_{\rm sub}=\{{\bf w},{\bf x},{\bf p}\}^\dagger \{{\bf W},{\bf X},{\bf P}\}\), \({\hat O}=\{{\bf w},{\bf x},{\bf p}\}^\dagger \{{\bf w},{\bf x},{\bf p}\}\),
Subspace diagonalization with the Lowdin's orthogonalization for generalized eigenvalue problem: \({\hat H}_{\rm sub}{\bf v}={\hat O}\mu_{\rm sub}{\bf v}\), \({\bf v}=(\alpha, \beta, \gamma)\)
Update \(\mu=(\mu+\mu_{\rm sub})/2\)
\({\bf x}=\alpha {\bf w}+\beta {\bf x}+\gamma {\bf p}\), Normalize \({\bf x}\)
\({\bf X}=\alpha {\bf W}+\beta {\bf X}+\gamma {\bf P}\), Normalize \({\bf X}\)
\({\bf p}=\alpha {\bf w}+\gamma {\bf p}\), Normalize \({\bf p}\)
\({\bf P}=\alpha {\bf W}+\gamma {\bf P}\), Normalize \({\bf P}\)
Normalize \({\bf w}\) and \({\bf W}\)
END DO LOBPCG iteration
Output resulting vectors for restart
[in,out] | X |
Definition at line 351 of file CalcByLOBPCG.cpp.
References calc_preshift(), DefineList::CDataFileHead, BindStruct::Check, childfopenMPI(), BindStruct::Def, diag_ovrp(), CheckList::idim_max, Initialize_wave(), DefineList::iReStart, LargeList::itr, DefineList::k_exct, DefineList::Lanczos_max, DefineList::LanczosEps, BindStruct::Large, list_Diagonal, mltply(), NormMPI_dv(), Output_restart(), stdoutMPI, SumMPI_cv(), SumMPI_dv(), TimeKeeper(), TimeKeeperWithStep(), v0, v1, v1buf, zclear(), and zgemm_().
Referenced by CalcByLOBPCG().
|
static |
Output eigenvectors for restart LOBPCG method.
[in,out] | X | |
[in] | wave | [exct][CheckList::idim_max] initial eigenvector |
Definition at line 312 of file CalcByLOBPCG.cpp.
References BindStruct::Check, childfopenALL(), BindStruct::Def, exitMPI(), CheckList::idim_max, LargeList::itr, DefineList::k_exct, BindStruct::Large, myrank, and stdoutMPI.
Referenced by LOBPCG_Main().
void zgemm_ | ( | char * | transa, |
char * | transb, | ||
int * | m, | ||
int * | n, | ||
int * | k, | ||
std::complex< double > * | alpha, | ||
std::complex< double > * | a, | ||
int * | lda, | ||
std::complex< double > * | b, | ||
int * | ldb, | ||
std::complex< double > * | beta, | ||
std::complex< double > * | c, | ||
int * | ldc | ||
) |
Referenced by debug_print(), diag_ovrp(), and LOBPCG_Main().
void zheevd_ | ( | char * | jobz, |
char * | uplo, | ||
int * | n, | ||
std::complex< double > * | a, | ||
int * | lda, | ||
double * | w, | ||
std::complex< double > * | work, | ||
int * | lwork, | ||
double * | rwork, | ||
int * | lrwork, | ||
int * | iwork, | ||
int * | liwork, | ||
int * | info | ||
) |
Referenced by debug_print(), diag_ovrp(), and ZHEEVall().