{ "cells": [ { "cell_type": "markdown", "id": "31ff2524", "metadata": {}, "source": [ "# Bond\n", "Use can control the bond using `avr.bond.settings`.\n", "\n", "\n", "Delete bond pair\n", "----------------\n", "\n", "For example, we delete the bond between Ca and Ti, and Ti and Ca.\n", "\n", "```python\n", "# delete the bond between Ca and Ti\n", "del viewer.avr.bond.settings['Ti-Ca']\n", "# change the bond color between Ti and O\n", "viewer.avr.bond.settings['Ti-O'].update({\"color\": \"red\"})\n", "# change the maximum bond length between Ti and O\n", "viewer.avr.bond.settings['Ti-O'][\"max\"] = 3.0\n", "```\n", "\n", "Add bond pair\n", "-------------\n", "\n", "```python\n", "# add the bond between Pt and Au\n", "viewer.avr.bond.add_bond_pair('Pt', 'Au', max=3.2)\n", "```\n", "\n", "Hydrogen bond\n", "-------------\n", "The hydrogen bond can be controlled using `avr.bond.show_hydrogen_bonds`:" ] }, { "cell_type": "code", "execution_count": 2, "id": "e7d6dbf1", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "1e6c0f138cd147e2889210c7b8807303", "version_major": 2, "version_minor": 0 }, "text/plain": [ "WeasWidget(children=(,))" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from weas_widget import WeasWidget\n", "from ase.io import read\n", "atoms = read(\"../../examples/urea.cif\")\n", "viewer1 = WeasWidget()\n", "viewer1.from_ase(atoms)\n", "viewer1.avr.model_style = 1\n", "viewer1.avr.show_hydrogen_bonds = True\n", "viewer1" ] } ], "metadata": { "kernelspec": { "display_name": "aiida", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 5 }