diff --git a/GoVizzy/GoVizzy.ipynb b/GoVizzy/GoVizzy.ipynb index 5dcd9ec..9346ac3 100644 --- a/GoVizzy/GoVizzy.ipynb +++ b/GoVizzy/GoVizzy.ipynb @@ -25,10 +25,39 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "c31b2aca", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "53607c596d444a7e970ddd843418c366", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "AppLayout(children=(HBox(children=(Output(layout=Layout(height='100%', width='70%')), VBox(children=(HBox(chil…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e07b178719f64af8ba8a442d37d4201e", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Text(value='', description='File Name:'), Button(description='Submit', style=ButtonStyle())), l…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "%run Main.py\n" ] @@ -37,18 +66,11 @@ "cell_type": "code", "execution_count": null, "id": "c75f164c-2d9f-44b9-8875-82d7f34a7d4e", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], - "source": [ - "from gv_ui import meshes\n", - "import cube_viskit as cv\n", - "\n", - "new_cube = cv.Cube()\n", - "new_cube.load_cube(\"data/rhopol.cube\")\n", - "new_cube.get_bonds()\n", - "\n", - "meshes.plot_bonds(new_cube)" - ] + "source": [] } ], "metadata": { diff --git a/GoVizzy/gv_ui/gv_ui/DisplayUI.py b/GoVizzy/gv_ui/gv_ui/DisplayUI.py index b38deef..9b0d329 100644 --- a/GoVizzy/gv_ui/gv_ui/DisplayUI.py +++ b/GoVizzy/gv_ui/gv_ui/DisplayUI.py @@ -70,6 +70,7 @@ def display_cube(cube): elif selected_option == 'Mesh Options': visualizer.display_cell() atom_meshes = meshes.plot_atoms(cube) + meshes.plot_bonds(cube) # Additional View elif selected_option == 'Color Options': diff --git a/GoVizzy/gv_ui/gv_ui/meshes.py b/GoVizzy/gv_ui/gv_ui/meshes.py index a2c167c..25b9f11 100644 --- a/GoVizzy/gv_ui/gv_ui/meshes.py +++ b/GoVizzy/gv_ui/gv_ui/meshes.py @@ -94,8 +94,21 @@ def plot_bonds(cube: Cube): Plots the bonds between atoms in the current Cube object, using the list of atom pairs, and the positions of the atoms in the graph. ''' + cube.get_bonds() + num_pts = 1000 for bond in cube.bonds: - print("Atoms: ",bond," Real Pos: ", ) - for atom in bond: - print(cube.atoms.get_scaled_positions()[atom]) + atomPos1 = cube.atoms.get_scaled_positions()[bond[0]] + x1, y1, z1 = tuple(p * cube.data3D.shape[idx] / Bohr for idx, p in enumerate(atomPos1)) + atomPos2 = cube.atoms.get_scaled_positions()[bond[1]] + x2, y2, z2 = tuple(p * cube.data3D.shape[idx] / Bohr for idx, p in enumerate(atomPos2)) + + # y = x1 -> x2 + # y = y1 -> y2 + # z = z1 -> z2 + X = np.linspace(x1, x2, num_pts) + Y = np.linspace(y1, y2, num_pts) + Z = np.linspace(z1, z2, num_pts) + p = ipv.plot(X, Y, Z) + p.material.visible = True + p.size = 3. \ No newline at end of file