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


Python OptimizeTask.analyse方法代码示例

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


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

示例1: analyse

# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import analyse [as 别名]
    def analyse(self):
        OptimizeTask.analyse(self)

        for name, data in self.data.items():
            if 'distances' in data:
                distances = data['distances']
                energies = data['energies']
                fit0 = np.poly1d(np.polyfit(1 / distances, energies, 3))
                fit1 = np.polyder(fit0, 1)
                fit2 = np.polyder(fit1, 1)

                dmin = None
                for t in np.roots(fit1):
                    if t > 0 and fit2(t) > 0:
                        dmin = 1 / t
                        break

                if dmin is None:
                    raise ValueError('No minimum!')

                if abs(dmin) < min(distances) or abs(dmin) > max(distances):
                    raise ValueError('Fit outside of range! ' + \
                                      str(abs(dmin)) + ' not in ' + \
                                      str(distances))

                emin = fit0(t)
                k = fit2(t) * t**4
                m1, m2 = self.create_system(name).get_masses()
                m = m1 * m2 / (m1 + m2)
                hnu = units._hbar * 1e10 * sqrt(k / units._e / units._amu / m)

                data['minimum energy'] = emin
                self.results[name][1:] = [energies[2] - emin, dmin, 1000 * hnu]
            else:
                self.results[name].extend([None, None])

        for name, data in self.data.items():
            atoms = self.create_system(name)
            if len(atoms) == 1:
                self.results[name].extend([None, None])
                continue

            eatoms = 0.0
            for symbol in atoms.get_chemical_symbols():
                if symbol in self.data and symbol != name:
                    eatoms += self.data[symbol]['energy']
                else:
                    eatoms = None
                    break
            ea = None
            ea0 = None
            if eatoms is not None:
                ea = eatoms - data['energy']
                if 'minimum energy' in data:
                    ea0 = eatoms - data['minimum energy']
            self.results[name].extend([ea, ea0])
开发者ID:gjuhasz,项目名称:ase,代码行数:58,代码来源:molecule.py

示例2: analyse

# 需要导入模块: from ase.tasks.task import OptimizeTask [as 别名]
# 或者: from ase.tasks.task.OptimizeTask import analyse [as 别名]
 def analyse(self):
     OptimizeTask.analyse(self)
     for name, data in self.data.items():
         if 'strains' in data:
             atoms = self.create_system(name)
             volumes = data['strains']**3 * atoms.get_volume()
             energies = data['energies']
             eos = EquationOfState(volumes, energies)
             try:
                 v, e, B = eos.fit()
             except ValueError:
                 self.results[name].extend([None, None])
             else:
                 self.results[name][1:] = [energies[2] - e, v,
                                           B * 1e24 / units.kJ]
         else:
             self.results[name].extend([None, None])
开发者ID:gjuhasz,项目名称:ase,代码行数:19,代码来源:bulk.py


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