{ "cells": [ { "cell_type": "markdown", "id": "09c77d8b", "metadata": {}, "source": [ "# Volume Slice\n", "The volume slice is a 2D cross-sectional visualization of 3D volumetric data. It is an effective method for analyzing volumetric properties, such as molecular orbitals or charge densities, by slicing through the data at specified orientations and distances.\n", "\n", "## Usage Example\n", "Here is an example of drawing volume slices for the HOMO of the H2O molecule.\n" ] }, { "cell_type": "code", "execution_count": null, "id": "0a2a6308", "metadata": {}, "outputs": [], "source": [ "from weas_widget import WeasWidget\n", "from ase.io.cube import read_cube_data\n", "\n", "volume, atoms = read_cube_data(\"../../examples/h2o-homo.cube\")\n", "viewer = WeasWidget()\n", "viewer.from_ase(atoms)\n", "viewer.avr.model_style = 1\n", "viewer.avr.volume_slice.volumetric_data = {\"values\": volume}\n", "viewer.avr.volume_slice.settings = {\n", " \"Slice 1\": {\"h\": 0, \"k\": 1, \"l\": 0, \"distance\": 5.5, \"samplingDistance\": 0.1},\n", " \"Slice 2\": {\"h\": 1, \"k\": 1, \"l\": 0, \"distance\": 5.5, \"samplingDistance\": 0.1},\n", "}\n", "viewer.camera.setting = {\"direction\": [0.5, 1, 2], \"zoom\": 1.5}\n", "viewer" ] }, { "cell_type": "markdown", "id": "3f2101c3", "metadata": {}, "source": [ "For the ``settings``:\n", "\n", "- **h, k, l**: Miller indices defining the orientation of the slice.\n", "- **distance**: The distance of the slice from the origin, in Ã…ngstroms.\n", "- **samplingDistance**: The sampling distance for rendering the slice, affecting resolution.\n", "\n", ".. tip::\n", " Support for multiple slices with individual settings, allowing analysis from different orientations and depths.\n" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }