Commit 8280970b authored by athomps's avatar athomps
Browse files

Tweaked fix nphug restart

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@6923 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 7ea78551
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -374,38 +374,37 @@ double FixNPHug::compute_vector(int n)
}

/* ----------------------------------------------------------------------
   pack entire state of Fix into one write 
   pack restart data 
------------------------------------------------------------------------- */

void FixNPHug::write_restart(FILE *fp)
int FixNPHug::pack_restart_data(double *list)
{
  int nsize = 3;

  // Add on the base class size

  int nsizetot = nsize + FixNH::size_restart();

  double *list;
  memory->create(list,nsize,"nphug:list");

  int n = 0;

  list[n++] = e0;
  list[n++] = v0;
  list[n++] = p0;

  if (comm->me == 0) {
    int sizetot = nsizetot * sizeof(double);
    fwrite(&sizetot,sizeof(int),1,fp);
    fwrite(list,sizeof(double),nsize,fp);
  // call the base class function

  n += FixNH::pack_restart_data(list+n);

  return n;
}

  memory->destroy(list);
/* ----------------------------------------------------------------------
   calculate the number of data to be packed
------------------------------------------------------------------------- */

int FixNPHug::size_restart()
{
  int nsize = 3;

  // Write the base class data without size
  // call the base class function

  FixNH::write_restart_nosize(fp);
  nsize += FixNH::size_restart();

  return nsize;
}

/* ----------------------------------------------------------------------
@@ -424,7 +423,7 @@ void FixNPHug::restart(char *buf)
  v0_set = 1;
  p0_set = 1;

  // Call the base class function
  // call the base class function

  buf += n*sizeof(double);
  FixNH::restart(buf);
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,8 @@ class FixNPHug : public FixNH {
  void init();
  void setup(int);
  int modify_param(int, char **);
  void write_restart(FILE *);
  int pack_restart_data(double *); // pack restart data
  int size_restart();              // return size
  void restart(char *);
 
 private: