Skip to content

Commit 8040a7b

Browse files
Update Hamiltonian expression & importations
1 parent 1c4f221 commit 8040a7b

File tree

1 file changed

+41
-18
lines changed

1 file changed

+41
-18
lines changed

SymPyfy Tutorial.ipynb

+41-18
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"In second quantization, the TB Hamiltonian is given by:\n",
4646
"\n",
4747
"$$\n",
48-
"H = -\\sum_{i j l_1 l_2 \\sigma} t_{i j}^{l_1 l_2} [c^{\\dagger}_{i l_1 \\sigma} c_{j l_2 \\sigma} + c^{\\dagger}_{j l_2 \\sigma} c_{i l_1 \\sigma}]\n",
48+
"H = -\\sum_{<i j> l_1 l_2 \\sigma} t_{i j}^{l_1 l_2} [c^{\\dagger}_{i l_1 \\sigma} c_{j l_2 \\sigma} + c^{\\dagger}_{j l_2 \\sigma} c_{i l_1 \\sigma}]\n",
4949
"$$\n",
5050
"\n",
5151
"where:\n",
@@ -110,9 +110,21 @@
110110
},
111111
{
112112
"cell_type": "code",
113-
"execution_count": 4,
113+
"execution_count": 17,
114114
"metadata": {},
115-
"outputs": [],
115+
"outputs": [
116+
{
117+
"ename": "ImportError",
118+
"evalue": "cannot import name 'TB_to_sympy' from 'triqs.lattice.utils' (/Users/munenekariuki/opt/anaconda3/envs/TRIQS/lib/python3.11/site-packages/triqs/lattice/utils.py)",
119+
"output_type": "error",
120+
"traceback": [
121+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
122+
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
123+
"Cell \u001b[0;32mIn[17], line 11\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mmatplotlib\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mpyplot\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mplt\u001b[39;00m\n\u001b[1;32m 10\u001b[0m \u001b[39m# import all files from lattice in TRIQS\u001b[39;00m\n\u001b[0;32m---> 11\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mtriqs\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mlattice\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mutils\u001b[39;00m \u001b[39mimport\u001b[39;00m TB_to_sympy\n",
124+
"\u001b[0;31mImportError\u001b[0m: cannot import name 'TB_to_sympy' from 'triqs.lattice.utils' (/Users/munenekariuki/opt/anaconda3/envs/TRIQS/lib/python3.11/site-packages/triqs/lattice/utils.py)"
125+
]
126+
}
127+
],
116128
"source": [
117129
"# importing the dependencies\n",
118130
"from itertools import product as itp\n",
@@ -124,7 +136,12 @@
124136
"import matplotlib.pyplot as plt\n",
125137
"\n",
126138
"# import all files from lattice in TRIQS\n",
127-
"import triqs.lattice "
139+
"\n",
140+
"# # importing it from TRIQS repo\n",
141+
"# from triqs.lattice.utils import TB_to_sympy\n",
142+
"\n",
143+
"# importing it from this locala tutorials repo\n",
144+
"from TB_to_sympy import TB_to_sympy"
128145
]
129146
},
130147
{
@@ -136,7 +153,7 @@
136153
},
137154
{
138155
"cell_type": "code",
139-
"execution_count": 5,
156+
"execution_count": 11,
140157
"metadata": {},
141158
"outputs": [],
142159
"source": [
@@ -152,20 +169,23 @@
152169
"cell_type": "markdown",
153170
"metadata": {},
154171
"source": [
155-
"We can call ```TB_from_sympy``` for different cases depending on the values we assign to its parameters. Here is one case:"
172+
"We can call ```TB_to_sympy``` for different cases depending on the values we assign to its parameters. Here is one case:"
156173
]
157174
},
158175
{
159176
"cell_type": "code",
160-
"execution_count": 6,
177+
"execution_count": 12,
161178
"metadata": {},
162179
"outputs": [
163180
{
164-
"name": "stdout",
165-
"output_type": "stream",
166-
"text": [
167-
"The analytical expression \n",
168-
" [[-0.88*cos(a1k + a3k) - 0.88*cos(a2k + a3k) + 0.159]]\n"
181+
"ename": "NameError",
182+
"evalue": "name 'TB_to_sympy' is not defined",
183+
"output_type": "error",
184+
"traceback": [
185+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
186+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
187+
"Cell \u001b[0;32mIn[12], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39mThe analytical expression \u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m\"\u001b[39m, TB_to_sympy(w90_triqs_La2CuO4, analytical \u001b[39m=\u001b[39m \u001b[39mTrue\u001b[39;00m, precision \u001b[39m=\u001b[39m \u001b[39m3\u001b[39m))\n",
188+
"\u001b[0;31mNameError\u001b[0m: name 'TB_to_sympy' is not defined"
169189
]
170190
}
171191
],
@@ -175,15 +195,18 @@
175195
},
176196
{
177197
"cell_type": "code",
178-
"execution_count": 7,
198+
"execution_count": 13,
179199
"metadata": {},
180200
"outputs": [
181201
{
182-
"name": "stdout",
183-
"output_type": "stream",
184-
"text": [
185-
"The numerical expression \n",
186-
" [[-0.88*cos(3.818*kx) - 0.88*cos(3.818*ky) + 0.159]]\n"
202+
"ename": "NameError",
203+
"evalue": "name 'TB_to_sympy' is not defined",
204+
"output_type": "error",
205+
"traceback": [
206+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
207+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
208+
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[39mprint\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39mThe numerical expression \u001b[39m\u001b[39m\\n\u001b[39;00m\u001b[39m\"\u001b[39m, TB_to_sympy(w90_triqs_La2CuO4, analytical \u001b[39m=\u001b[39m \u001b[39mFalse\u001b[39;00m, precision \u001b[39m=\u001b[39m \u001b[39m3\u001b[39m))\n",
209+
"\u001b[0;31mNameError\u001b[0m: name 'TB_to_sympy' is not defined"
187210
]
188211
}
189212
],

0 commit comments

Comments
 (0)