#include "layers.h"

int read_coords(char* label) {

  int k,n;
  FILE* file;
  char filename[256];

  n = 0;

  filename[0] = 'r';
  filename[1] = '0';
  filename[2] = '-';
  filename[3] = '\0';

  strcat(filename,label);

  if((file=fopen(filename,"r"))==NULL) {

    fprintf(stderr,"can't see no r0\n"); 
    exit(1); 

  } else {

    for(k=0;k<nsites;k++) {
        n += fscanf(file,"%le %le %le %le %le %le\n", 
          &(x[k]),&(y[k]),&(z[k]),&(xo[k]),&(yo[k]),&(zo[k]));
    }

  }

  if(n != 6*nsites) merr("Found incorrect number of coordinates in r0.\n");

  fclose(file);

  return(n);
}
