HΦ
3.2.0
|
Functions to perform calculations with the localy optimal block (preconditioned) conjugate gradient method. More...
#include "Common.h"
#include "xsetmem.h"
#include "mltply.h"
#include "FileIO.h"
#include "wrapperMPI.h"
#include "expec_cisajs.h"
#include "expec_cisajscktaltdc.h"
#include "expec_totalspin.h"
#include "expec_energy_flct.h"
#include "phys.h"
#include <math.h>
#include "./common/setmemory.h"
Go to the source code of this file.
Functions | |
void | zheevd_ (char *jobz, char *uplo, int *n, double complex *a, int *lda, double *w, double complex *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, double complex *alpha, double complex *a, int *lda, double complex *b, int *ldb, double complex *beta, double complex *c, int *ldc) |
static int | diag_ovrp (int nsub, double complex *hsub, double complex *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, double complex **wave) |
static void | Output_restart (struct BindStruct *X, double complex **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.c.
|
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 129 of file CalcByLOBPCG.c.
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 638 of file CalcByLOBPCG.c.
References PhysList::all_doublon, PhysList::all_energy, PhysList::all_sz, EDMainCalStruct::Bind, DefineList::CDataFileHead, cFileNameEnergy_CG, cFileNameEnergy_Lanczos, cFileNameInputEigen, cFileNameOutputEigen, cFileNameTimeKeep, BindStruct::Check, childfopenALL(), childfopenMPI(), cLogLanczos_EigenVecEnd, cOutputEigenVecStart, cReadEigenVecFinish, cReadEigenVecStart, D_FileNameMax, BindStruct::Def, exitMPI(), FALSE, DefineList::iCalcModel, CheckList::idim_max, DefineList::iFlgGeneralSpin, DefineList::iInputEigenVec, DefineList::initial_iv, initial_mode, DefineList::iOutputEigenVec, LargeList::itr, DefineList::k_exct, L_vec, BindStruct::Large, LOBPCG_Main(), myrank, phys(), BindStruct::Phys, DefineList::St, stdoutMPI, step_i, TimeKeeper(), TRUE, and v1.
Referenced by main().
|
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 43 of file CalcByLOBPCG.c.
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 | [exct][CheckList::idim_max] initial eigenvector |
Definition at line 155 of file CalcByLOBPCG.c.
References BcastMPI_li(), cFileNameInputVector, BindStruct::Check, childfopenALL(), cLogInputVecFinish, cLogInputVecStart, D_FileNameMax, BindStruct::Def, exitMPI(), CheckList::idim_max, DefineList::iInitialVecType, DefineList::initial_iv, initial_mode, DefineList::iReStart, LargeList::iv, DefineList::k_exct, BindStruct::Large, myrank, nproc, nthreads, stdoutMPI, SumMPI_li(), and VecProdMPI().
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 330 of file CalcByLOBPCG.c.
References calc_preshift(), DefineList::CDataFileHead, cFileNameLanczosStep, cFileNameTimeKeep, BindStruct::Check, childfopenMPI(), cLanczos_EigenValueFinish, cLanczos_EigenValueStart, cLanczos_EigenValueStep, cLogLanczos_EigenValueEnd, cLogLanczos_EigenValueNotConverged, D_FileNameMax, BindStruct::Def, diag_ovrp(), CheckList::idim_max, Initialize_wave(), DefineList::iReStart, LargeList::itr, DefineList::k_exct, L_vec, DefineList::Lanczos_max, DefineList::LanczosEps, BindStruct::Large, list_Diagonal, mltply(), nthreads, Output_restart(), stdoutMPI, TimeKeeper(), TimeKeeperWithStep(), v0, v1, VecProdMPI(), and vg.
Referenced by CalcByLOBPCG().
|
static |
Output eigenvectors for restart LOBPCG method.
[in,out] | X | |
[in] | wave | [exct][CheckList::idim_max] initial eigenvector |
Definition at line 297 of file CalcByLOBPCG.c.
References cFileNameOutputVector, BindStruct::Check, childfopenALL(), cLogOutputVecFinish, cLogOutputVecStart, D_FileNameMax, 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, | ||
double complex * | alpha, | ||
double complex * | a, | ||
int * | lda, | ||
double complex * | b, | ||
int * | ldb, | ||
double complex * | beta, | ||
double complex * | c, | ||
int * | ldc | ||
) |
void zheevd_ | ( | char * | jobz, |
char * | uplo, | ||
int * | n, | ||
double complex * | a, | ||
int * | lda, | ||
double * | w, | ||
double complex * | work, | ||
int * | lwork, | ||
double * | rwork, | ||
int * | lrwork, | ||
int * | iwork, | ||
int * | liwork, | ||
int * | info | ||
) |