#include "dump2analysis.h"

double DT = 0.0;
int TAU = -1;
int TAU_SHIFT = 1;
      
double DR =  0.01;
double RMAX = 20.005;
double RMIN =  0.005;
double RCUT = 2.3;
double RCUT_AB = 2.3;
double RCUT_BC = 2.3;
double RADIUS = 0.68; /* Ionic Radius of Li+ */

double DA = 0.1;

int NX = 100;
int NY = 100;
int NZ = 100;
int CUBE_TYPE = 1;

void InitParam(PARAM *param){
  param->atoms = 0;
  param->steps = 0;
  strcpy(param->infile, "");
  strcpy(param->outfile, "");
  strcpy(param->mode, "");
  param->Aid = NULL;
  param->Bid = NULL;
  param->Cid = NULL;
  strcpy(param->Aelem, "");
  strcpy(param->Belem, "");
  strcpy(param->Celem, "");
  param->Atype = -1;
  param->Btype = -1;
  param->Ctype = -1;
}

void SetAtomsSteps(PARAM *param){
  char buf[512];
  int i;
  FILE *f;

  f = fopen(param->infile, "r");
  printf("%s\n", param->infile);
  for (i=0; i<4; i++) fgets(buf, sizeof(buf), f);
  param->atoms = atoi(buf);
  rewind(f);
  for (i=0; fgets(buf, sizeof(buf), f) != NULL; i++);
  param->steps = i/(param->atoms+9);
  fclose(f);
}

int main(int argn, char** argv){
  PARAM param;
  
  InitParam(&param);
  SetArgment(argn,  argv, &param);
  if (strcmp(param.mode, "msd") == 0) EstimateMSD(&param);
  if (strcmp(param.mode, "gr") == 0) EstimateGr(&param);
  if (strcmp(param.mode, "angle") == 0) EstimateAngle(&param);
  if (strcmp(param.mode, "cube") == 0) EstimateCube(&param);
  if (strcmp(param.mode, "cube_jump") == 0) EstimateCube_Jump(&param);
  if (strcmp(param.mode, "cube_radius") == 0) EstimateCube_Radius(&param);
  if (strcmp(param.mode, "vcorr") == 0) EstimateVelocityCorr(&param);
  if (strcmp(param.mode, "rcorr") == 0) EstimateRotationCorr(&param);
  if (strcmp(param.mode, "vanHove") == 0) EstimateVanHove(&param);

}
