diff --git a/Project#03/.ipynb_checkpoints/pyscf crawford approach-checkpoint.ipynb b/Project#03/.ipynb_checkpoints/pyscf crawford approach-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/Project#03/.ipynb_checkpoints/pyscf crawford approach-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Project#03/pyscf crawford approach.ipynb b/Project#03/pyscf crawford approach.ipynb new file mode 100644 index 0000000..416e663 --- /dev/null +++ b/Project#03/pyscf crawford approach.ipynb @@ -0,0 +1,243 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "id": "3f5a45ea", + "metadata": {}, + "outputs": [], + "source": [ + "# Following os.chdir code is only for thebe (live code), since only in thebe default directory is /home/jovyan\n", + "#import os\n", + "#if os.getcwd().split(\"/\")[-1] != \"Project_03\":\n", + "# os.chdir(\"source/Project_03\")\n", + "#from solution_03 import Molecule as SolMol\n", + "# Following code is called for numpy array pretty printing\n", + "from pyscf import gto\n", + "import numpy as np\n", + "from scipy.linalg import fractional_matrix_power\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "172b0223", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mol = gto.Mole()\n", + "mol.unit = \"Bohr\"\n", + "mol.atom = \"\"\"\n", + "8 0.000000000000 -0.143225816552 0.000000000000\n", + "1 1.638036840407 1.136548822547 -0.000000000000\n", + "1 -1.638036840407 1.136548822547 -0.000000000000\n", + "\"\"\"\n", + "mol.basis = \"STO-3G\"\n", + "mol.build()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "2d7e0e81", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8.00236706181077" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mol.energy_nuc()" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "374750b3", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "converged SCF energy = -74.9420799281924\n" + ] + }, + { + "data": { + "text/plain": [ + "array([[-3.25773954e+01, -7.57883282e+00, 0.00000000e+00,\n", + " -1.44738359e-02, 0.00000000e+00, -1.24010226e+00,\n", + " -1.24010226e+00],\n", + " [-7.57883282e+00, -9.20094327e+00, 0.00000000e+00,\n", + " -1.76890247e-01, 0.00000000e+00, -2.90670983e+00,\n", + " -2.90670983e+00],\n", + " [ 0.00000000e+00, 0.00000000e+00, -7.45881931e+00,\n", + " 0.00000000e+00, 0.00000000e+00, -1.67515014e+00,\n", + " 1.67515014e+00],\n", + " [-1.44738359e-02, -1.76890247e-01, 0.00000000e+00,\n", + " -7.41531175e+00, 0.00000000e+00, -1.35686826e+00,\n", + " -1.35686826e+00],\n", + " [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,\n", + " 0.00000000e+00, -7.34714487e+00, 0.00000000e+00,\n", + " 0.00000000e+00],\n", + " [-1.24010226e+00, -2.90670983e+00, -1.67515014e+00,\n", + " -1.35686826e+00, 0.00000000e+00, -4.54017107e+00,\n", + " -1.07114588e+00],\n", + " [-1.24010226e+00, -2.90670983e+00, 1.67515014e+00,\n", + " -1.35686826e+00, 0.00000000e+00, -1.07114588e+00,\n", + " -4.54017107e+00]])" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mol.get_hcore()" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "591d0d61", + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "Mole object has no attribute integral_eri", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/ln/l8wwnnnx6blccp6x3y8b3g_00000gn/T/ipykernel_79553/4014791429.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmol\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mintegral_eri\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/opt/anaconda3/envs/pyhome/lib/python3.7/site-packages/pyscf/gto/mole.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 2235\u001b[0m \u001b[0mmethod\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2236\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmethod\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2237\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAttributeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mole object has no attribute %s'\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2238\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2239\u001b[0m \u001b[0;31m# Initialize SCF object for post-SCF methods if applicable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAttributeError\u001b[0m: Mole object has no attribute integral_eri" + ] + } + ], + "source": [ + "mol.integral_eri()" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "8cfca9d8", + "metadata": {}, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "Mole object has no attribute integral_ovlp_m1d2", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/var/folders/ln/l8wwnnnx6blccp6x3y8b3g_00000gn/T/ipykernel_79553/1467558305.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmol\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mintegral_ovlp_m1d2\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m~/opt/anaconda3/envs/pyhome/lib/python3.7/site-packages/pyscf/gto/mole.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 2235\u001b[0m \u001b[0mmethod\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2236\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmethod\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2237\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAttributeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Mole object has no attribute %s'\u001b[0m \u001b[0;34m%\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2238\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2239\u001b[0m \u001b[0;31m# Initialize SCF object for post-SCF methods if applicable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAttributeError\u001b[0m: Mole object has no attribute integral_ovlp_m1d2" + ] + } + ], + "source": [ + "mol.integral_ovlp_m1d2()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "8af17201", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "converged SCF energy = -74.9420799281924\n" + ] + }, + { + "data": { + "text/plain": [ + "array([[-2.02546002e+01, -5.16378026e+00, -6.95933583e-18,\n", + " -2.54794527e-02, 7.65683458e-33, -8.53342167e-01,\n", + " -8.53342167e-01],\n", + " [-5.16378026e+00, -2.41067887e+00, -2.59324641e-17,\n", + " -7.43881452e-02, -3.53584136e-33, -8.01537525e-01,\n", + " -8.01537525e-01],\n", + " [-6.95933583e-18, -2.59324641e-17, -2.33639891e-01,\n", + " -1.00769612e-16, -1.14652277e-16, -3.57785188e-01,\n", + " 3.57785188e-01],\n", + " [-2.54794527e-02, -7.43881452e-02, -1.00769612e-16,\n", + " -2.75535312e-01, 2.17684772e-31, -3.24681025e-01,\n", + " -3.24681025e-01],\n", + " [ 7.65683458e-33, -3.53584136e-33, -1.14652277e-16,\n", + " 2.17684772e-31, -3.87586717e-01, 1.16757249e-17,\n", + " -1.16757249e-17],\n", + " [-8.53342167e-01, -8.01537525e-01, -3.57785188e-01,\n", + " -3.24681025e-01, 1.16757249e-17, -4.18207544e-01,\n", + " -2.52290767e-01],\n", + " [-8.53342167e-01, -8.01537525e-01, 3.57785188e-01,\n", + " -3.24681025e-01, -1.16757249e-17, -2.52290767e-01,\n", + " -4.18207544e-01]])" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mol.get_fock()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd2fb90d", + "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.7.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}