|
15 | 15 | from ase.data import vdw_radii,atomic_numbers,covalent_radii,chemical_symbols
|
16 | 16 |
|
17 | 17 | from mcse import Structure
|
18 |
| -from mcse.io.check import mcse_ext |
| 18 | +from mcse.io.check import mcse_ext,extension2format,format2extension |
19 | 19 |
|
20 | 20 | # Acceptable file formats listed here
|
21 | 21 | ase_file_formats = [x for x in ase_all_formats.keys()]
|
@@ -156,7 +156,7 @@ def wrapper_write_struct(path, struct, file_format='json', overwrite=False):
|
156 | 156 | elif file_format == 'geometry' or \
|
157 | 157 | file_format == 'geo' or \
|
158 | 158 | file_format == 'aims':
|
159 |
| - output_geo(path, struct, overwrite=overwrite) |
| 159 | + output_ase(path, struct, file_format="aims", overwrite=overwrite) |
160 | 160 | elif file_format == "torch":
|
161 | 161 | output_torch(path, struct, overwrite=overwrite)
|
162 | 162 | else:
|
@@ -184,18 +184,6 @@ def output_struct(file_path, struct, overwrite=False):
|
184 | 184 | check_overwrite(file_path, overwrite=overwrite)
|
185 | 185 | with open(file_path,'w') as f:
|
186 | 186 | f.write(struct.dumps())
|
187 |
| - |
188 |
| - |
189 |
| -def output_geo(file_path, struct, overwrite=False): |
190 |
| - """ |
191 |
| - Output Structure as FHI-aims geometry file using built in functionality. |
192 |
| - """ |
193 |
| - # Fix file path with in extension |
194 |
| - file_path = file_ext(file_path, "in") |
195 |
| - # Checking overwrite |
196 |
| - check_overwrite(file_path, overwrite=overwrite) |
197 |
| - with open(file_path,'w') as f: |
198 |
| - f.write(struct.get_aims()) |
199 | 187 |
|
200 | 188 |
|
201 | 189 | def output_ase(file_path, struct, file_format, overwrite=False):
|
@@ -249,6 +237,11 @@ def file_ext(file_path, file_ext):
|
249 | 237 | ## Otherwise, don't know how to handle file ext
|
250 | 238 | ## so do nothing
|
251 | 239 | pass
|
| 240 | + |
| 241 | + ### Check that the given file_ext is formatted properly |
| 242 | + if file_ext not in extension2format: |
| 243 | + if file_ext in format2extension: |
| 244 | + file_ext = format2extension[file_ext] |
252 | 245 |
|
253 | 246 | # Add specified file extension
|
254 | 247 | file_name = file_name + "."+ file_ext
|
|
0 commit comments