本文整理汇总了Python中MAST.ingredients.chopingredient.ChopIngredient.run_subfolders方法的典型用法代码示例。如果您正苦于以下问题:Python ChopIngredient.run_subfolders方法的具体用法?Python ChopIngredient.run_subfolders怎么用?Python ChopIngredient.run_subfolders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MAST.ingredients.chopingredient.ChopIngredient
的用法示例。
在下文中一共展示了ChopIngredient.run_subfolders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_subfolders
# 需要导入模块: from MAST.ingredients.chopingredient import ChopIngredient [as 别名]
# 或者: from MAST.ingredients.chopingredient.ChopIngredient import run_subfolders [as 别名]
def test_run_subfolders(self):
#raise SkipTest
ingdir="%s/writedir/single_label1" % testdir
recipedir="%s/writedir" % testdir
topmetad = MASTFile("files/top_metadata_single")
topmetad.data.append("origin_dir = %s/files\n" % testdir) #give origin directory
topmetad.to_file("writedir/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.to_file("%s/metadata.txt" % ingdir)
kdict=dict()
kdict['mast_program'] = 'vasp'
kdict['mast_kpoints'] = [2,2,2,"M"]
kdict['mast_xc'] = 'pw91'
my_structure = Poscar.from_file("files/perfect_structure").structure
for subfolder in ['sub1','sub2','sub3','sub4']:
subname = "%s/%s" % (ingdir, subfolder)
os.mkdir(subname)
shutil.copy("files/metadata_single","%s/metadata.txt" % subname)
mywr = ChopIngredient(name=subname, program_keys = kdict, structure=my_structure)
mywr.write_singlerun()
myri = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myri.run_subfolders()
self.assertFalse(myri.checker.is_ready_to_run())
for subfolder in ['sub1','sub2','sub3','sub4']:
subname = "%s/%s" % (ingdir, subfolder)
myri.checker.keywords['name'] = subname
self.assertTrue(myri.checker.is_ready_to_run())
mysubmit = MASTFile("%s/submitlist" % self.test_control)
self.assertEquals(mysubmit.data[0], "%s/sub1\n" % ingdir)
self.assertEquals(mysubmit.data[1], "%s/sub2\n" % ingdir)
self.assertEquals(mysubmit.data[2], "%s/sub3\n" % ingdir)
self.assertEquals(mysubmit.data[3], "%s/sub4\n" % ingdir)