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
82 stars 25 forks source link

About installation in Ubuntu system #141

Closed SuHang980715 closed 3 weeks ago

SuHang980715 commented 1 year ago

Hi! I'm trying to install HPhi on my Ubuntu.22.04.1 system. I have installed LAPACK, BLAS, and gcc, gfortran successfully in it. After using "tar xzvf" to unzip HPhi file, then I try to use Cmake to install/compile it. However, after "make", I meet some problems shown in the follows: collect2: error: ld returned 1 exit status make[2]: [src/CMakeFiles/HPhi.dir/build.make:1365:src/HPhi] error 1 make[1]: [CMakeFiles/Makefile2:153:src/CMakeFiles/HPhi.dir/all] error 2 make: *** [Makefile:146:all] error 2

Could anyone give some suggestions about installation of it? I feel confused about this.

tmisawa commented 1 year ago

Let me confirm the procedure for the installation. Following is the procedure for the installation.

$ tar xzvf HPhi-3.5.1.tar.gz $ mkdir HPhi.build && cd HPhi.build $ cmake ../HPhi-3.5.1/ $ make

Note that, before cmake and make, it is necessary to make the directory for the build such as HPhi.build and the installation should be done in HPhi.build.

And, did you any error messages or warnings in cmake? If so, please tell us the error messages.

SuHang980715 commented 1 year ago

Hi~ Thanks for response, the process in Cmake part did not report any bugs.

SuHang980715 commented 1 year ago

Oh sorry, maybe I ignore some things....... There're some information here: " -- Build type: Release -- Could NOT find BLAS (missing: BLAS_LIBRARIES) -- Could NOT find LAPACK (missing: LAPACK_LIBRARIES) " Should I include BLAS and LAPACK into the root directory? In fact, I install them in a file......

yomichi commented 1 year ago

The easiest way to prepare required libraries is to use apt: sudo apt install liblapack-dev. If you want to use MPI, openmpi-bin and libopenmpi-dev are required.

FYI, HPhi is available via apt on Ubuntu. See the following: https://github.com/cmsi/MateriAppsLive/wiki/UsingMateriAppsInDebian-en

SuHang980715 commented 1 year ago

Thanks very much! This website is so helpful for me!

SuHang980715 commented 1 year ago

Sorry for disturbing, after installation, could I run it by using "$ Path /HPhi -s Input_file_name"? (where Input_file_name is name of the input file)

yomichi commented 1 year ago

Did you install HPhi via apt? If so, just type HPhi -s input_file_name.

SuHang980715 commented 1 year ago

Thanks, it is very helpful~

SuHang980715 commented 1 year ago

Could I ask why it outputs 924 results (dimensional = 924) for transversed field Ising model on 2*2 Kagome lattice? I mean, the dimensional seems not equal to that of Hilbert space (2^12=4096), which makes me confused.

tmisawa commented 1 year ago

I guess that you specify 2Sz=0 and model Spin in the input file. If so, the total dimension becomes Binomial(12,6)=924.

If you want to treat the system without total Sz conservation, please specify model SpinGC in the input file.

SuHang980715 commented 1 year ago

Yes, I set 2Sz=0 and model Spin in the input file. OK, thanks for suggestion. I want to make sure that if the "model Spin" means canonical ensemble (in other words, to choose some special configurations with some constraints)? By the way, could I ask about why it could calculate out energy without inputting temperature points? (in "Full Diag" model)

tmisawa commented 1 year ago

model Spin means spin systems with total Sz conservation and model SpinGC means spin systems without total Sz conservation. For details, please see the manual.

And, FullDiag just diagonalizes the given Hamiltonians and obtains the eigenvalues and eigenvectors. If you want to calculate the temperature dependence of the physical quantities, please take the ensemble average based on the result by the full diagonalization. For details, please refer to the tutorial.

SuHang980715 commented 1 year ago

OK, thanks. I would check my codes again!

SuHang980715 commented 1 year ago

Thanks for the code, it is very powerful for me. For the "Full Diag" mode, when adding "HamIO = "Out" in the input file, could I ask about where the output Hamiltonian is? In other words, if I want to get all of matrix elements, could I get it in standard mode in HPhi? Thanks

tmisawa commented 1 year ago

In output/zvo_Ham.dat, non-zero elements of the Hamiltonian are outputted.

SuHang980715 commented 1 year ago

When I add "HamIO = "Out" in the input file(standard mode), then I type "HPhi -s input_file_name" to run it, and then it is automatically to use Lanczos to give me answers, while I need to use Full Diagonalization. Is somewhere my operation wrong?

SuHang980715 commented 1 year ago

For example, this is which I type in my input file: L = 2 W = 2 model = "SpinGC" method = "Full Diag" lattice = "Kagome" Jz = 1.0 //J'z = 1.0 //J''z = 1.0 h = 1.5 //D = 0.0 Gamma = 1.5 //2Sz = 0 HamIO = "Out" After adding the last line, then I could not get results from full diagonlization... which makes me confused, and sorry for disturbing.

SuHang980715 commented 1 year ago

Oh, there maybe somewhere wrong in my system, now I get zvo_Ham.dat. Thanks~

tmisawa commented 1 year ago

Ok. that's good.

Please note that, if you specify "HamIO = "Out", only the elements of Hamiltonian are output and no other calculations are performed. This function is only used for checking the Hamiltonian.

So, if you want to do full diagonalization, please omit "HamIO = "Out".

SuHang980715 commented 1 year ago

Thank you very much, I found this, a powerful thing. Here I have a problem about expert mode is that: it seems that we could only give some key words like "CalcMod", "ModPara", "LocSpin" in the input file. But in Hamiltonian term, I did not see where I could set the type of lattice. Therefore, I have no idea about how to set lattice type. Could you suggest something about this? (In fact, I only need to add third-nearest-neighbor interactions on Kagome lattice, with "SpinGC" model , by using "Full Diag" mode).

SuHang980715 commented 1 year ago

When I testing expert mode, the information given by terminal is that:

Read File 'input_final.in'. Read File 'calcmod.def' for CalcMod. Read File 'modpara.def' for ModPara. Read File 'locspn.def' for LocSpin. Read File 'zcoulomb.def' for CoulombInter.

Definition files are correct.

Read File 'locspn.def'. Error: locspn.def (Broken file or Not exist) Error: Indices and Parameters of Definition files(*.def) are incomplete.

Here i have constructed a locspin.def file to define it, why HPhi says broken file or not exist?

tmisawa commented 1 year ago

In exert mode, by specifying the list of input files (namelist.def), you can do calculations as follows: HPhi -e namelist.def

An example of namelist.def is given as

     ModPara  modpara.def
     LocSpin  locspn.def
       Trans  trans.def
CoulombInter  coulombinter.def
        Hund  hund.def
    OneBodyG  greenone.def
    TwoBodyG  greentwo.def
     CalcMod  calcmod.def
PairExcitation  pair.def
 SpectrumVec  zvo_eigenvec_0

In this example, Coulombinter and Hund are the keywords for specifying the terms in Hamiltonians. If you want to include 3rd neighbor interactions, please add the corresponding term in hund.def and coulominter.def .

For details, please refer to the manual.

tmisawa commented 1 year ago

FYI, in Standard mode, it is possible to visualize the lattice structure using the command load lattice.gp.

Below is an example of 2by2 kagome lattice. From this, you can see (1,7), (3,6)... are the 3rd neighbor bonds.

スクリーンショット 2023-02-25 18 57 31

SuHang980715 commented 1 year ago

I see, thanks for your nice guide! Now I meet something difficult: Now I want to make a full diagonalization calculation by using HPhi, it is a model like Transversed-field Ising for hard-core boson (do not care about their spin), but with 3rd neighbor bonds interaction. Here if I use Fermion-Hubbard model (for 2*2 Kagome), then the Hilbert space is so much large (~2^24), which could not be calculated by HPhi. If using SpinGC model, then I have to use Expert mode because the 3rd neighbor bonds interaction is not included in standard mode. However, the transversed-field S^x seem to be not included in expert mode (If I use single-body excitation part, then it says something wrong). So how should I do? Could you give some suggestions about this?

tmisawa commented 1 year ago

The traverse magnetic field Sx can be treated in both Standard mode and Expert mode. In Standard mode, Sx can be specified by the keyword Gamma (see here).

In Expert mode, the traverse magnetic field Sx can also be specified in trans.def ( see here). For exampe, Sx=(S^{+} + S^{-})/2 at the Ath site can be specified in trans.def as A 0 A 1 -0.5 0.0 A 1 A 0 -0.5 0.0

SuHang980715 commented 1 year ago

Thanks for your help. In expert mode, we need to construct a LocSpin file. I try to make such a file like this:

================================ NlocalSpin 6 ========i_1LocSpn_0IteElc ====== 0 1 1 0 2 1 3 0 4 1 5 0 6 1 7 0 8 1 9 0 10 1 11 0

I set FullDiag and SpinGC mode in calcmod.def file (with default values for the rest parameters). And then I input "HPhi -e input_file_name" in terminal. However there are still some errors with the information:

Read File 'input_final.in'. Read File 'calcmod.def' for CalcMod. Read File 'modpara.def' for ModPara. Read File 'locspn.def' for LocSpin. Read File 'ztrans.def' for Trans. Read File 'zcoulomb.def' for CoulombInter.

Definition files are correct. Read File 'locspn.def'. Error: locspn.def (Broken file or Not exist) Error: Indices and Parameters of Definition files(*.def) are incomplete.

I'm not sure which operations of mine is wrong, could you give some suggestions about this? Thanks a lot!

tmisawa commented 1 year ago

If you want to treat 12-site S=1/2 Heisenberg model, LocSpn file is as follows

Note that NlocalSpin 12 means 12 local spins exist in the system and A 2S means amplitude of spin at the Ath site is 2S. For example, 0 1 means the amplitude of spin at the 0th site is 1/2.

== NlocalSpin 12

==

0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1

SuHang980715 commented 1 year ago

I think I know the problem, thanks!

SuHang980715 commented 1 year ago

Could I ask a very small question? In SpinGC mode, what's the difference between Coulomb interaction and Hund terms?

tmisawa commented 1 year ago

Coulominter means V_{IJ} (n_{I↑}+n_{I↓})(n_{J↑}+n_{J↓}) and Hund means -J_{IJ} (n_{I↑}n_{J↑}+n_{I↓}n_{J↓}). By using Coulmbinter and Hund, we expresee the Ising interactions in Standard mode.

But, in Expert model, it may be easy to use the keyord Ising for specifying the Ising intatections. For the keyword Ising, please see here.

SuHang980715 commented 1 year ago

I see, thanks for your nice suggection~

SuHang980715 commented 1 year ago

Hi, I have installed HPhi on my Ubuntu by using:

$ sudo apt -y install hphi

However, now I want to add some subroutine into the source code. So it seems that I need to reinstall it by CMake. I have tried this:

$ tar xzvf HPhi-3.5.1.tar.gz $ mkdir HPhi.build && cd HPhi.build $ cmake ../HPhi-3.5.1/ -DCMAKE_INSTALL_PREFIX=$HOME $ make $ make install

Then, I get a folder named "bin", which included 6 files: AveSSrand.py, greenr2k, histgram.sh, HPhi, respack2wan90.py, wout2geo.sh I think I need to include this folder into environment variable. Then I try to include it by using:

$ vim ~/.bashrc

Unfortunately, although I solved the problem about "HPhi: command not found", there were still some bugs with information showed as follow:

[suhang-virtual-machine:337732] Process received signal [suhang-virtual-machine:337732] Signal: Segmentation fault (11) [suhang-virtual-machine:337732] Signal code: Address not mapped (1) [suhang-virtual-machine:337732] Failing at address: 0x440000e8 [suhang-virtual-machine:337732] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f6874442520] [suhang-virtual-machine:337732] [ 1] /lib/x86_64-linux-gnu/libmpi.so.40(MPI_Comm_size+0x3b)[0x7f68747a986b] [suhang-virtual-machine:337732] [ 2] HPhi(InitializeMPI+0x2e)[0x563498762afe] [suhang-virtual-machine:337732] [ 3] HPhi(main+0x67)[0x563498746de7] [suhang-virtual-machine:337732] [ 4] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f6874429d90] [suhang-virtual-machine:337732] [ 5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f6874429e40] [suhang-virtual-machine:337732] [ 6] HPhi(_start+0x25)[0x5634987473a5] [suhang-virtual-machine:337732] End of error message

To make a conclusion, I still could not install HPhi on my Ubuntu system successfully, by using CMake tool (although I could install by use apt). How should I do to solve that? Thanks.

SuHang980715 commented 1 year ago

I think it is something wrong coming from MPI. However, I don't want to use HPhi with MPI. But if I do not install openmpi, then I could not do CMake for HPhi....... which makes me very confused.

ultimatile commented 1 year ago

To build HPhi without MPI, please use the CMake option -DENABLE_MPI=OFF like cmake ../HPhi-3.5.1/ -DCMAKE_INSTALL_PREFIX=$HOME -DENABLE_MPI=OFF.

SuHang980715 commented 1 year ago

It is very useful, and now it could be used. Thanks for you nice help~