Révision 1a158b9f modules/calculation.py

b/modules/calculation.py
43 43
    return finished_calcs, unfinished_calcs
44 44

  
45 45

  
46
def prep_cp2k(inp_file, run_type, atms_list):  # TODO name to PROJECT_NAME
46
def prep_cp2k(inp_file, run_type, atms_list, proj_name):
47 47
    """Prepares the directories to run isolated calculation with CP2K.
48 48

  
49 49
    @param inp_file: CP2K Input file to run the calculations with.
50 50
    @param run_type: Type of calculation. 'isolated', 'screening' or
51 51
        'refinement'
52 52
    @param atms_list: list of ase.Atoms objects to run the calculation of.
53
    @param proj_name: name of the project
53 54
    @return: None
54 55
    """
55 56
    from shutil import copy
......
58 59
    from modules.utilities import check_bak
59 60
    cp2k = CP2K()
60 61
    cp2k.parse(inp_file)
62
    cp2k.CP2K_INPUT.GLOBAL.Project_name = proj_name+"_"+run_type
61 63
    force_eval = cp2k.CP2K_INPUT.FORCE_EVAL_list[0]
62 64
    if force_eval.SUBSYS.TOPOLOGY.Coord_file_name is None:
63 65
        logger.warning("'COORD_FILE_NAME' not specified on CP2K input. Using\n"
64 66
                       "'coord.xyz'. A new CP2K input file with "
65 67
                       "the 'COORD_FILE_NAME' variable is created.")
66 68
        force_eval.SUBSYS.TOPOLOGY.Coord_file_name = 'coord.xyz'
67
        print(inp_file.split('/')[-1])
68 69
        check_bak(inp_file.split('/')[-1])
69
        cp2k.write_input_file(inp_file.split('/')[-1])
70
    cp2k.write_input_file(inp_file.split('/')[-1])
70 71

  
71 72
    coord_file = force_eval.SUBSYS.TOPOLOGY.Coord_file_name
72 73

  
......
183 184
    # Prepare directories and files for relevant code.
184 185
    if inp_vars['code'] == 'cp2k':
185 186
        if run_type == 'isolated':
186
            prep_cp2k(inp_vars['isol_inp_file'], run_type, atms_list)
187
            prep_cp2k(inp_vars['isol_inp_file'], run_type, atms_list,
188
                      inp_vars['project_name'])
187 189
        elif run_type == 'screening':
188
            prep_cp2k(inp_vars['screen_inp_file'], run_type, atms_list)
190
            prep_cp2k(inp_vars['screen_inp_file'], run_type, atms_list,
191
                      inp_vars['project_name'])
189 192
        elif run_type == 'refinement':
190
            prep_cp2k(inp_vars['refine_inp_file'], run_type, atms_list)
193
            prep_cp2k(inp_vars['refine_inp_file'], run_type, atms_list,
194
                      inp_vars['project_name'])
191 195
    # elif: inp_vars['code'] == 'Other codes here'
192 196

  
193 197
    # Submit/run Jobs

Formats disponibles : Unified diff