File tree 1 file changed +13
-2
lines changed
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):
159
159
atom_types = ("{:>5s}" * len (types ) + "\n " ).format (* types )
160
160
atom_numbers = ("{:>5d}" * len (numbers ) + "\n " ).format (* numbers )
161
161
162
+ # Direct or Cartesian
163
+ coord_type = kwargs .get ('coord_type' , 'direct' )
164
+
162
165
# 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 "
164
170
165
171
# data and tf
166
172
try :
@@ -170,7 +176,12 @@ def get_poscar_content(self, **kwargs):
170
176
default_tf = np .full (self .data .shape , 'T' , dtype = np .str )
171
177
tf = kwargs .get ("tf" , default_tf )
172
178
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 ()):
174
185
data_tf += ("{:18.12f}" * 3 + "{:>5s}" * 3 + "\n " ).format (* (data + tf ))
175
186
176
187
# merge all strings
You can’t perform that action at this time.
0 commit comments