commit fe91ddb2f9e628c20d6ce19590fb3ca1607223e2
Author: Carles Marti <carles.marti-aliod@ens-lyon.fr>
Date:   Mon Oct 5 17:30:45 2020 +0200

    Allow to customize adsorption height. Cleaned code.

diff --git a/modules/screening.py b/modules/screening.py
index e911a57..500c621 100644
--- a/modules/screening.py
+++ b/modules/screening.py
@@ -381,7 +381,7 @@ def correct_coll(molec, slab, ctr_coord, site_coord, num_pts,
     @param coll_coeff: The coefficient that multiplies the covalent radius of
         atoms resulting in a distance that two atoms being closer to that is
         considered as atomic collision.
-    @param height: Height on which to try adsorption
+    @param height: Height on which to try adsorption.
     @return collision: bool, whether the structure generated has collisions
         between slab and adsorbate.
     """
@@ -506,7 +506,7 @@ def dissociation(slab_molec, h_donor, h_acceptor, num_atoms_slab):
 
 def ads_euler(orig_molec, slab, ctr_coord, site_coord, num_pts,
               min_coll_height, coll_coeff, norm_vect, slab_nghbs, molec_nghbs,
-              h_donor, h_acceptor):
+              h_donor, h_acceptor, height):
     """Generates adsorbate-surface structures by sampling over Euler angles.
 
     This function generates a number of adsorbate-surface structures at
@@ -529,6 +529,7 @@ def ads_euler(orig_molec, slab, ctr_coord, site_coord, num_pts,
     @param molec_nghbs: Number of neighbors in the molecule.
     @param h_donor: List of atom types or atom numbers that are H-donors.
     @param h_acceptor: List of atom types or atom numbers that are H-acceptors.
+    @param height: Height on which to try adsorption.
     @return: list of ase.Atoms object conatining all the orientations of a given
         conformer.
     """
@@ -550,7 +551,7 @@ def ads_euler(orig_molec, slab, ctr_coord, site_coord, num_pts,
                                                      num_pts, min_coll_height,
                                                      norm_vect,
                                                      slab_nghbs, molec_nghbs,
-                                                     coll_coeff)
+                                                     coll_coeff, height)
                 if not collision and not any([np.allclose(slab_molec.positions,
                                                           conf.positions)
                                               for conf in slab_ads_list]):
@@ -831,7 +832,7 @@ def internal_rotate(molecule, surf, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
 
 def ads_internal(orig_molec, slab, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
                  ctr2_surf, num_pts, min_coll_height, coll_coeff, norm_vect,
-                 slab_nghbs, molec_nghbs, h_donor, h_acceptor, max_hel):
+                 slab_nghbs, molec_nghbs, h_donor, h_acceptor, max_hel, height):
     """Generates adsorbate-surface structures by sampling over internal angles.
 
     @param orig_molec: ase.Atoms object of the molecule to adsorb (adsorbate).
@@ -859,6 +860,7 @@ def ads_internal(orig_molec, slab, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
     @param h_acceptor: List of atom types or atom numbers that are H-acceptors.
     @param max_hel: Maximum value for sampling the helicopter
         (surf-adsorbate dihedral) angle.
+    @param height: Height on which to try adsorption.
     @return: list of ase.Atoms object conatining all the orientations of a given
         conformer.
     """
@@ -884,7 +886,8 @@ def ads_internal(orig_molec, slab, ctr1_mol, ctr2_mol, ctr3_mol, ctr1_surf,
                                                      ctr_coords, site_coords,
                                                      num_pts, min_coll_height,
                                                      norm_vect, slab_nghbs,
-                                                     molec_nghbs, coll_coeff)
+                                                     molec_nghbs, coll_coeff,
+                                                     height)
                 if not collision and \
                         not any([np.allclose(slab_molec.positions,
                                              conf.positions)
@@ -920,6 +923,7 @@ def adsorb_confs(conf_list, surf, inp_vars):
     coll_coeff = inp_vars['collision_threshold']
     h_donor = inp_vars['h_donor']
     h_acceptor = inp_vars['h_acceptor']
+    height = inp_vars['adsorption_height']
 
     if inp_vars['pbc_cell'] is not False:
         surf.set_pbc(True)
@@ -954,7 +958,7 @@ def adsorb_confs(conf_list, surf, inp_vars):
                                                    num_pts, min_coll_height,
                                                    coll_coeff, norm_vect,
                                                    surf_nghbs, molec_nghbs,
-                                                   h_donor, h_acceptor))
+                                                   h_donor, h_acceptor, height))
                 elif angles == 'internal':
                     mol_ctr1 = molec_ctrs[c]
                     mol_ctr2 = inp_vars["molec_ctrs2"][c]
@@ -969,7 +973,7 @@ def adsorb_confs(conf_list, surf, inp_vars):
                                                       coll_coeff, norm_vect,
                                                       surf_nghbs, molec_nghbs,
                                                       h_donor, h_acceptor,
-                                                      max_h))
+                                                      max_h, height))
     return surf_ads_list
 
 
