Révision b75bf97d

b/modules/dos_input.py
678 678
    return h_acceptor
679 679

  
680 680

  
681
def get_use_molec_file():
682
    use_molec_file = dos_inp.get('Screening', 'use_molec_file',
683
                                 fallback='False')
684
    if use_molec_file in turn_false_answers:
685
        return False
686
    if not os.path.isfile(use_molec_file):
687
        logger.error(f'File {use_molec_file} not found.')
688
        raise FileNotFoundError(f'File {use_molec_file} not found')
689

  
690
    return use_molec_file
691

  
692

  
681 693
# Refinement
682 694

  
683 695
def get_refine_inp_file():  # TODO if not specified try isol_inp_file.
......
810 822
        inp_vars['collision_threshold'] = get_coll_thrsld()
811 823
        inp_vars['min_coll_height'] = get_min_coll_height(
812 824
            inp_vars['surf_norm_vect'])
813
        inp_vars['h_donor'] = get_H_donor(inp_vars['special_atoms'])
814
        inp_vars['max_structures'] = get_max_structures()
815 825
        if inp_vars['min_coll_height'] is False \
816 826
                and inp_vars['collision_threshold'] is False:
817 827
            logger.warning("Collisions are deactivated: Overlapping of "
818 828
                           "adsorbate and surface is possible")
829
        inp_vars['h_donor'] = get_H_donor(inp_vars['special_atoms'])
830
        inp_vars['max_structures'] = get_max_structures()
831
        inp_vars['use_molec_file'] = get_use_molec_file()
819 832

  
820 833
        # Options depending on the value of others
821 834
        if inp_vars['set_angles'] == "chemcat":
b/modules/screening.py
995 995

  
996 996
    logger.info('Carrying out procedures for the screening of adsorbate-surface'
997 997
                ' structures.')
998
    if not os.path.isdir("isolated"):
999
        err = "'isolated' directory not found. It is needed in order to carry "
1000
        "out the screening of structures to be adsorbed"
1001
        logger.error(err)
1002
        raise FileNotFoundError(err)
998
    if inp_vars['use_molec_file']:
999
        selected_confs = [adapt_format('ase', inp_vars['use_molec_file'])]
1000
        logger.info(f"Using '{inp_vars['use_molec_file']}' as only conformer.")
1001
    else:
1002
        if not os.path.isdir("isolated"):
1003
            err = "'isolated' directory not found. It is needed in order to " \
1004
                  "carry out the screening of structures to be adsorbed"
1005
            logger.error(err)
1006
            raise FileNotFoundError(err)
1003 1007

  
1004
    finished_calcs, unfinished_calcs = check_finished_calcs('isolated',
1005
                                                            inp_vars['code'])
1006
    if not finished_calcs:
1007
        err_msg = "No calculations on 'isolated' finished normally."
1008
        logger.error(err_msg)
1009
        raise FileNotFoundError(err_msg)
1010

  
1011
    logger.info(f"Found {len(finished_calcs)} structures of isolated "
1012
                f"conformers whose calculation finished normally.")
1013
    if len(unfinished_calcs) != 0:
1014
        logger.warning(f"Found {len(unfinished_calcs)} calculations more that "
1015
                       f"did not finish normally: {unfinished_calcs}. \n"
1016
                       f"Using only the ones that finished normally: "
1017
                       f"{finished_calcs}.")
1018

  
1019
    conformer_atoms_list = collect_coords(finished_calcs, inp_vars['code'],
1020
                                          'isolated', inp_vars['special_atoms'])
1021
    selected_confs = select_confs(conformer_atoms_list, finished_calcs,
1022
                                  inp_vars['select_magns'],
1023
                                  inp_vars['confs_per_magn'],
1024
                                  inp_vars['code'])
1008
        correct_calcs, failed_calcs = check_finished_calcs('isolated',
1009
                                                           inp_vars['code'])
1010
        if not correct_calcs:
1011
            err_msg = "No calculations on 'isolated' finished normally."
1012
            logger.error(err_msg)
1013
            raise FileNotFoundError(err_msg)
1014

  
1015
        logger.info(f"Found {len(correct_calcs)} structures of isolated "
1016
                    f"conformers whose calculation finished normally.")
1017
        if len(failed_calcs) != 0:
1018
            logger.warning(
1019
                f"Found {len(failed_calcs)} calculations more that "
1020
                f"did not finish normally: {failed_calcs}. \n"
1021
                f"Using only the ones that finished normally: "
1022
                f"{correct_calcs}.")
1023

  
1024
        conformer_atoms_list = collect_coords(correct_calcs, inp_vars['code'],
1025
                                              'isolated',
1026
                                              inp_vars['special_atoms'])
1027
        selected_confs = select_confs(conformer_atoms_list, correct_calcs,
1028
                                      inp_vars['select_magns'],
1029
                                      inp_vars['confs_per_magn'],
1030
                                      inp_vars['code'])
1025 1031
    surf = adapt_format('ase', inp_vars['surf_file'], inp_vars['special_atoms'])
1026 1032
    surf_ads_list = adsorb_confs(selected_confs, surf, inp_vars)
1027 1033
    if len(surf_ads_list) > inp_vars['max_structures']:

Formats disponibles : Unified diff