Current python for loop not efficent
There isn't any need to name all your Sx variables and copy+paste the code to build each one; just build them in another loop.  You can do both loops as list comprehensions very concisely:

data = np.array([
    [(r[i+s*N, 0] - rcom[s, 0])**2 for i in range(N)]    
    for s in range(400)
])