Skip to content

Commit 167c310

Browse files
committed
Pretty print transition dipole
1 parent 09147d2 commit 167c310

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

book/problems/huckel_theory.ipynb

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
},
246246
{
247247
"cell_type": "code",
248-
"execution_count": 17,
248+
"execution_count": 3,
249249
"metadata": {},
250250
"outputs": [],
251251
"source": [
@@ -404,7 +404,7 @@
404404
},
405405
{
406406
"cell_type": "code",
407-
"execution_count": 18,
407+
"execution_count": 4,
408408
"metadata": {},
409409
"outputs": [],
410410
"source": [
@@ -512,7 +512,7 @@
512512
},
513513
{
514514
"cell_type": "code",
515-
"execution_count": 19,
515+
"execution_count": 5,
516516
"metadata": {},
517517
"outputs": [],
518518
"source": [
@@ -532,7 +532,7 @@
532532
},
533533
{
534534
"cell_type": "code",
535-
"execution_count": 20,
535+
"execution_count": 6,
536536
"metadata": {},
537537
"outputs": [],
538538
"source": [
@@ -572,7 +572,7 @@
572572
},
573573
{
574574
"cell_type": "code",
575-
"execution_count": 21,
575+
"execution_count": 7,
576576
"metadata": {},
577577
"outputs": [],
578578
"source": [
@@ -644,7 +644,7 @@
644644
},
645645
{
646646
"cell_type": "code",
647-
"execution_count": 22,
647+
"execution_count": 8,
648648
"metadata": {},
649649
"outputs": [],
650650
"source": [
@@ -670,7 +670,7 @@
670670
},
671671
{
672672
"cell_type": "code",
673-
"execution_count": 23,
673+
"execution_count": 9,
674674
"metadata": {},
675675
"outputs": [
676676
{
@@ -680,7 +680,7 @@
680680
"<IPython.core.display.Image object>"
681681
]
682682
},
683-
"execution_count": 23,
683+
"execution_count": 9,
684684
"metadata": {},
685685
"output_type": "execute_result"
686686
}
@@ -730,7 +730,7 @@
730730
},
731731
{
732732
"cell_type": "code",
733-
"execution_count": 24,
733+
"execution_count": 10,
734734
"metadata": {},
735735
"outputs": [
736736
{
@@ -757,7 +757,7 @@
757757
"<PIL.PngImagePlugin.PngImageFile image mode=RGB size=300x300>"
758758
]
759759
},
760-
"execution_count": 24,
760+
"execution_count": 10,
761761
"metadata": {},
762762
"output_type": "execute_result"
763763
}
@@ -788,7 +788,7 @@
788788
},
789789
{
790790
"cell_type": "code",
791-
"execution_count": 25,
791+
"execution_count": 11,
792792
"metadata": {},
793793
"outputs": [],
794794
"source": [
@@ -891,7 +891,7 @@
891891
},
892892
{
893893
"cell_type": "code",
894-
"execution_count": 26,
894+
"execution_count": 12,
895895
"metadata": {},
896896
"outputs": [],
897897
"source": [
@@ -939,7 +939,7 @@
939939
},
940940
{
941941
"cell_type": "code",
942-
"execution_count": 27,
942+
"execution_count": 13,
943943
"metadata": {},
944944
"outputs": [
945945
{
@@ -957,7 +957,7 @@
957957
"<IPython.core.display.Image object>"
958958
]
959959
},
960-
"execution_count": 27,
960+
"execution_count": 13,
961961
"metadata": {},
962962
"output_type": "execute_result"
963963
}
@@ -984,7 +984,7 @@
984984
},
985985
{
986986
"cell_type": "code",
987-
"execution_count": 28,
987+
"execution_count": 14,
988988
"metadata": {},
989989
"outputs": [
990990
{
@@ -994,7 +994,7 @@
994994
"<IPython.core.display.Image object>"
995995
]
996996
},
997-
"execution_count": 28,
997+
"execution_count": 14,
998998
"metadata": {},
999999
"output_type": "execute_result"
10001000
}
@@ -1012,7 +1012,7 @@
10121012
},
10131013
{
10141014
"cell_type": "code",
1015-
"execution_count": 29,
1015+
"execution_count": 15,
10161016
"metadata": {},
10171017
"outputs": [],
10181018
"source": [
@@ -1088,7 +1088,7 @@
10881088
},
10891089
{
10901090
"cell_type": "code",
1091-
"execution_count": 30,
1091+
"execution_count": 16,
10921092
"metadata": {},
10931093
"outputs": [
10941094
{
@@ -1098,7 +1098,7 @@
10981098
"<IPython.core.display.Image object>"
10991099
]
11001100
},
1101-
"execution_count": 30,
1101+
"execution_count": 16,
11021102
"metadata": {},
11031103
"output_type": "execute_result"
11041104
}
@@ -1110,7 +1110,7 @@
11101110
},
11111111
{
11121112
"cell_type": "code",
1113-
"execution_count": 31,
1113+
"execution_count": 17,
11141114
"metadata": {},
11151115
"outputs": [],
11161116
"source": [
@@ -1176,7 +1176,7 @@
11761176
},
11771177
{
11781178
"cell_type": "code",
1179-
"execution_count": 32,
1179+
"execution_count": 18,
11801180
"metadata": {},
11811181
"outputs": [
11821182
{
@@ -1369,7 +1369,7 @@
13691369
},
13701370
{
13711371
"cell_type": "code",
1372-
"execution_count": 33,
1372+
"execution_count": 19,
13731373
"metadata": {},
13741374
"outputs": [],
13751375
"source": [
@@ -1554,7 +1554,7 @@
15541554
},
15551555
{
15561556
"cell_type": "code",
1557-
"execution_count": 34,
1557+
"execution_count": 20,
15581558
"metadata": {},
15591559
"outputs": [
15601560
{
@@ -1570,7 +1570,7 @@
15701570
"name": "stderr",
15711571
"output_type": "stream",
15721572
"text": [
1573-
"[08:52:22] Molecule does not have explicit Hs. Consider calling AddHs()\n"
1573+
"[08:58:36] Molecule does not have explicit Hs. Consider calling AddHs()\n"
15741574
]
15751575
},
15761576
{
@@ -1627,7 +1627,7 @@
16271627
},
16281628
{
16291629
"cell_type": "code",
1630-
"execution_count": 35,
1630+
"execution_count": 21,
16311631
"metadata": {},
16321632
"outputs": [],
16331633
"source": [
@@ -1705,14 +1705,15 @@
17051705
},
17061706
{
17071707
"cell_type": "code",
1708-
"execution_count": 36,
1708+
"execution_count": 22,
17091709
"metadata": {},
17101710
"outputs": [
17111711
{
17121712
"name": "stdout",
17131713
"output_type": "stream",
17141714
"text": [
1715-
"2.4309424285321684\n",
1715+
"The transition dipole moment of azulene (HOMO to LUMO) is [-0.01674969 -2.42803264 0.11772008] Debye.\n",
1716+
"The magnitude of the transition dipole moment is 2.4309424285321684 Debye.\n",
17161717
"The following plots correspond to the following atomic property labels:\n",
17171718
"product of HOMO and LUMO orbitals\n"
17181719
]
@@ -1721,7 +1722,7 @@
17211722
"name": "stderr",
17221723
"output_type": "stream",
17231724
"text": [
1724-
"[08:52:23] Molecule does not have explicit Hs. Consider calling AddHs()\n"
1725+
"[08:58:36] Molecule does not have explicit Hs. Consider calling AddHs()\n"
17251726
]
17261727
},
17271728
{
@@ -1736,9 +1737,11 @@
17361737
}
17371738
],
17381739
"source": [
1739-
"# Look at the excitation from the HOMO to the LUMO\n",
1740+
"# Look at the excitation from the HOMO to the LUMO and print out the dipole moment\n",
1741+
"# and its size\n",
17401742
"transition_dipole = compute_transition_dipole(azulene, mo_coeffs, 4, 5)\n",
1741-
"print(np.linalg.norm(transition_dipole))\n",
1743+
"print(f\"The transition dipole moment of azulene (HOMO to LUMO) is {transition_dipole} Debye.\")\n",
1744+
"print(f\"The magnitude of the transition dipole moment is {np.linalg.norm(transition_dipole)} Debye.\")\n",
17421745
"\n",
17431746
"# Plot the orbital product\n",
17441747
"coeffs = mo_coeffs[:, 4] * mo_coeffs[:, 5]\n",

0 commit comments

Comments
 (0)