Commit 3092a341 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2930 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 4d4f48bb
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -106,10 +106,15 @@ Dump::~Dump()
  // XTC style sets fp to NULL since it closes file in its destructor

  if (multifile == 0 && fp != NULL) {
    if (compressed) {
      if (multiproc) pclose(fp);
      else if (me == 0) pclose(fp);
    } else {
      if (multiproc) fclose(fp);
      else if (me == 0) fclose(fp);
    }
  }
}

/* ---------------------------------------------------------------------- */

@@ -205,10 +210,15 @@ void Dump::write()
  // if file per timestep, close file

  if (multifile) {
    if (compressed) {
      if (multiproc) pclose(fp);
      else if (me == 0) pclose(fp);
    } else {
      if (multiproc) fclose(fp);
      else if (me == 0) fclose(fp);
    }
  }
}

/* ----------------------------------------------------------------------
   process params common to all dumps here
+6 −2
Original line number Diff line number Diff line
@@ -500,7 +500,11 @@ void FixTMD::readfile(char *file)
  // clean up

  delete [] buffer;
  if (me == 0) fclose(fp);

  if (me == 0) {
    if (compressed) pclose(fp);
    else fclose(fp);
  }

  // check that all atoms in group were listed in target file
  // set xf = 0.0 for atoms not in group
@@ -525,7 +529,7 @@ void FixTMD::readfile(char *file)

void FixTMD::open(char *file)
{
  int compressed = 0;
  compressed = 0;
  char *suffix = file + strlen(file) - 3;
  if (suffix > file && strcmp(suffix,".gz") == 0) compressed = 1;
  if (!compressed) fp = fopen(file,"r");
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class FixTMD : public Fix {

 private:
  int me;
  int nfileevery,previous_stat;
  int nfileevery,previous_stat,compressed;
  FILE *fp;
  double rho_start,rho_stop,rho_old,masstotal;
  double dtv,dtf;
+7 −3
Original line number Diff line number Diff line
@@ -86,7 +86,8 @@ void ReadData::command(int narg, char **arg)
      header(0);
      scan(atom->bond_per_atom,atom->angle_per_atom,
	   atom->dihedral_per_atom,atom->improper_per_atom);
      fclose(fp);
      if (compressed) pclose(fp);
      else fclose(fp);
      atom->bond_per_atom += atom->extra_bond_per_atom;
    }

@@ -256,7 +257,10 @@ void ReadData::command(int narg, char **arg)

  // close file

  if (me == 0) fclose(fp);
  if (me == 0) {
    if (compressed) pclose(fp);
    else fclose(fp);
  }
  
  // error if natoms > 0 yet no atoms were read

@@ -1219,7 +1223,7 @@ int ReadData::reallocate(int **pcount, int cmax, int amax)

void ReadData::open(char *file)
{
  int compressed = 0;
  compressed = 0;
  char *suffix = file + strlen(file) - 3;
  if (suffix > file && strcmp(suffix,".gz") == 0) compressed = 1;
  if (!compressed) fp = fopen(file,"r");
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class ReadData : protected Pointers {
  int me;
  char *line,*keyword,*buffer;
  FILE *fp;
  int narg,maxarg;
  int narg,maxarg,compressed;
  char **arg;

  void open(char *);