Example #1
0
 def clear_ga_vasp_ingredient(self, ingred_name="", new_seed_file=""):
     """Clear the Genetic Algorithm VASP ingredient.
         Assumes that the VASP ingredient has already
         been evaluated and the result passed
         to the child ingredient.
         Args:
             ingred_name <str>: Ingredient name to clear.
                 Match this carefully with a name from
                 the recipe.
             new_seed_file <str>: New seed file to put
                 in the cleared ingredient.
     """
     if ingred_name == "":
         self.logger.error("Needs an ingredient name!")
         return None
     fullpath = os.path.join(os.path.dirname(self.keywords['name']), ingred_name)
     self.logger.info("Removing directories and files from ingredient specified at %s" % fullpath)
     dircontents = os.listdir(fullpath)
     subfolders = list()
     import shutil
     for diritem in dircontents:
         fulldir = os.path.join(fullpath,diritem)
         if os.path.isdir(fulldir) and diritem.isdigit():
             subfolders.append(fulldir)
     for subfolder in subfolders:
         shutil.rmtree(subfolder)
     files_to_remove = list()
     files_to_remove.append("starting.xyz")
     for filename in files_to_remove:
         os.remove(os.path.join(fullpath, filename))
     shutil.copy(os.path.join(self.keywords['name'], new_seed_file), os.path.join(fullpath, "starting.xyz"))
     from MAST.ingredients import BaseIngredient
     cleared_ing = BaseIngredient(name=fullpath)
     cleared_ing.change_my_status("W")
     return
Example #2
0
 def clear_ga_vasp_ingredient(self, ingred_name="", new_seed_file=""):
     """Clear the Genetic Algorithm VASP ingredient.
         Assumes that the VASP ingredient has already
         been evaluated and the result passed
         to the child ingredient.
         Args:
             ingred_name <str>: Ingredient name to clear.
                 Match this carefully with a name from
                 the recipe.
             new_seed_file <str>: New seed file to put
                 in the cleared ingredient.
     """
     if ingred_name == "":
         self.logger.error("Needs an ingredient name!")
         return None
     fullpath = os.path.join(os.path.dirname(self.keywords['name']),
                             ingred_name)
     self.logger.info(
         "Removing directories and files from ingredient specified at %s" %
         fullpath)
     dircontents = os.listdir(fullpath)
     subfolders = list()
     import shutil
     for diritem in dircontents:
         fulldir = os.path.join(fullpath, diritem)
         if os.path.isdir(fulldir) and diritem.isdigit():
             subfolders.append(fulldir)
     for subfolder in subfolders:
         shutil.rmtree(subfolder)
     files_to_remove = list()
     files_to_remove.append("starting.xyz")
     for filename in files_to_remove:
         os.remove(os.path.join(fullpath, filename))
     shutil.copy(os.path.join(self.keywords['name'], new_seed_file),
                 os.path.join(fullpath, "starting.xyz"))
     from MAST.ingredients import BaseIngredient
     cleared_ing = BaseIngredient(name=fullpath)
     cleared_ing.change_my_status("W")
     return