# %%
import numpy as np

def dr(*x, p = 3):
    print(np.round(x, p))

def vol(x):
    return np.dot(x[0], np.cross(x[1], x[2]))

# %%
A_metal = 4.08
# a_general = np.array(((1/np.sqrt(2), 1/np.sqrt(2), 0), (1/np.sqrt(2), 0, 1/np.sqrt(2)), (0, 1/np.sqrt(2), 1/np.sqrt(2))))
a_metal = A_metal/2 * np.array(((0, 1, 1), (1, 0, 1), (1, 1, 0)))

dr(a_metal)

a = a_metal
V_metal = np.dot(a[0], np.cross(a[1], a[2]))

dr(V_metal, A_metal**3/4)

a_ = 2*np.pi/V_metal * np.array((np.cross(a[1],a[2]), np.cross(a[0], a[2]), np.cross(a[0], a[1])))

dr(a_)

dr(a_[0][0], 2*np.pi/A)

X = np.array((0, 0, 1)) * A
L = np.array((0.5, 0.5, 0.5)) * A
K = np.array((0.75, 0.75, 0)) * A

dr(X, L, K)

dr(vol(a_))

# %%

A_diel = 6.48

a_diel = a_general * A_diel

dr(a_diel)

a = a_diel
V_diel = np.dot(a[0], np.cross(a[1], a[2]))

dr(V_diel)

a_ = 2*np.pi/np.abs(V_diel) * np.array((np.cross(a[1],a[2]), np.cross(a[0], a[2]), np.cross(a[0], a[1])))

dr(a_)
# %%
a = a_general
dr(2*np.pi/(np.dot(a[0], np.cross(a[1], a[2])))*np.cross(a[1], a[2]))