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


Python Poscar.structure方法代码示例

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


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

示例1: _vasp_poscar_setup

# 需要导入模块: from pymatgen.io.vaspio import Poscar [as 别名]
# 或者: from pymatgen.io.vaspio.Poscar import structure [as 别名]
 def _vasp_poscar_setup(self):
     """Set up the POSCAR file for a single VASP run.
     """
     name = self.keywords['name']
     pospath = os.path.join(name, "POSCAR")
     if os.path.isfile(pospath):
         my_poscar = Poscar.from_file(pospath) 
         #parent should have given a structure
     else: #this is an originating run; mast should give it a structure
         if self.keywords['structure'] is not None:
             my_poscar = Poscar(self.keywords['structure'])
         else:
             pf = os.path.join(os.path.dirname(name),'POSCAR_%s'%os.path.basename(name))
             if os.path.isfile(pf):
                 my_poscar = Poscar.from_file(pf)
         workdir=os.path.dirname(name)
         sdir=os.path.join(workdir,"structure_index_files")
         if os.path.exists(sdir):
             mystr=my_poscar.structure
             manname="manifest___"
             myatomindex=AtomIndex(structure_index_directory=sdir)
             newstr=myatomindex.graft_new_coordinates_from_manifest(mystr, manname, "")
             self.logger.info("Getting original coordinates from manifest.")
             new_pos=Poscar(newstr)
             my_poscar=new_pos
         self.logger.info("No POSCAR found from a parent; base structure used for %s" % self.keywords['name'])
     if 'mast_coordinates' in self.keywords['program_keys'].keys():
         sxtend = StructureExtensions(struc_work1=my_poscar.structure, name=self.keywords['name'])
         coordstrucs=self.get_coordinates_only_structure_from_input()
         newstruc = sxtend.graft_coordinates_onto_structure(coordstrucs[0])
         my_poscar.structure=newstruc.copy()
     dirutil.lock_directory(name)
     my_poscar.write_file(pospath)
     dirutil.unlock_directory(name)
     return my_poscar
开发者ID:ZhewenSong,项目名称:USIT,代码行数:37,代码来源:vaspchecker.py

示例2: set_up_neb_folders

# 需要导入模块: from pymatgen.io.vaspio import Poscar [as 别名]
# 或者: from pymatgen.io.vaspio.Poscar import structure [as 别名]
 def set_up_neb_folders(self, image_structures):
     """Set up NEB folders.
         Args:
            image_structures <list of Structure>: List
                of image structures
     """
     imct=0
     myname = self.keywords['name']
     if 'mast_coordinates' in self.keywords['program_keys'].keys():
         coordstrucs=self.get_coordinates_only_structure_from_input()
         newstrucs=list()
         sidx = 0 #ex. coordstrucs 0, 1, 2 for 3 images
         while sidx < self.keywords['program_keys']['mast_neb_settings']['images']:
             sxtend = StructureExtensions(struc_work1=image_structures[sidx+1].copy(), name=self.keywords['name'])
             newstrucs.append(sxtend.graft_coordinates_onto_structure(coordstrucs[sidx]))
             sidx = sidx + 1
     while imct < len(image_structures):
         imposcar = Poscar(image_structures[imct])
         num_str = str(imct).zfill(2)
         impath = os.path.join(myname, num_str)
         impospath = os.path.join(myname, "POSCAR_" + num_str)
         if 'mast_coordinates' in self.keywords['program_keys'].keys():
             if imct == 0: #skip endpoint
                 pass 
             elif imct == len(image_structures)-1: #skip other endpt
                 pass
             else:
                 imposcar.structure=newstrucs[imct-1].copy()
         dirutil.lock_directory(myname)
         imposcar.write_file(impospath)
         dirutil.unlock_directory(myname)
         try:
             os.makedirs(impath)
         except OSError:
             self.logger.warning("Directory at %s already exists." % impath)
             return None
         dirutil.lock_directory(impath)
         imposcar.write_file(os.path.join(impath, "POSCAR"))
         dirutil.unlock_directory(impath)
         imct = imct + 1
     return
开发者ID:ZhewenSong,项目名称:USIT,代码行数:43,代码来源:vaspnebchecker.py


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