.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_pcd.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_pcd.py: Create and visualize a molecular point cloud ============================================ .. GENERATED FROM PYTHON SOURCE LINES 5-12 .. code-block:: Python from plotly.io import show from aidsorb.utils import pcd_from_file from aidsorb.visualize import draw_pcd # sphinx_gallery_thumbnail_number = 2 .. GENERATED FROM PYTHON SOURCE LINES 13-15 Create the point cloud ---------------------- .. GENERATED FROM PYTHON SOURCE LINES 17-24 .. code-block:: Python # We add electronegativity as additional feature to atomic number. name, pcd = pcd_from_file('IRMOF-1.xyz', features=['en_pauling']) print(f'The name of the point cloud is: {name}') print(f'The point cloud has shape: {pcd.shape}') .. rst-class:: sphx-glr-script-out .. code-block:: none The name of the point cloud is: IRMOF-1 The point cloud has shape: (424, 5) .. GENERATED FROM PYTHON SOURCE LINES 25-27 Visualize it ------------ .. GENERATED FROM PYTHON SOURCE LINES 27-32 .. code-block:: Python fig = draw_pcd(pcd, scheme='jmol') fig.update_layout(margin=dict(b=0, t=0, l=0, r=0)) # Optional. show(fig) .. raw:: html :file: images/sphx_glr_plot_pcd_001.html .. GENERATED FROM PYTHON SOURCE LINES 33-40 .. tip:: You can also use the CLI: .. code-block:: console $ aidsorb visualize path/to/structure .. GENERATED FROM PYTHON SOURCE LINES 42-47 .. code-block:: Python # Color it by electronegativity. fig = draw_pcd(pcd, feature_to_color=(4, 'Electronegativity'), colorscale='viridis') fig.update_layout(margin=dict(b=0, t=0, l=0, r=0)) # Optional. show(fig) .. raw:: html :file: images/sphx_glr_plot_pcd_002.html .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 10.438 seconds) .. _sphx_glr_download_auto_examples_plot_pcd.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_pcd.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_pcd.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_pcd.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_