{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interoperability With Visualization Software\n", "PyBigDFT can be used in combination with various kinds of visualization software. Here we present some basic examples of this functionality." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## py3Dmol\n", "[py3Dmol](https://pypi.org/project/py3Dmol/) is a convenient way to visualize molecules inside a notebook. First, let's define the system to look at." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from io import StringIO\n", "input_file = StringIO(\"\"\"ATOM 1 N GLU A 1 -1.154 2.418 1.060 1.00 0.00 N \n", "ATOM 2 CA GLU A 1 -0.291 1.391 1.511 1.00 0.00 C \n", "ATOM 3 C GLU A 1 0.988 1.375 0.674 1.00 0.00 C \n", "ATOM 4 O GLU A 1 2.084 1.489 1.199 1.00 0.00 O \n", "ATOM 5 H1 GLU A 1 -0.808 3.356 0.900 1.00 0.00 H \n", "ATOM 6 HB1 ALA A 2 2.228 0.884 -3.807 1.00 0.00 H \n", "ATOM 7 H2 GLU A 1 -2.131 2.117 0.916 1.00 0.00 H \n", "ATOM 8 HA GLU A 1 -0.012 1.610 2.555 1.00 0.00 H \n", "ATOM 9 CB GLU A 1 -1.012 0.017 1.443 1.00 0.00 C \n", "ATOM 10 CG GLU A 1 -1.458 -0.331 -0.002 1.00 0.00 C \n", "ATOM 11 HB1 GLU A 1 -1.897 0.046 2.100 1.00 0.00 H \n", "ATOM 12 HB2 GLU A 1 -0.338 -0.772 1.815 1.00 0.00 H \n", "ATOM 13 HG1 GLU A 1 -0.583 -0.365 -0.671 1.00 0.00 H \n", "ATOM 14 HG2 GLU A 1 -2.152 0.435 -0.382 1.00 0.00 H \n", "ATOM 15 CD GLU A 1 -2.156 -1.666 -0.029 1.00 0.00 C \n", "ATOM 16 OE1 GLU A 1 -1.704 -2.633 -0.619 1.00 0.00 O \n", "ATOM 17 OE2 GLU A 1 -3.307 -1.738 0.635 1.00 0.00 O \n", "ATOM 18 HE2 GLU A 1 -3.662 -2.616 0.558 1.00 0.00 H \n", "ATOM 19 N ALA A 2 0.783 1.228 -0.622 1.00 0.00 N \n", "ATOM 20 CA ALA A 2 1.867 1.202 -1.533 1.00 0.00 C \n", "ATOM 21 C ALA A 2 2.816 2.367 -1.249 1.00 0.00 C \n", "ATOM 22 O ALA A 2 3.998 2.171 -1.016 1.00 0.00 O \n", "ATOM 23 HB2 ALA A 2 0.925 1.765 -3.471 1.00 0.00 H \n", "ATOM 24 H ALA A 2 2.340 3.354 -1.287 1.00 0.00 H \n", "ATOM 25 H ALA A 2 -0.144 1.131 -1.066 1.00 0.00 H \n", "ATOM 26 HA ALA A 2 2.442 0.301 -1.259 1.00 0.00 H \n", "ATOM 27 CB ALA A 2 1.459 0.968 -3.161 1.00 0.00 C \n", "ATOM 28 HB3 ALA A 2 0.877 0.168 -3.356 1.00 0.00 H\"\"\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from BigDFT.IO import read_pdb\n", "sys = read_pdb(input_file)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To use py3D mol first define an a visualization object, and then call display_system." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol
You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n",
" jupyter labextension install jupyterlab_3dmol