Skip to content

Commit

Permalink
Merge branch 'majorana_update' of ssh://github.com/UCL-CCS/symmer int…
Browse files Browse the repository at this point in the history
…o majorana_update
  • Loading branch information
AlexisRalli committed Oct 17, 2022
2 parents 909d5aa + 25f8a6e commit 9a0d09b
Show file tree
Hide file tree
Showing 119 changed files with 2,612 additions and 984 deletions.
1,087 changes: 563 additions & 524 deletions notebooks/CS-VQE for Electronic Structure.ipynb

Large diffs are not rendered by default.

97 changes: 49 additions & 48 deletions notebooks/CS_VQE usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 1,
"id": "291ee440",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -75,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 2,
"id": "90045aaf",
"metadata": {},
"outputs": [],
Expand All @@ -96,7 +96,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 3,
"id": "9fb61dde",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -150,7 +150,7 @@
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 4,
"id": "06b536f1",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -193,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 5,
"id": "1565f781",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -242,7 +242,7 @@
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 6,
"id": "c9c9dcac",
"metadata": {},
"outputs": [
Expand All @@ -251,8 +251,8 @@
"output_type": "stream",
"text": [
"The ground state of the noncontextual Hamiltonian is -2.4748417658131507\n",
"The energy obtained from minimization of the classical objective function is -2.474841765813\n",
"The error is -1.5054624213917123e-13\n"
"The energy obtained from minimization of the classical objective function is -2.4748417658130966\n",
"The error is -5.417888360170764e-14\n"
]
}
],
Expand All @@ -273,7 +273,7 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 7,
"id": "1edcf802",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -305,7 +305,7 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 8,
"id": "2356a2e8",
"metadata": {},
"outputs": [
Expand All @@ -327,7 +327,7 @@
"-0.000-0.858j IXII"
]
},
"execution_count": 48,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -349,7 +349,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 9,
"id": "fcc51e61",
"metadata": {},
"outputs": [
Expand All @@ -361,14 +361,15 @@
]
},
{
"data": {
"text/plain": [
" 1.000+0.000j XYXI"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
"ename": "AttributeError",
"evalue": "'PauliwordOp' object has no attribute 'conjugate'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_12602/3220794072.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mcs_vqe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munitary_partitioning_method\u001b[0m\u001b[0;34m==\u001b[0m\u001b[0;34m'LCU'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'result of applying LCU rotations to A(r)'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mrotated_Ar\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcs_vqe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munitary_partitioning_rotations\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mcs_vqe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclique_operator\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mcs_vqe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0munitary_partitioning_rotations\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconjugate\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mrotated_Ar\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'PauliwordOp' object has no attribute 'conjugate'"
]
}
],
"source": [
Expand All @@ -392,7 +393,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 10,
"id": "e327bbb8",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -474,7 +475,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"id": "193035b4",
"metadata": {},
"outputs": [],
Expand All @@ -485,7 +486,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 12,
"id": "eeb32d3f",
"metadata": {},
"outputs": [
Expand All @@ -506,8 +507,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.4748417658131325\n",
"with error 0.34438670763913004\n",
"We obtain the contextual energy error -2.4748417658130966\n",
"with error 0.344386707639166\n",
"qubit count of new CS-VQE H = 0\n",
"\n",
"*********************************************\n",
Expand All @@ -522,8 +523,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.649488658497315\n",
"with error 0.1697398149549474\n",
"We obtain the contextual energy error -2.6494886626647505\n",
"with error 0.1697398107875121\n",
"qubit count of new CS-VQE H = 1\n",
"\n",
"*********************************************\n",
Expand All @@ -538,8 +539,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.5108157940205658\n",
"with error 0.3084126794316968\n",
"We obtain the contextual energy error -2.5108157812971803\n",
"with error 0.30841269215508227\n",
"qubit count of new CS-VQE H = 1\n",
"\n",
"*********************************************\n",
Expand All @@ -554,8 +555,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.4748417658131325\n",
"with error 0.34438670763913004\n",
"We obtain the contextual energy error -2.4748417658130966\n",
"with error 0.344386707639166\n",
"qubit count of new CS-VQE H = 1\n",
"\n",
"*********************************************\n",
Expand All @@ -581,8 +582,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.7065925666192165\n",
"with error 0.11263590683304603\n",
"We obtain the contextual energy error -2.7065925580437877\n",
"with error 0.11263591540847484\n",
"qubit count of new CS-VQE H = 2\n",
"\n",
"*********************************************\n",
Expand All @@ -596,8 +597,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.6494886584973156\n",
"with error 0.16973981495494694\n",
"We obtain the contextual energy error -2.6494886626647514\n",
"with error 0.1697398107875112\n",
"qubit count of new CS-VQE H = 2\n",
"\n",
"*********************************************\n",
Expand All @@ -611,8 +612,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.5108157940205658\n",
"with error 0.3084126794316968\n",
"We obtain the contextual energy error -2.51081578129718\n",
"with error 0.3084126921550827\n",
"qubit count of new CS-VQE H = 2\n",
"\n",
"*********************************************\n",
Expand Down Expand Up @@ -659,8 +660,8 @@
" 0.253 YXYI +\n",
"-0.709 XZXI\n",
"\n",
"We obtain the contextual energy error -2.706592566619216\n",
"with error 0.11263590683304647\n",
"We obtain the contextual energy error -2.7065925580437873\n",
"with error 0.11263591540847528\n",
"qubit count of new CS-VQE H = 3\n",
"\n",
"*********************************************\n",
Expand All @@ -669,8 +670,8 @@
"Enforcing the symmetry generators\n",
"-1 IIIZ\n",
"\n",
"We obtain the contextual energy error -2.8192284734522657\n",
"with error -3.1086244689504383e-15\n",
"We obtain the contextual energy error -2.819228473452263\n",
"with error -4.440892098500626e-16\n",
"qubit count of new CS-VQE H = 3\n",
"\n",
"*********************************************\n",
Expand Down Expand Up @@ -709,7 +710,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/lex/anaconda3/envs/symred/lib/python3.9/site-packages/symmer/projection/cs_vqe.py:310: UserWarning: No stabilizers were specifed so the operator was returned\n",
"/home/tweaving/anaconda3/envs/symmer/lib/python3.7/site-packages/symmer/projection/cs_vqe.py:328: UserWarning: No stabilizers were specifed so the operator was returned\n",
" warnings.warn('No stabilizers were specifed so the operator was returned')\n"
]
}
Expand Down Expand Up @@ -754,7 +755,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 13,
"id": "6a8b998b",
"metadata": {},
"outputs": [],
Expand All @@ -775,15 +776,15 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 14,
"id": "623e63cb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Enforcing -1.000+0.000j IIIZ we obtain an energy error of -3.1086244689504383e-15.\n",
"Enforcing -1.000+0.000j IIIZ we obtain an energy error of -4.440892098500626e-16.\n",
"qubit count of reduced CS-VQE H: 3\n"
]
}
Expand All @@ -807,7 +808,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 15,
"id": "ef9fcabd",
"metadata": {},
"outputs": [
Expand All @@ -819,7 +820,7 @@
"-1.000+0.000j YIYI\n",
"and A(r)\n",
"\n",
" we obtain an energy error of 0.34438670763913004.\n",
" we obtain an energy error of 0.344386707639166.\n",
"qubit count of reduced CS-VQE H: 1\n"
]
}
Expand Down Expand Up @@ -866,7 +867,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.7.13"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit 9a0d09b

Please sign in to comment.