From d2e702ad765ba98166e52f42cd6c3c9c078a94c7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 23 Apr 2020 11:25:03 +0200 Subject: [PATCH] =?UTF-8?q?=C3=84dd=20Boys.ipynb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Boys.ipynb | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 Boys.ipynb diff --git a/Boys.ipynb b/Boys.ipynb new file mode 100644 index 0000000..4707fbf --- /dev/null +++ b/Boys.ipynb @@ -0,0 +1,225 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Rotation d'orbitales" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "On peut écrire une matrice de rotation $R$ comme\n", + "$$\n", + "R = \\exp(X)\n", + "$$\n", + "où X est une matrice réelle anti-symétrique ($X_{ij} = -X_{ji}$) où $X_{ij}$ est la valeurs de l'angle de la rotation entre $i$ et $j$. Par exemple:\n", + "$$\n", + "R = \\left( \\begin{array}{cc}\n", + "\\cos \\theta & -\\sin \\theta \\\\\n", + "\\sin \\theta & \\cos \\theta \\end{array} \\right)\n", + "= \\exp\n", + " \\left( \\begin{array}{cc}\n", + " 0 & \\theta \\\\\n", + "- \\theta & 0 \\end{array} \\right)\n", + "$$\n", + "\n", + "D'abord on diagonalise $X^2$ :\n", + "$$\n", + "X^2 = W(-\\tau^2) W^\\dagger.\n", + "$$\n", + "Ensuite, $R$ peut être écrit comme\n", + "$$\n", + "R = W \\cos(\\tau) W^\\dagger + W \\tau^{-1} \\sin (\\tau) W^\\dagger X\n", + "$$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## TODO\n", + "\n", + "Ecrire une fonction qui calcule $R$ a partir de $X$.\n", + "Tu vas avoir besoin de Lacaml:\n", + "* Intro a Lapack : https://lipn.univ-paris13.fr/~coti/doc/tutolapack.pdf\n", + "* Lapack user's guide : http://www.netlib.org/lapack/lug/\n", + "* Lacaml : https://mmottl.github.io/lacaml/\n", + "\n", + "Pour diagonaliser une matrice : syev\n", + "\n", + "Pour multiplier des matrices : gemm\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Localisation de Boys" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "$N$ orthonormal molecular orbitals\n", + "$$\n", + "\\phi_i({\\bf r})= \\sum_{k=1}^N c_{ik} \\chi_k\n", + "$$\n", + "$$\n", + "{\\cal B}_{2|4} = \\sum_{i=1}^N \\langle \\phi_i | ( {\\bf \\vec{r}} - \\langle \\phi_i| {\\bf \\vec{r}} | \\phi_i …\\rangle)^{2|4} | \\phi_i \\rangle\n", + "$$\n", + "$$\n", + "{\\cal B}_2= \\sum_{i=1}^N \\big[ \\langle x^2 \\rangle_i - \\langle x \\rangle^2_i + \\langle y^2 \\rangle_i - …\\langle y \\rangle^2_i + \\langle z^2 \\rangle_i - \\langle z \\rangle^2_i \\big]\n", + "$$\n", + "$$\n", + "{\\cal B}_2 = \\sum_{i=1}^N \\big[ \\langle x^4 \\rangle_i - 4 \\langle x^3 \\rangle_i \\langle x \\rangle_i\n", + " + 6 \\langle x^2 \\rangle_i \\langle x \\rangle^2_i\n", + "- 3 \\langle x \\rangle^4_i \\big] + \\big[ ...y...] + \\big[ ...z...] \n", + "$$\n", + "Minimization of ${\\cal B}$ with respect to an arbitrary rotation $R$\n", + "$$\n", + " \\langle R \\phi_i x^n R \\phi_i \\rangle = \\sum_{k,l=1}^N R_{ik} R_{il} \\langle \\phi_k| x^n | \\phi_l …\\rangle= \n", + "$$\n", + "$$\n", + "\\sum_{k,l=1}^N R_{ik} R_{il} \\sum_{m,o=1}^N c_{km} c_{ln} \\langle \\chi_m | x^n |\\chi_o \\rangle\n", + "$$\n", + "We need to compute\n", + "$$\n", + "S^x_{n;mo}= \\langle \\chi_m | x^n |\\chi_o \\rangle\n", + "$$\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Rotation de deux orbitales" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Rotation of angle $\\theta$\n", + "$$\n", + "\\tilde{\\phi}_1 = cos\\theta \\phi_1 -sin\\theta \\phi_2\n", + "$$\n", + "$$\n", + "\\tilde{\\phi}_2 = sin\\theta \\phi_1 +cos\\theta \\phi_2\n", + "$$\n", + "Let us note\n", + "$$\n", + "{\\cal B}_x(\\theta) = \\langle x^2 \\rangle_{\\tilde{1}} - \\langle x \\rangle^2_{\\tilde{1}} + \\langle x^2 \\rangle_{\\tilde{2}} - \\langle x \\rangle^2_{\\tilde{2}}\n", + "$$\n", + "and\n", + "\\begin{eqnarray}\n", + "A^x_{ij} & = & \\langle \\phi_i| x^2 | \\phi_j \\rangle \\\\\n", + "B^x_{ij} & = & \\langle \\phi_i| x | \\phi_j \\rangle \\;\\; i,j=1,2 \n", + "\\end{eqnarray}\n", + "We have\n", + "$$\n", + "{\\cal B}_x(\\theta) = A^x_{11}+A^x_{22} - ({\\tilde B}^{x2}_{11} + {\\tilde B}^{x2}_{22})\n", + "$$\n", + "with\n", + "$$\n", + "{\\tilde B}^{x2}_{11}= (cos^2\\theta B^x_{11} + sin^2\\theta B^x_{22} - sin2\\theta B^x_{12})^2\n", + "$$\n", + "$$\n", + "{\\tilde B}^{x2}_{22}= (sin^2\\theta B^x_{11} + cos^2\\theta B^x_{22} + sin2\\theta B^x_{12})^2\n", + "$$\n", + "$$\n", + "{\\cal B}(\\theta)= {\\cal B}_x(\\theta)+{\\cal B}_y(\\theta)+{\\cal B}_z(\\theta)=(x) + (y)+(z)\n", + "$$\n", + "with\n", + "$$\n", + "{\\cal B}_x(\\theta)= A^x_{11}+A^x_{22} \n", + "- [(cos^4\\theta+ sin^4\\theta)({B^x_{11}}^2+ {B^x_{22}}^2 )\n", + "$$\n", + "$$\n", + "+ 2 sin^2 2\\theta {B^x_{12}}^2\n", + "+ 2 sin 2\\theta cos 2\\theta (({B^x_{22}} -{B^x_{11}} ) {B^x_{12}}]\n", + "$$\n", + "and idem for $y$ and $z$. \n", + "Using the fact that\n", + "$$\n", + "cos^4\\theta+ sin^4\\theta= \\frac{1}{4} ( 3 + cos4\\theta)\n", + "$$\n", + "$$\n", + "{\\cal B}_x(\\theta)= A^x_{11}+A^x_{22} \n", + "- [ \\frac{1}{4} ( 3 + cos4\\theta)({B^x_{11}}^2+ {B^x_{22}}^2 )\n", + "$$\n", + "$$\n", + "+ (1 -cos 4\\theta) {B^x_{12}}^2\n", + "+ sin 4\\theta (({B^x_{22}} -{B^x_{11}} ) {B^x_{12}}]\n", + "$$\n", + "Finally, we get\n", + "\\begin{equation}\n", + "{\\cal B}(\\theta)= {\\cal B}(0) + \\frac{1}{4} [(1-cos4\\theta)\\beta+sin4\\theta \\gamma] \n", + "\\end{equation}\n", + "where\n", + "$$\n", + "{\\cal B}(0)= A^x_{11}+A^x_{22} -((B^{x}_{11})^2+(B^{x}_{22})^2) + [...y...] + [...z...]\n", + "$$\n", + "$$\n", + "\\beta= (B^x_{11}-B^x_{22})^2 - 4 {(B^x_{12})}^2 + [...y...] + [...z...]\n", + "$$\n", + "and\n", + "$$\n", + "\\gamma= 4 B^x_{12} (B^{x}_{11}-B^x_{22}) + [...y...] + [...z...]\n", + "$$\n", + "Let us compute the derivative; we get\n", + "$$\n", + "\\frac{\\partial {\\cal B}(\\theta)}{\\partial \\theta} = \n", + "\\beta sin4\\theta \n", + "+ \\gamma cos4\\theta\n", + "$$\n", + "Extrema of ${\\cal B}(\\theta)$\n", + "\\begin{equation}\n", + "tg4\\theta= -\\frac{\\gamma}{\\beta} \n", + "\\end{equation}\n", + "There are four extrema:\n", + "$$\n", + "4\\theta; \\;\\; 4\\theta +\\pi; \\;\\; 4\\theta+ 2\\pi; \\;\\; 4\\theta+ 3\\pi\n", + "$$\n", + "Value of the second derivative of $\\cal{B}$ at the extrema\n", + "Value of $\\cal{B}$ at the extrema\n", + "\\begin{equation}\n", + "\\frac{\\partial^2 B(\\theta)}{\\partial \\theta^2}= 4 cos4\\theta \\frac{\\beta^2 + \\gamma^2}{\\beta}\n", + "\\end{equation}\n", + "There are two minima and two maxima since $cos4\\theta= -cos4(\\theta+\\pi)= -cos4(\\theta+2\\pi)=-cos4(\\theta+3\\pi)$.\n", + "Value of $\\cal{B}$ at the extrema\n", + "\\begin{equation}\n", + "{\\cal B}(\\theta)= {\\cal B}(0) + \\frac{1}{4} (\\beta -\\frac{\\beta^2 + \\gamma^2}{\\beta} {cos4\\theta})\n", + "\\end{equation}\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "OCaml 4.10.0", + "language": "OCaml", + "name": "ocaml-jupyter" + }, + "language_info": { + "codemirror_mode": "text/x-ocaml", + "file_extension": ".ml", + "mimetype": "text/x-ocaml", + "name": "OCaml", + "nbconverter_exporter": null, + "pygments_lexer": "OCaml", + "version": "4.10.0" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}