{ "cells": [ { "cell_type": "markdown", "id": "1344ef50", "metadata": {}, "source": [ "# SI Figure S5: per-solvent PCM benefit vs bulk dielectric constant and polarizability\n", "\n", "Per-solvent PCM benefit (% test-RMSE reduction) vs bulk dielectric constant and polarizability, for\n", "the MagNET-Zero reference method per nucleus (WP04 ¹H, wB97X-D ¹³C). Panels A (¹H) and B (¹³C)\n", "show all solvents; C repeats ¹H excluding aromatics and trifluoroethanol." ] }, { "cell_type": "code", "execution_count": null, "id": "dfffb6dc", "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": "74921dd6", "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "import delta22\n", "import delta22_plots\n", "import paths" ] }, { "cell_type": "code", "execution_count": null, "id": "c3053b56", "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": "99b0ba9e", "metadata": {}, "outputs": [], "source": [ "# the published panels use 250 seeded train/test splits\n", "N_SPLITS = 250" ] }, { "cell_type": "code", "execution_count": null, "id": "9aa30554", "metadata": {}, "outputs": [], "source": [ "dft = delta22.load_query_df_dft(DELTA22_HDF5, XLSX, verbose=False)\n", "solutes = sorted(dft[\"solute\"].unique())\n", "benefit = {}\n", "for nucleus, label in [(\"H\", \"1H\"), (\"C\", \"13C\")]:\n", " method = delta22.MAGNET_PCM_OUTPUT_METHODS[nucleus]\n", " benefit[nucleus] = delta22.pcm_benefit_per_solvent(dft, method, \"pcSseg2\", \"aimnet2\",\n", " delta22.DESMOND_SOLVENTS, n_splits=N_SPLITS,\n", " solutes=solutes, nucleus=nucleus)\n", " print(f\"{label} ({method}):\"); print(benefit[nucleus].round(1).to_string())" ] }, { "cell_type": "markdown", "id": "329088d2", "metadata": {}, "source": [ "## S5A (1H, all solvents), S5B (13C, all solvents), and S5C (1H, excluding aromatics and trifluoroethanol)" ] }, { "cell_type": "code", "execution_count": null, "id": "2d519d66", "metadata": {}, "outputs": [], "source": [ "# panels A (1H) and B (13C): all solvents\n", "for nucleus, letter, nuc_label in [(\"H\", \"A\", \"H\"), (\"C\", \"B\", \"C\")]:\n", " delta22_plots.plot_pcm_benefit_vs_properties(\n", " benefit[nucleus], delta22.SOLVENT_DIELECTRIC, delta22.SOLVENT_POLARIZABILITY, nuc_label,\n", " save_path=figure_path(f\"si_figure_s05{letter}_all.png\"))\n", "# panel C is 1H only, excluding the aromatic solvents and trifluoroethanol (matches the published SI)\n", "delta22_plots.plot_pcm_benefit_vs_properties(\n", " benefit[\"H\"], delta22.SOLVENT_DIELECTRIC, delta22.SOLVENT_POLARIZABILITY, \"H\",\n", " exclude=[\"benzene\", \"toluene\", \"chlorobenzene\", \"trifluoroethanol\"],\n", " title_extra=\"Excluding Aromatic Solvents and Trifluoroethanol\",\n", " save_path=figure_path(\"si_figure_s05A_no_aromatics_tfe.png\"))" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }