-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprint-cell-params.py
More file actions
executable file
·33 lines (25 loc) · 927 Bytes
/
print-cell-params.py
File metadata and controls
executable file
·33 lines (25 loc) · 927 Bytes
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
#!/usr/bin/env python3
#
# Script to print cell parameters from an ase trajectory
# by Patrick Melix
# 2022/10/27
#
from ase import io
import os
def main(inFile):
if not os.path.isfile(inFile):
raise ValueError('File {:} does not exist'.format(str(inFile)))
traj = io.read(inFile, index=slice(0, None))
assert isinstance(traj, list), "Given file does not contain a trajectory!"
print("Length of Trajectory: {} Frames".format(len(traj)))
print(("{:10}"*6).format("A", "B", "C", "alpha", "beta", "gamma"))
for frame in traj:
cell = [x for x in frame.cell.cellpar()]
print(("{:10f}"*6).format(*cell))
return
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Print Vell Information from ASE Compatible Input')
parser.add_argument('input', type=str, help='input file')
args = parser.parse_args()
main(args.input)