-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpot2xyz.py
More file actions
executable file
·50 lines (46 loc) · 1.14 KB
/
pot2xyz.py
File metadata and controls
executable file
·50 lines (46 loc) · 1.14 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python
# Arnfinn Hykkerud Steindal, Tromso Dec 2010
# Converts a dalton pot-file to a xyz-file
import re
import sys
import shutil
import string
import os
def au2ang(num):
return float(num)/1.889725989
atmnr = ['1','6','7','8','16']
atmnm = ['H','C','N','O','S']
for arg in sys.argv[1:]:
cntr = 0
inpxyz = ''
pot = open(arg+'.pot','r')
lines = pot.readlines()
pot.close()
words = lines[0].split()
if words[0] == 'AU':
au = True
else:
au = False
words = lines[1].split()
a = int(words[3])
b = int(words[0])
xyz = open(arg+'.xyz','w')
xyz.write(str(b)+'\n\n')
tall = 0
for i in lines[2:]:
tall = tall + 1
words = i.split()
d = 5
if au:
x = str(au2ang(words[a+1]))
y = str(au2ang(words[a+2]))
z = str(au2ang(words[a+3]))
else:
x = words[a+1]
y = words[a+2]
z = words[a+3]
for j in range(len(atmnr)):
if words[a] == atmnr[j]:
first = atmnm[j]
xyz.write(first+str(tall) + d*' '+x+d*' '+y+d*' '+z+'\n')
xyz.close()