| import os | |
| import math | |
| input_dir = "input_data" | |
| output_dir = "batches" | |
| batch_size = 1000 | |
| os.makedirs(output_dir, exist_ok=True) | |
| all_files = sorted([ | |
| os.path.join(input_dir, f) | |
| for f in os.listdir(input_dir) | |
| if f.endswith(".xyz") | |
| ]) | |
| n_batches = math.ceil(len(all_files) / batch_size) | |
| for i in range(n_batches): | |
| batch_files = all_files[i*batch_size : (i+1)*batch_size] | |
| with open(f"{output_dir}/batch_{i:03d}.txt", "w") as f: | |
| f.write("\n".join(batch_files)) |