-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67f0748
commit 257fb29
Showing
2 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# TJUV model" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[[0 1 0 0 0 1]\n", | ||
" [1 0 1 0 0 0]\n", | ||
" [0 1 0 1 0 0]\n", | ||
" [0 0 1 0 1 0]\n", | ||
" [0 0 0 1 0 1]\n", | ||
" [1 0 0 0 1 0]]\n", | ||
"<class 'numpy.ndarray'> <class 'numpy.ndarray'>\n", | ||
"Zero energy: 1.5\n", | ||
"One body integrals in spatial basis: \n", | ||
" [[-0.5 -1. 0. 0. 0. -1. ]\n", | ||
" [-1. -0.5 -1. 0. 0. 0. ]\n", | ||
" [ 0. -1. -0.5 -1. 0. 0. ]\n", | ||
" [ 0. 0. -1. -0.5 -1. 0. ]\n", | ||
" [ 0. 0. 0. -1. -0.5 -1. ]\n", | ||
" [-1. 0. 0. 0. -1. -0.5]]\n", | ||
"Shape of two body integral in spatial basis: (6, 6, 6, 6)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import sys \n", | ||
"sys.path.insert(0, '../')\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"# Now import the modules from the local moha package\n", | ||
"from moha import HamTJUV\n", | ||
"# Example parameters for the TJUV Hamiltonian\n", | ||
"connectivity= np.array([[0, 1, 0, 0, 0, 1],\n", | ||
" [1, 0, 1, 0, 0, 0],\n", | ||
" [0, 1, 0, 1, 0, 0],\n", | ||
" [0, 0, 1, 0, 1, 0],\n", | ||
" [0, 0, 0, 1, 0, 1],\n", | ||
" [1, 0, 0, 0, 1, 0]])\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"alpha = 0.0\n", | ||
"beta = -1.0\n", | ||
"u_onsite = np.array([1, 1, 1, 1, 1, 1])\n", | ||
"gamma = None\n", | ||
"charges = 1\n", | ||
"sym = 8\n", | ||
"J_eq = 1\n", | ||
"J_ax = 1\n", | ||
"\n", | ||
"# Initialize the HamTJUV object\n", | ||
"tjuv_hamiltonian = HamTJUV(connectivity=connectivity_ppp,\n", | ||
" alpha=alpha,\n", | ||
" beta=beta,\n", | ||
" u_onsite=u_onsite,\n", | ||
" gamma=gamma,\n", | ||
" charges=charges,\n", | ||
" sym=sym,\n", | ||
" J_eq=J_eq,\n", | ||
" J_ax=J_ax)\n", | ||
"\n", | ||
"# Generate integrals\n", | ||
"e0 = tjuv_hamiltonian.generate_zero_body_integral()\n", | ||
"h1 = tjuv_hamiltonian.generate_one_body_integral(dense=True, basis='spatial basis') \n", | ||
"h2 = tjuv_hamiltonian.generate_two_body_integral(dense=True, basis='spatial basis', sym=8)\n", | ||
"\n", | ||
"print(\"Zero energy: \", e0)\n", | ||
"print(\"One body integrals in spatial basis: \\n\", h1)\n", | ||
"print(\"Shape of two body integral in spatial basis: \", h2.shape)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 13, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[[0 1 0 0 0 1]\n", | ||
" [1 0 1 0 0 0]\n", | ||
" [0 1 0 1 0 0]\n", | ||
" [0 0 1 0 1 0]\n", | ||
" [0 0 0 1 0 1]\n", | ||
" [1 0 0 0 1 0]]\n", | ||
"<class 'numpy.ndarray'> <class 'numpy.ndarray'>\n", | ||
"One body integrals in spin basis: \n", | ||
" [[-0.25 -1. 0. 0. 0. -1. 0. 0. 0. 0. 0. 0. ]\n", | ||
" [-1. -0.25 -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n", | ||
" [ 0. -1. -0.25 -1. 0. 0. 0. 0. 0. 0. 0. 0. ]\n", | ||
" [ 0. 0. -1. -0.25 -1. 0. 0. 0. 0. 0. 0. 0. ]\n", | ||
" [ 0. 0. 0. -1. -0.25 -1. 0. 0. 0. 0. 0. 0. ]\n", | ||
" [-1. 0. 0. 0. -1. -0.25 0. 0. 0. 0. 0. 0. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. -0.25 -1. 0. 0. 0. -1. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. -1. -0.25 -1. 0. 0. 0. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. 0. -1. -0.25 -1. 0. 0. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. 0. 0. -1. -0.25 -1. 0. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. -0.25 -1. ]\n", | ||
" [ 0. 0. 0. 0. 0. 0. -1. 0. 0. 0. -1. -0.25]]\n", | ||
"Shape of two body integral in spinorbital basis: (12, 12, 12, 12)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"alpha = 0.0\n", | ||
"beta = -1.0\n", | ||
"u_onsite = np.array([1, 1, 1, 1, 1, 1])\n", | ||
"gamma = None\n", | ||
"charges = 1\n", | ||
"sym = 8\n", | ||
"J_eq = 0.5 \n", | ||
"J_ax = 0.5 \n", | ||
"\n", | ||
"# Initialize the HamTJUV object\n", | ||
"tjuv_hamiltonian = HamTJUV(connectivity=connectivity,\n", | ||
" alpha=alpha,\n", | ||
" beta=beta,\n", | ||
" u_onsite=u_onsite,\n", | ||
" gamma=gamma,\n", | ||
" charges=charges,\n", | ||
" sym=sym,\n", | ||
" J_eq=J_eq,\n", | ||
" J_ax=J_ax)\n", | ||
"\n", | ||
"h1_spin = tjuv_hamiltonian.generate_one_body_integral(dense=True, basis='spinorbital basis')\n", | ||
"h2_spin = tjuv_hamiltonian.generate_two_body_integral(dense=True, basis='spinorbital basis', sym=4)\n", | ||
"\n", | ||
"print(\"One body integrals in spin basis: \\n\", h1_spin)\n", | ||
"print(\"Shape of two body integral in spinorbital basis: \", h2_spin.shape)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters