{ "cells": [ { "cell_type": "markdown", "id": "a6d5bbd9", "metadata": {}, "source": [ "# Isosurface\n", "\n", "The isosurface is a 3D surface that represents points of a constant value within a volume of data. It is a powerful tool to visualize the orbital of a molecule, the charge density of a crystal and other volumetric data.\n", "\n", "\n", "## Usage Example\n", "Here is an example of drawing isosurfaces for HOMO of H2O molecule.\n" ] }, { "cell_type": "code", "execution_count": null, "id": "33de4a4b", "metadata": {}, "outputs": [], "source": [ "from weas_widget import WeasWidget\n", "from ase.io.cube import read_cube_data\n", "volume, atoms = read_cube_data(\"../../examples/h2o-homo.cube\")\n", "viewer = WeasWidget()\n", "viewer.from_ase(atoms)\n", "viewer.avr.iso.volumetric_data = {\"values\": volume}\n", "viewer.avr.iso.settings = {\"positive\": {\"isovalue\": 0.001, \"opacity\": 0.8},\n", " \"negative\": {\"isovalue\": -0.001, \"color\": \"yellow\", \"opacity\": 0.8},}\n", "viewer" ] }, { "cell_type": "markdown", "id": "b41abaf8", "metadata": {}, "source": [ "\n", "For the ``isoSetting``:\n", "\n", "- **isovalue**: The value used to generate the isosurface. If null, it will be computed as the average of the data range.\n", "- **color**: The color of the isosurface.\n", "- **opacity**: The opacity of the isosurface, typically between 0 (transparent) and 1 (opaque).\n", "- **mode**: The mode of isosurface generation.\n", " - mode=0: Positive and negative isosurfaces are drawn. In this case, the color of the positive is the given color, and the color of the negative is the complementary color of the given color\n", " - mode=other: Only the given isosurface is drawn.\n", "\n", "\n", "\n", "Note, the widget supports for multiple isosurfaces with individual properties (isovalue and color).\n" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }