title: Cuda, calculate distance matrix between 3d objects
body: <p>I have a "string"(molecule) of connected N objects(atoms) in 3D (each atom has  a coordinates). And I need to calculate a distance between each pair of atoms in a molecule (see pseudo code below ). How could it be done with CUDA? Should I pass to a kernel function 2 3D Arrays? Or 3 arrays with coordinates: X[N], Y[N], Z[N]? Thanks.</p>
  
  <p>struct atom
      {
          double x,y,z;
      }</p>
  
  <pre><code>int main()
  {
  
  //N number of atoms in a molecule
  double DistanceMatrix[N][N];
  double d;
  atom Atoms[N];
  
  for (int i = 0; i &lt; N; i ++)
      for (int j = 0; j &lt; N; j++)
        DistanceMatrix[i][j] = (atoms[i].x -atoms[j].x)*(atoms[i].x -atoms[j].x) +
                       (atoms[i].y -atoms[j].y)* (atoms[i].y -atoms[j].y) + (atoms[i].z -atoms[j].z)* (atoms[i].z -atoms[j].z;
  
   }
  </code></pre>