Menu

#46 Writing the ground state of the Bose-Hubbard model

1.0
open
None
2020-05-26
2020-05-19
Sanku Paul
No

Hi,

I am trying to write the coefficients of the ground state ($\psi_i$) of Bose Hubbard model in a file and the ground state ($|\Psi_0>$) is represented as

$|\Psi_0> = \sum_i \psi_i |i>$,

where $|i>$ are the basis state.

For this I wrote a line "myObservables.AddObservable('State', True)" in the existing code "02_BoseHubbardStatics.py" and after running the code, a file with .bin extension is obtained. Then, I am reading this file and writing the data in a .dat file using a seperate python code and the results that I obtained is not what I expect.

Could you please tell me what I am doing wrong.

Thanks,
Sanku

1 Attachments

Related

Tickets: #46

Discussion

  • Sanku Paul

    Sanku Paul - 2020-05-20

    Hi,
    Just an extension of the above question. Could you please help me to understand how to extract the meaningful interpretation of the data in the Bose_Hubbard_staticst_0.1N_5ObsOut0_1_State.bin file. Actally, I need all $\psi_i$ to calculate the multifractality of the system.

     
  • Daniel Jaschke

    Daniel Jaschke - 2020-05-20

    Hi Sanku,

    there are many things I would have to know before answering the question:
    1) What basis did you assume for the basis states |i>?
    2) Did you go through the fortran code in order to determine the format? Including symmetries?
    3) Did you consider all differences between (standard) python and fortran, e.g., row-major vs. column-major ordering?
    4) What did you expect? Did you expect another format or just other numbers?
    5) Why is there no code attached? The best thing is to attach a minimal working example which prints out an error.
    6) The real question: what do you want to measure and is there any OSMPS observable which could already do this? Just the coefficients psi_i or was this just the starting point?

    I would suggest that you get the most recent version of OSMPS via SourceForge and git. I have just added a tiny module that I had anyway into the Contrib folder. With the following modifications you can get the ground states.

    1) Add to the imports "from Contrib import MPSqState"
    2) Use the human readable version of saving a state, will be much easier for debugging etc., i.e., "myObservables.AddObservable('State', True, form='H')"
    3) In the post processing you can add a line as the following, where I just picked one state: " psi = MPSqState('OUTPUTS_02/Bose_Hubbard_staticst_0.02N_5.0ObsOut0_1_State.mps')"

    You will get a python class with all the information of the MPS state and you could start comparing it to your functions reading the results.

    Best regards,

    Daniel

     
  • Sanku Paul

    Sanku Paul - 2020-05-20

    Dear Daniel,
    Thank you for your quick response. I tried to go through the fortran code but honestly I don't know much about fortran, so could not understand it properly. I am comfortable with only python and C.
    The answer of your above questions:
    1) What basis did you assume for the basis states |i>?

         I assumed the basis states to be Fock states.
    
     2) Did you go through the fortran code in order to determine the format? Including symmetries?
    3) Did you consider all differences between (standard) python and fortran, e.g., row-major vs. column-major ordering?
    4) What did you expect? Did you expect another format or just other numbers?
    
         I don't know much about these three questions. I want to get the normalized psi_i.
    
    5) Why is there no code attached? The best thing is to attach a minimal working example which prints out an error.
    
          I just added an extra line "myObservables.AddObservable('State', True)" in the existing "Examples/02_BoseHubbardStatics.py".
    
      6) The real question: what do you want to measure and is there any OSMPS observable which could already do this? Just the coefficients psi_i or was this just the starting point?
          I just want to calculate the multifractality of the system for this I need the coefficients psi_i as the starting point. I want to write psi_i in a .dat file so that I can do further calculations.
          Could you please help me to write the data in a .dat file.
    

    Thanks

     
    • Daniel Jaschke

      Daniel Jaschke - 2020-05-20

      Hi Sanku,

      the number of coefficients grows exponentially with system size, which
      makes it difficult in a many-body scenario. What system sizes were you
      aiming for? If you have seen a paper where the measurement has been done
      for thirty or more sites in the Bose-Hubbard model, then one of us could
      look into the measurement. But right now I have not an idea how to define a
      one-shot measurement in MPS avoiding the exponential growth.

      Best regards,

      Daniel

      On Wed, May 20, 2020 at 12:13 PM Sanku Paul sanku@users.sourceforge.net
      wrote:

      Dear Daniel,
      Thank you for your quick response. I tried to go through the fortran code
      but honestly I don't know much about fortran, so could not understand it
      properly. I am comfortable with only python and C.
      The answer of your above questions:
      1) What basis did you assume for the basis states |i>?

       I assumed the basis states to be Fock states.
      

      2) Did you go through the fortran code in order to determine the format? Including symmetries?3) Did you consider all differences between (standard) python and fortran, e.g., row-major vs. column-major ordering?4) What did you expect? Did you expect another format or just other numbers?

       I don't know much about these three questions. I want to get the normalized psi_i.
      

      5) Why is there no code attached? The best thing is to attach a minimal working example which prints out an error.

        I just added an extra line "myObservables.AddObservable('State', True)" in the existing "Examples/02_BoseHubbardStatics.py".
      

      6) The real question: what do you want to measure and is there any OSMPS observable which could already do this? Just the coefficients psi_i or was this just the starting point?
      I just want to calculate the multifractality of the system for this I need the coefficients psi_i as the starting point. I want to write psi_i in a .dat file so that I can do further calculations.
      Could you please help me to write the data in a .dat file.

      Thanks

      Status: open
      Milestone: 1.0
      Created: Tue May 19, 2020 04:40 PM UTC by Sanku Paul
      Last Updated: Wed May 20, 2020 09:27 AM UTC
      Owner: Daniel Jaschke

      Hi,

      I am trying to write the coefficients of the ground state ($\psi_i$) of
      Bose Hubbard model in a file and the ground state ($|\Psi_0>$) is
      represented as

      $|\Psi_0> = \sum_i \psi_i |i>$,

      where $|i>$ are the basis state.

      For this I wrote a line "myObservables.AddObservable('State', True)" in
      the existing code "02_BoseHubbardStatics.py" and after running the code, a
      file with .bin extension is obtained. Then, I am reading this file and
      writing the data in a .dat file using a seperate python code and the
      results that I obtained is not what I expect.

      Could you please tell me what I am doing wrong.

      Thanks,
      Sanku


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/openmps/tickets/46/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Tickets: #46

  • Sanku Paul

    Sanku Paul - 2020-05-20

    Hi,
    It is true that the system size will grow exponentially large. For time being I would like to go up to maximum of 18 lattice sites. But I just want to write the coefficients in a dat file, so that I can use it for my further calculations. Could you help me to write the coefiicients of the normalized ground sate wavefunction represented in Fock basis in a dat file.
    Thanks.

     
  • Sanku Paul

    Sanku Paul - 2020-05-21

    Dear Daniel,
    Could you please help me to write in a dat file only the coefiicients of the normalized ground sate wavefunction which is represented in a Fock basis.
    Sorry for the inconvenience.
    Thanks

     
  • Daniel Jaschke

    Daniel Jaschke - 2020-05-22

    File for ED. Description follows in a second.

     

    Last edit: Daniel Jaschke 2020-05-22
  • Daniel Jaschke

    Daniel Jaschke - 2020-05-22

    Hi Sanku,

    I run some quick numbers how large the Hilbert space grows for the Bose-Hubbard in the scenario and for L = 4 ..10 the size of the Hilbert space corresponds to 4.25, 5.67, 7.14, 8.62, 10.11, 11.62, and 13.13 qubits (so I took log2 of the actual size). Extrapolating these values gets me to an equivalent of 25 qubits for L=18 in the Bose-Hubbard model. And I reduced the size of the local Hilbert space (max number of bosons per site).

    One could define MBString or MPO measures to measure the projector | i_1 > < i_1 | x |i_2 > < i_2 | .... But we cannot take this approach for 2^25 projectors. If you go with tensor networks, you need a one-shot measurement and maybe somebody can point out how to construct it.

    The alternative is contracting the MPS to its vector representation, what I would do if there were no symmetries, but this approach does not scale well with system size, too.

    Nonetheless, I can give you our exact diagonalization library to play around. I have updated the source code via git on SourceForge and attached the script in the previous post. It does build the Hamiltonian as a sparse matrix and thus has its limitations.

    Best regards,

    Daniel

     
  • Sanku Paul

    Sanku Paul - 2020-05-22

    Dear Daniel,
    I have git pull the update that you made in the git repository. I ran the code but obtained some errors which are:
    Traceback (most recent call last):
    File "/home/spaul/OSMPS/openmps/Bose_Hubbard_calc/Ticket46.py", line 192, in <module>
    main(PostProcess=Post, ShowPlots=Plot)
    File "/home/spaul/OSMPS/openmps/Bose_Hubbard_calc/Ticket46.py", line 109, in main
    ed.runED(parameters, Operators, H)
    File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 102, in runED
    ed_simulation(get_mpo(ii), Operators, params[ii], sparse, maxdim, 0)
    File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 297, in ed_simulation
    maxdim)
    File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 936, in statics_simulation
    for elem in statics_state(Hmpo, param, nn, SymmSec, maxdim):
    File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 981, in statics_state_sparse
    vals, vecs = spla.eigsh(Ham, k=nn, which='SA')
    File "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 1687, in eigsh
    params.iterate()
    File "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 571, in iterate
    self._raise_no_convergence()
    File "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py", line 377, in _raise_no_convergence
    raise ArpackNoConvergence(msg % (num_iter, k_ok, self.k), ev, vec)
    scipy.sparse.linalg.eigen.arpack.arpack.ArpackNoConvergence: ARPACK error -1: No convergence (1121 iterations, 3/4 eigenvectors converged)</module>

     
    • Daniel Jaschke

      Daniel Jaschke - 2020-05-25

      Hi,

      I double-checked and the complete script runs through on my machine. Did
      you alter anything? System size or the dimension of the local Hilbert
      space? Anyway, I would probably try to increase the number of iterations
      via scipy. The eigenvalue / vector search is iterative and the error is
      raised solely because the settings do not allow more iterations.

      Best regards,

      Daniel

      On Fri, May 22, 2020 at 3:22 PM Sanku Paul sanku@users.sourceforge.net
      wrote:

      Dear Daniel,
      I have git pull the update that you made in the git repository. I ran the
      code but obtained some errors which are:
      Traceback (most recent call last):
      File "/home/spaul/OSMPS/openmps/Bose_Hubbard_calc/Ticket46.py", line 192,
      in <module>
      main(PostProcess=Post, ShowPlots=Plot)
      File "/home/spaul/OSMPS/openmps/Bose_Hubbard_calc/Ticket46.py", line 109,
      in main
      ed.runED(parameters, Operators, H)
      File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 102, in
      runED
      ed_simulation(get_mpo(ii), Operators, params[ii], sparse, maxdim, 0)
      File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 297, in
      ed_simulation
      maxdim)
      File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 936, in
      statics_simulation
      for elem in statics_state(Hmpo, param, nn, SymmSec, maxdim):
      File "/home/spaul/OSMPS/openmps/MPSPyLib/EDLib/exactdiag.py", line 981, in
      statics_state_sparse
      vals, vecs = spla.eigsh(Ham, k=nn, which='SA')
      File
      "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py",
      line 1687, in eigsh
      params.iterate()
      File
      "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py",
      line 571, in iterate
      self._raise_no_convergence()
      File
      "/home/spaul/OSMPS/conda/conda/envs/openmps/lib/python3.7/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.py",
      line 377, in _raise_no_convergence
      raise ArpackNoConvergence(msg % (num_iter, k_ok, self.k), ev, vec)
      scipy.sparse.linalg.eigen.arpack.arpack.ArpackNoConvergence: ARPACK error
      -1: No convergence (1121 iterations, 3/4 eigenvectors converged)</module>


      Status: open
      Milestone: 1.0
      Created: Tue May 19, 2020 04:40 PM UTC by Sanku Paul
      Last Updated: Fri May 22, 2020 09:49 AM UTC
      Owner: Daniel Jaschke
      Attachments:

      Hi,

      I am trying to write the coefficients of the ground state ($\psi_i$) of
      Bose Hubbard model in a file and the ground state ($|\Psi_0>$) is
      represented as

      $|\Psi_0> = \sum_i \psi_i |i>$,

      where $|i>$ are the basis state.

      For this I wrote a line "myObservables.AddObservable('State', True)" in
      the existing code "02_BoseHubbardStatics.py" and after running the code, a
      file with .bin extension is obtained. Then, I am reading this file and
      writing the data in a .dat file using a seperate python code and the
      results that I obtained is not what I expect.

      Could you please tell me what I am doing wrong.

      Thanks,
      Sanku


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/openmps/tickets/46/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Tickets: #46

  • Sanku Paul

    Sanku Paul - 2020-05-26

    Hi,
    Earlier I did not alter anything. Now after reducing the number of lattice site like making $L=6$, the code is running and giving me result. However, the psi that it is giving is in the position representation but I need in the Fock space representation. I will take a look at the code more carefully and try to get it in the Fock space representation. If I face problem, I will ask you again. I do have an ED code with which I can go upto L=11 and N=11. But I need a ground state of BH model with lattice sites atleast $L=18$.
    Thanks,
    Sanku

     

Log in to post a comment.