Skip to content

Commit

Permalink
Merge branch 'main' into feature/integrate-with-structuremanager-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Mar 4, 2024
2 parents 24ff530 + 43d39f7 commit 0f90bc3
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 36 deletions.
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx_rtd_theme==1.2.2
nbsphinx==0.9.2
sphinx_rtd_theme==2.0.0
nbsphinx==0.9.3
ipython
ase
18 changes: 18 additions & 0 deletions docs/source/camera.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
===================
Camera
===================

Setting
=============

One can set the direction and zoom of the camera:

.. code-block:: python
viewer.cameraSetting = {"direction": [0, 5, 1], "zoom": 2}
Camera Type
=============

For the moment, only orthographic camera is supported.
2 changes: 1 addition & 1 deletion docs/source/color.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Supported style are:


Color by attribute
----------------
----------------------
Coloring based on the attribute of the atoms. The attribute can be: charge, magmom, or any other attribute in the structure.

Here we show how to color the atoms by their forces.
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ A widget to visualize and interact with atomistic structures in Jupyter Notebook
mesh_primitive
search_operator
selection
camera
gallery


Expand Down
50 changes: 18 additions & 32 deletions docs/source/quick_start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "36503e95",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b7d69dd0dc3a415b8a3be9d6f260b134",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"WeasWidget(atomScales=[1, 1, 1], atoms={'species': {'O': ['O', 8], 'H': ['H', 1]}, 'cell': [10.222218836840568…"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from weas_widget import WeasWidget\n",
"from ase.io.cube import read_cube_data\n",
Expand Down Expand Up @@ -412,36 +428,6 @@
"viewer.download_image(\"filename.png\")"
]
},
{
"cell_type": "markdown",
"id": "be15f588",
"metadata": {},
"source": [
"## Save image\n",
"One can save the image automatically:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f8fbf72",
"metadata": {},
"outputs": [],
"source": [
"# set the camera setting\n",
"from ase.build import molecule\n",
"from weas_widget import WeasWidget\n",
"# home directory\n",
"import os\n",
"home = os.path.expanduser(\"~\")\n",
"viewer = WeasWidget()\n",
"atoms = molecule(\"C2H6SO\")\n",
"viewer.from_ase(atoms)\n",
"viewer.cameraSetting = {\"direction\": [0, 2, 1], \"zoom\": 0.8}\n",
"display(viewer)\n",
"viewer.save_image(home+\"/test.png\")\n"
]
},
{
"cell_type": "markdown",
"id": "b854bffa-3ef6-4dd2-bfc5-73856d7b1076",
Expand Down
1 change: 0 additions & 1 deletion src/weas_widget/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,3 @@ def _save_image():
def _observe_structure(self, change):
if self.structure is not None:
self.from_ase(self.structure)

0 comments on commit 0f90bc3

Please sign in to comment.