本文整理汇总了Python中MAST.utility.MASTFile.to_file方法的典型用法代码示例。如果您正苦于以下问题:Python MASTFile.to_file方法的具体用法?Python MASTFile.to_file怎么用?Python MASTFile.to_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MAST.utility.MASTFile
的用法示例。
在下文中一共展示了MASTFile.to_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: change_my_status
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def change_my_status(self, newstatus):
"""Change an ingredient status by writing the new status to
change_status.txt in the ingredient folder, to get picked
up by the recipe plan.
Args:
newstatus <str>: New status to which to change the ingredient.
"""
ingdir = self.keywords['name']
oneup = os.path.dirname(ingdir)
tryrecipe = os.path.basename(oneup)
statuspath = ""
if dirutil.dir_is_in_scratch(tryrecipe):
statuspath = "%s/change_status.txt" % ingdir
else:
twoup = os.path.dirname(oneup)
tryrecipe = os.path.basename(twoup)
if dirutil.dir_is_in_scratch(tryrecipe):
statuspath = "%s/change_status.txt" % oneup
else:
raise MASTError(self.__class__.__name__, "Cannot change status of ingredient %s as recipe %s or %s is not found in $MAST_SCRATCH." % (self.keywords['name'],oneup, twoup))
if os.path.isfile(statuspath):
statusfile = MASTFile(statuspath)
else:
statusfile=MASTFile()
statusfile.data.append("%s:recommend:%s" % (newstatus, time.asctime()))
statusfile.to_file(statuspath)
self.logger.info("Recommending status change to %s" % newstatus)
示例2: test_run_staged_ingredients
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_run_staged_ingredients(self):
topmetad = MASTFile("files/top_metadata_single")
topmetad.data.append("origin_dir = %s/files\n" % testdir) #give origin directory
topmetad.to_file("recipedir/metadata.txt")
#metad = MASTFile("files/metadata_single")
#metad.to_file("%s/metadata.txt" % ingdir)
rp = RecipePlan("recipedir")
rp.ingredients['ing1']="C"
rp.ingredients['ing2a'] = "W"
rp.ingredients['ing2b'] = "S"
rp.ingredients['ing3'] = "W"
kdict=dict()
kdict['mast_program']='vasp'
kdict['mast_xc']='pw91'
kdict['mast_kpoints']=[1,2,3,"G"]
rp.ingred_input_options['ing2b']=dict()
rp.ingred_input_options['ing2b']['name']="recipedir/ing2b"
rp.ingred_input_options['ing2b']['program_keys']=kdict
rp.ingred_input_options['ing2b']['structure']=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
rp.write_methods['ing2b']=[['write_singlerun']]
rp.write_ingredient('ing2b')
rp.ready_methods['ing2b']=[['ready_singlerun']]
rp.run_methods['ing2b']=[['run_singlerun']]
rp.complete_methods['ing2b']=[['complete_singlerun']]
rp.run_staged_ingredients()
mysubmit = MASTFile("test_control/submitlist")
self.assertEquals(mysubmit.data[0],"recipedir/ing2b\n")
self.assertEquals(rp.ingredients,{'ing1':'C','ing2a':'W','ing2b':'P','ing3':'W'})
示例3: status_change_recommended
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def status_change_recommended(self, iname):
"""Check if a status change is recommended for the ingredient,
as listed in the ingredient folder/change_status.txt.
Args:
iname <str>: ingredient name
Returns:
True if a status change was recommended, and
changes the status of the ingredient in self.ingredients.
False otherwise
"""
statuspath = os.path.join(self.working_directory, iname, "change_status.txt")
if not os.path.isfile(statuspath):
return False
statusfile = MASTFile(statuspath)
newdata=list()
changed=False
for sline in statusfile.data: #status:recommend:timestamp
if not "status_changed" in sline:
newstatus = sline.split(":")[0]
self.ingredients[iname]=newstatus
newline = sline + ":status_changed:" + time.asctime() + "\n"
self.logger.info("Status of %s changed to %s" % (iname, newstatus))
changed=True
newdata.append(newline)
else:
newdata.append(sline)
statusfile.data=list(newdata)
statusfile.to_file(statuspath)
return changed
示例4: test_update_children
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_update_children(self):
topmetad = MASTFile("files/top_metadata_single")
topmetad.data.append("origin_dir = %s/files\n" % testdir) #give origin directory
topmetad.to_file("recipedir/metadata.txt")
#metad = MASTFile("files/metadata_single")
#metad.to_file("%s/metadata.txt" % ingdir)
rp = RecipePlan("%s/recipedir" % testdir)
rp.ingredients['ing1'] = "I"
kdict=dict()
kdict['mast_program']='vasp'
kdict['mast_xc']='pw91'
kdict['mast_kpoints']=[1,2,3,"G"]
rp.ingred_input_options['ing1']=dict()
rp.ingred_input_options['ing1']['name']="%s/ing1" % rp.working_directory
rp.ingred_input_options['ing1']['program_keys']=kdict
rp.ingred_input_options['ing1']['structure']=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
rp.update_methods['ing1']=dict()
rp.update_methods['ing1']['ing2a']=[['give_structure']]
rp.update_methods['ing1']['ing2b']=[['give_structure_and_restart_files']]
rp.update_children('ing1')
self.assertTrue(os.path.isfile("recipedir/ing2a/POSCAR"))
self.assertTrue(os.path.isfile("recipedir/ing2b/POSCAR"))
#CHGCAR softlink only sent to second child
self.assertFalse(os.path.exists("recipedir/ing2a/CHGCAR"))
self.assertTrue(os.path.exists("recipedir/ing2b/CHGCAR"))
示例5: test_run_subfolders
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [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)
示例6: create_archive_files
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def create_archive_files(self):
"""Save off archive files.
Returns:
creates archive_input_options.txt
creates archive_recipe_plan.txt
"""
inputsave = MASTFile()
inputsave.data = repr(self.input_options)
inputsave.to_file(os.path.join(self.working_directory, 'archive_input_options.txt'))
recipesave = MASTFile()
recipesave.data = repr(self.recipe_plan)
recipesave.to_file(os.path.join(self.working_directory, 'archive_recipe_plan.txt'))
#pickle_plan = os.path.join(self.working_directory, 'archive_recipe_plan.pickle')
#pm = PickleManager(pickle_plan)
#pm.save_variable(self.recipe_plan)
#pickle_options = os.path.join(self.working_directory, 'archive_input_options.pickle')
#pm = PickleManager(pickle_options)
#pm.save_variable(self.input_options)
#create the *.py input script
#ipc_obj = InputPythonCreator(input_options=self.input_options)
#ipc_filename = ipc_obj.write_script(self.working_directory, 'archive_input_options.py')
return
示例7: evaluate_ga_vasp_and_update
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def evaluate_ga_vasp_and_update(self, childname=""):
"""Evaluate the Genetic Algorithm VASP ingredient.
"""
raise NotImplementedError
childpath = os.path.join(os.path.dirname(self.keywords['name']), childname)
from mastlib.amy_ga_code import fitness_evaluation
from MAST.ingredients.checker import VaspChecker
from MAST.utility import MASTFile
dircontents = os.listdir(self.keywords['name'])
subfolders = list()
for diritem in dircontents:
fulldir = os.path.join(self.keywords['name'],diritem)
if os.path.isdir(fulldir) and diritem.isdigit():
subfolders.append(fulldir)
energylist = list()
structurelist = list()
for subfolder in subfolders:
mychecker = VaspChecker(subfolder, self.keywords['program_keys'], self.keywords['structure'])
mystructure = mychecker.get_final_structure_from_directory()
structurelist.append(mystructure)
myenergy = mychecker.get_energy_from_energy_file()
energylist.append(myenergy)
[fitoutput, fitstructure] = fitness_evaluation.evaluate(structurelist, energylist)
#If output is a structure or xyz file, could just write it directly.
fitfile = MASTFile()
fitfile.data = fitoutput
import time
timestamp = time.strftime("%Y%m%d_%H%M%S")
outputname = "my_output_%s" % timestamp
outputstrname = "my_structure_%s" % timestamp
fitfile.to_file(os.path.join(childpath, outputname))
fitstructure.write_file(os.path.join(childpath, outputstrname))
return " %s and %s written in %s" % (outputname, outputstrname, childpath)
示例8: test_ready_neb_subfolders
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_ready_neb_subfolders(self):
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'
kdict['mast_neb_settings']=dict()
kdict['mast_neb_settings']['images'] = 3
my_structure = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywr = ChopIngredient(name=ingdir, program_keys = kdict, structure=my_structure)
for subdir in ['00','01','02','03','04']:
subname = "%s/%s" % (ingdir, subdir)
os.mkdir(subname)
mywr.keywords['name'] = subname
mywr.checker.keywords['name'] = subname
if not subdir in ['00','04']:
mywr.write_singlerun()
mywr.write_submit_script()
myrdi = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
self.assertTrue(myrdi.ready_neb_subfolders())
os.remove("%s/01/POSCAR" % ingdir)
self.assertFalse(myrdi.ready_neb_subfolders())
示例9: test_give_saddle_structure
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_give_saddle_structure(self):
ingdir="%s/writedir/neb_labelinit-labelfin" % testdir
recipedir="%s/writedir" % testdir
topmetad = MASTFile("files/top_metadata_neb")
topmetad.data.append("origin_dir = %s/files\n" % testdir) #give origin directory
topmetad.to_file("writedir/metadata.txt")
metad = MASTFile("files/metadata_neb")
metad.to_file("%s/metadata.txt" % ingdir)
kdict=dict()
kdict['mast_program'] = 'vasp_neb'
kdict['images'] = 3
my_structure = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
myrelaxed=dict()
myosz=dict()
mywav=dict()
mychg=dict()
for subdir in ['00','01','02','03','04']:
os.mkdir("writedir/neb_labelinit-labelfin/%s" % subdir)
myrelaxed[subdir] = MASTFile("files/POSCAR_%s" % subdir)
myrelaxed[subdir].to_file("writedir/neb_labelinit-labelfin/%s/CONTCAR" % subdir)
myosz[subdir] = MASTFile("files/OSZICAR_%s" % subdir)
myosz[subdir].to_file("writedir/neb_labelinit-labelfin/%s/OSZICAR" % subdir)
mychg[subdir] = MASTFile("files/CHGCAR")
mychg[subdir].to_file("writedir/neb_labelinit-labelfin/%s/CHGCAR" % subdir)
mywav[subdir] = MASTFile("files/WAVECAR")
mywav[subdir].to_file("writedir/neb_labelinit-labelfin/%s/WAVECAR" % subdir)
myuci = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myuci.give_saddle_structure("next_ingred") #should be OSZ3
saddle = MASTFile("%s/writedir/next_ingred/POSCAR" % testdir)
self.assertEqual(myrelaxed['03'].data, saddle.data)
saddledir = myuci.get_saddle_dir()
self.assertEqual(saddledir, "03")
示例10: test_get_parent_image_structures
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_get_parent_image_structures(self):
kdict=dict()
kdict['mast_program'] = 'vasp_neb'
neblines = list()
neblines.append(["Cr","0.0 0.9 0.8","0.0 0.8 0.7"])
neblines.append(["Cr","0.4 0.2 0.1","0.3 0.3 0.2"])
neblines.append(["Cr","0.29 0.05 0.05","0.01 0.01 0.98"])
neblines.append(["Ni","0.61 0.99 0.98","0.25 0.01 0.97"])
kdict['mast_neb_settings']=dict()
kdict['mast_neb_settings']['images']=3
kdict['mast_neb_settings']['lines']=neblines
ingdir = "writedir/neb_labelinit-labelfin"
topmetad = MASTFile("files/top_metadata_neb")
topmetad.to_file("writedir/metadata.txt")
metad = MASTFile("files/metadata_neb")
metad.to_file("%s/metadata.txt" % ingdir)
unsorted_01 = MASTFile("unsorted/parent_structure_labelinit-labelfin_01")
unsorted_01.to_file("%s/parent_structure_labelinit-labelfin_01" % ingdir)
unsorted_02 = MASTFile("unsorted/parent_structure_labelinit-labelfin_02")
unsorted_02.to_file("%s/parent_structure_labelinit-labelfin_02" % ingdir)
unsorted_03 = MASTFile("unsorted/parent_structure_labelinit-labelfin_03")
unsorted_03.to_file("%s/parent_structure_labelinit-labelfin_03" % ingdir)
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
imstrs = mywi.get_parent_image_structures()
compare_01 = pymatgen.io.vaspio.Poscar.from_file("files/parent_structure_labelinit-labelfin_01").structure
compare_02 = pymatgen.io.vaspio.Poscar.from_file("files/parent_structure_labelinit-labelfin_02").structure
compare_03 = pymatgen.io.vaspio.Poscar.from_file("files/parent_structure_labelinit-labelfin_03").structure
self.assertEqual(imstrs[0].sites, compare_01.sites)
self.assertEqual(imstrs[0].lattice, compare_01.lattice)
self.assertEqual(imstrs[1].sites, compare_02.sites)
self.assertEqual(imstrs[1].lattice, compare_02.lattice)
self.assertEqual(imstrs[2].sites, compare_03.sites)
self.assertEqual(imstrs[2].lattice, compare_03.lattice)
示例11: test_give_phonon_single_forces_and_displacements
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_give_phonon_single_forces_and_displacements(self):
ingdir="%s/writedir/single_phonon_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_phonon")
metad.to_file("%s/metadata.txt" % ingdir)
mypos = MASTFile("files/phonon_initial_POSCAR")
mypos.to_file("%s/POSCAR" % ingdir)
kdict=dict()
kdict['mast_program'] = 'vasp'
my_structure = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
myxdat = MASTFile("files/XDATCAR_compare")
myxdat.to_file("%s/XDATCAR" % ingdir)
mydynmat = MASTFile("files/DYNMAT_compare")
mydynmat.to_file("%s/DYNMAT" % ingdir)
myuci = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myuci.give_phonon_single_forces_and_displacements("next_ingred")
newpos = MASTFile("%s/writedir/next_ingred/POSCAR_prePHON" % testdir)
newdyn = MASTFile("%s/writedir/next_ingred/DYNMAT" % testdir)
newxdat = MASTFile("%s/writedir/next_ingred/XDATCAR" % testdir)
comparepos = MASTFile("files/phonon_initial_POSCAR")
comparedyn = MASTFile("files/DYNMAT_compare")
comparexdat = MASTFile("%s/XDATCAR" % ingdir)
self.assertEqual(newpos.data, comparepos.data)
self.assertEqual(newdyn.data, comparedyn.data)
self.assertEqual(newxdat.data, comparexdat.data)
示例12: test_check_if_ready_to_proceed_are_complete
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_check_if_ready_to_proceed_are_complete(self):
metad = MASTFile("files/metadata_single")
metad.to_file("recipedir/ing1/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.to_file("recipedir/ing2a/metadata.txt")
rp = RecipePlan("recipedir")
rp.ingredients['ing1'] = "P"
rp.ingredients['ing2a'] = "I"
rp.ingredients['ing2b'] = "I"
rp.ingredients['ing3'] = "I"
kdict=dict()
kdict['mast_program']='vasp'
kdict['mast_xc']='pw91'
kdict['mast_kpoints']=[1,2,3,"G"]
my_struc = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
rp.ingred_input_options['ing1']=dict()
rp.ingred_input_options['ing1']['name']="%s/recipedir/ing1" % testdir
rp.ingred_input_options['ing1']['program_keys']=kdict
rp.ingred_input_options['ing1']['structure']=my_struc
rp.complete_methods['ing1']=[['complete_singlerun']]
rp.update_methods['ing1']=dict()
rp.update_methods['ing1']['ing2a']=[['give_structure']]
rp.update_methods['ing1']['ing2b']=[['give_structure']]
rp.ingred_input_options['ing2a']=dict()
rp.ingred_input_options['ing2a']['name']="%s/recipedir/ing2a" % testdir
rp.ingred_input_options['ing2a']['program_keys']=kdict
rp.ingred_input_options['ing2a']['structure']=my_struc
rp.complete_methods['ing2a']=[['complete_singlerun']]
rp.ready_methods['ing2a']=[['ready_structure']]
rp.check_if_ready_to_proceed_are_complete()
self.assertTrue(rp.ready_ingredient('ing2a'))
self.assertEquals
self.assertEquals(rp.ingredients,{'ing1':'C','ing2a':'I','ing2b':'I','ing3':'I'})
示例13: create_workflow_test_script
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def create_workflow_test_script(inputfile):
myvars = get_variables()
# set up testing directory tree
wtdir=myvars['workflow_test_directory']
mast_test_dir=os.path.join(wtdir,"no_directory_yet")
while not (os.path.isdir(mast_test_dir)):
timestamp=time.strftime("%Y%m%dT%H%M%S")
mast_test_dir = os.path.join(wtdir,"output_test_%s" % timestamp)
if not (os.path.isdir(mast_test_dir)):
shutil.copytree("%s/mini_mast_tree" % wtdir, mast_test_dir)
# set up output file and submission script
shortname = inputfile.split(".")[0]
output="%s/output_%s" % (wtdir, shortname)
submitscript="%s/submit_%s.sh" % (wtdir, shortname)
generic_script="%s/generic_mast_workflow.sh" % wtdir
bashcommand="bash %s %s %s %s %s %s >> %s" % (generic_script,
mast_test_dir,
myvars["workflow_examples_located"],
inputfile,
myvars["workflow_activate_command"],
myvars["workflow_testing_environment"],
output)
submitfile=MASTFile()
submitfile.data.append(bashcommand + "\n")
submitfile.to_file(submitscript)
return [mast_test_dir, submitscript, output]
示例14: test_fast_forward_check_complete
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
def test_fast_forward_check_complete(self):
topmetad = MASTFile("files/top_metadata_single")
topmetad.data.append("origin_dir = %s/files\n" % testdir) #give origin directory
topmetad.to_file("recipedir/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.to_file("recipedir/ing1/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.data.append("defect_label = labela\n")
metad.to_file("recipedir/ing2a/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.data.append("defect_label = labelb\n")
metad.to_file("recipedir/ing2b/metadata.txt")
metad = MASTFile("files/metadata_single")
metad.to_file("recipedir/ing3/metadata.txt")
rp = RecipePlan("recipedir")
rp.ingredients['ing1'] = "I"
rp.ingredients['ing2a'] = "I"
rp.ingredients['ing2b'] = "I"
rp.ingredients['ing3'] = "I"
kdict=dict()
kdict['mast_program']='vasp'
kdict['mast_xc']='pw91'
kdict['mast_kpoints']=[1,2,3,"G"]
my_struc = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
rp.ingred_input_options['ing1']=dict()
rp.ingred_input_options['ing1']['name']="%s/recipedir/ing1" % testdir
rp.ingred_input_options['ing1']['program_keys']=kdict
rp.ingred_input_options['ing1']['structure']=my_struc
rp.complete_methods['ing1']=[['complete_singlerun']]
rp.update_methods['ing1']=dict()
rp.update_methods['ing1']['ing2a']=[['give_structure']]
rp.update_methods['ing1']['ing2b']=[['give_structure']]
rp.ingred_input_options['ing2a']=dict()
rp.ingred_input_options['ing2a']['name']="%s/recipedir/ing2a" % testdir
rp.ingred_input_options['ing2a']['program_keys']=kdict
rp.ingred_input_options['ing2a']['structure']=my_struc
rp.complete_methods['ing2a']=[['complete_singlerun']]
rp.ready_methods['ing2a']=[['ready_structure']]
rp.ingred_input_options['ing2b']=dict()
rp.ingred_input_options['ing2b']['name']="%s/recipedir/ing2b" % testdir
rp.ingred_input_options['ing2b']['program_keys']=kdict
rp.ingred_input_options['ing2b']['structure']=my_struc
rp.complete_methods['ing2b']=[['complete_singlerun']]
rp.ready_methods['ing2b']=[['ready_structure']]
rp.ingred_input_options['ing3']=dict()
rp.ingred_input_options['ing3']['name']="%s/recipedir/ing3" % testdir
rp.ingred_input_options['ing3']['program_keys']=kdict
rp.ingred_input_options['ing3']['structure']=my_struc
rp.complete_methods['ing3']=[['complete_singlerun']]
rp.ready_methods['ing3']=[['ready_structure']]
rp.fast_forward_check_complete()
#self.assertTrue(rp.complete_ingredient('ing1'))
self.assertEquals(rp.ingredients, {'ing1':'C','ing2a':'I','ing2b':'I','ing3':'I'})
self.assertTrue(rp.ready_ingredient('ing2a'))
self.assertTrue(rp.ready_ingredient('ing2b'))
示例15: test_inputpythoncreator
# 需要导入模块: from MAST.utility import MASTFile [as 别名]
# 或者: from MAST.utility.MASTFile import to_file [as 别名]
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"))