{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# XYG3 型密度泛函" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "这一节我们讨论 XYG3 型密度泛函 (XYG3 type of Double Hybrid density functional, xDH)。后续文档的目标就是推导 XYG3 型泛函的一阶梯度与二阶梯度。" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pyscf import scf, gto, dft, mp\n", "import numpy as np\n", "from functools import partial\n", "import warnings\n", "\n", "from pkg_resources import resource_filename\n", "from pyxdh.Utilities import FormchkInterface\n", "from pyxdh.Utilities.test_molecules import Mol_H2O2\n", "from pyxdh.DerivOnce import GradXDH\n", "\n", "warnings.filterwarnings(\"ignore\")\n", "np.einsum = partial(np.einsum, optimize=[\"greedy\", 1024 ** 3 * 2 / 8])\n", "np.set_printoptions(5, linewidth=150, suppress=True)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "mol = Mol_H2O2().mol\n", "grids = Mol_H2O2().gen_grids()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 量化软件的 XYG3 计算" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Gaussian 计算" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "在一个内部版本的 Gaussian 中,我们可以获得 H2O2 分子的 XYG3 下,6-31G 基组、(99, 590) 格点的非冻核近似的计算结果;这个结果的输入卡与 formchk 文件也已经在 pyxdh 的库中。调取方式如下:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-151.1962822786802" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ref_fchk = FormchkInterface(resource_filename(\"pyxdh\", \"Validation/gaussian/H2O2-XYG3-force.fchk\"))\n", "ref_fchk.total_energy()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### PySCF 计算" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "为了实现 XYG3 的计算,我们需要对 B2PLYP 与非自洽泛函的计算过程有大致印象;但我们将为了方便后文,重新定义记号。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "