Unverified Commit 171d74f2 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

remove class member name clashes. Pointers contains `infile` so we rename other uses to `inpfile`

parent f190647a
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -115,25 +115,25 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) :
    char *result;
    int count;

    FILE *infile = fopen(xifilename,"r");
    if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
    FILE *inpfile = fopen(xifilename,"r");
    if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
    for (int i = 0; i < 4; i++) {
      result = fgets(line,IMGMAX,infile);
      result = fgets(line,IMGMAX,inpfile);
      if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
      count = sscanf(line,"%lg %lg %lg",&Rxi[i][0],&Rxi[i][1],&Rxi[i][2]);
      if (count != 3) error->one(FLERR,"Fix orient/bcc file read failed");
    }
    fclose(infile);
    fclose(inpfile);

    infile = fopen(chifilename,"r");
    if (infile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
    inpfile = fopen(chifilename,"r");
    if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed");
    for (int i = 0; i < 4; i++) {
      result = fgets(line,IMGMAX,infile);
      result = fgets(line,IMGMAX,inpfile);
      if (!result) error->one(FLERR,"Fix orient/bcc file read failed");
      count = sscanf(line,"%lg %lg %lg",&Rchi[i][0],&Rchi[i][1],&Rchi[i][2]);
      if (count != 3) error->one(FLERR,"Fix orient/bcc file read failed");
    }
    fclose(infile);
    fclose(inpfile);
  }

  MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);
+8 −8
Original line number Diff line number Diff line
@@ -113,25 +113,25 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
    char *result;
    int count;

    FILE *infile = fopen(xifilename,"r");
    if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
    FILE *inpfile = fopen(xifilename,"r");
    if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
    for (int i = 0; i < 6; i++) {
      result = fgets(line,IMGMAX,infile);
      result = fgets(line,IMGMAX,inpfile);
      if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
      count = sscanf(line,"%lg %lg %lg",&Rxi[i][0],&Rxi[i][1],&Rxi[i][2]);
      if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
    }
    fclose(infile);
    fclose(inpfile);

    infile = fopen(chifilename,"r");
    if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
    inpfile = fopen(chifilename,"r");
    if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
    for (int i = 0; i < 6; i++) {
      result = fgets(line,IMGMAX,infile);
      result = fgets(line,IMGMAX,inpfile);
      if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
      count = sscanf(line,"%lg %lg %lg",&Rchi[i][0],&Rchi[i][1],&Rchi[i][2]);
      if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
    }
    fclose(infile);
    fclose(inpfile);
  }

  MPI_Bcast(&Rxi[0][0],18,MPI_DOUBLE,0,world);
+4 −4
Original line number Diff line number Diff line
@@ -146,12 +146,12 @@ void NEB::command(int narg, char **arg)

  if (strcmp(arg[5],"final") == 0) {
    if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
    infile = arg[6];
    readfile(infile,0);
    inpfile = arg[6];
    readfile(inpfile,0);
  } else if (strcmp(arg[5],"each") == 0) {
    if (narg != 7 && narg !=8) error->universe_all(FLERR,"Illegal NEB command");
    infile = arg[6];
    readfile(infile,1);
    inpfile = arg[6];
    readfile(inpfile,1);
  } else if (strcmp(arg[5],"none") == 0) {
    if (narg != 6 && narg !=7) error->universe_all(FLERR,"Illegal NEB command");
  } else error->universe_all(FLERR,"Illegal NEB command");
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ class NEB : protected Pointers {
  double ftol;                 // force tolerance convergence criterion
  int n1steps, n2steps;        // number of steps in stage 1 and 2
  int nevery;                  // output interval
  char *infile;                // name of file containing final state
  char *inpfile;                // name of file containing final state

  class FixNEB *fneb;
  int numall;                  // per-replica dimension of array all
+21 −21
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ enum{ISO,ANISO,TRICLINIC};

FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
  Fix(lmp, narg, arg), step_respa(NULL),
  infile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL),
  inpfile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL),
  body(NULL), displace(NULL), masstotal(NULL), xcm(NULL),
  vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL),
  ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL),
@@ -327,7 +327,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
  t_iter = 1;
  t_order = 3;
  p_chain = 10;
  infile = NULL;
  inpfile = NULL;

  pcouple = NONE;
  pstyle = ANISO;
@@ -546,12 +546,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
      p_chain = force->inumeric(FLERR,arg[iarg+1]);
      iarg += 2;

    } else if (strcmp(arg[iarg],"infile") == 0) {
    } else if (strcmp(arg[iarg],"inpfile") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command");
      delete [] infile;
      delete [] inpfile;
      int n = strlen(arg[iarg+1]) + 1;
      infile = new char[n];
      strcpy(infile,arg[iarg+1]);
      inpfile = new char[n];
      strcpy(inpfile,arg[iarg+1]);
      restart_file = 1;
      reinitflag = 0;
      iarg += 2;
@@ -649,7 +649,7 @@ FixRigid::~FixRigid()
  atom->delete_callback(id,0);

  delete random;
  delete [] infile;
  delete [] inpfile;
  memory->destroy(mol2body);
  memory->destroy(body2mol);

@@ -760,14 +760,14 @@ void FixRigid::init()
  // setup rigid bodies, using current atom info. if reinitflag is not set,
  // do the initialization only once, b/c properties may not be re-computable
  // especially if overlapping particles.
  //   do not do dynamic init if read body properties from infile.
  // this is b/c the infile defines the static and dynamic properties and may
  //   do not do dynamic init if read body properties from inpfile.
  // this is b/c the inpfile defines the static and dynamic properties and may
  // not be computable if contain overlapping particles.
  //   setup_bodies_static() reads infile itself
  //   setup_bodies_static() reads inpfile itself

  if (reinitflag || !setupflag) {
    setup_bodies_static();
    if (!infile) setup_bodies_dynamic();
    if (!inpfile) setup_bodies_dynamic();
    setupflag = 1;
  }

@@ -1640,7 +1640,7 @@ void FixRigid::set_v()
   sets extended flags, masstotal, center-of-mass
   sets Cartesian and diagonalized inertia tensor
   sets body image flags
   may read some properties from infile
   may read some properties from inpfile
------------------------------------------------------------------------- */

void FixRigid::setup_bodies_static()
@@ -1791,7 +1791,7 @@ void FixRigid::setup_bodies_static()
    xcm[ibody][2] = all[ibody][2]/masstotal[ibody];
  }

  // set vcm, angmom = 0.0 in case infile is used
  // set vcm, angmom = 0.0 in case inpfile is used
  // and doesn't overwrite all body's values
  // since setup_bodies_dynamic() will not be called

@@ -1810,7 +1810,7 @@ void FixRigid::setup_bodies_static()
  // inbody[i] = 0/1 if Ith rigid body is initialized by file

  int *inbody;
  if (infile) {
  if (inpfile) {
    memory->create(inbody,nbody,"rigid:inbody");
    for (ibody = 0; ibody < nbody; ibody++) inbody[ibody] = 0;
    readfile(0,masstotal,xcm,vcm,angmom,imagebody,inbody);
@@ -1918,7 +1918,7 @@ void FixRigid::setup_bodies_static()

  // overwrite Cartesian inertia tensor with file values

  if (infile) readfile(1,NULL,all,NULL,NULL,NULL,inbody);
  if (inpfile) readfile(1,NULL,all,NULL,NULL,NULL,inbody);

  // diagonalize inertia tensor for each body via Jacobi rotations
  // inertia = 3 eigenvalues = principal moments of inertia
@@ -2116,11 +2116,11 @@ void FixRigid::setup_bodies_static()
  MPI_Allreduce(sum[0],all[0],6*nbody,MPI_DOUBLE,MPI_SUM,world);

  // error check that re-computed moments of inertia match diagonalized ones
  // do not do test for bodies with params read from infile
  // do not do test for bodies with params read from inpfile

  double norm;
  for (ibody = 0; ibody < nbody; ibody++) {
    if (infile && inbody[ibody]) continue;
    if (inpfile && inbody[ibody]) continue;
    if (inertia[ibody][0] == 0.0) {
      if (fabs(all[ibody][0]) > TOLERANCE)
        error->all(FLERR,"Fix rigid: Bad principal moments");
@@ -2149,7 +2149,7 @@ void FixRigid::setup_bodies_static()
      error->all(FLERR,"Fix rigid: Bad principal moments");
  }

  if (infile) memory->destroy(inbody);
  if (inpfile) memory->destroy(inbody);
}

/* ----------------------------------------------------------------------
@@ -2268,10 +2268,10 @@ void FixRigid::readfile(int which, double *vec,
  char line[MAXLINE];

  if (me == 0) {
    fp = fopen(infile,"r");
    fp = fopen(inpfile,"r");
    if (fp == NULL) {
      char str[128];
      snprintf(str,128,"Cannot open fix rigid infile %s",infile);
      snprintf(str,128,"Cannot open fix rigid inpfile %s",inpfile);
      error->one(FLERR,str);
    }

@@ -2371,7 +2371,7 @@ void FixRigid::readfile(int which, double *vec,

/* ----------------------------------------------------------------------
   write out restart info for mass, COM, inertia tensor, image flags to file
   identical format to infile option, so info can be read in when restarting
   identical format to inpfile option, so info can be read in when restarting
   only proc 0 writes list of global bodies to file
------------------------------------------------------------------------- */

Loading