From f7469fe114438e73e9fff55277e8dc45c87632a1 Mon Sep 17 00:00:00 2001
From: Amir Mirzanejad <aqm6884@psu.edu>
Date: Thu, 7 Sep 2023 16:29:35 -0400
Subject: [PATCH] Upload New File

---
 Plotly_plots.ipynb | 156 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)
 create mode 100644 Plotly_plots.ipynb

diff --git a/Plotly_plots.ipynb b/Plotly_plots.ipynb
new file mode 100644
index 0000000..aae634d
--- /dev/null
+++ b/Plotly_plots.ipynb
@@ -0,0 +1,156 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "id": "99d587ca-7160-4848-8ee1-858ee39ad93f",
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/html": [
+       "<iframe\n",
+       "    scrolling=\"no\"\n",
+       "    width=\"1020px\"\n",
+       "    height=\"1020\"\n",
+       "    src=\"iframe_figures/figure_2.html\"\n",
+       "    frameborder=\"0\"\n",
+       "    allowfullscreen\n",
+       "></iframe>\n"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
+   "source": [
+    "# improt dependecies\n",
+    "import numpy as np\n",
+    "import scipy\n",
+    "import plotly\n",
+    "import plotly.io as pio\n",
+    "import plotly.graph_objects as go\n",
+    "pio.renderers.default = \"iframe\"\n",
+    "\n",
+    "# Use the data array \"data\" for Figure 2 and \"data2\" for Figure 4\n",
+    "data = [\n",
+    "    [  0.,   1.,   1.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0., 0.],\n",
+    "    [  1.,   1.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0.,   0., 0.],\n",
+    "    [  1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1., 1.],\n",
+    "    [  3.,   2.,   2.,   2.,   2.,   1.,   1.,   1.,   1.,   1.,   1., 1.],\n",
+    "    [  6.,   5.,   5.,   4.,   3.,   2.,   2.,   1.,   1.,   1.,   1., 1.],\n",
+    "    [ 12.,  10.,   8.,   6.,   4.,   3.,   2.,   2.,   2.,   2.,   2., 2.],\n",
+    "    [ 20.,  18.,  16.,  14.,  11.,   8.,   5.,   3.,   2.,   2.,   2., 2.],\n",
+    "    [ 48.,  41.,  35.,  29.,  25.,  20.,  16.,  11.,   7.,   4.,   2., 2.],\n",
+    "    [ 65.,  61.,  54.,  44.,  34.,  25.,  17.,  11.,   7.,   4.,   3., 3.],\n",
+    "    [ 66.,  66.,  62.,  55.,  46.,  37.,  28.,  20.,  13.,   7.,   4., 3.],\n",
+    "    [ 66.,  66.,  62.,  54.,  44.,  34.,  24.,  16.,  10.,   6.,   4., 3.],\n",
+    "    [ 66.,  66.,  64.,  57.,  49.,  39.,  30.,  22.,  14.,   8.,   4., 4.],\n",
+    "    [ 65.,  66.,  67.,  66.,  60.,  49.,  38.,  28.,  18.,  11.,   8., 7.],\n",
+    "    [ 64.,  65.,  68.,  69.,  63.,  51.,  39.,  27.,  19.,  14.,  11., 11.],\n",
+    "    [ 62.,  64.,  68.,  71.,  69.,  59.,  46.,  35.,  26.,  20.,  17., 17.],\n",
+    "    [ 60.,  62.,  66.,  72.,  74.,  69.,  60.,  48.,  38.,  30.,  26., 25.],\n",
+    "    [ 57.,  59.,  65.,  73.,  79.,  78.,  71.,  61.,  51.,  43.,  38., 37.],\n",
+    "    [ 53.,  55.,  62.,  71.,  81.,  90.,  90.,  80.,  68.,  58.,  51., 49.],\n",
+    "    [ 43.,  47.,  57.,  72.,  92., 116., 124., 102.,  79.,  63.,  52., 49.]   \n",
+    "]\n",
+    "\n",
+    "# data2 = [ \n",
+    "#     [ 0.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.],\n",
+    "#     [ 1.,  1.,  2.,  2.,  2.,  2.,  3.,  3.,  4.,  4.,  5.,  5.],\n",
+    "#     [ 3.,  3.,  3.,  3.,  4.,  4.,  5.,  5.,  6.,  6.,  7.,  8.],\n",
+    "#     [ 8.,  8.,  8.,  9.,  9.,  9., 10., 10., 11., 12., 13., 14.],\n",
+    "#     [14., 14., 14., 14., 15., 15., 16., 17., 18., 19., 20., 20.],\n",
+    "#     [24., 24., 24., 24., 24., 25., 25., 26., 27., 28., 30., 32.],\n",
+    "#     [27., 27., 27., 27., 27., 28., 28., 29., 30., 32., 33., 35.],\n",
+    "#     [30., 30., 30., 30., 30., 31., 32., 32., 33., 35., 36., 37.],\n",
+    "#     [33., 33., 33., 33., 33., 34., 35., 36., 37., 38., 39., 40.],\n",
+    "#     [36., 36., 36., 36., 37., 37., 38., 39., 40., 41., 41., 42.],\n",
+    "#     [42., 42., 43., 43., 44., 44., 44., 44., 43., 42., 40., 39.],\n",
+    "#     [46., 46., 46., 47., 47., 47., 46., 44., 41., 38., 35., 32.],\n",
+    "#     [51., 51., 52., 53., 53., 51., 47., 40., 33., 27., 23., 21.],\n",
+    "#     [52., 52., 53., 54., 55., 53., 48., 40., 32., 26., 21., 20.],\n",
+    "#     [51., 52., 54., 55., 56., 54., 48., 40., 32., 25., 21., 19.],\n",
+    "#     [49., 51., 54., 57., 58., 56., 50., 40., 32., 25., 20., 19.],\n",
+    "#     [33., 39., 47., 55., 61., 60., 52., 40., 29., 21., 16., 14.]\n",
+    "# ] \n",
+    "\n",
+    "# Apply the Gaussian filter\n",
+    "sigma = [1.5, 2]\n",
+    "data_smooth = scipy.ndimage.gaussian_filter(data, sigma)\n",
+    "\n",
+    "# Mirror the data along the y-axis\n",
+    "data_smooth_symmetric = np.concatenate((np.fliplr(data_smooth), data_smooth), axis=1)\n",
+    "\n",
+    "# Define custom color scale\n",
+    "colorscale = [[0, 'orange'],  [1, 'yellow']]\n",
+    "\n",
+    "fig = go.Figure()\n",
+    "\n",
+    "# Generate x and y indices\n",
+    "x = np.linspace(-1, 1, data_smooth_symmetric.shape[1])\n",
+    "y = np.linspace(0, 1, data_smooth_symmetric.shape[0])\n",
+    "\n",
+    "# Add surface trace without contours, using the symmetric data\n",
+    "fig.add_trace(go.Surface(x=x, y=y, z=data_smooth_symmetric, colorscale=colorscale, showscale=True))\n",
+    "\n",
+    "# Add lines that correspond to constant y values\n",
+    "for i in range(data_smooth_symmetric.shape[0]):\n",
+    "    fig.add_trace(go.Scatter3d(x=x, y=np.full_like(x, y[i]), z=data_smooth_symmetric[i, :], mode='lines', \n",
+    "                               line=dict(color='black', width=5), showlegend=False))\n",
+    "\n",
+    "# Add thick blue line at x=0\n",
+    "fig.add_trace(go.Scatter3d(x=np.full_like(y, 0), y=y, z=data_smooth_symmetric[:, data_smooth.shape[1]], mode='lines', \n",
+    "                           line=dict(color='blue', width=15), showlegend=False))\n",
+    "\n",
+    "# Add thick red lines at x=first and x=last\n",
+    "fig.add_trace(go.Scatter3d(x=np.full_like(y, -1), y=y, z=data_smooth_symmetric[:, 0], mode='lines', \n",
+    "                           line=dict(color='red', width=10), showlegend=False))\n",
+    "fig.add_trace(go.Scatter3d(x=np.full_like(y, 1), y=y, z=data_smooth_symmetric[:, -1], mode='lines', \n",
+    "                           line=dict(color='red', width=10), showlegend=False))\n",
+    "\n",
+    "# Adjust position of camera\n",
+    "camera_params = dict(up=dict(x=1.25,y=0,z=1), center=dict(x=0,y=0,z=0), eye=dict(x=2.25,y=-2.25,z=1.75))\n",
+    "\n",
+    "fig.update_layout(scene_camera=camera_params)\n",
+    "\n",
+    "fig.update_layout(title='3D PES', autosize=True,\n",
+    "    scene = dict(xaxis = dict(title='Geometry Interpolation between Paths', title_font_family=\"Arial\", title_font_color='black'), \n",
+    "                 yaxis = dict(title='Reaction Progress / a.u.', title_font_family=\"Arial\", title_font_color='black'),\n",
+    "                 zaxis = dict(title='Relative Energy / kcal  mol', title_font_family=\"Arial\", title_font_color='black'),),\n",
+    "                 width=1000, height=1000, margin=dict(l=65, r=100, b=65, t=90))\n",
+    "\n",
+    "fig.show()"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "e8b23fb9-adba-416b-b21a-7cb4c3e3647a",
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "Python 3 (ipykernel)",
+   "language": "python",
+   "name": "python3"
+  },
+  "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.10.8"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
-- 
GitLab