File size: 4,027 Bytes
64c992d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | {
"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
}
|