当前位置: 首页>>代码示例>>Python>>正文


Python ChopIngredient.run_scale方法代码示例

本文整理汇总了Python中MAST.ingredients.chopingredient.ChopIngredient.run_scale方法的典型用法代码示例。如果您正苦于以下问题:Python ChopIngredient.run_scale方法的具体用法?Python ChopIngredient.run_scale怎么用?Python ChopIngredient.run_scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MAST.ingredients.chopingredient.ChopIngredient的用法示例。


在下文中一共展示了ChopIngredient.run_scale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_run_scale

# 需要导入模块: from MAST.ingredients.chopingredient import ChopIngredient [as 别名]
# 或者: from MAST.ingredients.chopingredient.ChopIngredient import run_scale [as 别名]
 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)
开发者ID:uw-cmg,项目名称:MAST,代码行数:23,代码来源:test_runingredient.py

示例2: test_run_scale_defect

# 需要导入模块: from MAST.ingredients.chopingredient import ChopIngredient [as 别名]
# 或者: from MAST.ingredients.chopingredient.ChopIngredient import run_scale [as 别名]
 def test_run_scale_defect(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['label1']=dict()
     kdict['label1']['subdefect1']=dict()
     kdict['label1']['subdefect1']['symbol']='Cr'
     kdict['label1']['subdefect1']['type']='interstitial'
     kdict['label1']['subdefect1']['coordinates']=np.array([0.8, 0.7, 0.6])
     kdict['label1']['subdefect2']=dict()
     kdict['label1']['subdefect2']['symbol']='Sr'
     kdict['label1']['subdefect2']['type']='antisite'
     kdict['label1']['subdefect2']['coordinates']=np.array([0.5,0.5,0.0])
     kdict['label1']['subdefect3']=dict()
     kdict['label1']['subdefect3']['symbol']='Cr'
     kdict['label1']['subdefect3']['type']='interstitial'
     kdict['label1']['subdefect3']['coordinates']=np.array([0.3,0.3,0.2])
     kdict['label1']['subdefect4']=dict()
     kdict['label1']['subdefect4']['symbol']='Fe'
     kdict['label1']['subdefect4']['type']='substitution'
     kdict['label1']['subdefect4']['coordinates']=np.array([0.25,0.75,0.75])
     kdict['label1']['subdefect5']=dict()
     kdict['label1']['subdefect5']['symbol']='O'
     kdict['label1']['subdefect5']['type']='vacancy'
     kdict['label1']['subdefect5']['coordinates']=np.array([0.5,0.25,0.75])
     kdict['label1']['subdefect6']=dict()
     kdict['label1']['subdefect6']['symbol']='Fe'
     kdict['label1']['subdefect6']['type']='substitution'
     kdict['label1']['subdefect6']['coordinates']=np.array([0.25,0.25,0.25])
     kdict['label1']['subdefect7']=dict()
     kdict['label1']['subdefect7']['symbol']='La'
     kdict['label1']['subdefect7']['type']='vacancy'
     kdict['label1']['subdefect7']['coordinates']=np.array([0,0,0.5])
     kdict['label1']['subdefect8']=dict()
     kdict['label1']['subdefect8']['symbol']='Ni'
     kdict['label1']['subdefect8']['type']='interstitial'
     kdict['label1']['subdefect8']['coordinates']=np.array([0.4,0.1,0.3])
     kdict['label1']['coord_type'] = 'fractional'
     kdict['label1']['threshold'] = 0.01
     kdict['label1']['charge'] = '2'
     mdict=dict()
     mdict['mast_program'] = 'vasp'
     mdict['mast_defect_settings']=dict()
     mdict['mast_defect_settings'].update(kdict['label1'])
     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=mdict, structure=my_structure)
     myri.run_scale()
     #copy contcar to poscar
     os.rename("%s/CONTCAR" % ingdir, "%s/POSCAR" % ingdir)
     myri.run_defect()
     my_defected = Poscar.from_file("%s/CONTCAR" % ingdir).structure.get_sorted_structure()
     defected_compare = Poscar.from_file("files/POSCAR_scaled_defected").structure.get_sorted_structure()
     self.assertEquals(my_defected, defected_compare)
开发者ID:uw-cmg,项目名称:MAST,代码行数:65,代码来源:test_runingredient.py


注:本文中的MAST.ingredients.chopingredient.ChopIngredient.run_scale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。