[ase-users] viewing structures in Jupyter notebook

Peterson, Andrew andrew_peterson at brown.edu
Mon Jun 12 18:57:19 CEST 2017


Very nice! Perhaps we want to include this as a helper function within
ase.visualize? E.g., we could define a command jupview as

from tempfile import NamedTemporaryFilefrom IPython.display import HTML
def jupview(atoms):
    """View atoms inline in a jupyter notbook."""
    with NamedTemporaryFile('r+', suffix='.html') as ntf:
        atoms.write(ntf.name, format='html')
        ntf.seek(0)
        html_atoms = ntf.read()
    return HTML(html_atoms)

which would be called just like the regular viewer, but would display
inline in jupyter notebooks. E.g.,

 from ase.build import molecule

atoms = molecule('trans-butane')
jupview(atoms)

Andy
​


On Mon, Jun 12, 2017 at 7:08 AM, Łukasz Mentel via ase-users <
ase-users at listserv.fysik.dtu.dk> wrote:

>
> Hi All,
>
> Recently I wrote a blog post describing a few alternatives for embedding
> interactive structure (ase.Atoms) visualizations in Jupyter notebooks. You
> can find it here: http://lukaszmentel.com/blog/a
> se-jupyter-notebook/index.html. I thought it might be of interest to some
> of you since there was a thread about it on this list not so long ago.
>
> I also created a github repo with the example notebooks where I tested the
> relevant code, https://github.com/lmmentel/ase-jnb.
>
> Cheers,
> Lukasz
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>



-- 
Andrew Peterson
Assistant Professor
Brown University School of Engineering
Barus & Holley 247
184 Hope Street
Providence, RI 02912
(401) 863-2153
http://brown.edu/go/catalyst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170612/6db38dbc/attachment.html>


More information about the ase-users mailing list