Exemplo n.º 1
0
Arquivo: mgga.py Projeto: qsnake/gpaw
    def __init__(self, kernel, nn=1):
        """Meta GGA functional.

        nn: int
            Number of neighbor grid points to use for FD stencil for
            wave function gradient.
        """
        self.nn = nn
        GGA.__init__(self, kernel)
Exemplo n.º 2
0
 def __init__(self, atoms, parameters, qna_setup_name='PBE', alpha=2.0,
              override_atoms=None, stencil=2):
     # override_atoms is only used to test the partial derivatives
     # of xc-functional
     kernel = QNAKernel(self)
     GGA.__init__(self, kernel, stencil=stencil)
     self.atoms = atoms
     self.parameters = parameters
     self.qna_setup_name = qna_setup_name
     self.alpha = alpha
     self.override_atoms = override_atoms
     self.orbital_dependent = False
Exemplo n.º 3
0
    def __init__(
        self,
        name,
        world=None,
        q0cut=5.0,
        phi0=0.5,
        ds=1.0,
        Dmax=20.0,
        nD=201,
        ndelta=21,
        soft_correction=False,
        kernel=None,
        Zab=None,
        vdwcoef=1.0,
        verbose=False,
        energy_only=False,
    ):
        """vdW-DF.

        parameters:

        name: str
            Name of functional.
        world: MPI communicator
            Communicator to parallelize over.  Defaults to gpaw.mpi.world.
        q0cut: float
            Maximum value for q0.
        phi0: float
            Smooth value for phi(0,0).
        ds: float
            Cutoff for smooth kernel.
        Dmax: float
            Maximum value for D.
        nD: int
            Number of values for D in kernel-table.
        ndelta: int
            Number of values for delta in kernel-table.
        soft_correction: bool
            Correct for soft kernel.
        kernel:
            Which kernel to use.
        Zab:
            parameter in nonlocal kernel.
        vdwcoef: float
            Scaling of vdW energy.
        verbose: bool
            Print useful information.
        """

        if world is None:
            self.world = mpi.world
        else:
            self.world = world

        self.q0cut = q0cut
        self.phi0 = phi0
        self.ds = ds

        self.delta_i = np.linspace(0, 1.0, ndelta)
        self.D_j = np.linspace(0, Dmax, nD)

        self.verbose = verbose

        self.read_table()

        self.soft_correction = soft_correction
        if soft_correction:
            dD = self.D_j[1]
            self.C_soft = np.dot(self.D_j ** 2, self.phi_ij[0]) * 4 * pi * dD

        self.gd = None
        self.energy_only = energy_only
        self.timer = nulltimer

        if name == "vdW-DF":
            assert kernel is None and Zab is None
            kernel = LibXC("GGA_X_PBE_R+LDA_C_PW")
            Zab = -0.8491
        elif name == "vdW-DF2":
            assert kernel is None and Zab is None
            kernel = LibXC("GGA_X_RPW86+LDA_C_PW")
            Zab = -1.887
        elif name == "optPBE-vdW":
            assert kernel is None and Zab is None
            kernel = LibXC("GGA_X_OPTPBE_VDW+LDA_C_PW")
            Zab = -0.8491
        elif name == "optB88-vdW":
            assert kernel is None and Zab is None
            kernel = LibXC("GGA_X_OPTB88_VDW+LDA_C_PW")
            Zab = -0.8491
        elif name == "C09-vdW":
            assert kernel is None and Zab is None
            kernel = LibXC("GGA_X_C09X+LDA_C_PW")
            Zab = -0.8491
        else:
            assert kernel is not None and Zab is not None

        self.Zab = Zab
        GGA.__init__(self, kernel)
        self.vdwcoef = vdwcoef
        self.name = name
        self.LDAc = LibXC("LDA_C_PW")
Exemplo n.º 4
0
 def __init__(self, kernel):
     """Meta GGA functional."""
     GGA.__init__(self, kernel)
Exemplo n.º 5
0
 def __init__(self, kernel):
     """Meta GGA functional."""
     GGA.__init__(self, kernel)
Exemplo n.º 6
0
 def __init__(self, name, kernel, **kwargs):
     RealSpaceVDWFunctional.__init__(self, **kwargs)
     GGA.__init__(self, kernel)
     self.name = name
Exemplo n.º 7
0
 def __init__(self, name, kernel, **kwargs):
     RealSpaceVDWFunctional.__init__(self, **kwargs)
     GGA.__init__(self, kernel)
     self.name = name
Exemplo n.º 8
0
    def __init__(self,
                 name,
                 world=None,
                 q0cut=5.0,
                 phi0=0.5,
                 ds=1.0,
                 Dmax=20.0,
                 nD=201,
                 ndelta=21,
                 soft_correction=False,
                 kernel=None,
                 Zab=None,
                 vdwcoef=1.0,
                 verbose=False,
                 energy_only=False):
        """vdW-DF.

        parameters:

        name: str
            Name of functional.
        world: MPI communicator
            Communicator to parallelize over.  Defaults to gpaw.mpi.world.
        q0cut: float
            Maximum value for q0.
        phi0: float
            Smooth value for phi(0,0).
        ds: float
            Cutoff for smooth kernel.
        Dmax: float
            Maximum value for D.
        nD: int
            Number of values for D in kernel-table.
        ndelta: int
            Number of values for delta in kernel-table.
        soft_correction: bool
            Correct for soft kernel.
        kernel:
            Which kernel to use.
        Zab:
            parameter in nonlocal kernel.
        vdwcoef: float
            Scaling of vdW energy.
        verbose: bool
            Print useful information.
        """

        if world is None:
            self.world = mpi.world
        else:
            self.world = world

        self.q0cut = q0cut
        self.phi0 = phi0
        self.ds = ds

        self.delta_i = np.linspace(0, 1.0, ndelta)
        self.D_j = np.linspace(0, Dmax, nD)

        self.verbose = verbose

        self.read_table()

        self.soft_correction = soft_correction
        if soft_correction:
            dD = self.D_j[1]
            self.C_soft = np.dot(self.D_j**2, self.phi_ij[0]) * 4 * pi * dD

        self.gd = None
        self.energy_only = energy_only
        self.timer = nulltimer

        if name == 'vdW-DF':
            assert kernel is None and Zab is None
            kernel = LibXC('GGA_X_PBE_R+LDA_C_PW')
            Zab = -0.8491
        elif name == 'vdW-DF2':
            assert kernel is None and Zab is None
            kernel = LibXC('GGA_X_PW86+LDA_C_PW')
            Zab = -1.887

        self.Zab = Zab
        GGA.__init__(self, kernel)
        self.vdwcoef = vdwcoef
        self.name = name
        self.LDAc = LibXC('LDA_C_PW')