コード例 #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
コード例 #2
0
 def __init__(self, **kwargs):
     """Please not modify this init method."""
     allowed_keys = {
         'name' : (str, str(), 'Name of directory'),
         'program': (str, str(), 'Program, e.g. "vasp"'),
         'program_keys': (dict, dict(), 'Dictionary of program keywords'),
         'structure': (Structure, None, 'Pymatgen Structure object')
         }
     BaseIngredient.__init__(self, allowed_keys, **kwargs)
コード例 #3
0
 def __init__(self, **kwargs):
     """Please not modify this init method."""
     allowed_keys = {
         'name': (str, str(), 'Name of directory'),
         'program': (str, str(), 'Program, e.g. "vasp"'),
         'program_keys': (dict, dict(), 'Dictionary of program keywords'),
         'structure': (Structure, None, 'Pymatgen Structure object')
     }
     BaseIngredient.__init__(self, allowed_keys, **kwargs)
コード例 #4
0
ファイル: recipesetup.py プロジェクト: ZhewenSong/USIT
 def create_ingredient(self, my_ingred_input_options):
     """Create the ingredient directory and metadata file.
         Args:
             my_ingred_input_options <Input Options>: single ingredient
                                                         input options
     """
     allowed_keys = {
         'name' : (str, str(), 'Name of optimization directory'),
         'program': (str, str(), 'DFT program, e.g. "vasp"'),
         'program_keys': (dict, dict(), 'Dictionary of program keywords'),
         'structure': (Structure, None, 'Pymatgen Structure object')
         }
     myingred = BaseIngredient(allowed_keys, 
                     name=my_ingred_input_options['name'],
                     structure=my_ingred_input_options['structure'],
                     program_keys=my_ingred_input_options['program_keys'])
     myingred.write_directory()
     return
コード例 #5
0
ファイル: recipesetup.py プロジェクト: zhenming-xu/MAST
    def create_ingredient(self, my_ingred_input_options):
        """Create the ingredient directory and metadata file.
            Args:
                my_ingred_input_options <Input Options>: single ingredient
                                                            input options
        """
        allowed_keys = {
            'name': (str, str(), 'Name of optimization directory'),
            'program': (str, str(), 'DFT program, e.g. "vasp"'),
            'program_keys': (dict, dict(), 'Dictionary of program keywords'),
            'structure': (Structure, None, 'Pymatgen Structure object')
        }

        myingred = BaseIngredient(
            allowed_keys,
            name=my_ingred_input_options['name'],
            structure=my_ingred_input_options['structure'],
            program_keys=my_ingred_input_options['program_keys'])
        myingred.write_directory()
        return
コード例 #6
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