commit b75bf97d3c6e5a9c8aea4df047ab4d98755ef3c0
Author: Carles Marti <carles.marti-aliod@ens-lyon.fr>
Date:   Tue Sep 29 13:52:22 2020 +0200

    Added the possibility to carry out screening on a single conformer specified in a file. Rename variables.

diff --git a/modules/dos_input.py b/modules/dos_input.py
index 6af9ce3..88c65d7 100644
--- a/modules/dos_input.py
+++ b/modules/dos_input.py
@@ -678,6 +678,18 @@ def get_H_acceptor(spec_atoms):
     return h_acceptor
 
 
+def get_use_molec_file():
+    use_molec_file = dos_inp.get('Screening', 'use_molec_file',
+                                 fallback='False')
+    if use_molec_file in turn_false_answers:
+        return False
+    if not os.path.isfile(use_molec_file):
+        logger.error(f'File {use_molec_file} not found.')
+        raise FileNotFoundError(f'File {use_molec_file} not found')
+
+    return use_molec_file
+
+
 # Refinement
 
 def get_refine_inp_file():  # TODO if not specified try isol_inp_file.
@@ -810,12 +822,13 @@ def read_input(in_file):
         inp_vars['collision_threshold'] = get_coll_thrsld()
         inp_vars['min_coll_height'] = get_min_coll_height(
             inp_vars['surf_norm_vect'])
-        inp_vars['h_donor'] = get_H_donor(inp_vars['special_atoms'])
-        inp_vars['max_structures'] = get_max_structures()
         if inp_vars['min_coll_height'] is False \
                 and inp_vars['collision_threshold'] is False:
             logger.warning("Collisions are deactivated: Overlapping of "
                            "adsorbate and surface is possible")
+        inp_vars['h_donor'] = get_H_donor(inp_vars['special_atoms'])
+        inp_vars['max_structures'] = get_max_structures()
+        inp_vars['use_molec_file'] = get_use_molec_file()
 
         # Options depending on the value of others
         if inp_vars['set_angles'] == "chemcat":
diff --git a/modules/screening.py b/modules/screening.py
index 3ecb542..41a165a 100644
--- a/modules/screening.py
+++ b/modules/screening.py
@@ -995,33 +995,39 @@ def run_screening(inp_vars):
 
     logger.info('Carrying out procedures for the screening of adsorbate-surface'
                 ' structures.')
-    if not os.path.isdir("isolated"):
-        err = "'isolated' directory not found. It is needed in order to carry "
-        "out the screening of structures to be adsorbed"
-        logger.error(err)
-        raise FileNotFoundError(err)
+    if inp_vars['use_molec_file']:
+        selected_confs = [adapt_format('ase', inp_vars['use_molec_file'])]
+        logger.info(f"Using '{inp_vars['use_molec_file']}' as only conformer.")
+    else:
+        if not os.path.isdir("isolated"):
+            err = "'isolated' directory not found. It is needed in order to " \
+                  "carry out the screening of structures to be adsorbed"
+            logger.error(err)
+            raise FileNotFoundError(err)
 
-    finished_calcs, unfinished_calcs = check_finished_calcs('isolated',
-                                                            inp_vars['code'])
-    if not finished_calcs:
-        err_msg = "No calculations on 'isolated' finished normally."
-        logger.error(err_msg)
-        raise FileNotFoundError(err_msg)
-
-    logger.info(f"Found {len(finished_calcs)} structures of isolated "
-                f"conformers whose calculation finished normally.")
-    if len(unfinished_calcs) != 0:
-        logger.warning(f"Found {len(unfinished_calcs)} calculations more that "
-                       f"did not finish normally: {unfinished_calcs}. \n"
-                       f"Using only the ones that finished normally: "
-                       f"{finished_calcs}.")
-
-    conformer_atoms_list = collect_coords(finished_calcs, inp_vars['code'],
-                                          'isolated', inp_vars['special_atoms'])
-    selected_confs = select_confs(conformer_atoms_list, finished_calcs,
-                                  inp_vars['select_magns'],
-                                  inp_vars['confs_per_magn'],
-                                  inp_vars['code'])
+        correct_calcs, failed_calcs = check_finished_calcs('isolated',
+                                                           inp_vars['code'])
+        if not correct_calcs:
+            err_msg = "No calculations on 'isolated' finished normally."
+            logger.error(err_msg)
+            raise FileNotFoundError(err_msg)
+
+        logger.info(f"Found {len(correct_calcs)} structures of isolated "
+                    f"conformers whose calculation finished normally.")
+        if len(failed_calcs) != 0:
+            logger.warning(
+                f"Found {len(failed_calcs)} calculations more that "
+                f"did not finish normally: {failed_calcs}. \n"
+                f"Using only the ones that finished normally: "
+                f"{correct_calcs}.")
+
+        conformer_atoms_list = collect_coords(correct_calcs, inp_vars['code'],
+                                              'isolated',
+                                              inp_vars['special_atoms'])
+        selected_confs = select_confs(conformer_atoms_list, correct_calcs,
+                                      inp_vars['select_magns'],
+                                      inp_vars['confs_per_magn'],
+                                      inp_vars['code'])
     surf = adapt_format('ase', inp_vars['surf_file'], inp_vars['special_atoms'])
     surf_ads_list = adsorb_confs(selected_confs, surf, inp_vars)
     if len(surf_ads_list) > inp_vars['max_structures']:
