Révision 4e82c425 modules/calculation.py

b/modules/calculation.py
1
"""Module for the submission or execution of the calculations to be done
2

  
3
functions:
4
check_finished_calcs: Checks if the calculations finished normally or not.
5
prep_cp2k: Prepares the directories to run calculations with CP2K.
6
prep_vasp: Prepares the directories to run calculations with VASP.
7
get_jobs_status: Returns a list of job status for a list of job ids.
8
submit_jobs: Submits jobs to a custom queuing system with the provided script
9
run_calc: Directs calculation run/submission.
10
"""
11

  
1 12
import os
2 13
import logging
3 14

  
......
5 16

  
6 17

  
7 18
def check_finished_calcs(run_type, code):
8
    from modules.utilities import _human_key
9
    """Returns two lists of calculations finished normally and abnormally.
19
    """Checks if the calculations finished normally or not.
10 20

  
11 21
    @param run_type: The type of calculation to check.
12 22
    @param code: The code used for the specified job.
13
    @return finished_calcs: List of calculation directories that have finished 
23
    @return finished_calcs: List of calculation directories that have finished
14 24
    normally.
15
    @return unfinished_calcs: List of calculation directories that have finished 
25
    @return unfinished_calcs: List of calculation directories that have finished
16 26
    abnormally.
17 27
    """
28
    from modules.utilities import _human_key
18 29
    from glob import glob
19 30
    import ase.io
20 31
    from modules.utilities import tail, is_binary
......
182 193
            incar = Incar.from_file(inp_file)
183 194
            incar["SYSTEM"] = proj_name+"_"+run_type
184 195

  
196
    # Builds the directory hierarchy and copies/creates the relevant files
185 197
    for c, conf in enumerate(atms_list):
186 198
        subdir = f'{run_type}/conf_{c}/'
187 199
        os.mkdir(subdir)
......
297 309

  
298 310

  
299 311
def run_calc(run_type, inp_vars, atms_list):
300
    """Directs the calculation run according to the provided arguments.
312
    """Directs the calculation run/submission.
301 313

  
302 314
    @param run_type: Type of calculation. 'isolated', 'screening' or
303 315
    'refinement'
......
353 365
        submit_jobs(run_type, 'ccc_msub -r %s %s', inp_vars['subm_script'],
354 366
                    stat_cmd, stat_dict, inp_vars['max_jobs'],
355 367
                    inp_vars['project_name'])
356

  
357 368
    elif inp_vars['batch_q_sys'] == 'local':
358 369
        pass  # TODO implement local
359 370
    elif not inp_vars['batch_q_sys']:

Formats disponibles : Unified diff