File: render_all_povray_styles.py

package info (click to toggle)
python-ase 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,448 kB
  • sloc: python: 144,945; xml: 2,728; makefile: 113; javascript: 47
file content (33 lines) | stat: -rw-r--r-- 853 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from ase import io
from ase.io.pov import POVRAY
from ase.utils.ptable import ptable

run_povray = True

atoms = ptable(spacing=3)

######
atoms.write('ptable.true_colors.png')
io.write('ptable.xyz', atoms)
#########
styles = list(POVRAY.material_styles_dict)

for style in styles:
    pov_name = f'ptable.{style}.pov'
    ini_name = pov_name.replace('pov', 'ini')

    kwargs = {  # For povray files only
        'textures': len(atoms) * [style],
        'transparent': True,  # Transparent background
        'canvas_width': 1000,  # Width of canvas in pixels
        'camera_type': 'orthographic angle 65',
    }

    generic_projection_settings = {}

    pov_object = io.write(pov_name, atoms,
                          **generic_projection_settings,
                          povray_settings=kwargs)

    if run_povray:
        pov_object.render()