Révision 1e9e784d

b/modules/refinement.py
3 3
logger = logging.getLogger('DockOnSurf')
4 4

  
5 5

  
6
def select_confs(orig_conf_list, energy_cutoff, code):
6
def select_confs(orig_conf_list, calc_dirs, energy_cutoff, code):
7 7
    """From a list of atomic configurations selects the most stable ones.
8 8

  
9 9
    Given a list of ase.Atoms configurations and an energy cutoff, selects all
10
    the structures that have an energy at most the value of energy cutoff larger
11
    than the most stable one.
12
    @param orig_conf_list: The original list of atomic configurations
10
    the structures that have an energy lower than, the energy of the most stable
11
    conformer plus the cutoff.
12

  
13
    @param orig_conf_list: List of ase.Atoms objects of the conformers
14
    @param calc_dirs: List of the directories of the finished calculations
13 15
    @param energy_cutoff: The maximum energy above the most stable configuration
14 16
    @param code: the code used to carry out the screening of structures.
15 17
    @return: list of the the most stable configurations within the energy cutoff
......
19 21

  
20 22
    conf_list = deepcopy(orig_conf_list)
21 23
    selected_ids = []
22
    conf_enrgs = collect_energies(code, 'screening') * 27.2113845  # Ha to eV
24
    conf_enrgs = collect_energies(calc_dirs, code, 'screening')
23 25

  
24 26
    for i, conf in enumerate(conf_list):
25 27
        conf.info['energy'] = conf_enrgs[i]
......
64 66
    conf_list = collect_coords(inp_vars['code'], 'screening', 'ase',
65 67
                               inp_vars['special_atoms'])
66 68
    logger.info(f"Found {len(conf_list)} structures on screening directory.")
67
    selected_confs = select_confs(conf_list, inp_vars['energy_cutoff'],
68
                                  inp_vars['code'])
69
    selected_confs = select_confs(conf_list, finished_calcs,
70
                                  inp_vars['energy_cutoff'], inp_vars['code'])
69 71
    run_calc('refinement', inp_vars, selected_confs)
70 72
    logger.info('Finished the procedures for the refinement of '
71 73
                'adsorbate-surface structures section.')
b/modules/screening.py
9 9
    atoms.info[prop_name] = prop_val
10 10

  
11 11

  
12
def select_confs(orig_conf_list: list, magns: list, num_sel: int, code: str):
12
def select_confs(orig_conf_list: list, calc_dirs: list, magns: list, num_sel: int, code: str):
13 13
    """Takes a list ase.Atoms and selects the most different magnitude-wise.
14 14

  
15 15
    Given a list of ase.Atoms objects and a list of magnitudes, it selects a
16 16
    number of the most different conformers according to every magnitude
17 17
    specified.
18
     
18 19
    @param orig_conf_list: list of ase.Atoms objects to select among.
20
    @param calc_dirs: List of directories where to read the energies from.
19 21
    @param magns: list of str with the names of the magnitudes to use for the
20
        conformer selection.
21
        Supported magnitudes: 'energy', 'moi'.
22
        conformer selection. Supported magnitudes: 'energy', 'moi'.
22 23
    @param num_sel: number of conformers to select for every of the magnitudes.
23 24
    @param code: The code that generated the magnitude information.
24 25
         Supported codes: See formats.py
......
37 38

  
38 39
    # Read properties
39 40
    if 'energy' in magns:
40
        conf_enrgs = collect_energies(code, 'isolated')
41
        conf_enrgs = collect_energies(calc_dirs, code, 'isolated')
41 42
    if 'moi' in magns:
42 43
        mois = np.array([conf.get_moments_of_inertia() for conf in conf_list])
43 44

  
......
499 500

  
500 501
    conformer_atoms_list = collect_coords(finished_calcs, inp_vars['code'],
501 502
                                          'isolated', inp_vars['special_atoms'])
502
    selected_confs = select_confs(conformer_atoms_list,
503
    selected_confs = select_confs(conformer_atoms_list, finished_calcs,
503 504
                                  inp_vars['select_magns'],
504 505
                                  inp_vars['confs_per_magn'],
505 506
                                  inp_vars['code'])

Formats disponibles : Unified diff