{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Viewing ase structure using HTML" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from ase.build import molecule\n", "from IPython.display import HTML" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def atoms_to_html(atoms):\n", " 'Return the html representation the atoms object as string'\n", "\n", " from tempfile import NamedTemporaryFile\n", " \n", " with NamedTemporaryFile('r+', suffix='.html') as ntf:\n", " atoms.write(ntf.name, format='html')\n", " ntf.seek(0)\n", " html = ntf.read()\n", " return html" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "Software | Version |
---|---|
Python | 3.6.1 64bit [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] |
IPython | 6.0.0 |
OS | Linux 3.16.0 4 amd64 x86_64 with debian 8.8 |
ase | 3.13.0 |
jupyter | 1.0.0 |
Sun May 28 22:10:46 2017 CEST |