-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcentural_sym.py
More file actions
executable file
·30 lines (25 loc) · 873 Bytes
/
centural_sym.py
File metadata and controls
executable file
·30 lines (25 loc) · 873 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
#!/usr/bin/python
import sys
if(len(sys.argv)!=5):
print("centural_sym.py [.xyz] [around_x] [around_y] [around_z]");
exit()
xyz_file = open(sys.argv[1],"r");
xyz_file_lines = xyz_file.readlines();
atom_count = int(xyz_file_lines[0].split()[0])
atom_types=[]
atom_xyzs=[]
for i in range(0,atom_count):
words = xyz_file_lines[i+2].split();
atom_types.append(words[0]);
atom_xyzs.append([ float(words[1]), float(words[2]), float(words[3]) ])
origin = [ float(sys.argv[2]),float(sys.argv[3]),float(sys.argv[4])]
for i in range(0,atom_count):
for j in range(0,3):
atom_xyzs[i][j] = 2*origin[j] - atom_xyzs[i][j]
print(atom_count)
print("Prepared by centural_sym.py")
for i in range(0,atom_count):
sys.stdout.write(atom_types[i]);
for j in range(0,3):
sys.stdout.write(" "+str(atom_xyzs[i][j]));
sys.stdout.write("\n")