File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -159,8 +159,14 @@ def get_poscar_content(self, **kwargs):
159159 atom_types = ("{:>5s}" * len (types ) + "\n " ).format (* types )
160160 atom_numbers = ("{:>5d}" * len (numbers ) + "\n " ).format (* numbers )
161161
162+ # Direct or Cartesian
163+ coord_type = kwargs .get ('coord_type' , 'direct' )
164+
162165 # string
163- info = "Selective Dynamics\n Direct\n "
166+ if coord_type == 'direct' :
167+ info = "Selective Dynamics\n Direct\n "
168+ else :
169+ info = "Cartensian\n "
164170
165171 # data and tf
166172 try :
@@ -170,7 +176,12 @@ def get_poscar_content(self, **kwargs):
170176 default_tf = np .full (self .data .shape , 'T' , dtype = np .str )
171177 tf = kwargs .get ("tf" , default_tf )
172178 data_tf = ''
173- for data , tf in zip (self .data .tolist (), tf .tolist ()):
179+ if coord_type == 'direct' :
180+ data = self .data .tolist ()
181+ else :
182+ data = self .dir2cart (self .bases , self .data ).tolist ()
183+
184+ for data , tf in zip (data , tf .tolist ()):
174185 data_tf += ("{:18.12f}" * 3 + "{:>5s}" * 3 + "\n " ).format (* (data + tf ))
175186
176187 # merge all strings
You can’t perform that action at this time.
0 commit comments