Example #1
0
    def initialize(self, nspins):
        self.nspins = nspins
        name = short_names.get(self.name, self.name)
        number = _gpaw.lxcXCFuncNum(name)
        if number is not None:
            f = number
            xc = -1
            x = -1
            c = -1
            if '_XC_' in name:
                xc = f
            elif '_C_' in name:
                c = f
            else:
                x = f
        else:
            try:
                x, c = name.split('+')
            except ValueError:
                raise NameError('Unknown functional: "%s".' % name)
            xc = -1
            x = _gpaw.lxcXCFuncNum(x)
            c = _gpaw.lxcXCFuncNum(c)
            if x is None or c is None:
                raise NameError('Unknown functional: "%s".' % name)

        self.xc = _gpaw.lxcXCFunctional(xc, x, c, nspins)
        self.set_omega()

        if self.xc.is_mgga():
            self.type = 'MGGA'
        elif self.xc.is_gga():
            self.type = 'GGA'
        else:
            self.type = 'LDA'
Example #2
0
    def initialize(self, nspins):
        self.nspins = nspins
        name = short_names.get(self.name, self.name)
        number = _gpaw.lxcXCFuncNum(name)
        if number is not None:
            f = number
            xc = -1
            x = -1
            c = -1
            if '_XC_' in name:
                xc = f
            elif '_C_' in name:
                c = f
            else:
                x = f
        else:
            try:
                x, c = name.split('+')
            except ValueError:
                raise NameError('Unknown functional: "%s".' % name)
            xc = -1
            x = _gpaw.lxcXCFuncNum(x)
            c = _gpaw.lxcXCFuncNum(c)

        self.xc = _gpaw.lxcXCFunctional(xc, x, c, nspins)

        if self.xc.is_mgga():
            self.type = 'MGGA'
        elif self.xc.is_gga():
            self.type = 'GGA'
        else:
            self.type = 'LDA'
Example #3
0
from ase import Atoms
from ase.dft.bee import BEEFEnsemble, readbee
from gpaw import GPAW
from gpaw.test import equal, gen
from gpaw.mpi import world
import _gpaw

newlibxc = _gpaw.lxcXCFuncNum('MGGA_X_MBEEF') is not None

c = {'energy': 0.001, 'eigenstates': 1, 'density': 1}
d = 0.75

gen('H', xcname='PBEsol')

for xc, E0, dE0 in [('mBEEF', 4.86, 0.16), ('BEEF-vdW', 5.13, 0.20),
                    ('mBEEF-vdW', 4.74, 0.36)]:
    print(xc)
    if not newlibxc and xc[0] == 'm':
        print('Skipped')
        continue

    # H2 molecule:
    h2 = Atoms('H2', [[0, 0, 0], [0, 0, d]])
    h2.center(vacuum=2)
    h2.calc = GPAW(txt='H2-' + xc + '.txt', convergence=c)
    h2.get_potential_energy()
    h2.calc.set(xc=xc)
    h2.get_potential_energy()
    h2.get_forces()
    ens = BEEFEnsemble(h2.calc)
    e_h2 = ens.get_ensemble_energies()
Example #4
0
from ase import Atoms
from ase.dft.bee import BEEFEnsemble, readbee
from gpaw import GPAW
from gpaw.test import equal, gen
from gpaw.mpi import world
import _gpaw

newlibxc = _gpaw.lxcXCFuncNum("MGGA_X_MBEEF") is not None

c = {"energy": 0.001, "eigenstates": 1, "density": 1}
d = 0.75

gen("H", xcname="PBEsol")

for xc, E0, dE0 in [("mBEEF", 4.86, 0.16), ("BEEF-vdW", 5.13, 0.20), ("mBEEF-vdW", 4.74, 0.36)]:
    print(xc)
    if not newlibxc and xc[0] == "m":
        print("Skipped")
        continue

    # H2 molecule:
    h2 = Atoms("H2", [[0, 0, 0], [0, 0, d]])
    h2.center(vacuum=2)
    h2.calc = GPAW(txt="H2-" + xc + ".txt", convergence=c)
    h2.get_potential_energy()
    h2.calc.set(xc=xc)
    h2.get_potential_energy()
    h2.get_forces()
    ens = BEEFEnsemble(h2.calc)
    e_h2 = ens.get_ensemble_energies()