Révision b25f77a4

b/modules/screening.py
533 533
        conformer.
534 534
    """
535 535
    from copy import deepcopy
536
    slab_ads_list = []
536
    slab_ads_list, coll_confs, dup_confs = [], [], []
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 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)))
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
560 565

  
561
    return slab_ads_list
562 566

  
563 567
def internal_rotate(molecule, surf, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
564 568
                    ctr2_surf, bond_vector, bond_angle_target,
......
860 864
        conformer.
861 865
    """
862 866
    from copy import deepcopy
863
    slab_ads_list = []
867
    slab_ads_list, coll_confs, dup_confs = [], [], []
864 868
    # Rotation over bond angle
865 869
    for alpha in np.arange(90, 180+1, 90 / max(1, num_pts-1))[:num_pts]:
866 870
        # Rotation over surf-adsorbate dihedral angle
......
882 886
                                                     num_pts, min_coll_height,
883 887
                                                     norm_vect, slab_nghbs,
884 888
                                                     molec_nghbs, coll_coeff)
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
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
896 903

  
897 904

  
898 905
def adsorb_confs(conf_list, surf, inp_vars):
......
922 929
        surf.set_pbc(True)
923 930
        surf.set_cell(inp_vars['pbc_cell'])
924 931

  
925
    surf_ads_list = []
932
    surf_ads_list, colli_confs, dupl_confs = [], [], []
926 933
    sites_coords = get_atom_coords(surf, sites)
927 934
    if coll_coeff is not False:
928 935
        surf_cutoffs = natural_cutoffs(surf, mult=coll_coeff)
......
947 954
                norm_vect = inp_norm_vect
948 955
            for c, ctr in enumerate(molec_ctr_coords):
949 956
                if angles == 'euler':
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))
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

  
955 964
                elif angles == 'chemcat':
956 965
                    mol_ctr1 = molec_ctrs[c]
957 966
                    mol_ctr2 = inp_vars["molec_ctrs2"][c]
......
959 968
                    surf_ctr1 = sites[s]
960 969
                    surf_ctr2 = inp_vars["surf_ctrs2"][s]
961 970
                    max_h = inp_vars["max_helic_angle"]
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
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
971 979

  
972 980

  
973 981
def run_screening(inp_vars):
......
1016 1024
                                      inp_vars['confs_per_magn'],
1017 1025
                                      inp_vars['code'])
1018 1026
    surf = adapt_format('ase', inp_vars['surf_file'], inp_vars['special_atoms'])
1019
    surf_ads_list = adsorb_confs(selected_confs, surf, inp_vars)
1027
    surf_ads_list, colli_confs, dupl_confs = adsorb_confs(selected_confs, surf,
1028
                                                          inp_vars)
1020 1029
    if len(surf_ads_list) > inp_vars['max_structures']:
1021 1030
        surf_ads_list = random.sample(surf_ads_list, inp_vars['max_structures'])
1022
    logger.info(f'Generated {len(surf_ads_list)} adsorbate-surface atomic '
1023
                f'configurations to carry out a calculation of.')
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.')
1024 1035

  
1025 1036
    run_calc('screening', inp_vars, surf_ads_list)
1026 1037
    logger.info('Finished the procedures for the screening of adsorbate-surface'

Formats disponibles : Unified diff