[ase-users] viewing structure in jupyter notebook and vasp calculator

Łukasz Mentel lmmentel at gmail.com
Fri Dec 16 14:47:53 CET 2016


> Perhaps there is a simple in-built solution that gets us most of the 
> way. We currently have the ability to save atoms as html:
>
> |from ase.build import molecule 
> molecule('trans-butane').write('butane.html') |
>
> The output is rotatable, translatable, and zoomable. See here 
> <http://www.brown.edu/Departments/Engineering/Labs/Peterson/images/butane.html> 
> (or here 
> <http://www.brown.edu/Departments/Engineering/Labs/Peterson/tips/BuildAButane/index.html>) 
> for the output, or try it yourself. You can get this to pop up in a 
> new tab from jupyter with a call like |os.system('firefox butane.html')|.
>
> The html output file is in simple X3D format, and some quick googling 
> sounds like there may be ways to get that to display within a jupyter 
> notebook, so it could be straightforward to convert this approach into 
> a simple inline viewer, if we are lucky.
>
>Thanks for sharing that, I didn't know that ASE had this functionality. 
Amongst other formats Jupyter can display html so embedding the 
structure in the notebook would require two more lines:

from  ase.buildimport  molecule
molecule('trans-butane').write('butane.html')

from  IPython.displayimport  HTML

HTML('butane.html')

Lukasz
> On Fri, Dec 16, 2016 at 7:25 AM, James Kermode via ase-users 
> <ase-users at listserv.fysik.dtu.dk 
> <mailto:ase-users at listserv.fysik.dtu.dk>> wrote:
>
>     Hi all
>     There is an ASE interface to chemview in matscipy:
>     https://github.com/libAtoms/matscipy/blob/master/matscipy/visualise.py
>     <https://github.com/libAtoms/matscipy/blob/master/matscipy/visualise.py>
>     If there is sufficient interest this could be merged into ASE.
>     I’ve also had good success using imolecule in Jupyter notebooks.
>     James
>>     On 16 Dec 2016, at 11:47, Łukasz Mentel via ase-users
>>     <ase-users at listserv.fysik.dtu.dk
>>     <mailto:ase-users at listserv.fysik.dtu.dk>> wrote:
>>     Hi, For interactive visualizations you could try one of: -
>>     imolecule: http://futurefullers.com/imolecule/
>>     <http://futurefullers.com/imolecule/> - chemview:
>>     http://chemview.readthedocs.io/en/latest/
>>     <http://chemview.readthedocs.io/en/latest/> There are examples on
>>     how to embed those in the jupyter notebook, but there is no
>>     direct interface to ASE so you would have to convert the POSCAR
>>     into one of the more popular formats like cif or xyz and feed it
>>     to the viewer. Cheers, Lukasz On 16.12.2016 12:38, Adam Jackson
>>     via ase-users wrote:
>>>
>>>         Hi everyone, I need help regarding some issues. I thought it
>>>         would be best to put them in one email rather than sending a
>>>         bunch. 1. For ase related coding I use jupyter notebook a
>>>         lot. For that I would like to view my structures in the
>>>         browser. Is there any interactive plotting library that
>>>         works well with ase? I don't need anything fancy, just need
>>>         to make sure that my structure is looking right I tried a
>>>         few but they need a lot modification. Also the ase view
>>>         gives me the following error: FileNotFoundError: [WinError
>>>         2] The system cannot find the file specified I am using
>>>         conda3 in windows 10.
>>>
>>>     Hi Protik, the method I usually use is to generate a PNG file
>>>     with something like
>>>
>>>         import ase.io <http://ase.io> atoms = ase.io.read('POSCAR')
>>>         atoms.write('poscar.png', show_unit_cell=True, radii=0.5) 
>>>
>>>     and then follow that code cell with a Markdown cell displaying
>>>     the generated file
>>>
>>>         ![](poscar.png) 
>>>
>>>     The only catch I find with this approach is that the image will
>>>     not automatically refresh when the file is changed; to update
>>>     the image I need to save the Jupyter notebook and refresh the
>>>     browser window. I would not be surprised if a more elegant
>>>     approach exists, but this works for me! (A similar approach is
>>>     useful for org-babel documents in Emacs.) All the best, Adam
>>>     Dr Adam J. Jackson Post-doctoral research associate Dept of
>>>     Chemistry University College London
>>>
>>>     _______________________________________________
>>>     ase-users mailing list
>>>     ase-users at listserv.fysik.dtu.dk
>>>     <mailto:ase-users at listserv.fysik.dtu.dk>
>>>     https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>>>     <https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users>
>>
>>     _______________________________________________ ase-users mailing
>>     list ase-users at listserv.fysik.dtu.dk
>>     <mailto:ase-users at listserv.fysik.dtu.dk>
>>     https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>>     <https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users>
>     _______________________________________________ ase-users mailing
>     list ase-users at listserv.fysik.dtu.dk
>     <mailto:ase-users at listserv.fysik.dtu.dk>
>     https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>     <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 <tel:%28401%29%20863-2153> http://brown.edu/go/catalyst

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20161216/1de8adad/attachment-0001.html>


More information about the ase-users mailing list