Currently I have a program which goes through a list of vector coordinates and performs a simple math function on the two vectors, but I want to make a loop inside of a loop to be able to have more control on what happens, this is my program so far:
import operator
import numpy as np
b = 0
a = 1
for a in range(0,56):
vector1 = (int(l[b][0]),int(l[b][1]),int(l[b][2]))
vector2 = (int(l[a][0]),int(l[a][1]),int(l[a][2]))
#print vector1
#print vector2
x = vector1
y = vector2
vector3 = list(np.array(x) - np.array(y))
#print vector3
dotProduct = reduce( operator.add, map( operator.mul, vector3, vector3))
print dotProduct
a += 1
But what I want is that once a hits 56 and does its final run through, I want B to add 1 and a to reset back to zero, and redo the loop of operations until b goes up to 55.
Desired output: example of coordiantes:
Cu 46.7176 27.1121 27.1121
Cu 43.2505 36.0618 32.4879
Cu 43.3392 36.0964 28.9236
Cu 43.2509 37.8362 27.1091
Cu 34.4872 14.1794 16.5767
Cu 34.4103 16.0364 14.3521
Cu 32.7006 14.069 14.412
and I want the first coordinate to perform the dot product with everything under it, and go back and then start with the second coordinate and perform dot product with everything under it, and so on..
a
in thefor
loop as python does this for you.