Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""Inline viewer for jupyter notebook using X3D.""" 

2 

3try: 

4 from StringIO import StringIO 

5except ImportError: 

6 from io import StringIO 

7from IPython.display import HTML 

8 

9 

10def view_x3d(atoms): 

11 """View atoms inline in a jupyter notbook. This command 

12 should only be used within a jupyter/ipython notebook. 

13  

14 Args: 

15 atoms - ase.Atoms, atoms to be rendered""" 

16 

17 output = StringIO() 

18 atoms.write(output, format='html') 

19 data = output.getvalue() 

20 output.close() 

21 return HTML(data)