コード例 #1
0
ファイル: dfe_ingredient.py プロジェクト: zhenming-xu/MAST
 def __init__(self, inputtxt="", plot_threshold=0.01):
     """Initialize defect formation energy ingredient
         Args:
             inputtxt <str>: Input text file, containing:
                 dfe_label1=perfect_label defected_label
                 dfe_label2=perfect_label defected_label
                 dfe_label3=perfect_label defected_label etc.
                 bandgap_lda_or_gga=<float>
                 bandgap_hse_or_expt=<float>
             plot_threshold <float>: Plotting threshold value
     """
     self.logger = loggerutils.get_mast_logger("DFE ingredient")
     self.ingdir = os.getcwd()  #Should be run in current directory
     self.recdir = os.path.dirname(self.ingdir)
     self.plot_threshold = plot_threshold
     ipdir = os.path.join(self.recdir, 'input.inp')
     os.chdir(self.recdir)  #change to recipe directory
     ipparser = InputParser(inputfile=ipdir)
     self.input_options = ipparser.parse()
     os.chdir(self.ingdir)  #change back to ingredient directory
     self.dirs = dict()
     self.bandgap_lda_or_gga = 0.0
     self.bandgap_hse_or_expt = 0.0
     self.read_input_file(inputtxt)
     self.e_defects = dict()
コード例 #2
0
 def test_parse(self):
     #ipfile='small_workflow_with_scaling.inp'
     ipfile = 'phonon_with_neb.inp'
     workdir = os.path.join(testdir, 'workdir')
     shutil.copy(os.path.join(testdir, ipfile), workdir)
     input_file = os.path.join(workdir, ipfile)
     parser_obj = InputParser(inputfile=input_file)
     input_options = parser_obj.parse()
     recipe_file_contents = input_options.get_item('recipe', 'recipe_file')
     myrtp = RecipeTemplateParser(inputOptions=input_options,
                                  working_directory=workdir,
                                  templateFile=recipe_file_contents,
                                  personalRecipe=input_file)
     parsed_lines = myrtp.parse()
     output_parsed = MASTFile()
     output_parsed.data = list(parsed_lines)
     output_parsed.to_file('workdir/personal_recipe_test_output.txt')
     self.assertEquals(len(myrtp.chunks), 5)
     #mypr = MASTFile(pr)
     #for line in mypr.data:
     #    print line.rstrip()
     compare_pr = MASTFile(
         os.path.join(testdir, 'compare',
                      'personal_recipe_test_output.txt'))
     self.assertEquals(parsed_lines, compare_pr.data)
コード例 #3
0
ファイル: dfe_ingredient.py プロジェクト: ZhewenSong/USIT
 def __init__(self, inputtxt="", plot_threshold=0.01):
     """Initialize defect formation energy ingredient
         Args:
             inputtxt <str>: Input text file, containing:
                 dfe_label1=perfect_label defected_label
                 dfe_label2=perfect_label defected_label
                 dfe_label3=perfect_label defected_label etc.
                 bandgap_lda_or_gga=<float>
                 bandgap_hse_or_expt=<float>
             plot_threshold <float>: Plotting threshold value
     """
     self.logger = loggerutils.get_mast_logger("DFE ingredient")
     self.ingdir = os.getcwd() #Should be run in current directory
     self.recdir = os.path.dirname(self.ingdir)
     self.plot_threshold = plot_threshold
     ipdir = os.path.join(self.recdir,'input.inp')
     os.chdir(self.recdir) #change to recipe directory
     ipparser = InputParser(inputfile=ipdir)
     self.input_options = ipparser.parse()
     os.chdir(self.ingdir) #change back to ingredient directory
     self.dirs = dict()
     self.bandgap_lda_or_gga = 0.0
     self.bandgap_hse_or_expt = 0.0
     self.read_input_file(inputtxt)
     self.e_defects = dict()
コード例 #4
0
 def __init__(self, directory=None, plot_threshold=0.01):
     self.directory = directory
     self.plot_threshold = plot_threshold
     ipparser = InputParser(inputfile=os.path.join(self.directory,'input.inp'))
     self.input_options = ipparser.parse()
     #pm = PickleManager(self.directory + '/input_options.pickle')
     #self.input_options = pm.load_variable()
     self.recipe_setup = RecipeSetup(inputOptions=self.input_options,recipeFile=self.input_options.get_item("personal_recipe","personal_recipe_list"),workingDirectory=self.directory)
     self.recipe_plan = self.recipe_setup.start()
     self.e_defects = dict()
コード例 #5
0
ファイル: oldinputtest.py プロジェクト: zhenming-xu/MAST
 def test_inputpythoncreator(self):
     raise SkipTest
     myip = InputParser(inputfile='mast.inp')
     myoptions=myip.parse()
     myipc = InputPythonCreator(input_options=myoptions) 
     mylines=myipc.print_input_options()
     myfile = MASTFile()
     myfile.data = mylines
     myfile.to_file("./input_python_created")
     #print mylines
     self.assertTrue(filecmp.cmp("input_python_created","test_input_python_created"))
コード例 #6
0
 def __init__(self, directory=None, plot_threshold=0.01):
     self.directory = directory
     self.plot_threshold = plot_threshold
     ipparser = InputParser(
         inputfile=os.path.join(self.directory, 'input.inp'))
     self.input_options = ipparser.parse()
     #pm = PickleManager(self.directory + '/input_options.pickle')
     #self.input_options = pm.load_variable()
     self.recipe_setup = RecipeSetup(inputOptions=self.input_options,
                                     recipeFile=self.input_options.get_item(
                                         "personal_recipe",
                                         "personal_recipe_list"),
                                     workingDirectory=self.directory)
     self.recipe_plan = self.recipe_setup.start()
     self.e_defects = dict()
コード例 #7
0
 def test_parse(self):
     #ipfile='small_workflow_with_scaling.inp'
     ipfile='phonon_with_neb.inp'
     workdir = os.path.join(testdir,'workdir')
     shutil.copy(os.path.join(testdir,ipfile),workdir)
     input_file = os.path.join(workdir,ipfile)
     parser_obj = InputParser(inputfile=input_file)
     input_options = parser_obj.parse()
     recipe_file_contents = input_options.get_item('recipe','recipe_file')
     myrtp = RecipeTemplateParser(inputOptions=input_options,
         working_directory=workdir,
         templateFile=recipe_file_contents,
         personalRecipe=input_file)
     parsed_lines = myrtp.parse()
     output_parsed = MASTFile()
     output_parsed.data = list(parsed_lines)
     output_parsed.to_file('workdir/personal_recipe_test_output.txt')
     self.assertEquals(len(myrtp.chunks),5)
     #mypr = MASTFile(pr)
     #for line in mypr.data:
     #    print line.rstrip()
     compare_pr = MASTFile(os.path.join(testdir,'compare','personal_recipe_test_output.txt'))
     self.assertEquals(parsed_lines, compare_pr.data)
コード例 #8
0
ファイル: oldinputtest.py プロジェクト: zhenming-xu/MAST
 def test_inputparser(self):
     raise SkipTest
     myip = InputParser(inputfile='mast.inp')
     myoptions=myip.parse()
     print myoptions
     self.assertEqual(True,True)
コード例 #9
0
ファイル: modifyrecipe.py プロジェクト: zhenming-xu/MAST
 def set_input_options(self):
     """Set input options.
     """
     parser_obj = InputParser(inputfile=self.keywords['inputfile'])
     self.input_options = parser_obj.parse()
コード例 #10
0
ファイル: modifyrecipe.py プロジェクト: ZhewenSong/USIT
 def set_input_options(self):
     """Set input options.
     """
     parser_obj = InputParser(inputfile=self.keywords['inputfile'])
     self.input_options = parser_obj.parse()