StationQ / Liquid

The Language-Integrated Quantum Operations (LIQUi|>) Simulator
http://StationQ.github.io/Liquid
Other
440 stars 97 forks source link

Simulation of Quantum Ising model using Spin-Glass sample #27

Closed yessenov closed 8 years ago

yessenov commented 8 years ago

Dear LIQUi|> Team, I am working on simulation of Quantum Ising model using LIQUi|>, which has almost the same Hamitonian as a Spin-Glass model given in the Samples. But as a result I have to plot [ versus Λ(t)/Γ(t)] and [Sx versus Λ(t)/Γ(t)] with different configuration of Λ(t)/Γ(t)]. I encountered with the following problem: I can not extract whole data. Output gives only for few time:

0:0198.6/Time:  2140 [2140 to 2141] MB=      64 cache(2584504,58) GC:332
0:0198.7/Time:  2568 [2568 to 2569] MB=      64 cache(2590068,58) GC:441
0:0198.7/  2%: .... [<H>=-2.025 Stdev 0.003] [S_mid=0.012]
0:0198.7/Time:  3008 [3008 to 3009] MB=      65 cache(2595814,58) GC:456
0:0198.8/Time:  3454 [3454 to 3455] MB=      65 cache(2601612,58) GC:462
0:0198.8/  3%: .... [<H>=-2.045 Stdev 0.004] [S_mid=0.023]
...

1) So how can we get whole data? 2) How can we plot a graph? Thanks for any help!

dbwz8 commented 8 years ago

This is definitely a limitation of the built-in Spin.Test routine. It decides when to output based on when the little graphic ("...." in your listing) changes (or at least 10 seconds have gone by). The best thing to do is to create your own instance of the Spin class and then you can single step your way through, dumping any information as you go using Spin.Step. You can then use Spin.EnergyExpectation, spin.Ket.Entropy and Qubit.Prob1 to get various statistics.

Baitenov commented 8 years ago

Is it possible to get the code of the Spin.Test function so it will be easier to create another instance of Spin class? Thank you in advance!

dbwz8 commented 8 years ago

I've crafted a small stand-alone example just fot this purpose and added it to UserCode/DaveWecker/SpinTest.fsx. I think it will show you everything you need to do. Here is the entry in the ReadMe.md file:

SpinTest.fsx

We've had a couple of requests to see an example of how Spin.Test() is implemented. This file contains a complete stand-alone version (simply called Test()) that is called from the command line with Ferro(). This will run one of the built-in examples (__Ferro()) with a frustrated ferromagnetic chain (one end up and the other down).

You can compile and run the sample with: \Liquid\bin\Liquid.exe /s SpinTest.fsx Ferro()