fmmgen/generator.py
def generate_M2P_operators(order, symbols, M_dict,
                           potential=True, field=True, source_order=0,
                           harmonic_derivs=False):
    """
    generate_M2L_operators(order, symbols, index_dict)

    Generates potential and field calculation operators for the
    Barnes-Hut method up to order.
    """
    x, y, z = symbols
    R = (x**2 + y**2 + z**2)**0.5

    terms = []

    V = L((0, 0, 0), order, symbols, M_dict, source_order=source_order, eval_derivs=True).subs('R', R)
    if potential:
        terms.append(V.subs(1/R, 'Rinv'))

    if field:
        Fx = -sp.diff(V, x).subs(1/R, 'Rinv')
        Fy = -sp.diff(V, y).subs(1/R, 'Rinv')
        Fz = -sp.diff(V, z).subs(1/R, 'Rinv')
        terms.append(Fx)
        terms.append(Fy)
        terms.append(Fz)

    return terms

    generate_M2L_operators(order, symbols, index_dict)

    Generates potential and field calculation operators for the
    Barnes-Hut method up to order.
    
generate_M2L_operators(order, symbols, index_dict)
Generates potential and field calculation operators for the
Barnes-Hut method up to order.
generate_M2L_operators ( order symbols index_dict ) Generates potential and field calculation operators for the Barnes - Hut method up to order .
def generate_M2P_operators(order, symbols, M_dict,
                           potential=True, field=True, source_order=0,
                           harmonic_derivs=False):
    x, y, z = symbols
    R = (x**2 + y**2 + z**2)**0.5
    terms = []
    V = L((0, 0, 0), order, symbols, M_dict, source_order=source_order, eval_derivs=True).subs('R', R)
    if potential:
        terms.append(V.subs(1/R, 'Rinv'))
    if field:
        Fx = -sp.diff(V, x).subs(1/R, 'Rinv')
        Fy = -sp.diff(V, y).subs(1/R, 'Rinv')
        Fz = -sp.diff(V, z).subs(1/R, 'Rinv')
        terms.append(Fx)
        terms.append(Fy)
        terms.append(Fz)
    return terms
def generate_M2P_operators ( order , symbols , M_dict , potential = True , field = True , source_order = 0 , harmonic_derivs = False ) : x , y , z = symbols R = ( x ** 2 + y ** 2 + z ** 2 ) ** 0.5 terms = [ ] V = L ( ( 0 , 0 , 0 ) , order , symbols , M_dict , source_order = source_order , eval_derivs = True ) . subs ( 'R' , R ) if potential : terms . append ( V . subs ( 1 / R , 'Rinv' ) ) if field : Fx = - sp . diff ( V , x ) . subs ( 1 / R , 'Rinv' ) Fy = - sp . diff ( V , y ) . subs ( 1 / R , 'Rinv' ) Fz = - sp . diff ( V , z ) . subs ( 1 / R , 'Rinv' ) terms . append ( Fx ) terms . append ( Fy ) terms . append ( Fz ) return terms
generate_M2L_operators(order, symbols, index_dict)
Generates potential and field calculation operators for the
Barnes-Hut method up to order.
generate_M2L_operators ( order symbols index_dict ) Generates potential and field calculation operators for the Barnes - Hut method up to order .
"""
    generate_M2L_operators(order, symbols, index_dict)

    Generates potential and field calculation operators for the
    Barnes-Hut method up to order.
    """
order
symbols
M_dict
potential
field
source_order
harmonic_derivs