本文整理汇总了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
示例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
示例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