biosspheres.laplace.crossinteractions#

Routine listings#

v_0_sj_semi_analytic_v1d v_0_sj_semi_analytic_v2d v_0_js_from_v_0_sj k_0_sj_semi_analytic_v1d k_0_sj_semi_analytic_v2d k_0_sj_from_v_0_sj ka_0_sj_semi_analytic_recurrence_v1d ka_0_sj_semi_analytic_recurrence_v2d ka_0_sj_from_k_js ka_0_sj_from_v_sj w_0_sj_from_v_sj a_0_sj_and_js_v1d a_0_sj_and_js_v2d all_cross_interactions_n_spheres_v1d all_cross_interactions_n_spheres_v2d v_sj_v_js_property_checks_cuts

Functions

a_0_sj_and_js_v1d(big_l, r_j, r_s, r_coord, ...)

Returns two numpy arrays that represents a numerical approximation of two matrices formed by the following boundary integral operators: a_sj = [-K_{s,j}^0 , V_{s,j}^0 ] [ W_{s,j}^0 , K_{s,j}^{*0}] a_js = [-K_{j,s}^0 , V_{j,s}^0 ] [ W_{j,s}^0 , K_{j,s}^{*0}] with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not use any symmetry or properties of the spherical harmonics.

a_0_sj_and_js_v2d(big_l, r_j, r_s, r_coord, ...)

Returns two numpy arrays that represents a numerical approximation of two matrices formed by the following boundary integral operators: a_sj = [-K_{s,j}^0 , V_{s,j}^0 ] [ W_{s,j}^0 , K_{s,j}^{*0}] a_js = [-K_{j,s}^0 , V_{j,s}^0 ] [ W_{j,s}^0 , K_{j,s}^{*0}] with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

all_cross_interactions_n_spheres_v1d(n, ...)

Returns an array with all the cross interactions for the given n spheres.

all_cross_interactions_n_spheres_v2d(n, ...)

Returns an array with all the cross interactions for the given n spheres.

k_0_sj_from_v_0_sj(data_v, r_j, el_diagonal)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

k_0_sj_semi_analytic_v1d(big_l, r_j, r_s, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

k_0_sj_semi_analytic_v2d(big_l, r_j, r_s, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

ka_0_sj_from_k_js(data_kjs)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to K_{j,s}^0 (notice the change of the order of the indexes indicating the spheres).

ka_0_sj_from_v_sj(data_v_sj, r_s, el_diagonal)

Returns a numpy array that represents a numerical approximation of

ka_0_sj_semi_analytic_recurrence_v1d(big_l, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not use any symmetry or properties of the spherical harmonics.

ka_0_sj_semi_analytic_recurrence_v2d(big_l, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d of the module biosspheres.quadratures.spheres.

v_0_js_from_v_0_sj(data_v_sj)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{j,s}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

v_0_sj_semi_analytic_v1d(big_l, r_j, r_s, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

v_0_sj_semi_analytic_v2d(big_l, r_j, r_s, ...)

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics.

v_sj_v_js_property_checks_cuts(v_sj, v_js, ...)

w_0_sj_from_v_sj(data_v_sj, r_j, r_s, ...)

Returns a numpy array that represents a numerical approximation of

biosspheres.laplace.crossinteractions.a_0_sj_and_js_v1d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, final_length: int, transform: ndarray, diagonal: ndarray) → tuple[ndarray, ndarray][source]#

Returns two numpy arrays that represents a numerical approximation of two matrices formed by the following boundary integral operators: a_sj = [-K_{s,j}^0 , V_{s,j}^0 ]

[ W_{s,j}^0 , K_{s,j}^{*0}]

a_js = [-K_{j,s}^0 , V_{j,s}^0 ]

[ W_{j,s}^0 , K_{j,s}^{*0}]

with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not use any symmetry or properties of the spherical harmonics.

Notes

The only operator computed directly with the numerical quadrature is V_{s,j}^0, which follows the same steps as v_0_sj_semi_analytic_v1d. The others are computed with the same properties used in: v_0_js_from_v_0_sj k_0_sj_from_v_0_sj ka_0_sj_from_v_sj w_0_sj_from_v_sj

Parameters:
  • big_l (int) – >= 0, max degree.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • phi_coord (np.ndarray) – Array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • cos_theta_coord (np.ndarray) – Array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Lengths equal to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • final_length (int) – How many points for the surface integral. Can come from the function spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

  • transform (np.ndarray) – of floats, for doing the real spherical harmonic transform. Can come from the function real_spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

  • diagonal (np.ndarray) – from diagonal_l_dense

Returns:

  • a_sj (numpy array) – Shape (2 * (big_l+1)**2, 2 * (big_l+1)**2).

  • a_js (numpy array) – Shape (2 * (big_l+1)**2, 2 * (big_l+1)**2).

biosspheres.laplace.crossinteractions.a_0_sj_and_js_v2d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, weights: ndarray, zeros: ndarray, quantity_theta_points: int, quantity_phi_points: int, pesykus: ndarray, p2_plus_p_plus_q: ndarray, p2_plus_p_minus_q: ndarray, diagonal: ndarray) → tuple[ndarray, ndarray][source]#

Returns two numpy arrays that represents a numerical approximation of two matrices formed by the following boundary integral operators: a_sj = [-K_{s,j}^0 , V_{s,j}^0 ]

[ W_{s,j}^0 , K_{s,j}^{*0}]

a_js = [-K_{j,s}^0 , V_{j,s}^0 ]

[ W_{j,s}^0 , K_{j,s}^{*0}]

with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

Notes

The only operator computed directly with the numerical quadrature is V_{s,j}^0, which follows the same steps as v_0_sj_semi_analytic_v2d. The others are computed with the same properties used in: v_0_js_from_v_0_sj k_0_sj_from_v_0_sj ka_0_sj_from_v_sj w_0_sj_from_v_sj

Parameters:
  • big_l (int) – >= 0, max degree of spherical harmonics used.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • weights (np.ndarray) – of floats. Weights for the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • zeros (np.ndarray) – of floats. Zeros of the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_theta_points (int) – how many points for the integral in theta. Can come from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_phi_points (int) – how many points for the integral in phi. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • pesykus (np.ndarray) – dtype int, shape ((big_l+1) * big_l // 2, 2). Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_plus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_minus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • diagonal (np.ndarray) – from diagonal_l_dense

Returns:

  • a_sj (numpy array) – Shape (2 * (big_l+1)**2, 2 * (big_l+1)**2).

  • a_js (numpy array) – Shape (2 * (big_l+1)**2, 2 * (big_l+1)**2).

biosspheres.laplace.crossinteractions.all_cross_interactions_n_spheres_v1d(n: int, big_l: int, big_l_c: int, radii: ndarray, center_positions: list[ndarray]) → ndarray[source]#

Returns an array with all the cross interactions for the given n spheres. It is a SLOW routine.

Notes

Uses the following: quadratures.real_spherical_harmonic_transform_1d(big_l, big_l_c) auxindexes.diagonal_l_dense(big_l) quadratures.from_sphere_s_cartesian_to_j_spherical_1d a_0_sj_and_js_v1d

Parameters:
  • n (int) – >= 2. Number of spheres.

  • big_l (int) – >= 0, max degree.

  • big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.

  • radii (np.ndarray) – Array with the radii of the spheres.

  • center_positions – List or arrays with the center position of the spheres

Returns:

almost_big_a_0 – Shape ( 2 * n * (big_l + 1) ** 2, 2 * n * (big_l + 1) ** 2).

Return type:

np.ndarray

biosspheres.laplace.crossinteractions.all_cross_interactions_n_spheres_v2d(n: int, big_l: int, big_l_c: int, radii: ndarray, center_positions: list[ndarray]) → ndarray[source]#

Returns an array with all the cross interactions for the given n spheres.

Notes

Uses the following: auxindexes.pes_y_kus quadratures.quadrature_points_sphere_shtools_version_2d auxindexes.diagonal_l_dense quadratures.from_sphere_s_cartesian_to_j_spherical_2d a_0_sj_and_js_v2d

Parameters:
  • n (int) – >= 2. Number of spheres.

  • big_l (int) – >= 0, max degree.

  • big_l_c (int) – >= 0. It’s the parameter used to compute the points of the quadrature.

  • radii (np.ndarray) – Array with the radii of the spheres.

  • center_positions (array_like) – List or array with the center position of the spheres

Returns:

almost_big_a_0 – Shape ( 2 * n * (big_l + 1) ** 2, 2 * n * (big_l + 1) ** 2).

Return type:

np.ndarray

biosspheres.laplace.crossinteractions.k_0_sj_from_v_0_sj(data_v: ndarray, r_j: float, el_diagonal: dia_array) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to the testing of V_{s,j}^0.

Notes

data_k[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

This computation uses the following result for this specific case: K_{s,j}^0 Y_{l,m} = - l / r_j V_{s,j}^0 Y_{l,m}.

Parameters:
  • data_v (np.ndarray) – that represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with spherical harmonics.

  • r_j (float) – > 0, radius of the sphere j.

  • el_diagonal (scipy.sparse.dia_array) – comes from biosspheres.miscella.auxindexes.diagonal_l_sparse

Returns:

data_k – Same shape than data_v. See notes for the indexes ordering.

Return type:

np.ndarray

biosspheres.laplace.crossinteractions.k_0_sj_semi_analytic_v1d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, final_length: int, transform: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not use any symmetry or properties of the spherical harmonics.

Notes

data_k[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression K_{s,j}^0 Y_l,m,j can be obtained analytically. A quadrature scheme is used to compute the surface integral corresponding to the inner product.

Parameters:
  • big_l (int) – >= 0, max degree.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • phi_coord (np.ndarray) – Array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • cos_theta_coord (np.ndarray) – Array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Lengths equal to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • final_length (int) – How many points for the surface integral. Can come from the function spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

  • transform (np.ndarray) – of floats, for doing the real spherical harmonic transform. Can come from the function real_spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

Returns:

data_k – of floats. Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.k_0_sj_semi_analytic_v2d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, weights: ndarray, zeros: ndarray, quantity_theta_points: int, quantity_phi_points: float, pesykus: ndarray, p2_plus_p_plus_q: ndarray, p2_plus_p_minus_q: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

Notes

data_k[p(2p + 1) + q, l(2l + 1) + m] =

( K_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression K_{s,j}^0 Y_l,m,j can be obtained analytically. A quadrature scheme is used to compute the other surface integral. It uses functions from the package pyshtools to compute the spherical harmonic transforms.

Parameters:
  • big_l (int) – >= 0, max degree of spherical harmonics used.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • weights (np.ndarray) – of floats. Weights for the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • zeros (np.ndarray) – of floats. Zeros of the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_theta_points (int) – how many points for the integral in theta. Can come from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_phi_points (int) – how many points for the integral in phi. Can come fron the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • pesykus (np.ndarray) – dtype int, shape ((big_l+1) * big_l // 2, 2). Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_plus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_minus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

Returns:

data_k – of floats. Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.ka_0_sj_from_k_js(data_kjs: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to K_{j,s}^0 (notice the change of the order of the indexes indicating the spheres).

Notes

data_ka_sj[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

This computation uses the following result for this specific case: ( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

= ( K_{j,s}^0 Y_p,q,s ; Y_l,m,j )_{L^2(S_j)}.

Parameters:

data_kjs (numpy array.) – represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with spherical harmonics.

Returns:

data_ka_sj – Same shape than data_kjs. See notes for the indexes ordering.

Return type:

numpy array.

biosspheres.laplace.crossinteractions.ka_0_sj_from_v_sj(data_v_sj: ndarray, r_s: float, el_diagonal: dia_array) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to V_{s,j}^0.

data_ka[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

This computation uses the following result for this specific case: ( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

= -

rac{p}{r_j} ( V_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

data_v_sjnp.ndarray

represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with spherical harmonics.

r_sfloat

> 0, radius of the sphere s.

el_diagonalscipy.sparse.dia_array

that comes from biosspheres.miscella.auxindexes.diagonal_l_sparse

data_kanumpy array.

Same shape than data_v_sj. See notes for the indexes ordering.

ka_0_sj_semi_analytic_recurrence_v1d ka_0_sj_semi_analytic_recurrence_v2d ka_0_sj_from_k_js

biosspheres.laplace.crossinteractions.ka_0_sj_semi_analytic_recurrence_v1d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, er_times_n: ndarray, etheta_times_n: ndarray, ephi_times_n: ndarray, final_length: int, transform: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not use any symmetry or properties of the spherical harmonics.

Notes

data_ka[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression K_{s,j}^{*0} Y_l,m,j can be obtained analytically. A quadrature scheme is used to compute the other surface integral corresponding to the inner product. For computing the derivative in theta a recurrence formula for Legendre Functions is used.

In this routine the quadrature points NEED to be ordered in an array of one dimension.

Parameters:
  • big_l (int) – >= 0, max degree.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – One dimensional array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • phi_coord (np.ndarray) – One dimensional array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • cos_theta_coord (np.ndarray) – One dimensional array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Lenght equals to final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • er_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate r in the points in the coordinate system s and the normal of a sphere. Length final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • etheta_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate theta in the points in the coordinate system s and the normal of a sphere. Length final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • ephi_times_n (np.ndarray) – One dimensional array of floats with the dot product of the canonical vector of the spherical coordinate phi in the points in the coordinate system s and the normal of a sphere. Length final_length. Can come from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_1d

  • final_length (int) – how many points for the surface integral, (big_l_c + 1) * (2 * big_l_c + 1).

  • transform (np.ndarray) – of floats, for doing the real spherical harmonic transform. Shape ((big_l+1)**2, final_length)

Returns:

data_ka – Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.ka_0_sj_semi_analytic_recurrence_v2d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, er_times_n: ndarray, etheta_times_n: ndarray, ephi_times_n: ndarray, weights: ndarray, zeros: ndarray, quantity_theta_points: int, quantity_phi_points: float, pesykus: ndarray, p2_plus_p_plus_q: ndarray, p2_plus_p_minus_q: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator K_{s,j}^{*0} with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d of the module biosspheres.quadratures.spheres.

Notes

data_ka[p*(2p+1) + q, l*(2l+1) + m] =

( K_{s,j}^{*0} Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression K_{s,j}^{*0} Y_l,m,j can be obtained analytically. A quadrature scheme is used to compute the other surface integral corresponding to the inner product. For computing the derivative in theta a recurrence formula for Legendre Functions is used.

In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d of the module biosspheres.quadratures.spheres. It uses functions from the package pyshtools to compute the spherical harmonic transforms.

Parameters:
  • big_l (int) – >= 0, max degree.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • er_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate r in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • etheta_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate theta in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • ephi_times_n (np.ndarray) – Two dimensional array of floats with the dot product of the canonical vector of the spherical coordinate phi in the points in the coordinate system s and the normal of a sphere. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from biosspheres.quadratures.spheres. from_sphere_s_cartesian_to_j_spherical_and_spherical_vectors_2d

  • weights (np.ndarray) – of floats. Weights for the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • zeros (np.ndarray) – of floats. Zeros of the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_theta_points (int) – how many points for the integral in theta. Can come from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_phi_points (int) – how many points for the integral in phi. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • pesykus (np.ndarray) – dtype int, shape ((big_l+1) * big_l // 2, 2). Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_plus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_minus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

Returns:

data_ka – Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.v_0_js_from_v_0_sj(data_v_sj: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{j,s}^0 with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to V_{s,j}^0 (notice the change of the order of the indexes indicating the spheres).

Notes

data_v_js[p*(2p+1) + q, l*(2l+1) + m] =

( V_{j,s}^0 Y_{l,m,s} ; Y_{p,q,j} )_{L^2(S_j)}.

Y_{l,m,s}spherical harmonic degree l, order m, in the coordinate

system s.

S_j : surface of the sphere j.

This computation uses the following result for this specific case: ( V_{j,s}^0 Y_{l,m,s} ; Y_{p,q,j} )_{L^2(S_j)}.

= ( V_{s,j}^0 Y_{p,q,j} ; Y_{l,m,s} )_{L^2(S_s)}

Parameters:

data_v_sj (np.ndarray) – of floats. Represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with spherical harmonics.

Returns:

data_v_js – of floats. Same shape than data_v_sj. See notes for the indexes ordering.

Return type:

np.ndarray

biosspheres.laplace.crossinteractions.v_0_sj_semi_analytic_v1d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, final_length: int, transform: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of one dimension. It is a SLOW routine, because it does not have performance improvements for the real spherical harmonic transform algorithm.

Notes

data_v[p(2p + 1) + q, l(2l + 1) + m] =

( V_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression V_{s,j}^0 Y_{l,m,j} is analytic. A quadrature scheme is used to compute the surface integral corresponding to the inner product.

Parameters:
  • big_l (int) – >= 0, max degree of spherical harmonics used.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • phi_coord (np.ndarray) – Array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Length equals to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • cos_theta_coord (np.ndarray) – Array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Lengths equal to final_length. Can come from the function from_sphere_s_cartesian_to_j_spherical_1d of the module biosspheres.quadratures.spheres.

  • final_length (int) – How many points for the surface integral. Can come from the function spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

  • transform (np.ndarray) – of floats, for doing the real spherical harmonic transform. Can come from the function real_spherical_harmonic_transform_1d of the module biosspheres.quadratures.spheres.

Returns:

data_v – of floats. Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.v_0_sj_semi_analytic_v2d(big_l: int, r_j: float, r_s: float, r_coord: ndarray, phi_coord: ndarray, cos_theta_coord: ndarray, weights: ndarray, zeros: ndarray, quantity_theta_points: int, quantity_phi_points: float, pesykus: ndarray, p2_plus_p_plus_q: ndarray, p2_plus_p_minus_q: ndarray) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. In this routine the quadrature points NEED to be ordered in an array of two dimensions, given by the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

Notes

data_v[p(2p + 1) + q, l(2l + 1) + m] =

( V_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

The expression V_{s,j}^0 Y_{l,m,j} is analytic. A quadrature scheme is used to compute the surface integral corresponding to the inner product.

It uses functions from the package pyshtools to compute the spherical harmonic transforms. These functions have performance improvements.

Parameters:
  • big_l (int) – >= 0, max degree of spherical harmonics used.

  • r_j (float) – > 0, radius of the sphere j.

  • r_s (float) – > 0, radius of the sphere s.

  • r_coord (np.ndarray) – Two dimensional array of floats with the spherical coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • phi_coord (np.ndarray) – Two dimensional array of floats with the phi coordinate r of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • cos_theta_coord (np.ndarray) – Two dimensional array of floats with the cosine of the spherical coordinate theta of the quadrature points in the coordinate system s. Shape equals to (quantity_theta_points, quantity_phi_points). Comes from the function from_sphere_s_cartesian_to_j_spherical_2d of the module biosspheres.quadratures.spheres.

  • weights (np.ndarray) – of floats. Weights for the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • zeros (np.ndarray) – of floats. Zeros of the integral quadrature in the theta variable. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_theta_points (int) – how many points for the integral in theta. Can come from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • quantity_phi_points (int) – how many points for the integral in phi. Comes from the function gauss_legendre_trapezoidal_shtools_2d from the module biosspheres.quadratures.spheres.

  • pesykus (np.ndarray) – dtype int, shape ((big_l+1) * big_l // 2, 2). Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_plus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

  • p2_plus_p_minus_q (np.ndarray) – dtype int, length (big_l+1) * big_l // 2. Used for the vectorization of some computations. Comes from the function biosspheres.miscella.auxindexes.pes_y_kus(big_l)

Returns:

data_v – of floats. Shape ((big_l+1)**2, (big_l+1)**2). See notes for the indexes ordering.

Return type:

numpy array

biosspheres.laplace.crossinteractions.w_0_sj_from_v_sj(data_v_sj: ndarray, r_j: float, r_s: float, el_diagonal: dia_array) → ndarray[source]#

Returns a numpy array that represents a numerical approximation of the matrix formed by the boundary integral operator W_{s,j}^0 with Laplace kernel evaluated and tested with real spherical harmonics. This routine needs the numpy array corresponding to V_{s,j}^0.

data_w[p*(2p+1) + q, l*(2l+1) + m] =

( W_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}.

Y_{l,m,j}spherical harmonic degree l, order m, in the coordinate

system j.

S_s : surface of the sphere s.

This computation uses the following result for this specific case: ( W_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

= -

rac{l p}{r_j r_s}
  • ( V_{s,j}^0 Y_{l,m,j} ; Y_{p,q,s} )_{L^2(S_s)}

data_v_sjnp.ndarray

represents a numerical approximation of the matrix formed by the boundary integral operator V_{s,j}^0 with Laplace kernel evaluated and tested with spherical harmonics.

r_jfloat

> 0, radius of the sphere j.

r_sfloat

> 0, radius of the sphere s.

el_diagonalscipy.sparse.dia_array

that comes from biosspheres.miscella.auxindexes.diagonal_l_sparse

data_wnumpy array.

Same shape than data_v_js. See notes for the indexes ordering.