diff --git a/plot.ipynb b/plot.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..b3ea52844b12f1ddea35cdd6adc48080c4c21531 --- /dev/null +++ b/plot.ipynb @@ -0,0 +1,95 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "99d587ca-7160-4848-8ee1-858ee39ad93f", + "metadata": {}, + "outputs": [], + "source": [ + "# improt dependecies\n", + "import plotly.graph_objects as go\n", + "import numpy as np\n", + "import scipy.ndimage\n", + "\n", + "# Assuming your data is in an array called \"data\"\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 +}