本文整理汇总了Python中MAST.ingredients.chopingredient.ChopIngredient类的典型用法代码示例。如果您正苦于以下问题:Python ChopIngredient类的具体用法?Python ChopIngredient怎么用?Python ChopIngredient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChopIngredient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_parent_structures
def test_get_parent_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_init = MASTFile("unsorted/parent_structure_labelinit")
#unsorted_init = MASTFile("unsorted/parent_structure_labelinit_scrambled")
unsorted_init.to_file("%s/parent_structure_labelinit" % ingdir)
unsorted_fin = MASTFile("unsorted/parent_structure_labelfin")
unsorted_fin.to_file("%s/parent_structure_labelfin" % ingdir)
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
[sinit, sfin] = mywi.get_parent_structures()
init_compare = pymatgen.io.vaspio.Poscar.from_file("files/parent_structure_labelinit").structure
fin_compare = pymatgen.io.vaspio.Poscar.from_file("files/parent_structure_labelfin").structure
#print sinit
#print init_compare
#print sfin
#print fin_compare
self.assertEqual(sinit.sites, init_compare.sites)
self.assertEqual(sinit.lattice, init_compare.lattice)
self.assertEqual(sfin.sites, fin_compare.sites)
self.assertEqual(sfin.lattice, fin_compare.lattice)
示例2: test_give_phonon_single_forces_and_displacements
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)
示例3: test_place_parent_energy_files
def test_place_parent_energy_files(self):
ingdir="writedir/neb_labelinit-labelfin"
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)
peinit = MASTFile("files/parent_energy_labelinit")
peinit.to_file("%s/parent_energy_labelinit" % ingdir)
pefin = MASTFile("files/parent_energy_labelfin")
pefin.to_file("%s/parent_energy_labelfin" % ingdir)
kdict=dict()
kdict['mast_kpoints']=[3,3,3,"G"]
kdict['mast_xc']='pbe'
kdict['mast_program']='vasp_neb'
kdict['mast_neb_settings']=dict()
kdict['mast_neb_settings']['images']=3
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
os.mkdir(ingdir + '/00')
os.mkdir(ingdir + '/04')
mywi.place_parent_energy_files()
self.assertTrue(os.path.isfile(ingdir + '/00/OSZICAR'))
self.assertTrue(os.path.isfile(ingdir + '/04/OSZICAR'))
oszinit = MASTFile(ingdir + "/00/OSZICAR")
oszfinal = MASTFile(ingdir + "/04/OSZICAR")
self.assertEqual(oszinit.data, peinit.data)
self.assertEqual(oszfinal.data, pefin.data)
示例4: test_get_parent_image_structures
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)
示例5: test_give_saddle_structure
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")
示例6: test_write_neb_subfolders
def test_write_neb_subfolders(self):
ingdir="writedir/neb_labelinit-labelfin"
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)
parent_01 = MASTFile("statfiles/parent_structure_labelinit-labelfin_01")
parent_01.to_file(ingdir + "/parent_structure_labelinit-labelfin_01")
parent_02 = MASTFile("statfiles/parent_structure_labelinit-labelfin_02")
parent_02.to_file(ingdir + "/parent_structure_labelinit-labelfin_02")
parent_03 = MASTFile("statfiles/parent_structure_labelinit-labelfin_03")
parent_03.to_file(ingdir + "/parent_structure_labelinit-labelfin_03")
parent_init = MASTFile("statfiles/parent_structure_labelinit")
parent_init.to_file(ingdir + "/parent_structure_labelinit")
parent_fin = MASTFile("statfiles/parent_structure_labelfin")
parent_fin.to_file(ingdir + "/parent_structure_labelfin")
peinit = MASTFile("statfiles/parent_energy_labelinit")
peinit.to_file("%s/parent_energy_labelinit" % ingdir)
pefin = MASTFile("statfiles/parent_energy_labelfin")
pefin.to_file("%s/parent_energy_labelfin" % ingdir)
kdict=dict()
kdict['mast_kpoints']=[3,3,3,"G"]
kdict['mast_xc']='pbe'
kdict['mast_program']='vasp'
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
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
mywi.write_neb_subfolders()
self.assertFalse(os.path.isfile("%s/00/submit.sh" % ingdir))
self.assertTrue(os.path.isfile("%s/01/submit.sh" % ingdir))
self.assertTrue(os.path.isfile("%s/02/submit.sh" % ingdir))
self.assertTrue(os.path.isfile("%s/03/submit.sh" % ingdir))
self.assertFalse(os.path.isfile("%s/04/submit.sh" % ingdir))
oszinit = MASTFile("%s/00/OSZICAR" % ingdir)
oszfin = MASTFile("%s/04/OSZICAR" % ingdir)
pos00 = MASTFile("%s/00/POSCAR" % ingdir)
pos01 = MASTFile("%s/01/POSCAR" % ingdir)
pos02 = MASTFile("%s/02/POSCAR" % ingdir)
pos03 = MASTFile("%s/03/POSCAR" % ingdir)
pos04 = MASTFile("%s/04/POSCAR" % ingdir)
self.assertEqual(oszinit.data, peinit.data)
self.assertEqual(oszfin.data, pefin.data)
self.assertEqual(pos01.data, parent_01.data)
self.assertEqual(pos02.data, parent_02.data)
self.assertEqual(pos03.data, parent_03.data)
self.assertEqual(pos00.data, parent_init.data)
self.assertEqual(pos04.data, parent_fin.data)
示例7: test_complete_neb_subfolders
def test_complete_neb_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'
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)
myoutcar = MASTFile("files/OUTCAR_completed")
myoszicar = MASTFile("files/OSZICAR_completed")
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()
myoutcar.to_file("%s/OUTCAR" % subname)
myoszicar.to_file("%s/OSZICAR" % subname)
myci = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
self.assertTrue(myci.complete_neb_subfolders())
os.remove("%s/03/OUTCAR" % ingdir)
self.assertFalse(myci.complete_neb_subfolders())
示例8: test__fullpath_childname
def test__fullpath_childname(self):
ingdir="%s/writedir/single_label1" % 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'
my_structure = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
myuci = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
fullpath = myuci._fullpath_childname("next_ingred")
self.assertEqual(fullpath, "%s/writedir/next_ingred" % testdir)
示例9: test_write_neb_with_parent_image_structures
def test_write_neb_with_parent_image_structures(self):
ingdir="writedir/neb_labelinit-labelfin"
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)
peinit = MASTFile("files/parent_energy_labelinit")
peinit.to_file("%s/parent_energy_labelinit" % ingdir)
pefin = MASTFile("files/parent_energy_labelfin")
pefin.to_file("%s/parent_energy_labelfin" % ingdir)
psinit = MASTFile("files/parent_structure_labelinit")
psinit.to_file("%s/parent_structure_labelinit" % ingdir)
psfin = MASTFile("files/parent_structure_labelfin")
psfin.to_file("%s/parent_structure_labelfin" % ingdir)
kdict=dict()
kdict['mast_kpoints']=[3,3,3,"G"]
kdict['mast_xc']='pbe'
kdict['mast_program']='vasp_neb'
kdict['mast_coordinates']=list()
kdict['mast_coordinates'].append('%s/files/POSCAR_coords_01' % testdir)
kdict['mast_coordinates'].append('%s/files/POSCAR_coords_02' % testdir)
kdict['mast_coordinates'].append('%s/files/POSCAR_coords_03' % testdir)
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
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
mywi.write_neb()
self.assertTrue(mywi.checker.is_ready_to_run())
pos_compare_00 = MASTFile("files/POSCAR_grafted_00")
pos_compare_01 = MASTFile("files/POSCAR_grafted_01")
pos_compare_02 = MASTFile("files/POSCAR_grafted_02")
pos_compare_03 = MASTFile("files/POSCAR_grafted_03")
pos_compare_04 = MASTFile("files/POSCAR_grafted_04")
mypos00 = MASTFile("writedir/neb_labelinit-labelfin/00/POSCAR")
mypos01 = MASTFile("writedir/neb_labelinit-labelfin/01/POSCAR")
mypos02 = MASTFile("writedir/neb_labelinit-labelfin/02/POSCAR")
mypos03 = MASTFile("writedir/neb_labelinit-labelfin/03/POSCAR")
mypos04 = MASTFile("writedir/neb_labelinit-labelfin/04/POSCAR")
self.assertEqual(pos_compare_00.data, mypos00.data)
self.assertEqual(pos_compare_01.data, mypos01.data)
self.assertEqual(pos_compare_02.data, mypos02.data)
self.assertEqual(pos_compare_03.data, mypos03.data)
self.assertEqual(pos_compare_04.data, mypos04.data)
示例10: test_write_singlerun
def test_write_singlerun(self):
ingdir="writedir/single_label1"
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_kpoints']=[3,3,3,"G"]
kdict['mast_xc']='pbe'
kdict['mast_program']='vasp'
my_structure=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=my_structure)
mywi.write_singlerun()
self.assertTrue(mywi.checker.is_ready_to_run())
示例11: test_give_structure
def test_give_structure(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'
my_structure = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure").structure
myrelaxed = MASTFile("files/relaxed_structure")
myrelaxed.to_file("%s/CONTCAR" % ingdir)
myuci = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myuci.give_structure("next_ingred")
givenstr = MASTFile("%s/writedir/next_ingred/POSCAR" % testdir)
self.assertEqual(myrelaxed.data, givenstr.data)
示例12: test_ready_structure
def test_ready_structure(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'
my_pos = pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure")
my_pos.write_file("writedir/single_label1/POSCAR")
myrdi = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_pos.structure)
self.assertTrue(myrdi.ready_structure())
os.remove("%s/POSCAR" % ingdir)
self.assertFalse(myrdi.ready_structure())
示例13: test_write_singlerun_automesh
def test_write_singlerun_automesh(self):
ingdir="writedir/single_label1"
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_kpoints']=[3,3,3,"G"]
kdict['mast_xc']='pbe'
kdict['mast_program']='vasp'
kdict['mast_kpoint_density']='1000'
mypos=pymatgen.io.vaspio.Poscar.from_file("files/perfect_structure")
mypos.write_file("writedir/single_label1/POSCAR")
mywi = ChopIngredient(name=ingdir,program_keys=kdict,structure=mypos.structure)
mywi.write_singlerun_automesh()
mykpts = pymatgen.io.vaspio.Kpoints.from_file("writedir/single_label1/KPOINTS")
self.assertEqual(mykpts.to_dict['kpoints'][0],[8,8,8])
#print mykpts
self.assertTrue(mywi.checker.is_ready_to_run())
示例14: test_run_scale
def test_run_scale(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.data.append("defect_label = label1\n")
metad.data.append("scaling_size = [2,2,2]\n")
metad.to_file("%s/metadata.txt" % ingdir)
kdict=dict()
kdict['mast_program'] = 'vasp'
my_structure = Poscar.from_file("files/POSCAR_perfect").structure
myperf = MASTFile("files/POSCAR_perfect")
myperf.to_file("%s/POSCAR" % ingdir)
myri = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myri.run_scale()
my_scaled = Poscar.from_file("%s/CONTCAR" % ingdir).structure.get_sorted_structure()
scaled_compare = Poscar.from_file("files/POSCAR_scaled").structure.get_sorted_structure()
self.assertEquals(my_scaled, scaled_compare)
示例15: test_run_strain
def test_run_strain(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_strain']=" 0.98 0.92 1.03 \n"
my_structure = Poscar.from_file("files/POSCAR_perfect").structure
myunstrained = MASTFile("files/POSCAR_unstrained")
myunstrained.to_file("%s/POSCAR" % ingdir)
myri = ChopIngredient(name=ingdir,program_keys=kdict, structure=my_structure)
myri.run_strain()
my_strained = Poscar.from_file("%s/CONTCAR" % ingdir).structure
strained_compare = Poscar.from_file("files/POSCAR_strained").structure
self.assertEquals(my_strained, strained_compare)
self.assertFalse(os.path.isfile("%s/submitlist" % self.test_control))