SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


script:traj2xyz

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
$ 
script/traj2xyz.txt · 最終更新: 2022/08/23 13:34 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki