示例#1
0
 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"))
示例#2
0
 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"))