|
9 | 9 | #################################################################### |
10 | 10 | import os |
11 | 11 | import sys |
12 | | -import glob |
13 | 12 | import time |
14 | 13 | import copy |
15 | 14 | import shutil |
@@ -107,24 +106,16 @@ def main(): |
107 | 106 | if rank == 0: |
108 | 107 | # If there is a checkpoint file, we see the execution as an extension of an EEXE simulation |
109 | 108 | ckpt_data = np.load(args.ckpt) |
110 | | - start_idx = len(ckpt_data[0]) |
| 109 | + start_idx = len(ckpt_data[0]) # The length should be the same for the same axis |
111 | 110 | print(f'\nGetting prepared to extend the EEXE simulation from iteration {start_idx} ...') |
112 | 111 |
|
113 | | - print('Deleting corrupted data ...') |
114 | | - corrupted = glob.glob('gmxapi.commandline.cli*') # corrupted iteration |
115 | | - corrupted.extend(glob.glob('mdrun*')) |
116 | | - for i in corrupted: |
117 | | - shutil.rmtree(i) |
118 | | - if len(corrupted) == 0: |
119 | | - corrupt_bool = False |
120 | | - |
121 | | - for i in range(EEXE.n_sim): |
122 | | - n_finished = len(next(os.walk(f'sim_{i}'))[1]) # number of finished iterations (the last might be initialized but corrupted though) # noqa: E501 |
123 | | - if n_finished == EEXE.n_iter and corrupt_bool is False: |
124 | | - print('Extension aborted: The expected number of iterations have been completed!') |
125 | | - sys.exit() |
126 | | - else: |
127 | | - print('Deleting data generated after the checkpoint ...') |
| 112 | + if start_idx == EEXE.n_iter: |
| 113 | + print('Extension aborted: The expected number of iterations have been completed!') |
| 114 | + sys.exit() |
| 115 | + else: |
| 116 | + print('Deleting data generated after the checkpoint ...') |
| 117 | + for i in range(EEXE.n_sim): |
| 118 | + n_finished = len(next(os.walk(f'sim_{i}'))[1]) # number of finished iterations |
128 | 119 | for j in range(start_idx, n_finished): |
129 | 120 | print(f' Deleting the folder sim_{i}/iteration_{j}') |
130 | 121 | shutil.rmtree(f'sim_{i}/iteration_{j}') |
|
0 commit comments