Skip to content

Commit 95397a1

Browse files
committed
Create QN FAQ section and document sysimages for Jupyter and VS Code [no ci]
1 parent 9f96579 commit 95397a1

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

docs/settings.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ settings = Dict(
4646
"Frequently Asked Questions" => [
4747
"Programming Language (Julia, C++, ...) FAQs" => "faq/JuliaAndCpp.md",
4848
"DMRG FAQs" => "faq/DMRG.md",
49+
"Quantum Number (QN) FAQs" => "faq/QN.md",
4950
"ITensor Development FAQs" => "faq/Development.md",
5051
"Relationship of ITensor to other tensor libraries FAQs" => "faq/RelationshipToOtherLibraries.md",
5152
"Julia Package Manager FAQs" => "faq/JuliaPkg.md",

docs/src/faq/QN.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Quantum Number Frequently Asked Questions
2+
3+
## Can I mix different types of quantum numbers within the same system?
4+
5+
Yes, you can freely mix quantum numbers (QNs) of different types. For example,
6+
you can make the sites of your systems alternate between sites carrying
7+
spin "Sz" QNs and fermion sites carrying particle number "Nf" QNs. The QNs will
8+
not mix with each other and will separately be conserved to the original value
9+
you set for your initial wavefunction.
10+
11+
## How can I separately conserve QNs which have the same name?
12+
13+
If you have two physically distinct types of sites, such as "Qudit" sites, but
14+
which carry identically named QNs called "Number", and you want the qudit number
15+
to be separately conserved within each type of site,
16+
you must make the QN names different for the two types of sites.
17+
18+
For example, the following line of code will make an array of site indices with the qudit number QN having the name "Number\_odd" on odd sites and "Number\_even" on even sites:
19+
```
20+
sites = [isodd(n) ? siteind("Qudit", n; dim=10, conserve_qns=true, qnname_number="Number_odd")
21+
: siteind("Qudit", n; dim=2, conserve_qns=true, qnname_number="Number_even")
22+
for n in 1:2*L]
23+
```
24+
(You may have to collapse the above code into a single line for it to run properly.)

docs/src/getting_started/RunningCodes.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,23 @@ alias julia_itensors="julia --sysimage ~/.julia/sysimages/sys_itensors.so -e \"u
102102
```
103103

104104
where of course you can use the command name you like when defining the alias. Now running commands like `julia_itensors code.jl` or `julia_itensors` to start an interactive session will have the ITensor system image pre-loaded and you will notice significantly faster startup times. The arguments `-e \"using ITensors\" -i` make it so that running `julia_itensors` also loads the ITensor library as soon as Julia starts up, so that you don't have to type `using ITensors` every time.
105+
106+
## Using a Compiled Sysimage in Jupyter or VS Code
107+
108+
If you have compiled a sysimage for ITensor as shown above, you can use it in Jupyter by running the following code:
109+
```
110+
using IJulia
111+
installkernel("julia_ITensors","--sysimage=~/.julia/sysimages/sys_itensors.so")
112+
```
113+
in the Julia REPL (Julia console).
114+
115+
116+
To load the ITensor sysimage in VS Code, you can add
117+
```
118+
"--sysimage ~/.julia/sysimages/sys_itensors.so"
119+
```
120+
as an argument under the `julia.additionalArgs` setting in your Settings.json file.
121+
122+
For more information on the above, see the following [Julia Discourse post](https://discourse.julialang.org/t/using-an-itensors-sysimage-when-starting-the-julia-repl-in-vs-code/98625/4).
123+
124+

0 commit comments

Comments
 (0)