.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_generated/04-gallery/render_povray.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_generated_04-gallery_render_povray.py: .. _gallery_render_povray: Rendering structure with povray =============================== .. GENERATED FROM PYTHON SOURCE LINES 7-14 .. code-block:: Python import numpy as np from ase import Atoms from ase.io import write from ase.utils import hsv .. GENERATED FROM PYTHON SOURCE LINES 15-76 .. code-block:: Python atoms = Atoms('Ag', cell=(2.7, 2.7, 2.7), pbc=True) * (18, 8, 8) rotation = '-70x, -20y, -2z' # found using ASE-GUI menu 'view -> rotate' # Make colors colors = hsv(atoms.positions[:, 0]) # Textures tex = ['jmol'] * 288 + ['glass'] * 288 + ['ase3'] * 288 + ['vmd'] * 288 # Keywords that exist for eps, png, and povs generic_projection_settings = { 'rotation': rotation, 'colors': colors, 'radii': None, } povray_settings = { # For povray files only 'display': False, # Display while rendering 'pause': False, # Pause when done rendering (only if display) 'transparent': False, # Transparent background 'canvas_width': None, # Width of canvas in pixels 'canvas_height': None, # Height of canvas in pixels 'camera_dist': 50.0, # Distance from camera to front atom 'image_plane': None, # Distance from front atom to image plane # (focal depth for perspective) 'camera_type': 'perspective', # perspective, ultra_wide_angle 'point_lights': [], # [[loc1, color1], [loc2, color2],...] 'area_light': [ (2.0, 3.0, 40.0), # location 'White', # color 0.7, 0.7, 3, 3, ], # width, height, Nlamps_x, Nlamps_y 'background': 'White', # color 'textures': tex, # Length of atoms list of texture names 'celllinewidth': 0.05, # Radius of the cylinders representing the cell } # Make flat png file # write('flat.png', atoms, **kwargs) # Make the color of the glass beads semi-transparent colors2 = np.zeros((1152, 4)) colors2[:, :3] = colors colors2[288:576, 3] = 0.95 generic_projection_settings['colors'] = colors2 # Make the raytraced image # first write the configuration files, then call the external povray executable renderer = write( 'nice.pov', atoms, **generic_projection_settings, povray_settings=povray_settings, ) renderer.render() .. image-sg:: /examples_generated/04-gallery/images/sphx_glr_render_povray_001.png :alt: render povray :srcset: /examples_generated/04-gallery/images/sphx_glr_render_povray_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none PosixPath('/builds/ase/ase-deploy/examples/tutorials/04-gallery/nice.png') .. _sphx_glr_download_examples_generated_04-gallery_render_povray.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: render_povray.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: render_povray.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: render_povray.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_