Skip to content

Commit b80d923

Browse files
committed
finish qn tutorial
1 parent 49a95b7 commit b80d923

File tree

3 files changed

+118
-13
lines changed

3 files changed

+118
-13
lines changed

doc/source/tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ please refer to the :doc:`applications`.
88
.. toctree::
99
tutorials/define_model.ipynb
1010
tutorials/mps_mpo.ipynb
11-
tutorials/compress_mps.ipynb
1211
tutorials/quantum_number.ipynb
12+
tutorials/compress_mps.ipynb
1313
tutorials/ttn_basic.ipynb
1414

1515
..

doc/source/tutorials/define_model.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"- The DOF at wich the operation is operated on, such as \"spin 0\", \"exiton 1\". In mathematical expression this is usually the subscript for an operator, i.e., $\\hat X_0$ or $\\hat a^\\dagger_1$\n",
6868
"- The factor or coefficient for the operator.\n",
6969
"\n",
70-
"There is an additional useful attributes that is sometimes quite useful: the quantum number.\n",
70+
"There is an additional useful attributes that is sometimes quite useful: the quantum number. The idea of quantum number will be described in detail in another tutorial.\n",
7171
"\n",
7272
"`Op` are constructed from the above 4 attributes. The first 2 are necessary and the last 2 are optional."
7373
]

doc/source/tutorials/quantum_number.ipynb

Lines changed: 116 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
{
6868
"cell_type": "code",
69-
"execution_count": 7,
69+
"execution_count": 5,
7070
"id": "38d22aea-d558-4050-ba09-5ee910022a6e",
7171
"metadata": {},
7272
"outputs": [],
@@ -84,7 +84,7 @@
8484
},
8585
{
8686
"cell_type": "code",
87-
"execution_count": 8,
87+
"execution_count": 6,
8888
"id": "4069da65-755f-4fce-8a83-48a498dfabda",
8989
"metadata": {},
9090
"outputs": [],
@@ -104,7 +104,7 @@
104104
},
105105
{
106106
"cell_type": "code",
107-
"execution_count": 9,
107+
"execution_count": 7,
108108
"id": "9d3b7ff7-ac29-4a33-8ed8-98dca88d1c37",
109109
"metadata": {},
110110
"outputs": [],
@@ -114,7 +114,7 @@
114114
},
115115
{
116116
"cell_type": "code",
117-
"execution_count": 10,
117+
"execution_count": 8,
118118
"id": "e9358f1f-f98e-4581-b6e0-54308966f74f",
119119
"metadata": {},
120120
"outputs": [],
@@ -124,7 +124,7 @@
124124
},
125125
{
126126
"cell_type": "code",
127-
"execution_count": 11,
127+
"execution_count": 9,
128128
"id": "f86cea1c-916f-47c0-bced-a8dc7c2f7055",
129129
"metadata": {},
130130
"outputs": [],
@@ -309,7 +309,7 @@
309309
},
310310
{
311311
"cell_type": "code",
312-
"execution_count": 31,
312+
"execution_count": 16,
313313
"id": "eb7f7ba4-5228-41bc-bf6d-ee41211e5f81",
314314
"metadata": {},
315315
"outputs": [],
@@ -419,14 +419,119 @@
419419
"id": "2dd4d74c-386a-4244-8422-5d022842d07f",
420420
"metadata": {},
421421
"source": [
422-
"## Advanced usage (To be updated)\n",
422+
"## Notes\n",
423423
"\n",
424-
"- Setting quantum number is not necessary. When quantum number is not conserved or in other cases when quantum number is not desired, we can skip this by set all to 0.\n",
424+
"Setting quantum number is not necessary. When quantum number is not conserved or for some reason quantum number conservation is not desired, set all quantum numbers to 0.\n",
425425
"\n",
426-
"- If quantum numbers are set incorrectly.\n",
427-
"\n",
428-
"- U(1) quantum number and more than one quantum number"
426+
"Renormalizer supports the conservation of multiple quantum numbers. For example, in *ab initio* electronic structure calculations, both the number of alpha spin electrons and the number of beta spin electrons are conserved.\n",
427+
"In such cases, quantum numbers should be set to a numpy array of integers."
428+
]
429+
},
430+
{
431+
"cell_type": "code",
432+
"execution_count": 20,
433+
"id": "9d3c8a36-25e8-46e6-91cd-4d520238f0df",
434+
"metadata": {},
435+
"outputs": [],
436+
"source": [
437+
"import numpy as np"
438+
]
439+
},
440+
{
441+
"cell_type": "code",
442+
"execution_count": 23,
443+
"id": "9f5fa2cf-e6e5-430a-9dc2-176237d82e5a",
444+
"metadata": {},
445+
"outputs": [
446+
{
447+
"data": {
448+
"text/plain": [
449+
"Op('a^\\\\dagger', ['up'], 1.0, [[1, 0]])"
450+
]
451+
},
452+
"execution_count": 23,
453+
"metadata": {},
454+
"output_type": "execute_result"
455+
}
456+
],
457+
"source": [
458+
"# spin up creation operator\n",
459+
"Op(r\"a^\\dagger\", \"up\", qn=np.array([1, 0]))"
460+
]
461+
},
462+
{
463+
"cell_type": "code",
464+
"execution_count": 24,
465+
"id": "9166c78b-15d3-4c64-a42d-5a3c37ecc4aa",
466+
"metadata": {},
467+
"outputs": [
468+
{
469+
"data": {
470+
"text/plain": [
471+
"Op('a', ['up'], 1.0, [[-1, 0]])"
472+
]
473+
},
474+
"execution_count": 24,
475+
"metadata": {},
476+
"output_type": "execute_result"
477+
}
478+
],
479+
"source": [
480+
"# spin up annihilation operator\n",
481+
"Op(r\"a\", \"up\", qn=np.array([-1, 0]))"
482+
]
483+
},
484+
{
485+
"cell_type": "code",
486+
"execution_count": 25,
487+
"id": "f789d3b7-46e2-4a23-b9a0-e72ed323c0e3",
488+
"metadata": {},
489+
"outputs": [
490+
{
491+
"data": {
492+
"text/plain": [
493+
"Op('a^\\\\dagger', ['down'], 1.0, [[0, 1]])"
494+
]
495+
},
496+
"execution_count": 25,
497+
"metadata": {},
498+
"output_type": "execute_result"
499+
}
500+
],
501+
"source": [
502+
"# spin down creation operator\n",
503+
"Op(r\"a^\\dagger\", \"down\", qn=np.array([0, 1]))"
504+
]
505+
},
506+
{
507+
"cell_type": "code",
508+
"execution_count": 26,
509+
"id": "4f023161-daa1-42f2-84ba-4d4528dd4461",
510+
"metadata": {},
511+
"outputs": [
512+
{
513+
"data": {
514+
"text/plain": [
515+
"Op('a^\\\\dagger', ['down'], 1.0, [[0, -1]])"
516+
]
517+
},
518+
"execution_count": 26,
519+
"metadata": {},
520+
"output_type": "execute_result"
521+
}
522+
],
523+
"source": [
524+
"# spin down annihilation operator\n",
525+
"Op(r\"a^\\dagger\", \"down\", qn=np.array([0, -1]))"
429526
]
527+
},
528+
{
529+
"cell_type": "code",
530+
"execution_count": null,
531+
"id": "78557796-060c-42ce-94ab-6981c862c870",
532+
"metadata": {},
533+
"outputs": [],
534+
"source": []
430535
}
431536
],
432537
"metadata": {

0 commit comments

Comments
 (0)