本文整理汇总了Python中ase.tasks.task.OptimizeTask.calculate方法的典型用法代码示例。如果您正苦于以下问题:Python OptimizeTask.calculate方法的具体用法?Python OptimizeTask.calculate怎么用?Python OptimizeTask.calculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ase.tasks.task.OptimizeTask
的用法示例。
在下文中一共展示了OptimizeTask.calculate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calculate
# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import calculate [as 别名]
def calculate(self, name, atoms):
if self.fit and len(atoms) == 2:
return self.fit_bond_length(name, atoms)
else:
data = OptimizeTask.calculate(self, name, atoms)
self.check_occupation_numbers(atoms)
return data
示例2: calculate
# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import calculate [as 别名]
def calculate(self, name, atoms):
data = OptimizeTask.calculate(self, name, atoms)
if self.fmax is not None and len(atoms) == 2:
data['distance'] = atoms.get_distance(0, 1)
self.check_occupation_numbers(atoms)
if self.fit and len(atoms) == 2:
self.fit_bond_length(name, atoms, data)
return data
示例3: calculate
# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import calculate [as 别名]
def calculate(self, name, atoms):
if self.fmax is not None:
# this performs relaxation of internal degrees of freedom
data = OptimizeTask.calculate(self, name, atoms)
data['distance'] = atoms.get_distance(0, -1)
else:
# no optimization
if self.fit is None or len(atoms) != 2:
# for dimers: only calculate single-point energy if no fit follows
data = OptimizeTask.calculate(self, name, atoms)
if self.fit is not None and len(atoms) == 2:
if self.fmax is not None:
# fit after optimization
self.fit_bond_length(name, atoms, data)
else:
# fit is the only task performed
data = self.fit_bond_length(name, atoms)
self.check_occupation_numbers(atoms)
return data
示例4: calculate
# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import calculate [as 别名]
def calculate(self, name, atoms):
#????
if self.sfmax is not None and self.fmax is not None:
# this performs first relaxation of internal degrees of freedom
data = OptimizeTask.calculate(self, name, atoms)
# writing traj from optimizer does not work for StrainFilter!
traj = Trajectory(self.get_filename(name, 'traj'), 'a', atoms)
sf = StrainFilter(atoms)
while not self.converged(atoms, sfmax=self.sfmax, fmax=self.fmax):
# take a step on the cell
self.soptimize(name, sf, data, trajectory=traj)
# relax internal degrees of freedom
OptimizeTask.optimize(self, name, atoms, data, trajectory=traj)
data['relaxed energy'] = atoms.get_potential_energy()
data['relaxed volume'] = atoms.get_volume()
elif self.sfmax is not None:
# this performs single-point energy calculation
data = OptimizeTask.calculate(self, name, atoms)
sf = StrainFilter(atoms)
# writing traj from optimizer does not work for StrainFilter!
traj = Trajectory(self.get_filename(name, 'traj'), 'w', atoms)
self.soptimize(name, sf, data, trajectory=traj)
data['relaxed energy'] = atoms.get_potential_energy()
data['relaxed volume'] = atoms.get_volume()
elif self.fmax is not None:
data = OptimizeTask.calculate(self, name, atoms)
else:
# no optimization
if self.fit is None:
# only calculate single-point energy if no fit follows
data = OptimizeTask.calculate(self, name, atoms)
if self.fit is not None:
if self.sfmax is not None or self.fmax is not None:
# fit after optimization
self.fit_volume(name, atoms, data)
else:
# fit is the only task performed
data = self.fit_volume(name, atoms)
return data
示例5: calculate
# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import calculate [as 别名]
def calculate(self, name, atoms):
#????
if self.fit:
return self.fit_volume(name, atoms)
else:
return OptimizeTask.calculate(self, name, atoms)