Révision cf8fe0e3 modules/screening.py
b/modules/screening.py | ||
---|---|---|
473 | 473 |
import os |
474 | 474 |
import random |
475 | 475 |
from modules.formats import read_coords, adapt_format |
476 |
from modules.calculation import run_calc |
|
476 |
from modules.calculation import run_calc, check_finished_calcs
|
|
477 | 477 |
|
478 | 478 |
if not os.path.isdir("isolated"): |
479 | 479 |
err = "'isolated' directory not found. It is needed in order to carry " |
480 | 480 |
"out the screening of structures to be adsorbed" |
481 | 481 |
logger.error(err) |
482 |
raise ValueError(err)
|
|
482 |
raise FileNotFoundError(err)
|
|
483 | 483 |
|
484 | 484 |
logger.info('Carrying out procedures for the screening of adsorbate-surface' |
485 | 485 |
' structures.') |
486 |
conf_list = read_coords(inp_vars['code'], 'isolated', 'ase', |
|
486 |
|
|
487 |
finished_calcs, unfinished_calcs = check_finished_calcs('isolated', |
|
488 |
inp_vars['code']) |
|
489 |
if len(unfinished_calcs) == 0: |
|
490 |
logger.info(f"Found {len(finished_calcs)} structures of isolated " |
|
491 |
f"conformers.") |
|
492 |
else: |
|
493 |
logger.info(f"Found {len(finished_calcs)} structures of isolated " |
|
494 |
f"conformers whose calculation finished normally.") |
|
495 |
logger.warning(f"Found {len(unfinished_calcs)} calculations more that " |
|
496 |
f"did not finish normally: {unfinished_calcs}. Using " |
|
497 |
f"only the {len(finished_calcs)} ones who finished " |
|
498 |
f"normally") |
|
499 |
|
|
500 |
conf_list = read_coords(finished_calcs, inp_vars['code'], 'isolated', |
|
487 | 501 |
inp_vars['special_atoms']) |
488 |
logger.info(f"Found {len(conf_list)} structures of isolated conformers.") |
|
489 | 502 |
selected_confs = select_confs(conf_list, inp_vars['select_magns'], |
490 | 503 |
inp_vars['confs_per_magn'], |
491 | 504 |
inp_vars['code']) |
... | ... | |
503 | 516 |
surf_ads_list = random.sample(surf_ads_list, inp_vars['max_structures']) |
504 | 517 |
logger.info(f'Generated {len(surf_ads_list)} adsorbate-surface atomic ' |
505 | 518 |
f'configurations to carry out a calculation of.') |
506 |
for i in range(len(surf_ads_list)): |
|
507 |
for j in range(i): |
|
508 |
if (surf_ads_list[i].positions == surf_ads_list[j].positions).all(): |
|
509 |
logger.warning(i, j, 'Same') |
|
510 | 519 |
|
511 | 520 |
run_calc('screening', inp_vars, surf_ads_list) |
512 | 521 |
logger.info('Finished the procedures for the screening of adsorbate-surface' |
Formats disponibles : Unified diff