Exemple #1
0
    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])
Exemple #2
0
    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])
Exemple #3
0
 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])
Exemple #4
0
 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])