Révision cf40df1b modules/screening.py
b/modules/screening.py | ||
---|---|---|
533 | 533 |
conformer. |
534 | 534 |
""" |
535 | 535 |
from copy import deepcopy |
536 |
slab_ads_list, coll_confs, dup_confs = [], [], []
|
|
536 |
slab_ads_list = []
|
|
537 | 537 |
prealigned_molec = align_molec(orig_molec, ctr_coord, norm_vect) |
538 | 538 |
# rotation around z |
539 | 539 |
for alpha in np.arange(0, 360, 360 / num_pts): |
... | ... | |
549 | 549 |
norm_vect, |
550 | 550 |
slab_nghbs, molec_nghbs, |
551 | 551 |
coll_coeff) |
552 |
if not collision: |
|
553 |
if not any([np.allclose(slab_molec.positions, conf.positions) |
|
554 |
for conf in slab_ads_list]): |
|
555 |
slab_ads_list.append(slab_molec) |
|
556 |
else: |
|
557 |
dup_confs.append(slab_molec) |
|
558 |
# if h_donor is not False: |
|
559 |
# slab_ads_list.extend(dissociation(slab_molec, h_donor, |
|
560 |
# h_acceptor, |
|
561 |
# len(slab))) |
|
562 |
else: |
|
563 |
coll_confs.append(slab_molec) |
|
564 |
return slab_ads_list, coll_confs, dup_confs |
|
552 |
if not collision and not any([np.allclose(slab_molec.positions, |
|
553 |
conf.positions) |
|
554 |
for conf in slab_ads_list]): |
|
555 |
slab_ads_list.append(slab_molec) |
|
556 |
if h_donor is not False: |
|
557 |
slab_ads_list.extend(dissociation(slab_molec, h_donor, |
|
558 |
h_acceptor, |
|
559 |
len(slab))) |
|
565 | 560 |
|
561 |
return slab_ads_list |
|
566 | 562 |
|
567 | 563 |
def internal_rotate(molecule, surf, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf, |
568 | 564 |
ctr2_surf, bond_vector, bond_angle_target, |
... | ... | |
864 | 860 |
conformer. |
865 | 861 |
""" |
866 | 862 |
from copy import deepcopy |
867 |
slab_ads_list, coll_confs, dup_confs = [], [], []
|
|
863 |
slab_ads_list = []
|
|
868 | 864 |
# Rotation over bond angle |
869 | 865 |
for alpha in np.arange(90, 180+1, 90 / max(1, num_pts-1))[:num_pts]: |
870 | 866 |
# Rotation over surf-adsorbate dihedral angle |
... | ... | |
886 | 882 |
num_pts, min_coll_height, |
887 | 883 |
norm_vect, slab_nghbs, |
888 | 884 |
molec_nghbs, coll_coeff) |
889 |
if not collision: |
|
890 |
if not any([np.allclose(slab_molec.positions, conf.positions) |
|
891 |
for conf in slab_ads_list]): |
|
892 |
slab_ads_list.append(slab_molec) |
|
893 |
else: |
|
894 |
dup_confs.append(slab_molec) |
|
895 |
# if h_donor is not False: |
|
896 |
# slab_ads_list.extend(dissociation(slab_molec, h_donor, |
|
897 |
# h_acceptor, |
|
898 |
# len(slab))) |
|
899 |
else: |
|
900 |
coll_confs.append(slab_molec) |
|
901 |
|
|
902 |
return slab_ads_list, coll_confs, dup_confs |
|
885 |
if not collision and \ |
|
886 |
not any([np.allclose(slab_molec.positions, |
|
887 |
conf.positions) |
|
888 |
for conf in slab_ads_list]): |
|
889 |
slab_ads_list.append(slab_molec) |
|
890 |
if h_donor is not False: |
|
891 |
slab_ads_list.extend(dissociation(slab_molec, h_donor, |
|
892 |
h_acceptor, |
|
893 |
len(slab))) |
|
894 |
|
|
895 |
return slab_ads_list |
|
903 | 896 |
|
904 | 897 |
|
905 | 898 |
def adsorb_confs(conf_list, surf, inp_vars): |
... | ... | |
929 | 922 |
surf.set_pbc(True) |
930 | 923 |
surf.set_cell(inp_vars['pbc_cell']) |
931 | 924 |
|
932 |
surf_ads_list, colli_confs, dupl_confs = [], [], []
|
|
925 |
surf_ads_list = []
|
|
933 | 926 |
sites_coords = get_atom_coords(surf, sites) |
934 | 927 |
if coll_coeff is not False: |
935 | 928 |
surf_cutoffs = natural_cutoffs(surf, mult=coll_coeff) |
... | ... | |
954 | 947 |
norm_vect = inp_norm_vect |
955 | 948 |
for c, ctr in enumerate(molec_ctr_coords): |
956 | 949 |
if angles == 'euler': |
957 |
good_confs, coll_confs, dup_confs = ads_euler(conf, surf, |
|
958 |
ctr, site, num_pts, min_coll_height, coll_coeff, |
|
959 |
norm_vect, surf_nghbs, molec_nghbs, h_donor, h_acceptor) |
|
960 |
surf_ads_list.extend(good_confs) |
|
961 |
colli_confs.extend(coll_confs) |
|
962 |
dupl_confs.extend(dup_confs) |
|
963 |
|
|
950 |
surf_ads_list.extend(ads_euler(conf, surf, ctr, site, |
|
951 |
num_pts, min_coll_height, |
|
952 |
coll_coeff, norm_vect, |
|
953 |
surf_nghbs, molec_nghbs, |
|
954 |
h_donor, h_acceptor)) |
|
964 | 955 |
elif angles == 'chemcat': |
965 | 956 |
mol_ctr1 = molec_ctrs[c] |
966 | 957 |
mol_ctr2 = inp_vars["molec_ctrs2"][c] |
... | ... | |
968 | 959 |
surf_ctr1 = sites[s] |
969 | 960 |
surf_ctr2 = inp_vars["surf_ctrs2"][s] |
970 | 961 |
max_h = inp_vars["max_helic_angle"] |
971 |
good_confs, coll_confs, dup_confs = ads_internal(conf, surf, |
|
972 |
mol_ctr1, mol_ctr2, mol_ctr3, surf_ctr1, surf_ctr2, |
|
973 |
num_pts, min_coll_height, coll_coeff, norm_vect, |
|
974 |
surf_nghbs, molec_nghbs, h_donor, h_acceptor, max_h) |
|
975 |
surf_ads_list.extend(good_confs) |
|
976 |
colli_confs.extend(coll_confs) |
|
977 |
dupl_confs.extend(dup_confs) |
|
978 |
return surf_ads_list, colli_confs, dupl_confs |
|
962 |
surf_ads_list.extend(ads_chemcat(conf, surf, mol_ctr1, |
|
963 |
mol_ctr2, mol_ctr3, |
|
964 |
surf_ctr1, surf_ctr2, |
|
965 |
num_pts, min_coll_height, |
|
966 |
coll_coeff, norm_vect, |
|
967 |
surf_nghbs, molec_nghbs, |
|
968 |
h_donor, h_acceptor, |
|
969 |
max_h)) |
|
970 |
return surf_ads_list |
|
979 | 971 |
|
980 | 972 |
|
981 | 973 |
def run_screening(inp_vars): |
... | ... | |
1024 | 1016 |
inp_vars['confs_per_magn'], |
1025 | 1017 |
inp_vars['code']) |
1026 | 1018 |
surf = adapt_format('ase', inp_vars['surf_file'], inp_vars['special_atoms']) |
1027 |
surf_ads_list, colli_confs, dupl_confs = adsorb_confs(selected_confs, surf, |
|
1028 |
inp_vars) |
|
1019 |
surf_ads_list = adsorb_confs(selected_confs, surf, inp_vars) |
|
1029 | 1020 |
if len(surf_ads_list) > inp_vars['max_structures']: |
1030 | 1021 |
surf_ads_list = random.sample(surf_ads_list, inp_vars['max_structures']) |
1031 |
logger.info(f"Good: {len(surf_ads_list)}, Collision: {len(colli_confs)}," |
|
1032 |
f" Duplicate: {len(dupl_confs)}") |
|
1033 |
# logger.info(f'Generated {len(surf_ads_list)} adsorbate-surface atomic ' |
|
1034 |
# f'configurations to carry out a calculation of.') |
|
1022 |
logger.info(f'Generated {len(surf_ads_list)} adsorbate-surface atomic ' |
|
1023 |
f'configurations to carry out a calculation of.') |
|
1035 | 1024 |
|
1036 | 1025 |
run_calc('screening', inp_vars, surf_ads_list) |
1037 | 1026 |
logger.info('Finished the procedures for the screening of adsorbate-surface' |
Formats disponibles : Unified diff