Skip to content

Commit b7f510c

Browse files
committed
更新
1 parent 7722ceb commit b7f510c

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

all2unix.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import re
2+
import sys
3+
4+
separator = re. compile(r'\r\n')
5+
6+
for i in xrange(1, len(sys.argv)):
7+
content = ''
8+
with open(sys.argv[i]) as IN:
9+
content = IN.readlines()
10+
for j in xrange(0, len(content)):
11+
content[j] = content[j].rstrip()
12+
with open(sys.argv[i], 'w') as OUT:
13+
for line in content:
14+
OUT.write(line + '\n')
15+

hlcluster.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,24 @@
140140
if input_file[i].strip() == '':
141141
break
142142
line = space.split(input_file[i].strip())
143-
gjfcoord.append([float(line[1]), float(line[2]), float(line[3])])
143+
gjfcoord.append([float(line[1]), float(line[2]), float(line[3]), line[0]])
144144

145145
coor = []
146-
num_atoms[2] = 0
146+
prev_element = ''
147+
elements = [elements[0]]
148+
num_atoms = [num_atoms[0]]
147149
for i in xrange(c, d):
150+
if gjfcoord[3] != prev_element:
151+
elements.append(gjfcoord[3])
152+
prev_element = gjfcoord[3]
153+
num_atoms.append(1)
154+
else:
155+
num_atoms[-1] += 1
156+
148157
v1 = gjfcoord[i][0] - gjfcoord[a][0] + pos1[b][0]
149158
v2 = gjfcoord[i][1] - gjfcoord[a][1] + pos1[b][1]
150159
v3 = gjfcoord[i][2] - gjfcoord[a][2] + pos1[b][2]
151160
pos1.append([v1, v2, v3])
152-
num_atoms[2] += 1
153-
num_atoms[2] -= 2
154-
155-
VASP.write_poscar('POSCAR.vasp', lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, pos1, selective)
156161

157162

163+
VASP.write_poscar('POSCAR.vasp', lattice, basis, elements, num_atoms, selectiveflag, coordinate_type, pos1, selective)

0 commit comments

Comments
 (0)