{ "cells": [ { "cell_type": "markdown", "id": "9f479dac", "metadata": {}, "source": [ "# Figure 5C: implicit vs explicit correction RMSE, delta-22 vs the natural-products test set\n", "\n", "Bootstrap RMSE of implicit (PCM) vs explicit (OpenMM + vibrations) corrections, delta-22 vs the pooled complex/natural-product test set, chloroform and benzene (bars = mean, error bars = 2.5-97.5 percentile). Produces the ¹H panel (saved) and a ¹³C companion (inline only)." ] }, { "cell_type": "code", "execution_count": null, "id": "c4fd38cc", "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/applications\", \"analysis/code\", \"analysis/code/shared\"):\n", " sys.path.insert(0, os.path.join(REPO, _p))" ] }, { "cell_type": "code", "execution_count": null, "id": "aef1da3f", "metadata": {}, "outputs": [], "source": [ "from applications_reader import Applications\n", "import applications\n", "import applications_plots\n", "import paths" ] }, { "cell_type": "code", "execution_count": null, "id": "178e31b6", "metadata": {}, "outputs": [], "source": [ "APPLICATIONS_HDF5 = paths.dataset_file(\"applications\", root=REPO)\n", "XLSX = os.path.join(REPO, \"data\", \"applications\", \"applications_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": "a013c941", "metadata": {}, "outputs": [], "source": [ "loader = Applications(APPLICATIONS_HDF5, XLSX)\n", "query_df_nn = applications.build_query_df_nn(loader)\n", "seed = applications.build_bootstrap_seed_coeffs(loader)\n", "\n", "# pooled \"Test Set\" bootstrap RMSE distributions (one bin over all 13 complex molecules)\n", "grouped = {}\n", "for nuc in [\"H\", \"C\"]:\n", " preds = applications.apply_bootstrap_params_to_full_dataset(query_df_nn, seed[nuc], nucleus=nuc)\n", " grouped[nuc] = applications.compute_grouped_rmse(preds, applications.ALL_IN_ONE_BIN)" ] }, { "cell_type": "code", "execution_count": null, "id": "3d3cf53a", "metadata": {}, "outputs": [], "source": [ "applications_plots.plot_nps_benefit_barplot(\n", " loader.rmse_distribution(\"H\"), grouped[\"H\"], nucleus=\"H\",\n", " solvents=[[\"chloroform\"], [\"benzene\"]], np_solute_groups=applications.ALL_IN_ONE_BIN,\n", " formulas=[\"stationary_plus_pcm\", \"stationary_plus_qcd + openMM\"],\n", " labels=[\"Implicit Solvent (SotA)\", \"Explicit Solvent + Vibrations (OpenMM)\"],\n", " colors=[\"#A72608\", \"#61a89a\"], formula_remap=applications.FORMULA_REMAP,\n", " figsize=(6, 5), y_min=0.0, y_max=0.37, save_path=figure_path(\"fig5c_benefit_1H.png\"))\n", "\n", "applications_plots.plot_nps_benefit_barplot(\n", " loader.rmse_distribution(\"C\"), grouped[\"C\"], nucleus=\"C\",\n", " solvents=[[\"chloroform\"], [\"benzene\"]], np_solute_groups=applications.ALL_IN_ONE_BIN,\n", " formulas=[\"stationary_plus_pcm\", \"stationary_plus_op_vib + openMM\"],\n", " labels=[\"Implicit Solvent (SotA)\", \"Explicit Solvent + Vibrations (OpenMM)\"],\n", " colors=[\"#A72608\", \"#61a89a\"], formula_remap=applications.FORMULA_REMAP,\n", " figsize=(6, 5), y_min=0.0, save_path=None) # inline-only companion, not saved to disk" ] } ], "metadata": { "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.13" } }, "nbformat": 4, "nbformat_minor": 5 }