{ "cells": [ { "cell_type": "markdown", "id": "3d63629e", "metadata": {}, "source": [ "# Basis Set\n", "\n", "MoHa supports Cartesian Gaussian type orbtial (GTO), it is an atomic orbital used in linear combinations forming molecular orbitals. Cartesian GTOs are defiend by an angular par which is homogeneous polynomial in the compoents x, y, and z of the position vector $\\mathbf{r}$. That is,\n", "\\begin{equation}\n", "G_{ijk}(r_A,\\alpha) = x^i_A y^j_A z^k_A e^{-\\alpha r^2_A}\n", "\\end{equation}\n", "\n", "here $r_A = r - A$ is the atom-centered function $\\alpha > 0$ is the real orbital exponent and $i+j+k = n$.\n", "\n", "MoHa use the same basis set input file as NWChem, all the available basis set file can be found in the `moha/data/examples` directory. If you need basis set more than MoHa offered, you can downloaded it from the EMSL webpage (https://bse.pnl.gov/bse/portal).\n", "\n", "STO-3G EMSL basis set of hydrogen and oxygen:" ] }, { "cell_type": "markdown", "id": "ae5c13c1", "metadata": {}, "source": [ " # STO-3G EMSL Basis Set Exchange Library 8/21/18 3:24 AM\n", " # Elements References\n", " # -------- ----------\n", " # H - Ne: W.J. Hehre, R.F. Stewart and J.A. Pople, J. Chem. Phys. 2657 (1969).\n", " # Na - Ar: W.J. Hehre, R. Ditchfield, R.F. Stewart, J.A. Pople,\n", " # J. Chem. Phys. 2769 (1970).\n", " # K,Ca - : W.J. Pietro, B.A. Levy, W.J. Hehre and R.F. Stewart,\n", " # Ga - Kr: J. Am. Chem. Soc. 19, 2225 (1980).\n", " # Sc - Zn: W.J. Pietro and W.J. Hehre, J. Comp. Chem. 4, 241 (1983) + Gaussian.\n", " # Y - Cd: W.J. Pietro and W.J. Hehre, J. Comp. Chem. 4, 241 (1983). + Gaussian\n", " # \n", "\n", "\n", " BASIS \"ao basis\" PRINT\n", " #BASIS SET: (3s) -> [1s]\n", " H S\n", " 3.42525091 0.15432897 \n", " 0.62391373 0.53532814 \n", " 0.16885540 0.44463454 \n", " #BASIS SET: (6s,3p) -> [2s,1p]\n", " O S\n", " 130.7093200 0.15432897 \n", " 23.8088610 0.53532814 \n", " 6.4436083 0.44463454 \n", " O SP\n", " 5.0331513 -0.09996723 0.15591627 \n", " 1.1695961 0.39951283 0.60768372 \n", " 0.3803890 0.70011547 0.39195739 \n", " END" ] }, { "cell_type": "markdown", "id": "dd98d42e", "metadata": {}, "source": [ "| Atom | number | name |symbol|coordinate|mass|\n", "|:--------:|:--------:|:------:|:------:|:----------:|:----:|\n", "|mol\\[0\\]| 8 | Oxygen | O|(0.000000,-0.143225,0.000000)|15.9994|\n", "|mol\\[1\\]| 1 | Hydrogen | H|(1.638036,1.136548,-0.000000)|1.007975|\n", "|mol\\[2\\]| 1 | Hydrogen | H|(-1.638036,1.136548,-0.000000)|1.007975|" ] }, { "cell_type": "code", "execution_count": 1, "id": "93767509", "metadata": {}, "outputs": [], "source": [ "from moha.molecule import Molecule\n", "from moha.basis import BasisSet\n", "\n", "geo = [[8, 0.000000000000, -0.143225816552, 0.000000000000],\n", " ['h', 1.638036840407, 1.136548822547, -0.000000000000],\n", " [\"H\", -1.638036840407, 1.136548822547, -0.000000000000]]\n", "\n", "mol = Molecule.build(geo,pg=False)\n", "orb = BasisSet.build(mol,'sto-3g.nwchem')" ] }, { "cell_type": "code", "execution_count": 2, "id": "9c3ef85a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['__add__', '__call__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__neg__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__weakref__', 'coefficients', 'expansion', 'exponents', 'norm', 'norm_memo', 'origin', 'parallel', 'shell']\n", "\n" ] }, { "ename": "TypeError", "evalue": "unsupported operand type(s) for +: 'ContractedGaussian' and 'ContractedGaussian'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", "Input \u001b[0;32mIn [2]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;28mdir\u001b[39m(orb[\u001b[38;5;241m0\u001b[39m]))\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241m-\u001b[39morb[\u001b[38;5;241m0\u001b[39m])\n\u001b[0;32m----> 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(orb[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m+\u001b[39morb[\u001b[38;5;241m1\u001b[39m])\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;241m2\u001b[39m\u001b[38;5;241m*\u001b[39morb[\u001b[38;5;241m0\u001b[39m])\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m(orb[\u001b[38;5;241m0\u001b[39m]\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m2\u001b[39m)\n", "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'ContractedGaussian' and 'ContractedGaussian'" ] } ], "source": [ "print(dir(orb[0]))\n", "print(-orb[0])\n", "print(orb[0]+orb[1])\n", "print(2*orb[0])\n", "print(orb[0]/2)" ] }, { "cell_type": "markdown", "id": "3b8ff243", "metadata": {}, "source": [ "| Atom | shell | Angular momentum |Spherical part |\n", "|:--------:|:--------:|:------:|:------:|\n", "| O| 8 | Oxygen | O|\n" ] }, { "cell_type": "markdown", "id": "1bc81583", "metadata": {}, "source": [ "## Primitive Gaussian Type Orbital\n", "\n", "Most quantum chemistry package supports Contracted Gaussian type orbtial(CGTO), it is an atomic orbital forming in linear combinations of primitive Gaussians type orbital(PGTO). Here in this note, only the integral over primitive Gaussian type orbital is to be considered which are defiend by an angular part which is homogeneous polynomial in the compoents x, y, and z of the position vector $\\mathbf{r}$. That is,\n", "\n", "\\begin{equation}\n", "G_{ijk}(r_A,a) = x^i_A y^j_A z^k_A e^{-a r^2_A}\n", "\\end{equation}\n", "\n", "- a>0 is the orbital exponent. \n", "- $r_A = r − A$ is the electronic coordinate.\n", "- i ≥ 0, j ≥ 0, k ≥ 0 is the quantum number.\n", "- Total angular-momentum quantum number l = i + j + k ≥ 0\n", "\n", "The Cartesian Gaussians may be factorized in the three Cartesian directons\n", "\\begin{equation}\n", "G_{ijk}(r_A,a) = G_i(r_A,a)G_j(r_A,a)G_k(r_A,a)\n", "\\end{equation}\n", "where\n", "\\begin{equation}\n", "G_i(r_A,a)= x^i_A e^{-a x^2_A}\n", "\\end{equation}\n", "\n", "Gaussians satisfy a simple recurrence relation:\n", "\n", "\\begin{equation}\n", "x_A G_i(a, x_A ) = G_{i+1}(a, x_A )\n", "\\end{equation}\n", "\n", "The differentiation of a Gaussian yields a linear combination of two Gaussians\n", "\\begin{equation}\n", "\\frac{\\partial G_i(a, x_A )}{\\partial A_x}\n", "= -\\frac{\\partial G_i(a, x_A)}{\\partial x}\n", "= 2aG_{i+1}(a, x_A) − iG_{i−1}(a, x_A)\n", "\\end{equation}\n", "\n", "An important property of Gaussians is the Gaussian product rule. The product of two Gaussians is another Gaussian centered somewhere on the line connecting the original Gaussians; its exponent is the sum of the original exponents:\n", "\n", "\\begin{equation}\n", "e^{-a x^2_A} e^{-b x^2_B} = e^{-\\mu X_{AB}^2} e^{-p x^2_P}\n", "\\end{equation}\n", "\n", "while the centre-of-charge $P_x$ and the relative coordinate or Gaussian separation $X_{AB}$ are given by\n", "\n", "\\begin{equation}\n", "\\begin{aligned}\n", "p &= a+b\\\\\n", "\\mu &= \\frac{ab}{a+b}\\\\\n", "P_x &= \\frac{aA_x+bB_x}{a+b}\\\\\n", "X_{AB} &= A_x - B_x\n", "\\end{aligned}\n", "\\end{equation}\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ea967f7a", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "class PrimitiveGaussian(object):\n", " \"\"\"Primitive Gaussian functions.\n", " \n", " Attributes\n", " ----------\n", " origin : 3-list\n", " Coordinate of the nuclei.\n", "\n", " n : int\n", " Principal quantum number.\n", " \n", " shell : 3-tuple\n", " Angular momentum.\n", " \n", " coef : float\n", " Coefficent of Primitive Gaussian function.\n", "\n", " exp : float\n", " Primitive Gaussian exponent.\n", " \n", " Methods\n", " -------\n", " __init__(self,type,origin,n,shell,coef,exp)\n", " Initialize the instance.\n", "\n", " \"\"\"\n", " def __init__(self,coefficient,origin,shell,exponent):\n", " \"\"\"Initialize the instance.\n", "\n", " Parameters\n", " ----------\n", " origin : list\n", " Coordinate of the nuclei.\n", "\n", " n : int\n", " Principal quantum number.\n", " \n", " shell : list\n", " Angular momentum.\n", "\n", " coef : float\n", " Primitive Gaussian coefficients.\n", " \n", " exp : float\n", " Primitive Gaussian exponent.\n", " \"\"\"\n", " self.coefficient = coefficient\n", " self.origin = origin\n", " self.shell = shell\n", " self.exponent = exponent\n", "\n", "\n", "if __name__ == '__main__':\n", " # Molecular coordinates\n", " H2O = [[0., 1.43233673, -0.96104039],\n", " [0., -1.43233673, -0.96104039],\n", " [0., 0., 0.24026010]]\n", "\n", " # Orbital exponents\n", " OrbCoeff = np.array([[3.425250914, 0.6239137298, 0.168855404],\n", " [3.425250914, 0.6239137298, 0.168855404],\n", " [130.7093214, 23.80886605, 6.443608313],\n", " [5.033151319, 1.169596125, 0.38038896],\n", " [5.033151319, 1.169596125, 0.38038896],\n", " [5.033151319, 1.169596125, 0.38038896],\n", " [5.033151319, 1.169596125, 0.38038896]])\n", "\n", " # H1s, H2s, O1s, O2s, O2px , O2py, O2p\n", " FCenter = [H2O[0], H2O[1], H2O[2], H2O[2], H2O[2], H2O[2], H2O[2]]\n", " CartAng = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0],\n", " [1, 0, 0], [0, 1, 0], [0, 0, 1]]\n", "\n", " pga = PrimitiveGaussian(1.0,FCenter[0],CartAng[0],OrbCoeff[0,0])\n", " pgb = PrimitiveGaussian(1.0,FCenter[6],CartAng[6],OrbCoeff[6,0])" ] } ], "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.6" }, "vscode": { "interpreter": { "hash": "3b4dd1ce6c8ed31661adb8e55d1f9c30ec54ed472785ff10576acd13e5f2c743" } } }, "nbformat": 4, "nbformat_minor": 5 }