File: writepngs.py

package info (click to toggle)
python-ase 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 15,448 kB
  • sloc: python: 144,945; xml: 2,728; makefile: 113; javascript: 47
file content (17 lines) | stat: -rw-r--r-- 422 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from ase import io

t = io.read('mytrajectory.traj')

for i, s in enumerate(t):
    # rotate to the desired direction
    s.rotate('z', 'x', rotate_cell=True)

    # repeat with keeping old cell
    cell = s.get_cell()
    s = s.repeat((1, 3, 3))
    s.set_cell(cell)

    ofname = str(i) + '.png'
    print('writing', ofname)
    io.write(ofname, s,
             bbox=[-3, -5, 50, 22])  # set bbox by hand, try and error