====== traj2xyz ======
#!/usr/bin/env python
import os
import tempfile
from optparse import OptionParser
from ase.io.trajectory import PickleTrajectory
from ase.io import write
cmd = OptionParser(usage = '%prog input_traj_file output_xyz_file')
(opt, argv) = cmd.parse_args()
if len(argv) != 2:
cmd.print_help()
raise SystemExit
trajfile = argv[0]
xyzfile = argv[1]
traj1 = PickleTrajectory(trajfile)
atoms1 = []
for it in traj1:
atoms1.append(it)
write(xyzfile, images = atoms1, format = 'xyz', comment = trajfile)
===== Usage =====
$ traj2xyz
usage: input_traj_file output_xyz_file
$