libcint 0.2.3

FFI binding and GTO wrapper for libcint (C library)
Documentation
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e839a5d8-dd7e-422a-83de-e430eca88dd7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyscf import gto, lib, scf, df, ao2mo\n",
    "import numpy as np\n",
    "import scipy\n",
    "\n",
    "np.set_printoptions(16, suppress=False, linewidth=300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a382f595-53a0-4258-9eb7-7f422be99ca3",
   "metadata": {},
   "outputs": [],
   "source": [
    "mol = mol_tzvp = gto.Mole(atom=\"O; H 1 0.94; H 1 0.94 2 104.5\", basis=\"def2-TZVP\").build()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "955ad945-276a-4cc7-b82c-8b6912612409",
   "metadata": {},
   "outputs": [],
   "source": [
    "mol_jk = gto.Mole(atom=\"O; H 1 0.94; H 1 0.94 2 104.5\", basis=\"def2-universal-jkfit\").build()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0994d915-9945-45c1-a866-60d43aecc773",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(11.25500947854174, (43, 113))"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_jk)\n",
    "lib.fp(out.T), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "95393f49-5dd3-45f4-b4ca-5c813c5c529f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(10.435234769997802, (946, 113, 3))"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "out = df.incore.aux_e2(mol_tzvp, mol_jk, \"int3c2e_ip2\", \"s2ij\")\n",
    "out_c = out.transpose(0, 2, 1)\n",
    "lib.fp(out_c), out_c.shape[::-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "bd26d67b-bca2-4837-842f-ffe98974056d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(7.422726471473346, (43, 113))"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_jk)\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "24992402-b8af-4ecc-9253-579bfba389f4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(15.423815120360992, (3, 946, 113))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "out = df.incore.aux_e2(mol_tzvp, mol_jk, \"int3c2e_ip2\", \"s2ij\")\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1ddba5ed-d7a0-4d41-a91f-efc23ce4c92a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "efccdfe3-b7f1-4c6b-b13d-aa33b389b18e",
   "metadata": {},
   "outputs": [],
   "source": [
    "coords_chg = np.asarray([[0, 1, 2], [2, 0, 1], [0, 2, 1]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "35da31c5-dc11-4269-b62c-8dc208052fc3",
   "metadata": {},
   "outputs": [],
   "source": [
    "mol_chg = gto.fakemol_for_charges(coords_chg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "60afecc3-e36e-4a83-82eb-3dca08c6ccef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(-0.12650556883004238, (43, 3))"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_chg)\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "fb6dd265-431b-4134-8756-c1591e9ed101",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.0707265752256318, (43, 3))"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "exp_chg = 1.0\n",
    "mol_chg = gto.fakemol_for_charges(coords_chg, exp_chg)\n",
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_chg)\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "eb5318a8-c437-4c93-b172-b8f73d023633",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.0424629237780389, (43, 3))"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "exp_chg = [1.0, 2.5, 4.9]\n",
    "mol_chg = gto.fakemol_for_charges(coords_chg, exp_chg)\n",
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_chg)\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "bea44cdc-0e5c-40de-87e1-6f20c5f6d909",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(-0.054460537334674264, (43, 1))"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "coord = np.asarray([[0., 1., 2.]])\n",
    "exp_chg = [1.0, 2.5, 4.9]\n",
    "coef_chg = [2.8, 3.3, 0.7]\n",
    "mol_chg = gto.fakemol_for_cgtf_charge(coord, exp_chg, coef_chg)\n",
    "out = gto.intor_cross(\"int1e_ovlp\", mol_tzvp, mol_chg)\n",
    "lib.fp(out), out.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d4f6338a-ff03-47d0-a404-c0c1fe9563e9",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d793fb90-1999-460e-9952-ed48839daa70",
   "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.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}