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


Python Vasp.calculate方法代码示例

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


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

示例1: calculate

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import calculate [as 别名]
    def calculate(self, atoms):
        '''
        Blocking/Non-blocking calculate method

        If we are in blocking mode we just run, wait for 
        the job to end and read in the results. Easy ...
        
        The non-blocking mode is a little tricky. 
        We need to start the job and guard against it reading 
        back possible old data from the directory - the queuing 
        system may not even started the job when we get control 
        back from the starting script. Thus anything we read 
        after invocation is potentially garbage - even if it 
        is a converged calculation data.

        We handle it by custom run function above which 
        raises an exception after submitting the job.
        This skips post-run processing in the calculator, preserves 
        the state of the data and signals here that we need to wait
        for results.
        '''
        
        with work_dir(self.working_dir) :
            self.prepare_calc_dir()
            self.calc_running=True
            #print('Run VASP.calculate')
            try :
                Vasp.calculate(self, atoms)
                self.calc_running=False
                #print('VASP.calculate returned')
            except _NonBlockingRunException as e:
                # We have nothing else to docs
                # until the job finishes
                #print('Interrupted ', self.working_dir, os.getcwd())
                pass
开发者ID:digideskio,项目名称:Elastic,代码行数:37,代码来源:parcalc.py

示例2: vasp_vol_relax

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import calculate [as 别名]
def vasp_vol_relax():
    Al = bulk("Al", "fcc", a=4.5, cubic=True)
    calc = Vasp(xc="LDA", isif=7, nsw=5, ibrion=1, ediffg=-1e-3, lwave=False, lcharg=False)
    calc.calculate(Al)

    # Explicitly parse atomic position output file from Vasp
    CONTCAR_Al = io.read("CONTCAR", format="vasp")

    print("Stress after relaxation:\n", calc.read_stress())

    print("Al cell post relaxation from calc:\n", calc.get_atoms().get_cell())
    print("Al cell post relaxation from atoms:\n", Al.get_cell())
    print("Al cell post relaxation from CONTCAR:\n", CONTCAR_Al.get_cell())

    # All the cells should be the same.
    assert (calc.get_atoms().get_cell() == CONTCAR_Al.get_cell()).all()
    assert (Al.get_cell() == CONTCAR_Al.get_cell()).all()

    return Al
开发者ID:jboes,项目名称:ase,代码行数:21,代码来源:vasp_Al_volrelax.py

示例3: vasp_vol_relax

# 需要导入模块: from ase.calculators.vasp import Vasp [as 别名]
# 或者: from ase.calculators.vasp.Vasp import calculate [as 别名]
def vasp_vol_relax():
    Al = bulk('Al', 'fcc', a=4.5, cubic=True)
    calc = Vasp(xc='LDA', isif=7, nsw=5,
                ibrion=1, ediffg=-1e-3, lwave=False, lcharg=False)
    calc.calculate(Al)

    # Explicitly parse atomic position output file from Vasp
    CONTCAR_Al = io.read('CONTCAR', format='vasp')

    print 'Stress after relaxation:\n', calc.read_stress()

    print 'Al cell post relaxation from calc:\n', calc.get_atoms().get_cell()
    print 'Al cell post relaxation from atoms:\n', Al.get_cell()
    print 'Al cell post relaxation from CONTCAR:\n', CONTCAR_Al.get_cell()

    # All the cells should be the same.
    assert (calc.get_atoms().get_cell() == CONTCAR_Al.get_cell()).all()
    assert (Al.get_cell() == CONTCAR_Al.get_cell()).all()

    return Al
开发者ID:JConwayAWT,项目名称:PGSS14CC,代码行数:22,代码来源:vasp_Al_volrelax.py


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