-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxtbstruc
executable file
·31 lines (22 loc) · 871 Bytes
/
xtbstruc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
# xtbstruc -- A small python script to copy over finished xtb opt files
# Nicholas Hadler - [email protected]
# March 20th, 2022
import os
from pathlib import Path
import shutil
def file_copy():
dir = os.getcwd()
path = Path("final_structures")
path.mkdir(parents=True, exist_ok=True)
for file in os.listdir(dir):
if file.endswith("_dir"):
subdir = dir + "/" + file + "/"
for subfile in os.listdir(subdir):
if subfile.startswith("xtbopt") and not subfile.endswith(".log"):
copy_file = subdir + "/" + subfile
new_name = file[:-4] + "." + subfile.split(".")[1]
new_dir = dir + "/" + "final_structures" + "/" + new_name
shutil.copy(copy_file, new_dir)
if __name__ == "__main__":
file_copy()