Skip to content

Commit

Permalink
Clean up notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
charnley committed Jan 4, 2025
1 parent 3da31a3 commit 95e816b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 719 deletions.
2 changes: 1 addition & 1 deletion notebooks/coord_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ def rotate_coord(angle, coord, axis=[0, 1]):
U = get_rotation_matrix(angle)
_xy = np.dot(coord[:, axis], U)
_coord = np.array(coord, copy=True)
_coord[:, :2] = _xy
_coord[:, axis] = _xy
return _coord
72 changes: 28 additions & 44 deletions notebooks/figures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@
"import rmsd as rmsdlib"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d24b792-ea7d-4611-ab3c-b64a1177815b",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -138,7 +130,7 @@
"id": "3cf67d24-ad0a-4130-a3cd-d3f8d79e59cd",
"metadata": {},
"source": [
"# What"
"# Explain problem"
]
},
{
Expand Down Expand Up @@ -209,81 +201,73 @@
},
{
"cell_type": "markdown",
"id": "4630b581-9f43-4f0d-9fd7-bb8912f659b1",
"id": "faa92f45-9f5f-4f4e-9021-dd3e1c9d271a",
"metadata": {},
"source": [
"# QML"
"# Reorder problem"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fb946f75-651f-4f68-a99c-a4c88979b991",
"id": "9d6ce450-e2f3-42ca-9904-bcfe6873d92d",
"metadata": {},
"outputs": [],
"source": [
"def qml_illustration():\n",
"def reorder():\n",
"\n",
" coord = [\n",
" coord1 = [\n",
" [0,0,0],\n",
" [1,1,0],\n",
" [2,0,0],\n",
" ]\n",
" coord = np.array(coord, dtype=float)\n",
" atoms = [6, 6, 6]\n",
" coord1 = np.array(coord1, dtype=float) / 1.2\n",
" coord1 -= rmsdlib.centroid(coord1)\n",
" coord2 = np.array(coord1, copy=True)\n",
" atoms1 = [6, 6, 6]\n",
"\n",
" coord -= rmsdlib.get_cm(atoms, coord)\n",
" coord2 /= 1.5\n",
" coord2 -= rmsdlib.centroid(coord1)\n",
" coord2[:,1] -= 0.5\n",
" coord1[:,1] += 0.2\n",
" \n",
" fig, ax = plot_funcs.get_plot()\n",
" plot_funcs.set_axis_default(ax)\n",
" plot_funcs.plot_molecule(ax, [\"\"]*3, coord)\n",
" plot_funcs.plot_representation(ax, atoms, coord)\n",
" plot_funcs.plot_molecule(ax, [\"1\", \"2\", \"3\"], coord1)\n",
" plot_funcs.plot_molecule(ax, [\"2\", \"3\", \"1\"], coord2, hatch=\"\\\\\\\\\\\\\")\n",
"\n",
" save_figure(fig, \"fig_reorder_qml\")\n",
" save_figure(fig, \"fig_reorder_problem\")\n",
"\n",
"qml_illustration()"
]
},
{
"cell_type": "markdown",
"id": "faa92f45-9f5f-4f4e-9021-dd3e1c9d271a",
"metadata": {},
"source": [
"# Reorder problem"
"reorder()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9d6ce450-e2f3-42ca-9904-bcfe6873d92d",
"id": "fb946f75-651f-4f68-a99c-a4c88979b991",
"metadata": {},
"outputs": [],
"source": [
"def reorder():\n",
"def qml_illustration():\n",
"\n",
" coord1 = [\n",
" coord = [\n",
" [0,0,0],\n",
" [1,1,0],\n",
" [2,0,0],\n",
" ]\n",
" coord1 = np.array(coord1, dtype=float) / 1.2\n",
" coord1 -= rmsdlib.centroid(coord1)\n",
" coord2 = np.array(coord1, copy=True)\n",
" atoms1 = [6, 6, 6]\n",
" coord = np.array(coord, dtype=float)\n",
" atoms = [6, 6, 6]\n",
"\n",
" coord2 /= 1.5\n",
" coord2 -= rmsdlib.centroid(coord1)\n",
" coord2[:,1] -= 0.5\n",
" coord1[:,1] += 0.2\n",
" coord -= rmsdlib.get_cm(atoms, coord)\n",
" \n",
" fig, ax = plot_funcs.get_plot()\n",
" plot_funcs.set_axis_default(ax)\n",
" plot_funcs.plot_molecule(ax, [\"1\", \"2\", \"3\"], coord1)\n",
" plot_funcs.plot_molecule(ax, [\"2\", \"3\", \"1\"], coord2, hatch=\"\\\\\\\\\\\\\")\n",
" plot_funcs.plot_molecule(ax, [\"\"]*3, coord)\n",
" plot_funcs.plot_representation(ax, atoms, coord)\n",
"\n",
" save_figure(fig, \"fig_reorder_problem\")\n",
" save_figure(fig, \"fig_reorder_qml\")\n",
"\n",
"reorder()"
"qml_illustration()"
]
},
{
Expand Down
Loading

0 comments on commit 95e816b

Please sign in to comment.