File size: 6,995 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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | {
"cells": [
{
"cell_type": "markdown",
"id": "8e86520a",
"metadata": {},
"source": [
"# Figure 2D: per-method scaled error and slope vs a CCSD(T) reference (NS372)\n",
"\n",
"Each conventional method placed by **scaled error** (RMSE after rescaling into CCSD(T) units via the\n",
"per-method fit) and **slope** of that fit, vs a CCSD(T)/pcSseg-3 reference on the NS372 benchmark\n",
"(proton shieldings); third axis is the method's introduction year, colored by Jacob's-ladder rung."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "37fd61c1",
"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 (\"analysis/code\", \"analysis/code/shared\"):\n",
" sys.path.insert(0, os.path.join(REPO, _p))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3de7e8c2",
"metadata": {},
"outputs": [],
"source": "import leveling\nimport convergence_plot"
},
{
"cell_type": "code",
"execution_count": null,
"id": "de9503d1",
"metadata": {},
"outputs": [],
"source": [
"# the Kaupp NS372 spreadsheet is small and ships in the repo's data/ns372/ folder\n",
"KAUPP_XLSX = os.path.join(REPO, \"data\", \"ns372\", \"ct1c00919_si_002.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": "a3bba2c1",
"metadata": {},
"outputs": [],
"source": [
"# the 1H / pcSseg-3 slice as a raw-named table, then per-method statistics (slope and scaled RMSE vs CCSD(T)).\n",
"cc_df = leveling.load_ns372_1h_convergence(KAUPP_XLSX)\n",
"fig2c_results_df = leveling.convergence_statistics(cc_df)\n",
"print(f\"{len(fig2c_results_df)} methods vs CCSD(T)/pcSseg-3\")\n",
"fig2c_results_df.sort_values(\"RMSE (scaled)\").head(6)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "afb2a097",
"metadata": {},
"outputs": [],
"source": [
"# rung colors follow Jacob's ladder (DFT approximation hierarchy).\n",
"METHOD_COLOR_MAP = {\n",
" \"Ab Initio\": \"#2B2B2B\",\n",
" \"LDA\": \"#3B82F6\",\n",
" \"GGA\": \"#1A2A6B\",\n",
" \"Meta-GGA\": \"#1E7A8B\",\n",
" \"Global Hybrid\": \"#22C55E\",\n",
" \"Range-Separated Hybrid\": \"#F59E0B\",\n",
" \"Local Hybrid\": \"#EF4444\",\n",
" \"Double Hybrid\": \"#A855F7\",\n",
"}\n",
"\n",
"methods_categorization = {\n",
" \"HF\": \"Ab Initio\", \"MP2\": \"Ab Initio\",\n",
" \"SVWN\": \"LDA\",\n",
" \"BP86\": \"GGA\", \"BLYP\": \"GGA\", \"PBE\": \"GGA\", \"KT1\": \"GGA\", \"KT2\": \"GGA\",\n",
" \"KT3\": \"GGA\", \"HCTH\": \"GGA\", \"B97D\": \"GGA\",\n",
" \"TPSS\": \"Meta-GGA\", \"τ-HCTH\": \"Meta-GGA\", \"M06-L\": \"Meta-GGA\", \"VSXC\": \"Meta-GGA\",\n",
" \"MN15-L\": \"Meta-GGA\", \"B97M-V\": \"Meta-GGA\", \"SCAN\": \"Meta-GGA\", \"rSCAN\": \"Meta-GGA\",\n",
" \"r2SCAN\": \"Meta-GGA\",\n",
" \"TPSSh\": \"Global Hybrid\", \"B3LYP\": \"Global Hybrid\", \"B97-2\": \"Global Hybrid\",\n",
" \"PBE0\": \"Global Hybrid\", \"M06\": \"Global Hybrid\", \"PW6B95\": \"Global Hybrid\",\n",
" \"BHLYP\": \"Global Hybrid\", \"MN15\": \"Global Hybrid\", \"M06-2X\": \"Global Hybrid\",\n",
" \"CAM-B3LYP\": \"Range-Separated Hybrid\", \"ωB97X-D\": \"Range-Separated Hybrid\",\n",
" \"ωB97X-V\": \"Range-Separated Hybrid\", \"ωB97M-V\": \"Range-Separated Hybrid\",\n",
" \"LH07s-SVWN\": \"Local Hybrid\", \"MPSTS\": \"Local Hybrid\", \"LHJ14\": \"Local Hybrid\",\n",
" \"LH07t-SVWN\": \"Local Hybrid\", \"LH12ct-SsirPW92\": \"Local Hybrid\",\n",
" \"LH12ct-SsifPW92\": \"Local Hybrid\", \"LH14t-calPBE\": \"Local Hybrid\", \"LH20t\": \"Local Hybrid\",\n",
" \"B2PLYP\": \"Double Hybrid\", \"B2GP-PLYP\": \"Double Hybrid\", \"DSD-PBEP86\": \"Double Hybrid\",\n",
"}\n",
"\n",
"year_map = {\n",
" \"ωB97X-D\": 2008, \"ωB97X-V\": 2014, \"r2SCAN\": 2020, \"M06-L\": 2006, \"B97D\": 1997,\n",
" \"SVWN\": 1980, \"MP2\": 1934, \"HF\": 1930, \"DSD-PBEP86\": 2011, \"BP86\": 1988, \"BLYP\": 1988,\n",
" \"PBE\": 1996, \"KT1\": 2003, \"KT2\": 2003, \"HCTH\": 1998, \"TPSS\": 2003, \"τ-HCTH\": 2002,\n",
" \"VSXC\": 1998, \"MN15-L\": 2016, \"B97M-V\": 2015, \"KT3\": 2004, \"SCAN\": 2015, \"rSCAN\": 2019,\n",
" \"TPSSh\": 2003, \"B3LYP\": 1994, \"B97-2\": 1998, \"PBE0\": 1999, \"M06\": 2008, \"PW6B95\": 2005,\n",
" \"BHLYP\": 1993, \"MN15\": 2016, \"M06-2X\": 2008, \"CAM-B3LYP\": 2004, \"ωB97M-V\": 2016,\n",
" \"LH07s-SVWN\": 2007, \"LH07t-SVWN\": 2007, \"LHJ14\": 2014, \"LH12ct-SsirPW92\": 2017,\n",
" \"LH12ct-SsifPW92\": 2017, \"LH14t-calPBE\": 2014, \"LH20t\": 2020, \"B2PLYP\": 2006,\n",
" \"B2GP-PLYP\": 2006, \"MPSTS\": 2021,\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "62e50faa",
"metadata": {},
"outputs": [],
"source": "highlight_methods = [\n \"DSD-PBEP86\", \"LH07t-SVWN\", \"LH14t-calPBE\", \"ωB97X-D\", \"ωB97X-V\",\n \"BHLYP\", \"M06-L\", \"r2SCAN\", \"B97D\", \"SVWN\", \"MP2\", \"HF\",\n]\n\nfig, ax, saved = convergence_plot.plot_statistics_3d_emphasize_rungs(\n x_param=\"Slope\",\n y_param=\"RMSE (scaled)\",\n z_param=None,\n results_df=fig2c_results_df,\n methods_categorization=methods_categorization,\n method_color_map=METHOD_COLOR_MAP,\n year_map=year_map,\n save_path=figure_path(\"fig2d_convergence_1H.png\"),\n dpi=200,\n highlight_methods=highlight_methods,\n highlight_marker_size=80, # uniform with the non-highlighted points\n highlight_edgewidth=1.3,\n highlight_text=True,\n highlight_text_size=8,\n highlight_text_dx_frac=0.03,\n highlight_text_dy_frac=-0.05,\n highlight_text_dz=2.0,\n year_tick_step=5,\n z_jitter_by_category=0.03,\n z_lane_by_category=True,\n z_lane_width=2,\n elev=12,\n azim=25,\n xlim=(0.99, 1.105),\n ylim=(0, 0.40),\n z_break=(1935, 1980),\n z_break_gap=8,\n zlim=(1930, 2025),\n xy_lane_by_category=True,\n xy_lane_strength=0.1,\n xy_lane_style=\"circle\",\n lane_exclude_categories=(\"ab initio\",),\n group_by_decade=False,\n)"
}
],
"metadata": {
"kernelspec": {
"display_name": "magnet-venv",
"language": "python",
"name": "magnet-venv"
},
"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
} |