コード例 #1
0
ファイル: overlap.py プロジェクト: thonmaker/gpaw
def spherical_harmonics_and_derivatives(R_c, lmax=LMAX):
    R_c = np.asarray(R_c)
    drlYdR_lmc = []
    rlY_lm = spherical_harmonics(R_c, lmax)
    for l, rlY_m in enumerate(rlY_lm):
        drlYdR_mc = np.empty((2 * l + 1, 3))
        for m in range(2 * l + 1):
            L = l**2 + m
            drlYdR_mc[m, :] = nablarlYL(L, R_c)
        drlYdR_lmc.append(drlYdR_mc)
    return rlY_lm, drlYdR_lmc
コード例 #2
0
ファイル: overlap.py プロジェクト: robwarm/gpaw-symm
def spherical_harmonics_and_derivatives(R_c, lmax=LMAX):
    R_c = np.asarray(R_c)
    drlYdR_lmc = []
    rlY_lm = spherical_harmonics(R_c, lmax)
    for l, rlY_m in enumerate(rlY_lm):
        drlYdR_mc = np.empty((2 * l + 1, 3))
        for m in range(2 * l + 1):
            L = l**2 + m
            drlYdR_mc[m, :] = nablarlYL(L, R_c)
        drlYdR_lmc.append(drlYdR_mc)
    return rlY_lm, drlYdR_lmc
コード例 #3
0
    def _stress_tensor_contribution(self, v1, v2, cache, G1, G2,
                                    G_Gv, a_xG, c_axi, q):
        f_IG = np.empty((self.nI, G2 - G1), complex)
        K_v = self.pd.K_qv[q]
        for a, j, i1, i2, I1, I2 in self:
            l = self.lf_aj[a][j][0]
            spline = self.spline_aj[a][j]
            f_G, dfdGoG_G = cache[spline]

            emiGR_G = np.exp(-1j * np.dot(G_Gv, self.pos_av[a]))
            f_IG[I1:I2] = (emiGR_G * (-1.0j)**l *
                           np.exp(1j * np.dot(K_v, self.pos_av[a])) * (
                               dfdGoG_G[G1:G2] * G_Gv[:, v1] * G_Gv[:, v2] *
                               self.Y_qLG[q][l**2:(l + 1)**2, G1:G2] +
                               f_G[G1:G2] * G_Gv[:, v1] *
                               [nablarlYL(L, G_Gv.T)[v2]
                                for L in range(l**2, (l + 1)**2)]))

        c_xI = np.zeros(a_xG.shape[:-1] + (self.nI,), self.pd.dtype)

        b_xI = c_xI.reshape((np.prod(c_xI.shape[:-1], dtype=int), self.nI))
        a_xG = a_xG.reshape((-1, a_xG.shape[-1]))

        alpha = 1.0 / self.pd.gd.N_c.prod()
        if self.pd.dtype == float:
            alpha *= 2
            if G1 == 0:
                f_IG[:, 0] *= 0.5
            f_IG = f_IG.view(float)
            a_xG = a_xG.view(float)

        gemm(alpha, f_IG, a_xG, 0.0, b_xI, 'c')

        stress = 0.0
        for a, I1, I2 in self.indices:
            stress -= self.eikR_qa[q][a] * (c_axi[a] * c_xI[..., I1:I2]).sum()
        return stress.real
コード例 #4
0
ファイル: overlap.py プロジェクト: thonmaker/gpaw
 def evaluate(self, l):
     drlYdR_mc = np.empty((2 * l + 1, 3))
     L0 = l**2
     for m in range(2 * l + 1):
         drlYdR_mc[m, :] = nablarlYL(L0 + m, self.R_c)
     return drlYdR_mc
コード例 #5
0
ファイル: pawcorrection.py プロジェクト: yihsuanliu/gpaw
             L            v=1    L


        dY
          L
  A   = --- r
   Lv   dr
          v

"""
# A_nvL is defined as above, n is an expansion point index (50 Lebedev points).
rnablaY_nLv = np.empty((len(R_nv), 25, 3))
for rnablaY_Lv, Y_L, R_v in zip(rnablaY_nLv, Y_nL, R_nv):
    for l in range(5):
        for L in range(l**2, (l + 1)**2):
            rnablaY_Lv[L] = nablarlYL(L, R_v) - l * R_v * Y_L[L]


class PAWXCCorrection:
    def __init__(
        self,
        w_jg,  # all-lectron partial waves
        wt_jg,  # pseudo partial waves
        nc_g,  # core density
        nct_g,  # smooth core density
        rgd,  # radial grid descriptor
        jl,  # ?
        lmax,  # maximal angular momentum to consider
        Exc0,  # xc energy of reference atom
        phicorehole_g,  # ?
        fcorehole,  # ?
コード例 #6
0
ファイル: overlap.py プロジェクト: robwarm/gpaw-symm
 def evaluate(self, l):
     drlYdR_mc = np.empty((2 * l + 1, 3))
     L0 = l**2
     for m in range(2 * l + 1):
         drlYdR_mc[m, :] = nablarlYL(L0 + m, self.R_c)
     return drlYdR_mc
コード例 #7
0
ファイル: pawcorrection.py プロジェクト: robwarm/gpaw-symm
             L            v=1    L


        dY
          L
  A   = --- r
   Lv   dr
          v

"""
# A_nvL is defined as above, n is an expansion point index (50 Lebedev points).
rnablaY_nLv = np.empty((len(R_nv), 25, 3))
for rnablaY_Lv, Y_L, R_v in zip(rnablaY_nLv, Y_nL, R_nv):
    for l in range(5):
        for L in range(l**2, (l + 1)**2):
            rnablaY_Lv[L] = nablarlYL(L, R_v)  - l * R_v * Y_L[L]


class PAWXCCorrection:
    def __init__(self,
                 w_jg,  # all-lectron partial waves
                 wt_jg, # pseudo partial waves
                 nc_g,  # core density
                 nct_g, # smooth core density
                 rgd,   # radial grid descriptor
                 jl,    # ?
                 lmax,  # maximal angular momentum to consider
                 Exc0,  # xc energy of reference atom
                 phicorehole_g, # ?
                 fcorehole,     # ?
                 tauc_g,   # kinetic core energy array