The problem is my box is not orthorhombic (base angles different than 90 degrees). So, I am getting wrong results with the formula,
def distance(a, b):
dx = abs(a[0] - b[0])
x = min(dx, abs(A - dx))
dy = abs(a[1] - b[1])
y = min(dy, abs(B - dy))
dz = abs(a[2] - b[2])
z = min(dz, abs(C - dz))
return sp.sqrt(x**2 + y**2 + z**2)
Any suggestion on how to get the proper distance between any atom and its neighbours, including the periodic images of the neighbours. Basically, it makes the results of RDF and CN unphysical.