{ "cells": [ { "cell_type": "markdown", "id": "a0000001", "metadata": {}, "source": [ "# ChemView\n", "\n", "``ChemView`` is a wrapper around [Chemiscope](https://chemiscope.org/) for visualising\n", "ASE trajectories in Jupyter notebooks. It computes geometric and atomic properties from\n", "``ase.Atoms`` objects and renders them as a linked scatter plot and 3-D structure viewer.\n", "\n", "Clicking a point on the scatter plot loads the corresponding frame. The trajectory\n", "player at the bottom of the viewer animates through all frames." ] }, { "cell_type": "code", "execution_count": 34, "id": "64473a82", "metadata": {}, "outputs": [], "source": [ "from ase.io import read\n", "from sparc.src.utils.chemview import ChemView" ] }, { "cell_type": "markdown", "id": "a0000002", "metadata": {}, "source": [ "### Load a trajectory\n", "\n", "Any ASE-readable format works. Here we load a molecular dynamics trajectory stored\n", "as an ASE ``.traj`` file." ] }, { "cell_type": "code", "execution_count": 35, "id": "1d66f812", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Total frames: 54\n" ] } ], "source": [ "traj = read('../tests/iter_000000/00.dft/AseMD.traj', index=':')\n", "print(f\"Total frames: {len(traj)}\")" ] }, { "cell_type": "markdown", "id": "a0000003", "metadata": {}, "source": [ "### Energy vs. frame\n", "\n", "The simplest usage: plot potential energy as a function of frame index." ] }, { "cell_type": "code", "execution_count": 36, "id": "1eb425d2", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "aeab4908bfe1411991a6a4defebbc98d", "version_major": 2, "version_minor": 0 }, "text/html": [ "" ], "text/plain": [ "" ], "text/plain": [ "" ], "text/plain": [ "" ], "text/plain": [ "" ], "text/plain": [ "" ], "text/plain": [ "" ], "text/plain": [ "