예제 #1
0
    def func(theta):
        """Parallelizing piece of code."""
        # Calculate the EM field vector in each of the dipole sites
        EHvec = EHinc_array(N, Dp, theta, [ncf1, ncf2], k, 'PW')

        # Calculate the self-consistent dipole coupling
        P = M.dot(EHvec)

        return P
else:
    Lambda, a_e, a_m = lambda_kerker(a, LambdaArray, eps_part,
                                     np.ones(len(eps_part)), 1)
    k = 2 * np.pi / Lambda

# ---------- OPTIONS OF THE PROGRAM ----------------------------------------- #
# --------------------------------------------------------------------------- #

theta = 0
Dp = 618.36 * nm

# For the Dp value, we calculate the dipole coupling
M = AGmatrix_array(Dp, N, a_e, a_m, k)

# Calculate the EM field vector in each of the dipole sites
EHvec = EHinc_array(N, Dp, theta, [ncf1, ncf2], k, 'PW')

# Calculate the self-consistent dipole coupling
P = M.dot(EHvec)

# Calculate the absolute value of the dipoles in each site
Pabs = np.zeros(N, dtype=float)
Mabs = np.zeros(N, dtype=float)
Px = np.zeros(N, dtype=float)
Py = np.zeros(N, dtype=float)
Pz = np.zeros(N, dtype=float)
Mx = np.zeros(N, dtype=float)
My = np.zeros(N, dtype=float)
Mz = np.zeros(N, dtype=float)
for i in range(0, N):