Exemple #1
0
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)
    c_cv = np.dot(cell_cv, e)
    gd = GridDescriptor((n, n, n), c_cv, comm=mpi.serial_comm)
    pd = PWDescriptor(45, gd)
    aa_G = a_G / np.linalg.det(e)
    lfc = PWLFC([[s, p, d]], pd)
    lfc.set_positions(spos_ac)
Exemple #2
0
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)
    c_cv = np.dot(cell_cv, e)
    gd = GridDescriptor((n, n, n), c_cv, comm=mpi.serial_comm)
    pd = PWDescriptor(45, gd)
    aa_G = a_G / np.linalg.det(e)
    lfc = PWLFC([[s, p, d]], pd)