Skip to content

Commit 6011846

Browse files
committed
Update notebook
1 parent 4695dad commit 6011846

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

notebooks/02_bbmep/create_figures.ipynb

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"metadata": {},
1616
"outputs": [],
1717
"source": [
18+
"import sys\n",
19+
"sys.path.append('/home/fosteradam/oneqmc/src')\n",
20+
"\n",
1821
"import matplotlib.pyplot as plt\n",
1922
"from matplotlib import rcParams\n",
2023
"import numpy as np\n",
@@ -58,7 +61,7 @@
5861
"metadata": {},
5962
"outputs": [],
6063
"source": [
61-
"save_figures = False"
64+
"save_figures = True"
6265
]
6366
},
6467
{
@@ -168,6 +171,7 @@
168171
"# Single color for all non-QMC methods, different markers\n",
169172
"non_qmc_color = \"#E05A33\" # red/orange\n",
170173
"non_qmc_markers = ['s', '^', 'v', 'D', 'p', 'h', '*', 'X', 'P', '<', '>'] # variety of markers\n",
174+
"non_qmc_marker_sizes = {'s': 180, '^': 240, 'v': 240, 'D': 180, 'p': 180, 'h': 180, '*': 300, 'X': 180, 'P': 180, '<': 180, '>': 180}\n",
171175
"\n",
172176
"fig, ax = plt.subplots(3, 2, figsize=(18.5, 19), sharey=True)\n",
173177
"compute_sec = {\n",
@@ -195,9 +199,9 @@
195199
" x_gpu_hr = x * 4 * compute_sec[i] / 3600\n",
196200
" y = 627.5 * MAE[i][j][:, 1]\n",
197201
" h, v = np.divmod(m, 3)\n",
198-
" ax[v][h].scatter(x_gpu_hr, y, marker=\"o\", s=140, label=j, color=qmc_colors[n])\n",
202+
" ax[v][h].scatter(x_gpu_hr, y, marker=\"o\", s=140, label=j, color=qmc_colors[n], zorder=3)\n",
199203
" a, b = np.polyfit(np.log(x_gpu_hr), np.log(y), 1)\n",
200-
" ax[v][h].plot(x_gpu_hr, np.exp(a * np.log(x_gpu_hr) + b), color=qmc_colors[n], linewidth=4)\n",
204+
" ax[v][h].plot(x_gpu_hr, np.exp(a * np.log(x_gpu_hr) + b), color=qmc_colors[n], linewidth=4, zorder=2)\n",
201205
" ax[v][h].set_xscale(\"log\", base=10)\n",
202206
" ax[v][h].set_yscale(\"log\", base=4)\n",
203207
" ticks = [0.01, 0.1, 1, 10, 100]\n",
@@ -210,21 +214,25 @@
210214
" gpu_hr_equiv,\n",
211215
" 627.5 * MAE_es[i][k][1],\n",
212216
" label=k,\n",
213-
" s=180,\n",
217+
" s=non_qmc_marker_sizes[non_qmc_markers[idx % len(non_qmc_markers)]],\n",
214218
" color=non_qmc_color,\n",
215219
" marker=non_qmc_markers[idx % len(non_qmc_markers)],\n",
220+
" zorder=4,\n",
221+
" edgecolors='white',\n",
222+
" linewidths=1.5,\n",
216223
" )\n",
217224
" ax[v][h].set_xticks(ticks)\n",
218225
" ax[v][h].set_xticklabels(ticks, fontsize=16)\n",
219-
" ax[v][h].axhspan(0.2, 5, color=\"grey\", alpha=0.2, lw=0)\n",
220-
" ax[v][h].set_xlim([0.0025, 500])\n",
221-
" ax[v][h].axhline(1, color=\"k\", ls=\":\", linewidth=4)\n",
226+
" ax[v][h].axhspan(0.2, 5, color=\"grey\", alpha=0.2, lw=0, zorder=0)\n",
227+
" ax[v][h].set_xlim([0.0025, 300] if h == 0 else [0.005, 1100])\n",
228+
" ax[v][h].axhline(1, color=\"darkgray\", ls=\":\", linewidth=4, zorder=1)\n",
222229
" ax[v][h].set_yticks(\n",
223-
" [0.5, 1, 2, 5, 10, 20, 50], [0.5, 1, 2, 5, 10, 20, 50], fontsize=16\n",
230+
" [0.5, 1, 2, 5, 10, 20, 50, 100, 200], [0.5, 1, 2, 5, 10, 20, 50, 100, 200], fontsize=16\n",
224231
" )\n",
232+
" ax[v][h].minorticks_off()\n",
225233
" ax[v][h].set_ylim([0.25, 850])\n",
226234
" if h == 0:\n",
227-
" ax[v][h].set_ylabel(\"MARE over entire MEP (kcal/mol)\", fontsize=22)\n",
235+
" ax[v][h].set_ylabel(\"MARE over MEP (kcal/mol)\", fontsize=22)\n",
228236
"ax[2][1].set_axis_off()\n",
229237
"\n",
230238
"ax[0][0].legend(\n",
@@ -335,7 +343,7 @@
335343
"source": [
336344
"## Get reaction profile figure\n",
337345
"\n",
338-
"fig, ax = plt.subplots(3, 2, figsize=(13, 17.5), sharex=True)\n",
346+
"fig, ax = plt.subplots(3, 2, figsize=(13, 19), sharex=True)\n",
339347
"\n",
340348
"for m, j in enumerate([\"Ethane\", \"Formamide\", \"2-Aminopropan-2-ol\"]):\n",
341349
" step = int(MAE[j][\"Orbformer fine-tune LAC (400k), all structures\"][-1, 0])\n",
@@ -440,8 +448,8 @@
440448
" )\n",
441449
" ax[m][0].set_ylabel(\"Relative E (kcal/mol)\", fontsize=22)\n",
442450
" ax[m][1].set_ylabel(\"Relative E Error (kcal/mol)\", fontsize=22)\n",
443-
"ax[0][0].text(0.03, 0.9, \"(a) Ethane\", transform=ax[0][0].transAxes, fontsize=24)\n",
444-
"ax[0][1].text(0.03, 0.9, \"(d) Ethane\", transform=ax[0][1].transAxes, fontsize=24)\n",
451+
"ax[0][0].text(0.03, 1.02, \"(a) Ethane\", transform=ax[0][0].transAxes, fontsize=24)\n",
452+
"ax[0][1].text(0.03, 1.02, \"(d) Ethane\", transform=ax[0][1].transAxes, fontsize=24)\n",
445453
"ax[1][0].text(0.03, 0.9, \"(b) Formamide\", transform=ax[1][0].transAxes, fontsize=24)\n",
446454
"ax[1][1].text(0.03, 0.9, \"(e) Formamide\", transform=ax[1][1].transAxes, fontsize=24)\n",
447455
"ax[2][0].text(\n",
@@ -508,14 +516,18 @@
508516
"ax[0][1].text(\n",
509517
" 0.18, 1.1, \"Relative Energy Error\", transform=ax[0][1].transAxes, fontsize=26\n",
510518
")\n",
519+
"ax[0][0].set_ylim([-100, 55])\n",
511520
"ax[2][0].set_ylim([-65, 58])\n",
512-
"plt.subplots_adjust(wspace=0.2, hspace=0.02)\n",
521+
"fig.align_ylabels(ax[:, 0])\n",
522+
"fig.align_ylabels(ax[:, 1])\n",
523+
"plt.subplots_adjust(wspace=0.2, hspace=0.15)\n",
513524
"ax[2][0].set_xticks(2 * np.arange(11))\n",
514525
"ax[2][0].set_xlim([-0.5, 19.5])\n",
515526
"ax[2][0].set_xticklabels(2 * np.arange(11))\n",
516527
"ax[2][0].set_xlabel(\"Image ID on MEP\", fontsize=22)\n",
517528
"ax[2][1].set_xlabel(\"Image ID on MEP\", fontsize=22)\n",
518529
"plt.draw()\n",
530+
"\n",
519531
"if save_figures:\n",
520532
" plt.savefig(f\"{data_dir}/BBMEP_energy_profile.pdf\", dpi=600, bbox_inches='tight')\n",
521533
"plt.show()"
@@ -532,7 +544,7 @@
532544
],
533545
"metadata": {
534546
"kernelspec": {
535-
"display_name": "Python 3 (ipykernel)",
547+
"display_name": "oneqmc",
536548
"language": "python",
537549
"name": "python3"
538550
},

0 commit comments

Comments
 (0)