c_axi[0][0, 0] = 1.9 cr_axi = {0: np.zeros((1, 2 * l + 1))} cr_axi[0][0, 0] = 1.9 b = pd.zeros(1, dtype=complex) br = pdr.zeros(1) lfc.set_positions(spos_ac) lfc.add(b, c_axi) lfcr.set_positions(spos_ac) lfcr.add(br, cr_axi) a = pd.ifft(b) ar = pdr.ifft(br) equal(abs(a-ar).max(), 0, 1e-14) if l == 0: a = a[:, ::-1].copy() b0 = pd.fft(a) br0 = pdr.fft(a.real) lfc.integrate(b0, c_axi) lfcr.integrate(br0, cr_axi) assert abs(c_axi[0][0]-cr_axi[0][0]).max() < 1e-14 c_axiv = {0: np.zeros((1, 2 * l + 1, 3), complex)} cr_axiv = {0: np.zeros((1, 2 * l + 1, 3))} lfc.derivative(b0, c_axiv) lfcr.derivative(br0, cr_axiv) assert abs(c_axiv[0][0]-cr_axiv[0][0]).max() < 1e-14
spos_ac = np.array([(0.15, 0.45, 0.95)]) pd = PWDescriptor(45, gd) a_G = pd.fft(a_R) s = Spline(0, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) p = Spline(1, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) d = Spline(2, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) lfc = PWLFC([[s, p, d]], pd) lfc.set_positions(spos_ac) b_LG = pd.zeros(9) lfc.add(b_LG, {0: np.eye(9)}) e1 = pd.integrate(a_G, b_LG) assert abs(lfc.integrate(a_G)[0] - e1).max() < 1e-11 s1 = [] for i in range(9): x = [0, 0, 0, 0, 0, 0, 0, 0, 0] x[i] = 1 s1.append(lfc.stress_tensor_contribution(a_G, {0: x}) - np.eye(3) * e1[i]) x = 1e-6 for dist in [[[x, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, x, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, x]], [[0, x, 0], [x, 0, 0], [0, 0, 0]], [[0, 0, x], [0, 0, 0], [x, 0, 0]], [[0, 0, 0], [0, 0, x], [0, x, 0]]]: e = dist + np.eye(3)
spos_ac = np.array([(0.15, 0.45, 0.95)]) pd = PWDescriptor(45, gd) a_G = pd.fft(a_R) s = Spline(0, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) p = Spline(1, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) d = Spline(2, rc, 2 * x**1.5 / np.pi * np.exp(-x * r**2)) lfc = PWLFC([[s, p, d]], pd) lfc.set_positions(spos_ac) b_LG = pd.zeros(9) lfc.add(b_LG, {0: np.eye(9)}) e1 = pd.integrate(a_G, b_LG) assert abs(lfc.integrate(a_G)[0] - e1).max() < 1e-11 s1 = [] for i in range(9): x = [0, 0, 0, 0, 0, 0, 0, 0, 0] x[i] = 1 s1.append(lfc.stress_tensor_contribution(a_G, {0: x}) - np.eye(3) * e1[i]) x = 1e-6 for dist in [[[x, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, x, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, x]], [[0, x, 0], [x, 0, 0], [0, 0, 0]], [[0, 0, x], [0, 0, 0], [x, 0, 0]], [[0, 0, 0], [0, 0, x], [0, x, 0]]]: