fmmgen/generator.py
def generate_M_operators(order, symbols, M_dict):
    """
    generate_M_operators(order, symbols, index_dict):

    Generates multipole operators up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which
        define coordinate labels.

    index_dict:
        Forward mapping dictionary between
        monomials of symbols and array indices,
        generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic multipole moments up to order.

    Example:
    >>> order = 2
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, [x, y, z])
    >>> generate_M_operators(order, (x, y, z), map)
    [q, -q*x, -q*y, -q*z, q*x**2/2, q*x*y, q*x*z, q*y**2/2, q*y*z, q*z**2/2]
    """
    x, y, z = symbols
    M_operators = []
    for n in M_dict.keys():
        M_operators.append(M(n, symbols))
    return M_operators

    generate_M_operators(order, symbols, index_dict):

    Generates multipole operators up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which
        define coordinate labels.

    index_dict:
        Forward mapping dictionary between
        monomials of symbols and array indices,
        generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic multipole moments up to order.

    Example:
    >>> order = 2
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, [x, y, z])
    >>> generate_M_operators(order, (x, y, z), map)
    [q, -q*x, -q*y, -q*z, q*x**2/2, q*x*y, q*x*z, q*y**2/2, q*y*z, q*z**2/2]
    
generate_M_operators(order, symbols, index_dict):
Generates multipole operators up to order.

order, int:
Maximum order of multipole expansion

symbols, list:
List of sympy symbol type objects which
define coordinate labels.

Forward mapping dictionary between
monomials of symbols and array indices,
generated by generate_mappings or otherwise.

List of symbolic multipole moments up to order.
generate_M_operators ( order symbols index_dict ) : Generates multipole operators up to order . order int : Maximum order of multipole expansion symbols list : List of sympy symbol type objects which define coordinate labels . Forward mapping dictionary between monomials of symbols and array indices generated by generate_mappings or otherwise . List of symbolic multipole moments up to order .
def generate_M_operators(order, symbols, M_dict):
    x, y, z = symbols
    M_operators = []
    for n in M_dict.keys():
        M_operators.append(M(n, symbols))
    return M_operators
def generate_M_operators ( order , symbols , M_dict ) : x , y , z = symbols M_operators = [ ] for n in M_dict . keys ( ) : M_operators . append ( M ( n , symbols ) ) return M_operators
generate_M_operators(order, symbols, index_dict):
Generates multipole operators up to order.
generate_M_operators ( order symbols index_dict ) : Generates multipole operators up to order .
"""
    generate_M_operators(order, symbols, index_dict):

    Generates multipole operators up to order.

    Input:
    order, int:
        Maximum order of multipole expansion

    symbols, list:
        List of sympy symbol type objects which
        define coordinate labels.

    index_dict:
        Forward mapping dictionary between
        monomials of symbols and array indices,
        generated by generate_mappings or otherwise.

    Output:
    list:
        List of symbolic multipole moments up to order.

    Example:
    >>> order = 2
    >>> x, y, z = sp.symbols('x y z')
    >>> map, _ = generate_mappings(order, [x, y, z])
    >>> generate_M_operators(order, (x, y, z), map)
    [q, -q*x, -q*y, -q*z, q*x**2/2, q*x*y, q*x*z, q*y**2/2, q*y*z, q*z**2/2]
    """
order
symbols
M_dict
examples
None