File size: 3,283 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
{
 "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
}