issp-center-dev / HPhi

Quantum Lattice Model Simulator Package
https://www.pasums.issp.u-tokyo.ac.jp/hphi/en/
GNU General Public License v3.0
91 stars 25 forks source link

Using existing eigenvector as an initial vector? #31

Closed henhans closed 6 years ago

henhans commented 6 years ago

Dear HPhi Team,

I wonder if it is possible to use an existing eigenvector as an initial vector for the Lanczos calculation? I am doing a self-consistent calculation (similar to DMFT) for which the Hamiltonian between the previous and the current iteration does not change abruptly. It would be ideal to use the converged Lanczos vector in the previous iteration as an input for the ED calculation in the current iteration.

Thank you very much in advance! Best regards, Tsung-Han

k-yoshimi commented 6 years ago

Dear Tsung-Han,

Sorry, HPhi does not support to read a vector as an initial vector. But the implementation of this function to HPhi is easy and I think it is better to implement it at the next minor version.

If you want to use this function soon, please implement it as follows: Add new mode to SetInitialVector function by using ReadInitialVector function. Then, set the initial_mode by modifying l. 78-86. in CalcByLanczos.c.

       if(X->Bind.Def.initial_iv>0){
          initial_mode = 0; // 0 -> only v[iv] = 1
        }else{
          initial_mode = 1; // 1 -> random initial vector
        }

For example, X->Bind.Def.initial_iv>0, initial_mode =0, X->Bind.Def.initial_iv<0, initial_mode =1, X->Bind.Def.initial_iv=0, initial_mode =2.

Best regards, Kazuyoshi Yoshimi

henhans commented 6 years ago

Dear Yoshimi, Thank you very much for the instruction! I will dig into the code and try it out. Anyway, the code is already very fast with amazing parallel scaling!

Best regards, Tsung-Han

mitsuaki1987 commented 6 years ago

Dear Tsung-Han

The LOBPCG mode can do this. The input file for Standard mode is as follows:

method = "CG"
restart = "restartsave"
:

However, please be careful when you perform such a calculation. If there is a level-crossing (see below), it is possible that you cannot reach the ground state. This is a common problem of the Krylov subspace methods (Lanczos, LOBPCG, ...). It is safe to start from the random vector.

default

Best regards, Mitsuaki Kawamura

henhans commented 6 years ago

Dear Mitsuaki, Thank you very much for the instruction! I will pay attention to it.

Best regards, Tsung-Han