{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Dissociation of oxygen on Pt(100)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n\nfrom ase.build import add_adsorbate, fcc100\nfrom ase.io import write\n\n# the metal slab\natoms = fcc100('Pt', size=[4, 10, 3], vacuum=10)\ntransmittances = [0 for a in atoms]\nbonded_atoms = []\n\nupper_layer_idx = [a.index for a in atoms if a.tag == 1]\nmiddle = atoms.positions[upper_layer_idx, :2].max(axis=0) / 2\n\n# the dissociating oxygen... fake some dissociation curve\ngas_dist = 1.1\nmax_height = 8.0\nmin_height = 1.0\nmax_dist = 6\n\n# running index for the bonds\nindex = len(atoms)\n\nfor i, x in enumerate(np.linspace(0, 1.5, 6)):\n height = (max_height - min_height) * np.exp(-2 * x) + min_height\n d = np.exp(1.5 * x) / np.exp(1.5**2) * max_dist + gas_dist\n pos = middle + [0, d / 2]\n add_adsorbate(atoms, 'O', height=height, position=pos)\n pos = middle - [0, d / 2]\n add_adsorbate(atoms, 'O', height=height, position=pos)\n transmittances += [x / 2] * 2\n\n # we want bonds for the first two molecules\n if i < 2:\n bonded_atoms.append([len(atoms) - 1, len(atoms) - 2])\n\ntextures = ['ase3' for a in atoms]\n\n# add some semi-transparent bath (only in x/y direction for this example)\ncell = atoms.cell\n\nidx = [a.index for a in atoms if a.symbol == 'Pt']\n\nNbulk = len(idx)\nmultiples = [0, 1, -1]\nfor i in multiples:\n for j in multiples:\n if i == j == 0:\n continue\n chunk = atoms[idx]\n chunk.translate(i * cell[0] + j * cell[1])\n atoms += chunk\n transmittances += [0.8] * Nbulk\n textures += ['pale'] * Nbulk\n\nbbox = [-30, 10, 5, 25]\n\nrenderer = write(\n 'o2pt100.pov',\n atoms,\n rotation='90z,-75x',\n bbox=bbox,\n show_unit_cell=0,\n povray_settings=dict(\n pause=False,\n canvas_width=1024,\n bondatoms=bonded_atoms,\n camera_type='perspective',\n transmittances=transmittances,\n textures=textures,\n ),\n)\n\nrenderer.render()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.13.7" } }, "nbformat": 4, "nbformat_minor": 0 }