{ "cells": [ { "cell_type": "markdown", "id": "a1be4f68", "metadata": {}, "source": [ "# Figure 4A: predicted vs measured solvent-induced shift, implicit (PCM)\n", "\n", "Implicit (PCM) predicted vs measured solvent-induced shifts (Δδ vs. CDCl3, ¹H) for one solvent per class." ] }, { "cell_type": "code", "execution_count": null, "id": "27283d57", "metadata": {}, "outputs": [], "source": [ "import os, sys\n", "\n", "# make the in-repo modules importable (not pip-installed)\n", "REPO = os.path.abspath(\"../..\")\n", "for _p in (\"data/delta22\", \"analysis/code\", \"analysis/code/shared\"):\n", " sys.path.insert(0, os.path.join(REPO, _p))" ] }, { "cell_type": "code", "execution_count": null, "id": "576ad573", "metadata": {}, "outputs": [], "source": [ "import delta22\n", "import paths\n", "import fig4_plots" ] }, { "cell_type": "code", "execution_count": null, "id": "fff8d490", "metadata": {}, "outputs": [], "source": [ "DELTA22_HDF5 = paths.dataset_file(\"delta22\", root=REPO)\n", "XLSX = os.path.join(REPO, \"data\", \"delta22\", \"delta22_experimental.xlsx\")\n", "\n", "def figure_path(name):\n", " os.makedirs(\"figures\", exist_ok=True)\n", " return os.path.join(\"figures\", name)" ] }, { "cell_type": "code", "execution_count": null, "id": "236a76a8", "metadata": {}, "outputs": [], "source": [ "METHOD, BASIS, GEOM = \"b3lyp_d3bj\", \"pcSseg2\", \"aimnet2\"\n", "q = delta22.load_query_df_dft(DELTA22_HDF5, XLSX, verbose=False)\n", "one = q[(q[\"sap_nmr_method\"] == METHOD) & (q[\"sap_basis\"] == BASIS) & (q[\"sap_geometry_type\"] == GEOM)]\n", "one = delta22.add_solvent_mean(one)\n", "print(len(one), \"rows for\", METHOD, BASIS, GEOM)" ] }, { "cell_type": "code", "execution_count": null, "id": "f28bd2a4", "metadata": {}, "outputs": [], "source": [ "shifts_chcl3 = delta22.solvent_induced_shifts(one, \"chloroform\", delta22.DESMOND_SOLVENTS,\n", " nucleus=\"H\", explicit=\"desmond\")\n", "print(len(shifts_chcl3), \"site/solvent differences\")" ] }, { "cell_type": "code", "execution_count": null, "id": "6f3c02f9", "metadata": {}, "outputs": [], "source": [ "# Water == TIP4P\n", "FIG4_HIGHLIGHT = {\"dimethylsulfoxide\": \"DMSO\", \"TIP4P\": \"Water\", \"benzene\": \"Benzene\"}\n", "FIG4_ORDER = [\"DMSO\", \"Water\", \"Benzene\"]\n", "FIG4_PALETTE = {\"DMSO\": \"#61a89a\", \"Water\": \"#A72608\", \"Benzene\": \"#dacd82\"}\n", "FIG4_MARKERS = {\"DMSO\": \"o\", \"Water\": \"^\", \"Benzene\": \"X\"}" ] }, { "cell_type": "code", "execution_count": null, "id": "59bb0a61", "metadata": {}, "outputs": [], "source": [ "fig4_plots.save_panel(\n", " lambda ax: fig4_plots.draw_shift_scatter(ax, shifts_chcl3, \"implicit_diff\",\n", " FIG4_HIGHLIGHT, FIG4_ORDER, FIG4_PALETTE, FIG4_MARKERS),\n", " figure_path(\"fig4a_implicit_1H.png\"),\n", ")" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }