{ "cells": [ { "cell_type": "markdown", "id": "14144752", "metadata": {}, "source": [ "# Molecule\n", "\n", "A molecule is a system consisting of a nucleus and electrons. For quantum chemistry calculation in MoHa, we will always use the Born-Oppenheimer approximation, which assumes that the motion of atomic nuclei and electrons in a molecule can be separated.\n", "\\begin{equation}\n", "\\Psi_{molecule} = \\psi_{electronic} \\otimes \\psi_{nuclear}\n", "\\end{equation}\n", "\n", "The class `Molecule` in MoHa only contains information about the nuclear. In Moha package, it is a constructed as a subclass of python list, anyhow, for moha user, you can just use it as list of `Atom` instance. " ] }, { "cell_type": "markdown", "id": "0a1a0a8f", "metadata": {}, "source": [ "## Build\n", "\n", "To build a water molecule with MoHa, " ] }, { "cell_type": "code", "execution_count": 1, "id": "9671f7ea", "metadata": {}, "outputs": [], "source": [ "from moha.molecule import Molecule\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)" ] }, { "cell_type": "markdown", "id": "83984ea9", "metadata": {}, "source": [ "We can specify the essential information of a molecule by Python iterator, tuple or list, in matrix format. Each row of the geo obejct represents an atom in molecule, with first element the number or symbol (case insensitive) of the element." ] }, { "cell_type": "markdown", "id": "58ab9f2a", "metadata": {}, "source": [ "Another way to build the `Molecule` instance is loading the molecular geometry from .xyz file." ] }, { "cell_type": "code", "execution_count": 2, "id": "628d2e82", "metadata": {}, "outputs": [], "source": [ "from moha.molecule import Molecule\n", "\n", "geo = './data/h2o.xyz'\n", "\n", "mol = Molecule.build(geo,pg=False)" ] }, { "cell_type": "markdown", "id": "d753ce93", "metadata": {}, "source": [ "The XYZ file format is a chemical file format. There is no formal standard and several variations exist, but a typical XYZ format specifies the molecule geometry by giving the number of atoms with Cartesian coordinates that will be read on the first line, a comment on the second, and the lines of atomic coordinates in the following lines.\n", "\n", "The typical formatting of xyz is:\n", "\n", " \n", " comment line\n", " \n", " ... \n", " \n", "In quantum chemistry, the atomic unit system is generally used, here Bohr radius ($a_0$ = 0.0529177nm) is taken as the unit by default. " ] }, { "cell_type": "markdown", "id": "7e8b0fe2", "metadata": {}, "source": [ "Only instance of `Atom` class are allowed to be the element of `Molecule` instances. \n", "\n", "| 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": "markdown", "id": "352142c3", "metadata": {}, "source": [ "## Geometry Methods\n", "\n", "- Bond Lengths\n", "\n", "Calculate the atomic distances between atom i and atom j using the expression:\n", "\n", "\\begin{equation}\n", "R_{ij} = \\sqrt{(x_i-x_j)^2+(y_i-y_j)^2+(z_i-z_j)^2}\n", "\\end{equation}\n", "\n", "\n", "- Bond Angles\n", "\n", "Calculate bond angles between atoms i-j-k, where j is the central atom using the expression:\n", "\n", "\\begin{equation}\n", "\\Phi_{ijk} = \\sqrt{(x_i-x_j)^2+(y_i-y_j)^2+(z_i-z_j)^2}\n", "\\end{equation}\n", "\n", "where the eij are unit vectors between the atoms, e.g.,\n", "\n", "- Out-of-Plane Angles\n", "\n", "Calculate all possible out-of-plane angles. For example, the angle Ξijkl for atom i out of the plane containing atoms j-k-l (with k as the central atom, connected to i) is given by:\n", "\n", "\\begin{equation}\n", "\\Phi_{ijk} = \\sqrt{(x_i-x_j)^2+(y_i-y_j)^2+(z_i-z_j)^2}\n", "\\end{equation}\n", "\n", "- Center of Mass\n", "\n", "Find the center of mass of the molecule:\n", "\n", "\n", "\n", "\\begin{equation}\n", "\\begin{aligned}\n", "X_{com} = \\frac{\\sum_i m_i x_i}{\\sum_i m_i}\n", "&Y_{com} = \\frac{\\sum_i m_i y_i}{\\sum_i m_i}\n", "&Z_{com} = \\frac{\\sum_i m_i z_i}{\\sum_i m_i}\n", "\\end{aligned}\n", "\\end{equation}\n", "\n", "where mi is the mass of atom i and the summation runs over all atoms in the molecule.\n", "\n", "Translate the input coordinates of the molecule to the center-of-mass.\n", "\n", "- Rotational Constants\n", "\n", "\n", "Only instance of `Atom` class are allowed to be the element of `Molecule` instances. \n", "\n", "| Methods | Call | Return |\n", "|:--------|:--------|:------|\n", "|Bond Length| mol.bond_length(i,j) | scalar |\n", "|Bond angle| mol.bond_angle(i,j,k) | scalar |\n", "|Center of mass| mol.center_of_mass | (x,y,z) |\n", "|Moment of inertia| mol.moment_of_inertia | \\begin{equation}\n", "I = \n", "\\left[\n", "\\begin{matrix}\n", "I_{xx}&I_{xy}&I_{xz}\\\\\n", "I_{yx}&I_{yy}&I_{yz}\\\\\n", "I_{zx}&I_{zy}&I_{zz}\\\\\n", "\\end{matrix}\n", "\\right]\n", "\\end{equation} | \n" ] }, { "cell_type": "code", "execution_count": 2, "id": "527b50b5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1.008\n", "[ 0.02812358 -0.04871137 0.01988632]\n", "[[ 1.88739293 -0.41753364 0.17045764]\n", " [-0.41753364 2.36952099 -0.29524068]\n", " [ 0.17045764 -0.29524068 1.7668645 ]]\n" ] } ], "source": [ "# Calculate the atomic distances between atom i and atom j\n", "print(mol.bond_length(0,1))\n", "\n", "# Calculate bond angles between atoms i-j-k, where j is the central atom\n", "\n", "# Find the center of mass of the molecule\n", "print(mol.center_of_mass)\n", "print(mol.moment_of_inertia)" ] }, { "cell_type": "markdown", "id": "1d891d91", "metadata": {}, "source": [ "## Point Group\n", "\n", "Abelian groups are special types of groups in which commutativity holds. In other words, the binary operation on such groups is commutative. Because these abelian groups P all have real-valued character tables, the direct product of any irrep $I_j$ with itself gives the trivial irrep $I_0$:\n", "\n", "\\begin{equation}\n", "\\forall I_j: I_j\\otimes I_j = I_0\n", "\\end{equation}\n", "\n", "\n", "\n", "| Point Group |0|1|2|3|4|5|6|7\n", "|:--------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n", "|$C_1$\t|A|\t||||||| \t \t \t \t \t \t \n", "|$C_i$\t|$A_g$|$A_u$|||||||\t \t \t \t \t \t \n", "|$C_2$\t|A|\tB|||||||\t \t \t \t \t \t \n", "|$C_s$\t|A'|A''||||||| \t \t \t \t \t \n", "|$D_2$\t|A |$B_1$|$B_2$|$B_3$|||||\t \t \t \t \n", "|$C_{2v}$|$A_1$|$A_2$|$B_1$|\t$B_2$|||||\t \t \t \t \n", "|$C_{2h}$|$A_g$|$B_g$|$A_u$|\t$B_u$|||||\t \t \t \t \n", "|$D_{2h}$|$A_g$|$B_{1g}$|$B_{2g}$|$B_{3g}$|$A_u$|$B_{1u}$|$B_{2u}$|$B_{3u}$|\n" ] }, { "cell_type": "code", "execution_count": null, "id": "d00f7f4f", "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.6" }, "vscode": { "interpreter": { "hash": "3b4dd1ce6c8ed31661adb8e55d1f9c30ec54ed472785ff10576acd13e5f2c743" } } }, "nbformat": 4, "nbformat_minor": 5 }