{
"cells": [
{
"cell_type": "markdown",
"id": "4d8ac986-14f3-41a0-b6eb-3b0d66ee8ed3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Cubic response"
]
},
{
"cell_type": "markdown",
"id": "05d748fd-5993-4b4f-ba57-a99b1e390064",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## Second-order electric-dipole hyperpolarizability"
]
},
{
"cell_type": "markdown",
"id": "d55da645-fb68-4a0b-96d2-53ff475e9a8b",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"The second-order electric-dipole hyperpolarizability relates to the cubic response \n",
"function accordin to\n",
"\n",
"$$\n",
"\\gamma_{\\alpha\\beta\\gamma\\delta}(-\\omega_\\sigma;\\omega_1,\\omega_2,\\omega_3) =\n",
"-\\langle\\langle \\hat{\\mu}_\\alpha ;\\hat{\\mu}_\\beta ,\\hat{\\mu}_\\gamma\n",
",\\hat{\\mu}_\\delta \\rangle\\rangle_{\\omega_1,\\omega_2,\\omega_3}\n",
"$$\n",
"\n",
"where $\\omega_\\sigma = \\omega_1 + \\omega_2 + \\omega_3$. In the limit of static fields, $\\gamma(0;0,0,0)$ can also be determined from the fourth-order derivative of the energy with respect to electric field strengths."
]
},
{
"cell_type": "markdown",
"id": "7aabc70e-d49e-4dd8-9e51-89122430b651",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"### Pertinent optical processes\n",
"\n",
"For dynamic fields, nonlinear optical processes of interest relating to this molecular property include:\n",
"\n",
" | Optical process | Response function |\n",
" | :---- | :---- | \n",
"| Electric-Field Induced Second-Harmonic Generation | $\\gamma^\\mathrm{ESHG}_{\\mu\\nu\\eta\\xi}(-2\\omega;\\omega,\\omega,0) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi} \\rangle\\rangle_{\\omega,\\omega,0}$ |\n",
"|Third Harmonic Generation| $\\gamma^\\mathrm{THG}_{\\mu\\nu\\eta\\xi}(-3\\omega;\\omega,\\omega,\\omega) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi} \\rangle\\rangle_{\\omega,\\omega,\\omega}$|\n",
"| Electro-optical or dc-Kerr effect | $\\gamma^{\\rm dc-Kerr}_{\\mu\\nu\\eta\\xi}(-\\omega;\\omega,0,0) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi}\\rangle\\rangle_{\\omega,0,0}$|\n",
"| Optical or ac-Kerr effect| $\\gamma^\\mathrm{ac-Kerr}_{\\mu\\nu\\eta\\xi}(-\\omega_1;\\omega_1,\\omega_2,-\\omega_2) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi}\\rangle\\rangle_{\\omega_1,\\omega_2,-\\omega_2}$ |\n",
"| Intensity Dependent Refractive Index | $\\gamma^\\mathrm{IDRI}_{\\mu\\nu\\eta\\xi}(-\\omega;\\omega,\\omega,-\\omega) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi}\\rangle\\rangle_{\\omega,\\omega,-\\omega}$ |\n",
"dc Optical Rectification | $\\gamma^\\mathrm{dc-OR}_{\\mu\\nu\\eta\\xi}(0;\\omega,-\\omega,0) = - \\langle\\langle \\hat{\\mu}_{\\mu};\\hat{\\mu}_{\\nu},\\hat{\\mu}_{\\eta},\\hat{\\mu}_{\\xi} \\rangle\\rangle_{\\omega,-\\omega,0}$|\n",
"\n",
"We note that IDRI is also known under the name of degenerate four-wave mixing (DFWM)."
]
},
{
"cell_type": "markdown",
"id": "e872ab33-336e-487f-8ea6-ff0714caa004",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"### Isotropic quantities\n",
"\n",
"The experimentally measured quantities in isotropic fluids are \n",
"usually the scalar components of the tensor $\\gamma$ given by the\n",
"isotropic average:\n",
"\n",
"\\begin{eqnarray*}\n",
"\\gamma_{\\parallel} & = & \\frac{1}{15}\n",
"(\\gamma_{\\xi\\eta\\eta\\xi}\n",
"+\\gamma_{\\xi\\eta\\xi\\eta}+\\gamma_{\\xi\\xi\\eta\\eta}),\n",
"\\\\\n",
"\\gamma_{\\perp} & = & \\frac{1}{15}\n",
"(2\\gamma_{\\xi\\eta\\eta\\xi}\n",
"-\\gamma_{\\xi\\xi\\eta\\eta}), \n",
"\\end{eqnarray*}\n",
"\n",
"where the same sequence of optical frequencies, not given\n",
"explicitly above, is used for the laboratory axes and the \n",
"molecular axes. \n",
"\n",
"As for the first hyperpolarizability, the number of independent\n",
"non-zero tensor elements depends on the optical process and on the\n",
"symmetry of the molecule. For example, $\\gamma^{\\rm THG}$ is symmetric \n",
"with respect to the second, third, and fourth indices,\n",
"and this can be used to simplify\n",
"the expression given for $\\gamma_{\\perp}$. \n",
"For instance, the average value that should be \n",
"compared with the experimental THG parallel component becomes \n",
"\n",
"\\begin{eqnarray*}\n",
"\\gamma^{\\rm THG}_{\\|} = \n",
"\\frac{1}{5} \n",
"\\gamma^{\\rm THG}_{\\xi\\xi\\eta\\eta}.\n",
"\\end{eqnarray*}\n",
"\n",
"Experimentally, if all fields have parallel polarization, one can\n",
"measure the parallel components of the first and second\n",
"hyperpolarizablities, which take into account the classical\n",
"orientational averaging. In the case of ESHG, with the optical\n",
"field polarized perpendicular to the static field, one measures\n",
"the perpendicular components, and in the case of a dc-Kerr\n",
"experiment, the differences between the parallel and perpendicular\n",
"components.\n",
"\n",
"In the ESHG experiment a laser beam passes through the sample \n",
"in a static electric field\n",
"and a weak, collinear, frequency-doubled beam is detected. \n",
"Absolute values for the hyperpolarizabilities cannot be extracted; \n",
"the signal from the sample is compared to that of a known buffer \n",
"gas (ultimately helium, for which there are accurate theoretical \n",
"values) or a solid. In analogy with the derivation for \n",
"$\\tilde{\\alpha}$, the classical thermal averaging yields\n",
"\n",
"$$\n",
"\\tilde{\\gamma}^{\\rm ESHG} =\n",
"\\left( \\tilde{\\beta}_{ZZZ}^{F}/{F} \\right)_{{F}{\\rightarrow}0} =\n",
"\\langle \\gamma_{ZZZZ} \\rangle_\\Omega + \\mu_z \\langle \\beta_{ZZZ}\n",
"\\rangle_\\Omega /3kT.\n",
"$$\n",
"\n",
"The molecular hyperpolarizabilities $\\gamma^{\\rm ESHG}$ and \n",
"$\\beta^{\\rm SHG}$ can be obtained in this experiment. For \n",
"non-centrosymmetric molecules a series of measurements over a \n",
"range of temperatures has to be performed, whereas for \n",
"centrosymmetric molecules $\\beta = 0 $ and thus a single\n",
"measurement at one temperature is sufficient.\n",
"\n",
"The majority of existing experimental data on \n",
"hyperpolarizabilities are derived from ESHG and dc-Kerr \n",
"measurements. The dc-Kerr effect \n",
"differs from the other nonlinear optical processes as it allows \n",
"for absolute measurements without the need for a reference\n",
"measurement. The measured molar Kerr constant is\n",
"\n",
"\\begin{eqnarray*}\n",
"A^{\\rm dc-Kerr} &=& \\frac{N_A}{81\\epsilon_0}\n",
"\\left[\n",
"\\frac{3}{2}\n",
"(\\langle \\gamma_{ZZZZ} \\rangle_\\Omega-\\langle \\gamma_{ZXXZ} \\rangle_\\Omega)\n",
"+\\mu_z (\\langle \\beta_{ZZZ} \\rangle_\\Omega - \\langle \\beta_{XXZ} \\rangle_\\Omega ) /kT\n",
"\\right. \n",
"\\\\ \n",
"&+& \\left. \\frac{3}{10kT}\n",
"\\left(\n",
"\\alpha_{\\alpha\\beta}\\alpha_{\\alpha\\beta}^0 - \\langle \\alpha_{ZZ} \\rangle_\\Omega\n",
"\\langle \\alpha_{ZZ}^0 \\rangle_\\Omega +\n",
"\\frac{1}{kT}\n",
"\\mu_z^2 ( \\alpha_{zz} - \\langle \\alpha_{ZZ} \\rangle_\\Omega )\n",
"\\right) \\right],\n",
"\\end{eqnarray*}\n",
"\n",
"where $N_A$ is Avogadro's number,\n",
"and it involves both dynamic hyperpolarizabilities \n",
"($\\gamma^{\\rm dc-Kerr}$ and $\\beta^{\\rm EOPE}$) as well as static \n",
"(superscript 0) and dynamic polarizabilities.\n",
"\n",
"The computational requirements for the second hyperpolarizability \n",
"are more or less the same as for the first hyperpolarizability.\n",
"Although the number of studies that analyze the importance \n",
"of electron correlation effects (not including here DFT) is rather \n",
"limited, the available results confirm in general the findings made for\n",
"the first hyperpolarizabilities.\n",
"\n",
"The atomic units of $\\gamma$ are e$^4$ a$_0^4$ E$_h^{-3}$. 1 au of $\\gamma$ corresponds to 6.23538 $\\times 10^{-65}$ C$^4$ m$^4$ J$^{-3}$ (SI) or to \n",
"5.0367 $\\times 10^{-40}$ statvolt$^{-2}$ cm$^5$ (esu)."
]
},
{
"cell_type": "markdown",
"id": "d86b71b0-fa84-4d93-9e65-43d1e2499516",
"metadata": {},
"source": [
"### Dispersion\n",
"\n",
"Similar to Cauchy expansions, expansions may be applied to describe the dispersions\n",
"of hyperpolarizabilities\n",
"\n",
"$$\n",
"\\gamma_{\\parallel}(-\\omega_\\sigma;\\omega_1,\\omega_2,\\omega_3)\n",
"= \\gamma_\\parallel(0;0,0,0)\n",
"\\Big[\n",
"1 + {\\cal A}^{\\gamma}(\\omega_\\sigma^2+\\omega_1^2+\\omega_2^2+\\omega_3^2)\n",
"+{\\cal{O}}(\\omega_i^4)\n",
"\\Big]\n",
"$$\n",
"\n",
"Since the expansion coefficient, ${\\cal A}^{\\gamma}$, is frequency independent in itself, dispersions are transferable in between different nonlinear optical processes."
]
},
{
"cell_type": "markdown",
"id": "db6effc0-a4e7-45cf-9461-00b0af99c0ee",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## In VeloxChem"
]
},
{
"cell_type": "markdown",
"id": "459ea4d2-b1ce-442a-aa49-8f9a075361f3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"As an illustration, let us calculate $\\gamma_{zzzz}(-\\omega; \\omega, -\\omega, \\omega)$ using damped response theory."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "88f282c8-a811-48e8-9f1c-663f3711cdea",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove_output"
]
},
"outputs": [],
"source": [
"import veloxchem as vlx"
]
},
{
"cell_type": "markdown",
"id": "6f03eb3d-a3ab-464d-b561-fa75af8ee242",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"First, we determine the reference state of the system."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d06ef0e9-b38f-4802-ae75-02202808926c",
"metadata": {
"editable": true,
"scrolled": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"remove_output"
]
},
"outputs": [],
"source": [
"mol_str = \"\"\"3\n",
"\n",
"O 0.000000000000 0.000000000000 0.000000000000\n",
"H 0.000000000000 0.740848095288 0.582094932012\n",
"H 0.000000000000 -0.740848095288 0.582094932012\n",
"\"\"\"\n",
"\n",
"molecule = vlx.Molecule.read_xyz_string(mol_str)\n",
"basis = vlx.MolecularBasis.read(molecule, \"def2-svpd\", ostream=None)\n",
"\n",
"scf_drv = vlx.ScfRestrictedDriver()\n",
"scf_drv.ostream.mute()\n",
"\n",
"scf_drv.xcfun = \"b3lyp\"\n",
"scf_results = scf_drv.compute(molecule, basis)"
]
},
{
"cell_type": "markdown",
"id": "2e021db5-6f95-4a08-ac7f-a6a070677f18",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"Second, we calculate the needed cubic response functions with use of the `CubicResponseDriver` class."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9aeaf9d4-76ca-4f7d-9c5b-db96d20cad0e",
"metadata": {
"editable": true,
"scrolled": true,
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-output"
]
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
" Cubic Response Driver Setup \n",
" ============================= \n",
" \n",
" ERI Screening Threshold : 1.0e-12 \n",
" Convergance Threshold : 1.0e-04 \n",
" Max. Number of Iterations : 150 \n",
" Damping Parameter : 4.556000e-03 \n",
" Exchange-Correlation Functional : B3LYP \n",
" Molecular Grid Level : 4 \n",
" \n",
" \n",
" Complex Response Solver Setup \n",
" =============================== \n",
" \n",
" Number of Frequencies : 1 \n",
" Max. Number of Iterations : 150 \n",
" Convergence Threshold : 1.0e-04 \n",
" ERI Screening Scheme : Cauchy Schwarz + Density \n",
" ERI Screening Threshold : 1.0e-12 \n",
" Exchange-Correlation Functional : B3LYP \n",
" Molecular Grid Level : 4 \n",
" \n",
"* Info * Using the Libxc library (version 6.2.2). \n",
" \n",
" S. Lehtola, C. Steigemann, M. J.T. Oliveira, and M. A.L. Marques., SoftwareX 7, 1–5 (2018)\n",
" \n",
"* Info * Using the B3LYP functional. \n",
" \n",
" P. J. Stephens, F. J. Devlin, C. F. Chabalowski, and M. J. Frisch., J. Phys. Chem. 98, 11623 (1994)\n",
" \n",
"* Info * Molecular grid with 40720 points generated in 0.02 sec. \n",
" \n",
"* Info * Processing Fock builds... (batch size: 6) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 3 gerade trial vectors in reduced space \n",
"* Info * 3 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 78.19 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.61 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 1 * Residuals (Max,Min): 8.43e-01 and 8.25e-01 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 6) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 6 gerade trial vectors in reduced space \n",
"* Info * 6 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 94.51 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.61 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 2 * Residuals (Max,Min): 9.37e-02 and 9.11e-02 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 5) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 8 gerade trial vectors in reduced space \n",
"* Info * 9 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 108.11 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.61 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 3 * Residuals (Max,Min): 9.50e-03 and 9.17e-03 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 5) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 11 gerade trial vectors in reduced space \n",
"* Info * 11 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 121.71 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.62 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 4 * Residuals (Max,Min): 3.92e-04 and 3.80e-04 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 5) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 13 gerade trial vectors in reduced space \n",
"* Info * 14 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 135.31 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.62 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 5 * Residuals (Max,Min): 1.23e-05 and 1.22e-05 \n",
" \n",
" *** Complex response converged in 5 iterations. Time: 1.44 sec \n",
" \n",
" \n",
" Fock Matrix Computation \n",
" ========================= \n",
" \n",
"* Info * Processing Fock builds... (batch size: 4) \n",
"* Info * batch 1/4 \n",
"* Info * batch 2/4 \n",
"* Info * batch 3/4 \n",
"* Info * batch 4/4 \n",
" \n",
"* Info * Time spent in Fock matrices: 3.03 sec \n",
" \n",
" \n",
" Complex Response Solver Setup \n",
" =============================== \n",
" \n",
" Number of Frequencies : 1 \n",
" Max. Number of Iterations : 150 \n",
" Convergence Threshold : 1.0e-04 \n",
" ERI Screening Scheme : Cauchy Schwarz + Density \n",
" ERI Screening Threshold : 1.0e-12 \n",
" Exchange-Correlation Functional : B3LYP \n",
" Molecular Grid Level : 4 \n",
" \n",
"* Info * Using the Libxc library (version 6.2.2). \n",
" \n",
" S. Lehtola, C. Steigemann, M. J.T. Oliveira, and M. A.L. Marques., SoftwareX 7, 1–5 (2018)\n",
" \n",
"* Info * Using the B3LYP functional. \n",
" \n",
" P. J. Stephens, F. J. Devlin, C. F. Chabalowski, and M. J. Frisch., J. Phys. Chem. 98, 11623 (1994)\n",
" \n",
"* Info * Molecular grid with 40720 points generated in 0.02 sec. \n",
" \n",
"* Info * Processing Fock builds... (batch size: 8) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 4 gerade trial vectors in reduced space \n",
"* Info * 4 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 67.66 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.63 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 1 * Residuals (Max,Min): 9.79e-02 and 8.00e-02 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 8) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 8 gerade trial vectors in reduced space \n",
"* Info * 8 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 89.42 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.64 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 2 * Residuals (Max,Min): 6.81e-03 and 5.73e-03 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 8) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 12 gerade trial vectors in reduced space \n",
"* Info * 12 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 111.18 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.65 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 3 * Residuals (Max,Min): 5.21e-04 and 4.42e-04 \n",
" \n",
"* Info * Processing Fock builds... (batch size: 8) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * 16 gerade trial vectors in reduced space \n",
"* Info * 16 ungerade trial vectors in reduced space \n",
" \n",
"* Info * 132.94 kB of memory used for subspace procedure on the master node \n",
"* Info * 2.65 GB of memory available for the solver on the master node \n",
" \n",
" *** Iteration: 4 * Residuals (Max,Min): 1.70e-05 and 1.56e-05 \n",
" \n",
" *** Complex response converged in 4 iterations. Time: 1.28 sec \n",
" \n",
" \n",
" Fock Matrix Computation \n",
" ========================= \n",
" \n",
"* Info * Processing Fock builds... (batch size: 4) \n",
"* Info * batch 1/1 \n",
" \n",
"* Info * Time spent in Fock matrices: 0.67 sec \n",
" \n",
" \n",
" Cubic response function: << z;z,z,z >> (0.0,0.0,0.0) \n",
" ======================================================= \n",
" \n",
" Real Imaginary \n",
" ---------------------------------------------------- \n",
" CRF -998.63354647 -0.00000000j \n",
" \n",
" \n",
" Cubic response function: << z;z,z,z >> (0.0720028,-0.0720028,0.0720028) \n",
" ========================================================================== \n",
" \n",
" Real Imaginary \n",
" ---------------------------------------------------- \n",
" CRF -1188.61696054 -13.89780647j \n",
" \n",
" *** Time spent in cubic response calculation: 6.51 sec *** \n",
" \n"
]
}
],
"source": [
"crf_drv = vlx.CubicResponseDriver()\n",
"\n",
"crf_drv.a_operator = \"electric dipole\"\n",
"crf_drv.b_operator = \"electric dipole\"\n",
"crf_drv.c_operator = \"electric dipole\"\n",
"crf_drv.d_operator = \"electric dipole\"\n",
"\n",
"# other available operators\n",
"#lrf.b_operator = \"electric dipole\"\n",
"#lrf.b_operator = \"linear momentum\"\n",
"#lrf.b_operator = \"angular momentum\"\n",
"#lrf.b_operator = \"magnetic dipole\"\n",
"\n",
"crf_drv.a_component = \"z\"\n",
"crf_drv.b_component = \"z\"\n",
"crf_drv.c_component = \"z\"\n",
"crf_drv.d_component = \"z\"\n",
"\n",
"crf_drv.b_frequencies = [0.0, 0.07200280]\n",
"crf_drv.c_frequencies = [0.0, -0.07200280]\n",
"crf_drv.d_frequencies = [0.0, 0.07200280]\n",
"\n",
"crf_drv.damping = 0.004556 # 1000 cm-1\n",
"\n",
"crf_drv.print_level = 2\n",
"\n",
"crf_results = crf_drv.compute(molecule, basis, scf_results)"
]
},
{
"cell_type": "markdown",
"id": "ff961e3e-f568-4746-a8bf-7fb3ff5c5eec",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"Third, we print the requested molecular properties. "
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5b3a6404-8005-4592-9402-b8d4945abc5f",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" w1 w2 w3 gamma_zzzz\n",
"------------------------------------------------\n",
" 0.0000 0.0000 0.0000 998.6335+0.0000j\n",
" 0.0720 -0.0720 0.0720 1188.6170+13.8978j\n"
]
}
],
"source": [
"print(f\"{'w1':>8s}{'w2':>8s}{'w3':>8s}{'gamma_zzzz':>24s}\")\n",
"print(\"-\"*48)\n",
"for key in crf_results.keys():\n",
" print(f\"{key[1]:8.4f}{key[2]:8.4f}{key[3]:8.4f}{-crf_results[key]:24.4f}\")"
]
},
{
"cell_type": "markdown",
"id": "d24ca426-2893-4382-970a-abd15a0f783e",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"```{note}\n",
"Taking into account the three perturbation operators, all of the form $\\hat{V}^\\omega = - \\hat{\\mu}_\\alpha F_\\alpha^\\omega$, we need to change the sign of the response function values to get results for the second-order hyperpolarizability.\n",
"```"
]
}
],
"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.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}