File: writepngs.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (18 lines) | stat: -rw-r--r-- 423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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