I am trying to make a program for Metropolis Monte Carlo Simulation. I am still on the first two steps of the program. My problem is on how to output the the number of atoms, distance between two atoms, the Lennard-Jones Energy and total energy correctly in a matrix form. I think this is the part that I am having a problem.

Thank you.Code:float calculate_energy() // calculates the energies of the atoms { // Loop over all pairs of atoms and calculate // the LJ energy float Etotal=0.00; float r2; float e_lj; sigma = 0.0; epsilon = 1.23; for ( i = 0; i < n_atoms-1; i++) { for (j = i+1; j < n_atoms; j++) { r2 = sqrt(pow(coords[j][0] - coords[i][0],2)+ (coords[j][1] - coords[i][1],2)+ (coords[j][2] - coords[i][2],2)); //calculate the Lennard-Jones energy e_lj=4.0*epsilon*(pow(sigma,12)/pow(r2,12)-(pow(sigma,6)/pow(r2,12))); //calculate the total energy Etotal = Etotal+ e_lj; } } printf("Output number of atom, distance of the atom and LJE \n"); printf("%d\t %d\t %f\t %f\t \n",i,j,r2,e_lj); printf("Output the total energy: \t"); printf("%f \n",Etotal); return 0; } int main(){ printf("Output the calculated total energy \n"); read_intconfig(); calculate_energy(); fclose(fp); free(coords); return 0; }