Exemplo n.º 1
0
def radial_sto(n, zeta, l, r):
    """Build radial part of slater type orbital"""
#       Stolen from gpaw all_electron.py (intialize_wave_functions)
#
#       STOs are defined as
#
#           N Y_l^m r^{n-1} exp(-zeta * r)
#
#           N = (2 zeta)^n sqrt(2 zeta / (2n)!)
    assert n > 0
    radial = r**(n + l + 0.5)
    radial *= exp(-zeta * r)
    N = (2 * zeta)**(n + l) * sqrt(2 * zeta / fact(2 * (n + l)))
    radial *= N  # perhaps also do Y_l^m normalization
    return radial
Exemplo n.º 2
0
    def __init__(self, gd, v, scale=1.0, n=1, dtype=float, allocate=True):
        h = (gd.h_cv**2).sum(1)**0.5
        d = gd.xxxiucell_cv[:,v]
        A=np.zeros((2*n+1,2*n+1))
        for i,io in enumerate(range(-n,n+1)):
            for j in range(2*n+1):
                A[i,j]=io**j/float(fact(j))
        A[n,0]=1.
        coefs=np.linalg.inv(A)[1]
        coefs=np.delete(coefs,len(coefs)//2)
        offs=np.delete(np.arange(-n,n+1),n)
        coef_p = []
        offset_pc = []
        for i in range(3):
            if abs(d[i])>1e-11:
                coef_p.extend(list(coefs * d[i] / h[i] * scale))
                offset = np.zeros((2*n, 3), int)
                offset[:,i]=offs
                offset_pc.extend(offset)

        FDOperator.__init__(self, coef_p, offset_pc, gd, dtype, allocate)
Exemplo n.º 3
0
Arquivo: csh.py Projeto: qsnake/gpaw
def intYdYdtheta_ey(l1, m1, l2, m2):
    """Calculates::

                  pi 2pi
                  /  /      *                    d Y(u,v)
           A    = |  |    Y (u,v) cos(u)*sin(v) --- l'm'  sin(u) dv du
            LL'   /  /     lm                    du  
                  0  0

    where u = theta and v = phi in the usual notation. Note that the result
    is only non-zero if `|l1-l2|` is odd and `|m1-m2|` = 1 (stricter rule applies).
    """
    if abs(l1-l2) % 2 != 1 or abs(m1-m2) != 1:
        return 0.0
    scale = -C(l1,m1)*C(l2,m2)*np.sign(m1-m2)*np.pi/1j
    if abs(m1) == abs(m2)+1:
        if l1+1 == l2:
            return scale*2/(2.0*l2+1)*(l2+1)/(2.0*l2-1.0)*fact(l2+abs(m2))/fact(l2-abs(m2)-1)*(l2-abs(m2)-1)
        elif l1-1 == l2:
            return scale*2/(2.0*l2+1)*((l2+1)*fact(l2+abs(m2))/fact(l2-abs(m2))*(l2-abs(m2))-l2/(2.0*l2+3.0)*fact(l2+abs(m2)+1)/fact(l2-abs(m2))*(l2-abs(m2)+1))
        elif l1-l2 > 2: # and (l1-l2)%2 == 1 which is always true
            return -scale*2*abs(m2)*fact(l2+abs(m2))/fact(l2-abs(m2))
        else:
            return 0.0
    else:
        assert abs(m1) == abs(m2)-1
        if l1 == l2+1:
            return -scale*2/(2.0*l1+1.0)*(l1-1)/(2.0*l1-1.0)*fact(l1+abs(m1))/fact(l1-abs(m1)-1)*(l1-abs(m1)-1)
        elif l1 == l2-1:
            return -scale*2/(2.0*l1+1.0)*((l1+1)/(2.0*l1+3.0)*fact(l1+abs(m1)+1)/fact(l1-abs(m1))*(l1-abs(m1)+1)-(abs(m1)+1)*fact(l1+abs(m1))/fact(l1-abs(m1))*(l1-abs(m1)))
        elif l2-l1 > 2: # and (l2-l1)%2 == 1 which is always true
            return scale*2*(abs(m1)+1)*fact(l1+abs(m1))/fact(l1-abs(m1))
        else:
            return 0.0