forked from MabinogiX/VASP-script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodemake.py
More file actions
29 lines (24 loc) · 735 Bytes
/
modemake.py
File metadata and controls
29 lines (24 loc) · 735 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
#!/bin/env python3
import sys
import re
if len(sys.argv) != 3:
print('')
print("Usage: %s freqfile scale" % sys.argv[0])
print("Please try again!")
print('')
exit(0)
print('')
with open(sys.argv[1]) as input_file:
content = input_file.readlines()
scale = float(sys.argv[2])
with open('MODECAR', 'w') as output_file:
length = len(content)
space = re.compile(r'\s+')
for i in range(2, length):
line = content[i].strip()
if line == "":
break
line = list(map(float, space.split(line)))
output_file.write("%10.5f %10.5f %10.5f\n" % (line[3] * scale, line[4] * scale, line[5] * scale))
print(" --------------------Done--------------------")
print('')