Révision fe91ddb2

b/modules/dos_input.py
564 564
    return np.array(surf_norm_vect) / np.linalg.norm(surf_norm_vect)
565 565

  
566 566

  
567
def get_adsorption_height():
568
    err_msg = num_error % ('adsorption_height', 'positive number')
569
    ads_height = try_command(dos_inp.getfloat, [(ValueError, err_msg)],
570
                             'Screening', 'adsorption_height', fallback=2.5)
571
    if ads_height <= 0:
572
        logger.error(err_msg)
573
        raise ValueError(err_msg)
574
    return ads_height
575

  
576

  
567 577
def get_set_angles():
568 578
    set_vals = ['euler', 'internal']
569 579
    check_expect_val(dos_inp.get('Screening', 'set_angles').lower(), set_vals)
......
596 606

  
597 607

  
598 608
def get_coll_thrsld():
599
    err_msg = num_error % ('collision_threshold',
600
                           'positive number')
609
    err_msg = num_error % ('collision_threshold', 'positive number')
601 610
    coll_thrsld_str = dos_inp.get('Screening', 'collision_threshold',
602 611
                                  fallback="1.3")
603 612
    if coll_thrsld_str.lower() in turn_false_answers:
......
692 701

  
693 702
# Refinement
694 703

  
695
def get_refine_inp_file():  # TODO if not specified try isol_inp_file.
704
def get_refine_inp_file():
696 705
    refine_inp_file = dos_inp.get('Refinement', 'refine_inp_file')
697 706
    if not os.path.isfile(refine_inp_file):
698 707
        logger.error(f'File {refine_inp_file} not found.')
......
816 825
        inp_vars['select_magns'] = get_select_magns()
817 826
        inp_vars['confs_per_magn'] = get_confs_per_magn()
818 827
        inp_vars['surf_norm_vect'] = get_surf_norm_vect()
828
        inp_vars['adsorption_height'] = get_adsorption_height()
819 829
        inp_vars['set_angles'] = get_set_angles()
820 830
        inp_vars['sample_points_per_angle'] = get_pts_per_angle()
821 831
        inp_vars['pbc_cell'] = get_pbc_cell()
b/modules/screening.py
381 381
    @param coll_coeff: The coefficient that multiplies the covalent radius of
382 382
        atoms resulting in a distance that two atoms being closer to that is
383 383
        considered as atomic collision.
384
    @param height: Height on which to try adsorption
384
    @param height: Height on which to try adsorption.
385 385
    @return collision: bool, whether the structure generated has collisions
386 386
        between slab and adsorbate.
387 387
    """
......
506 506

  
507 507
def ads_euler(orig_molec, slab, ctr_coord, site_coord, num_pts,
508 508
              min_coll_height, coll_coeff, norm_vect, slab_nghbs, molec_nghbs,
509
              h_donor, h_acceptor):
509
              h_donor, h_acceptor, height):
510 510
    """Generates adsorbate-surface structures by sampling over Euler angles.
511 511

  
512 512
    This function generates a number of adsorbate-surface structures at
......
529 529
    @param molec_nghbs: Number of neighbors in the molecule.
530 530
    @param h_donor: List of atom types or atom numbers that are H-donors.
531 531
    @param h_acceptor: List of atom types or atom numbers that are H-acceptors.
532
    @param height: Height on which to try adsorption.
532 533
    @return: list of ase.Atoms object conatining all the orientations of a given
533 534
        conformer.
534 535
    """
......
550 551
                                                     num_pts, min_coll_height,
551 552
                                                     norm_vect,
552 553
                                                     slab_nghbs, molec_nghbs,
553
                                                     coll_coeff)
554
                                                     coll_coeff, height)
554 555
                if not collision and not any([np.allclose(slab_molec.positions,
555 556
                                                          conf.positions)
556 557
                                              for conf in slab_ads_list]):
......
831 832

  
832 833
def ads_internal(orig_molec, slab, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
833 834
                 ctr2_surf, num_pts, min_coll_height, coll_coeff, norm_vect,
834
                 slab_nghbs, molec_nghbs, h_donor, h_acceptor, max_hel):
835
                 slab_nghbs, molec_nghbs, h_donor, h_acceptor, max_hel, height):
835 836
    """Generates adsorbate-surface structures by sampling over internal angles.
836 837

  
837 838
    @param orig_molec: ase.Atoms object of the molecule to adsorb (adsorbate).
......
859 860
    @param h_acceptor: List of atom types or atom numbers that are H-acceptors.
860 861
    @param max_hel: Maximum value for sampling the helicopter
861 862
        (surf-adsorbate dihedral) angle.
863
    @param height: Height on which to try adsorption.
862 864
    @return: list of ase.Atoms object conatining all the orientations of a given
863 865
        conformer.
864 866
    """
......
884 886
                                                     ctr_coords, site_coords,
885 887
                                                     num_pts, min_coll_height,
886 888
                                                     norm_vect, slab_nghbs,
887
                                                     molec_nghbs, coll_coeff)
889
                                                     molec_nghbs, coll_coeff,
890
                                                     height)
888 891
                if not collision and \
889 892
                        not any([np.allclose(slab_molec.positions,
890 893
                                             conf.positions)
......
920 923
    coll_coeff = inp_vars['collision_threshold']
921 924
    h_donor = inp_vars['h_donor']
922 925
    h_acceptor = inp_vars['h_acceptor']
926
    height = inp_vars['adsorption_height']
923 927

  
924 928
    if inp_vars['pbc_cell'] is not False:
925 929
        surf.set_pbc(True)
......
954 958
                                                   num_pts, min_coll_height,
955 959
                                                   coll_coeff, norm_vect,
956 960
                                                   surf_nghbs, molec_nghbs,
957
                                                   h_donor, h_acceptor))
961
                                                   h_donor, h_acceptor, height))
958 962
                elif angles == 'internal':
959 963
                    mol_ctr1 = molec_ctrs[c]
960 964
                    mol_ctr2 = inp_vars["molec_ctrs2"][c]
......
969 973
                                                      coll_coeff, norm_vect,
970 974
                                                      surf_nghbs, molec_nghbs,
971 975
                                                      h_donor, h_acceptor,
972
                                                      max_h))
976
                                                      max_h, height))
973 977
    return surf_ads_list
974 978

  
975 979

  

Formats disponibles : Unified diff