Ejemplo n.º 1
0
def dYdtheta(l,m,theta,phi):
    if m == 0:
        return C(l,m)*dlegendre(l,abs(m),np.cos(theta))
    elif m > 0:
        return C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.cos(m*phi)*2**0.5
    else:
        return C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.sin(abs(m)*phi)*2**0.5
Ejemplo n.º 2
0
def dYdtheta(l, m, theta, phi):
    if m == 0:
        return C(l, m) * dlegendre(l, abs(m), np.cos(theta))
    elif m > 0:
        return C(l, m) * dlegendre(l, abs(m), np.cos(theta)) * np.cos(
            m * phi) * 2**0.5
    else:
        return C(l, m) * dlegendre(l, abs(m), np.cos(theta)) * np.sin(
            abs(m) * phi) * 2**0.5
Ejemplo n.º 3
0
Archivo: rsh.py Proyecto: qsnake/gpaw
def dYdtheta(l,m,theta,phi):
    if m == 0:
        #return _dYdtheta(l,m,theta,phi)
        return C(l,m)*dlegendre(l,abs(m),np.cos(theta))
    elif m > 0:
        #return (-1)**m*np.real(_dYdtheta(l,abs(m),theta,phi))*2**0.5
        #return (-1)**m*(_dYdtheta(l,m,theta,phi)+_dYdtheta(l,m,theta,phi).conj())/2**0.5
        #return (-1)**m*(_dYdtheta(l,m,theta,phi)+(-1)**m*_dYdtheta(l,-m,theta,phi))/2**0.5
        #return (-1)**m*_C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.cos(m*phi)*2**0.5
        return C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.cos(m*phi)*2**0.5
    else:
        #return (-1)**m*np.imag(_dYdtheta(l,abs(m),theta,phi))*2**0.5
        #return (-1)**m*(_dYdtheta(l,abs(m),theta,phi)-_dYdtheta(l,abs(m),theta,phi).conj())/(2**0.5*1j)
        #return (-1)**m*(_dYdtheta(l,abs(m),theta,phi)-(-1)**abs(m)*_dYdtheta(l,-abs(m),theta,phi))/(2**0.5*1j)
        #return -_C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.sin(m*phi)*2**0.5
        return -C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.sin(m*phi)*2**0.5
Ejemplo n.º 4
0
def dYdtheta(l, m, theta, phi):
    if m == 0:
        #return _dYdtheta(l,m,theta,phi)
        return C(l, m) * dlegendre(l, abs(m), np.cos(theta))
    elif m > 0:
        #return (-1)**m*np.real(_dYdtheta(l,abs(m),theta,phi))*2**0.5
        #return (-1)**m*(_dYdtheta(l,m,theta,phi)+_dYdtheta(l,m,theta,phi).conj())/2**0.5
        #return (-1)**m*(_dYdtheta(l,m,theta,phi)+(-1)**m*_dYdtheta(l,-m,theta,phi))/2**0.5
        #return (-1)**m*_C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.cos(m*phi)*2**0.5
        return C(l, m) * dlegendre(l, abs(m), np.cos(theta)) * np.cos(
            m * phi) * 2**0.5
    else:
        #return (-1)**m*np.imag(_dYdtheta(l,abs(m),theta,phi))*2**0.5
        #return (-1)**m*(_dYdtheta(l,abs(m),theta,phi)-_dYdtheta(l,abs(m),theta,phi).conj())/(2**0.5*1j)
        #return (-1)**m*(_dYdtheta(l,abs(m),theta,phi)-(-1)**abs(m)*_dYdtheta(l,-abs(m),theta,phi))/(2**0.5*1j)
        #return -_C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.sin(m*phi)*2**0.5
        return -C(l, m) * dlegendre(l, abs(m), np.cos(theta)) * np.sin(
            m * phi) * 2**0.5
Ejemplo n.º 5
0
Archivo: csh.py Proyecto: qsnake/gpaw
import numpy as np

from gpaw.utilities import fact
from gpaw.sphere import lmfact
from gpaw.sphere.legendre import ilegendre, legendre, dlegendre

# Define the Heaviside function
heaviside = lambda x: (1.0+np.sign(x))/2.0

# Define spherical harmoncics and normalization coefficient
C = lambda l,m: (-1)**((m+abs(m))//2)*((2.*l+1.)/(4*np.pi*lmfact(l,m)))**0.5
Y = lambda l,m,theta,phi: C(l,m)*legendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# Define theta-derivative of spherical harmoncics
dYdtheta = lambda l,m,theta,phi: C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# Define phi-derivative of spherical harmoncics
dYdphi = lambda l,m,theta,phi: 1j*m*C(l,m)*legendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# -------------------------------------------------------------------

def intYY(l1, m1, l2, m2):
    """Calculates::

                  pi 2pi
                  /  /      *
           A    = |  |    Y (u,v) Y (u,v) sin(u) dv du
            LL'   /  /     lm      l'm'
                  0  0
Ejemplo n.º 6
0
from math import factorial as fact
import numpy as np

from gpaw.sphere import lmfact
from gpaw.sphere.legendre import ilegendre, legendre, dlegendre

# Define the Heaviside function
heaviside = lambda x: (1.0+np.sign(x))/2.0

# Define spherical harmoncics and normalization coefficient
C = lambda l,m: (-1)**((m+abs(m))//2)*((2.*l+1.)/(4*np.pi*lmfact(l,m)))**0.5
Y = lambda l,m,theta,phi: C(l,m)*legendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# Define theta-derivative of spherical harmoncics
dYdtheta = lambda l,m,theta,phi: C(l,m)*dlegendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# Define phi-derivative of spherical harmoncics
dYdphi = lambda l,m,theta,phi: 1j*m*C(l,m)*legendre(l,abs(m),np.cos(theta))*np.exp(1j*m*phi)

# -------------------------------------------------------------------

def intYY(l1, m1, l2, m2):
    """Calculates::

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

    where u = theta and v = phi in the usual notation. Note that the result