Last active
January 22, 2023 03:07
-
-
Save shivupa/15364aaaaa79de3600762ac49a3b7dcc to your computer and use it in GitHub Desktop.
NEO CCSD doi:10.1021/acs.jctc.8b01120
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "c7770cc0-e946-4c6b-b41c-f311ef962bcc", | |
"metadata": {}, | |
"source": [ | |
"# Load" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "485b1cc0-750d-4a8d-9a2a-5ab19284c55b", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import wicked as w\n", | |
"from IPython.display import display, Math, Latex\n", | |
"\n", | |
"def latex(expr):\n", | |
" \"\"\"Function to render any object that has a member latex() function\"\"\"\n", | |
" display(Math(expr.latex()))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "4658c1e7-d76b-420f-a43d-ef624d94d717", | |
"metadata": {}, | |
"source": [ | |
"# Defining orbital spaces" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "bc41a20e-9c92-4030-bbe6-d0c7740799d3", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"osi = w.osi()\n", | |
"print(str(osi))" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "2740f6ac-52d8-4a8b-a542-bf428fcae5d0", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"w.reset_space()\n", | |
"# e\n", | |
"w.add_space(\"o\", \"fermion\", \"occupied\", ['i','j','k','l'])\n", | |
"w.add_space(\"v\", \"fermion\", \"unoccupied\", ['a','b','c','d'])\n", | |
"# p\n", | |
"w.add_space(\"p\", \"fermion\", \"occupied\", ['I','J','K','L'])\n", | |
"w.add_space(\"b\", \"fermion\", \"unoccupied\", ['A','B','C','D'])\n", | |
"wt = w.WickTheorem()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "07196caa-6322-487b-bbae-990a3d1bac38", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"space label: o\n", | |
"field type: fermion\n", | |
"space type: occupied\n", | |
"indices: [i,j,k,l]\n", | |
"\n", | |
"space label: v\n", | |
"field type: fermion\n", | |
"space type: unoccupied\n", | |
"indices: [a,b,c,d]\n", | |
"\n", | |
"space label: p\n", | |
"field type: fermion\n", | |
"space type: occupied\n", | |
"indices: [I,J,K,L]\n", | |
"\n", | |
"space label: b\n", | |
"field type: fermion\n", | |
"space type: unoccupied\n", | |
"indices: [A,B,C,D]\n" | |
] | |
} | |
], | |
"source": [ | |
"osi = w.osi()\n", | |
"print(str(osi))" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "a6ed1114-1ced-40b9-826e-3ad02af8f4b1", | |
"metadata": {}, | |
"source": [ | |
"# Operators" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "ba169410-3b72-4f04-8a02-bd2290f6feed", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"E0 = w.op(\"E_0\",[\"\"])\n", | |
"F_ee = w.utils.gen_op('f',1,'ov','ov')\n", | |
"F_pp = w.op(\"f\",['p+ p']) + w.op(\"f\",['p+ b']) + w.op(\"f\",['b+ p']) + w.op(\"f\",['b+ b'])\n", | |
"V_ee = w.utils.gen_op('v',2,'ov','ov')\n", | |
"V_pp = w.utils.gen_op('v',2,'pb','pb')\n", | |
"#V_ep = need to define, can't use gen_op bc no exchange\n", | |
"#V_ep = w.utils.gen_op('v',2,'ov','pb') <- can't do this\n", | |
"V_ep = \\\n", | |
"w.op(\"v\",['v+ b+ o p']) + \\\n", | |
"w.op(\"v\",['o+ p+ v b']) + \\\n", | |
"w.op(\"v\",['p+ v+ b o']) " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "80d72311-b8bd-4dfc-abce-bc8adbfd6e03", | |
"metadata": {}, | |
"source": [ | |
"# CCSD E equation" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"id": "94de7b76-e529-4969-b6f1-bb945a817bf4", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle + {E_{0}}^{}_{} \\\\ \n", | |
"+ {f}^{a}_{i} {t}^{i}_{a} \\\\ \n", | |
"+ {f}^{A}_{I} {t}^{I}_{A} \\\\ \n", | |
"+\\frac{1}{2} {t}^{i}_{a} {t}^{j}_{b} {v}^{a b}_{i j} \\\\ \n", | |
"+\\frac{1}{4} {t}^{i j}_{a b} {v}^{a b}_{i j} \\\\ \n", | |
"- {t}^{i I}_{a A} {v}^{a A}_{i I} \\\\ \n", | |
"- {t}^{I}_{A} {t}^{i}_{a} {v}^{a A}_{i I} \\\\ \n", | |
"+\\frac{1}{2} {t}^{I}_{A} {t}^{J}_{B} {v}^{A B}_{I J} \\\\ \n", | |
"+\\frac{1}{4} {t}^{I J}_{A B} {v}^{A B}_{I J}$" | |
], | |
"text/plain": [ | |
"<IPython.core.display.Math object>" | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"H = E0 + F_ee + F_pp + V_ee + V_pp - V_ep\n", | |
"T = w.op(\"t\",[\"v+ o\", \"b+ p\",\"v+ v+ o o\",\"b+ b+ p p\",\"v+ b+ o p\"])\n", | |
"Hbar = w.bch_series(H,T,2)\n", | |
"expr = wt.contract(Hbar,0,0)\n", | |
"expr\n", | |
"latex(expr)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "8c1cc449-8b1e-4434-accd-13eff42a1a76", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# This expression should match S3 of doi:10.1021/acs.jctc.8b01120" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "f5ffef6c-8250-401e-8f79-d57089747a8e", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
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
Reproducing NEO-CCSD E expression with fevangelista/wicked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment