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


Python OptimizeTask.optimize方法代码示例

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


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

示例1: calculate

# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import optimize [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
开发者ID:jboes,项目名称:ase,代码行数:41,代码来源:bulk.py


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