Académique Documents
Professionnel Documents
Culture Documents
"""
i : potential location
r : distance between particles
p : list of charged particles
sigma : Ewald convergence parameter, determines the relative rate of
convergence b/w real and reciprocal sum
n_max : an integer defines the range of real-space sum and control its max no
of vectors
m_max : an integer define the summation range in the reciprocal space and its
no of vectors
"""
if len(vec_1) != len(vec_2):
return 0
dot_product = 0
for i in range(len(vec_1)):
dot_product += vec_1[i] * vec_2[i]
return dot_product
def compute_norm(vector):
summation = 0
for i in range(len(vector)):
summation += vector[i]**2
distance = sqrt(summation)
return distance