@@ -16,7 +16,7 @@ def ground(self,prefix,soc,mag,dftu,kdense=20):
16
16
#spec=sorted(tuple(set(atom)))
17
17
atom , a_vec , sublat = self .getxsf (self .wkdir ,prefix )
18
18
klabel , kpath = self .getkpf (self .wkdir ,prefix )
19
-
19
+
20
20
# check if V<0, if yes, swap a1 and a2
21
21
V = np .dot (np .cross (a_vec [0 ,:],a_vec [1 ,:]),a_vec [2 ,:])
22
22
print ('system volume={0} A^3' .format (V ))
@@ -66,7 +66,6 @@ def ground(self,prefix,soc,mag,dftu,kdense=20):
66
66
for n in range (0 ,len (atom )):
67
67
file .write (' {0[0]:12.8f} {0[1]:12.8f} {0[2]:12.8f} # {1:>2s} ({2:>3d})\n ' .\
68
68
format (sublat [n ,:],ptable [atom [n ]],(n + 1 )))
69
- #file.write('%12.8f %12.8f %12.8f\n' % tuple(sublat[n,:].tolist()))
70
69
file .write ('\n ' )
71
70
file .write ('# Magnetism ======================================\n ' )
72
71
if mag == 'on' :
@@ -231,15 +230,17 @@ def relax(self,prefix):
231
230
ptable = self .ptable ()
232
231
#spec=sorted(tuple(set(atom)))
233
232
atom , a_vec , sublat = self .getxsf (self .wkdir ,prefix )
234
- if type (atom [0 ])== str :
235
- atom = [ self .__grep__ (ptable ,atn )[0 ] for atn in atom ]
233
+
236
234
# check if V<0, if yes, swap a1 and a2
237
235
V = np .dot (np .cross (a_vec [0 ,:],a_vec [1 ,:]),a_vec [2 ,:])
238
236
print ('system volume={0} A^3' .format (V ))
239
237
if V < 0 :
240
238
print ('Warning: V<0, a1/b1 and a2/b2 swapped, else abinit will report error!' )
241
239
a_vec = a_vec [[1 ,0 ,2 ],:]
242
- sublat = sublat [:,[1 ,0 ,2 ]]
240
+ sublat = sublat [:,[1 ,0 ,2 ]]
241
+
242
+ if type (atom [0 ])== str :
243
+ atom = [ self .__grep__ (ptable ,atn )[0 ] for atn in atom ]
243
244
# convert atomic name format to atomic number format
244
245
spec = []
245
246
[spec .append (at_n ) for at_n in atom if spec .count (at_n )== 0 ]
@@ -275,7 +276,7 @@ def relax(self,prefix):
275
276
file .write (' %12.8f %12.8f %12.8f\n ' % tuple (a_vec [n ,:].tolist ()))
276
277
file .write ('xred # atom in reduced coordinates\n ' )
277
278
for n in range (0 ,len (atom )):
278
- file .write (' {0[0]:12.8f} {0[0 ]:12.8f} {0[0 ]:12.8f} # {1:>2s} ({2:>3d})\n ' .\
279
+ file .write (' {0[0]:12.8f} {0[1 ]:12.8f} {0[2 ]:12.8f} # {1:>2s} ({2:>3d})\n ' .\
279
280
format (sublat [n ,:],ptable [atom [n ]],(n + 1 )))
280
281
file .write ('\n ' )
281
282
file .write ('# Plane Waves ================================\n ' )
0 commit comments