Révision 61f71e3c
b/modules/refinement.py | ||
---|---|---|
3 | 3 |
logger = logging.getLogger('DockOnSurf') |
4 | 4 |
|
5 | 5 |
|
6 |
def select_confs(orig_conf_list, calc_dirs, energy_cutoff, code):
|
|
6 |
def select_confs(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 | 10 |
the structures that have an energy lower than, the energy of the most stable |
11 | 11 |
conformer plus the cutoff. |
12 | 12 |
|
13 |
@param orig_conf_list: List of ase.Atoms objects of the conformers
|
|
13 |
@param conf_list: List of ase.Atoms objects of the conformers |
|
14 | 14 |
@param calc_dirs: List of the directories of the finished calculations |
15 | 15 |
@param energy_cutoff: The maximum energy above the most stable configuration |
16 | 16 |
@param code: the code used to carry out the screening of structures. |
... | ... | |
19 | 19 |
from copy import deepcopy |
20 | 20 |
from modules.formats import collect_energies |
21 | 21 |
|
22 |
conf_list = deepcopy(orig_conf_list) |
|
23 |
selected_ids = [] |
|
24 | 22 |
conf_enrgs = collect_energies(calc_dirs, code, 'screening') |
25 | 23 |
|
26 | 24 |
for i, conf in enumerate(conf_list): |
27 | 25 |
conf.info['energy'] = conf_enrgs[i] |
26 |
conf.info['id'] = calc_dirs[i] |
|
28 | 27 |
|
29 | 28 |
sorted_list = sorted(conf_list, key=lambda conf: conf.info['energy']) |
30 | 29 |
lowest_e = sorted_list[0].info['energy'] |
31 | 30 |
return [conf for conf in sorted_list |
32 |
if conf.info['energy'] < lowest_e + energy_cutoff] |
|
31 |
if conf.info['energy'] <= lowest_e + energy_cutoff]
|
|
33 | 32 |
|
34 | 33 |
|
35 | 34 |
def run_refinement(inp_vars): |
... | ... | |
71 | 70 |
inp_vars['energy_cutoff'], inp_vars['code']) |
72 | 71 |
logger.info(f"Selected {len(selected_confs)} structures to carry out the" |
73 | 72 |
f" refinement") |
74 |
run_calc('refinement', inp_vars, selected_confs) |
|
73 |
# run_calc('refinement', inp_vars, selected_confs) |
|
74 |
finished_calcs, unfinished_calcs = check_finished_calcs('refinement', |
|
75 |
inp_vars['code']) |
|
76 |
conf_list = collect_coords(finished_calcs, inp_vars['code'], 'refinement', |
|
77 |
inp_vars['special_atoms']) |
|
75 | 78 |
most_stable_conf = select_confs(conf_list, finished_calcs, 0, |
76 | 79 |
inp_vars['code'])[0] |
77 | 80 |
logger.info('Finished the procedures for the refinement of ' |
78 | 81 |
'adsorbate-surface structures section. Most stable structure ' |
79 |
f'is {most_stable_conf}') |
|
82 |
f"is {most_stable_conf.info['id']}") |
Formats disponibles : Unified diff