forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8321 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
3b8898e7e9
commit
023ccd9d7c
|
@ -99,6 +99,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
startstep = 0;
|
||||
prefactor = 1.0;
|
||||
fp = NULL;
|
||||
overwrite = 0;
|
||||
char *title1 = NULL;
|
||||
char *title2 = NULL;
|
||||
char *title3 = NULL;
|
||||
|
@ -139,6 +140,9 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
}
|
||||
}
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"rewrite") == 0) {
|
||||
overwrite = 1;
|
||||
iarg += 1;
|
||||
} else if (strcmp(arg[iarg],"title1") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command");
|
||||
delete [] title1;
|
||||
|
@ -172,6 +176,8 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
error->all(FLERR,"Illegal fix ave/correlate command");
|
||||
if (ave == ONE && nfreq < (nrepeat-1)*nevery)
|
||||
error->all(FLERR,"Illegal fix ave/correlate command");
|
||||
if (ave != RUNNING && overwrite)
|
||||
error->all(FLERR,"Illegal fix ave/correlate command");
|
||||
|
||||
for (int i = 0; i < nvalues; i++) {
|
||||
if (which[i] == COMPUTE) {
|
||||
|
@ -255,6 +261,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
fprintf(fp," %s*%s",arg[6+i],arg[6+j]);
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
filepos = ftell(fp);
|
||||
}
|
||||
|
||||
delete [] title1;
|
||||
|
@ -461,9 +468,10 @@ void FixAveCorrelate::end_of_step()
|
|||
save_corr[i][j] = 0.0;
|
||||
}
|
||||
|
||||
// output to file
|
||||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nrepeat);
|
||||
for (i = 0; i < nrepeat; i++) {
|
||||
fprintf(fp,"%d %d %d",i+1,i*nevery,count[i]);
|
||||
|
|
|
@ -44,9 +44,10 @@ class FixAveCorrelate : public Fix {
|
|||
char **ids;
|
||||
FILE *fp;
|
||||
|
||||
int type,ave,startstep;
|
||||
int type,ave,startstep,overwrite;
|
||||
double prefactor;
|
||||
char *title1,*title2,*title3;
|
||||
long filepos;
|
||||
|
||||
int firstindex; // index in values ring of earliest time sample
|
||||
int lastindex; // index in values ring of latest time sample
|
||||
|
|
|
@ -241,6 +241,8 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||
error->all(FLERR,"Illegal fix ave/histo command");
|
||||
if (lo >= hi) error->all(FLERR,"Illegal fix ave/histo command");
|
||||
if (nbins <= 0) error->all(FLERR,"Illegal fix ave/histo command");
|
||||
if (ave != RUNNING && overwrite)
|
||||
error->all(FLERR,"Illegal fix ave/histo command");
|
||||
|
||||
int kindflag;
|
||||
for (int i = 0; i < nvalues; i++) {
|
||||
|
@ -419,6 +421,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||
"Total-counts Missing-counts Min-value Max-value\n");
|
||||
if (title3) fprintf(fp,"%s\n",title3);
|
||||
else fprintf(fp,"# Bin Coord Count Count/Total\n");
|
||||
filepos = ftell(fp);
|
||||
}
|
||||
|
||||
delete [] title1;
|
||||
|
@ -780,6 +783,7 @@ void FixAveHisto::end_of_step()
|
|||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
fprintf(fp,BIGINT_FORMAT " %d %g %g %g %g\n",ntimestep,nbins,
|
||||
stats_total[0],stats_total[1],stats_total[2],stats_total[3]);
|
||||
if (stats_total[0] != 0.0)
|
||||
|
@ -886,6 +890,7 @@ void FixAveHisto::options(int narg, char **arg)
|
|||
startstep = 0;
|
||||
mode = SCALAR;
|
||||
beyond = IGNORE;
|
||||
overwrite = 0;
|
||||
title1 = NULL;
|
||||
title2 = NULL;
|
||||
title3 = NULL;
|
||||
|
@ -935,6 +940,9 @@ void FixAveHisto::options(int narg, char **arg)
|
|||
else if (strcmp(arg[iarg+1],"extra") == 0) beyond = EXTRA;
|
||||
else error->all(FLERR,"Illegal fix ave/histo command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"rewrite") == 0) {
|
||||
overwrite = 1;
|
||||
iarg += 1;
|
||||
} else if (strcmp(arg[iarg],"title1") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
delete [] title1;
|
||||
|
|
|
@ -45,7 +45,8 @@ class FixAveHisto : public Fix {
|
|||
char **ids;
|
||||
FILE *fp;
|
||||
double lo,hi,binsize,bininv;
|
||||
int kind,beyond;
|
||||
int kind,beyond,overwrite;
|
||||
long filepos;
|
||||
|
||||
double stats[4],stats_total[4],stats_all[4];
|
||||
double **stats_list;
|
||||
|
|
|
@ -165,6 +165,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
|
|||
fp = NULL;
|
||||
ave = ONE;
|
||||
nwindow = 0;
|
||||
overwrite = 0;
|
||||
char *title1 = NULL;
|
||||
char *title2 = NULL;
|
||||
char *title3 = NULL;
|
||||
|
@ -217,6 +218,9 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
|
|||
}
|
||||
iarg += 2;
|
||||
if (ave == WINDOW) iarg++;
|
||||
} else if (strcmp(arg[iarg],"rewrite") == 0) {
|
||||
overwrite = 1;
|
||||
iarg += 1;
|
||||
} else if (strcmp(arg[iarg],"title1") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
delete [] title1;
|
||||
|
@ -252,6 +256,8 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
|
|||
error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
if (ndim == 3 && delta[2] <= 0.0)
|
||||
error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
if (ave != RUNNING && overwrite)
|
||||
error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
|
||||
for (int i = 0; i < nvalues; i++) {
|
||||
if (which[i] == COMPUTE) {
|
||||
|
@ -313,6 +319,7 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
|
|||
for (int i = 0; i < nvalues; i++) fprintf(fp," %s",arg[6+3*ndim+i]);
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
filepos = ftell(fp);
|
||||
}
|
||||
|
||||
delete [] title1;
|
||||
|
@ -790,6 +797,7 @@ void FixAveSpatial::end_of_step()
|
|||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nbins);
|
||||
if (ndim == 1)
|
||||
for (m = 0; m < nbins; m++) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class FixAveSpatial : public Fix {
|
|||
int me,nvalues;
|
||||
int nrepeat,nfreq,irepeat;
|
||||
bigint nvalid;
|
||||
int ndim,normflag,regionflag,iregion;
|
||||
int ndim,normflag,regionflag,iregion,overwrite;
|
||||
char *tstring,*sstring,*idregion;
|
||||
int *which,*argindex,*value2index;
|
||||
char **ids;
|
||||
|
@ -53,6 +53,7 @@ class FixAveSpatial : public Fix {
|
|||
double xscale,yscale,zscale;
|
||||
double bin_volume;
|
||||
|
||||
long filepos;
|
||||
int dim[3],originflag[3],nlayers[3];
|
||||
double origin[3],delta[3];
|
||||
double offset[3],invdelta[3];
|
||||
|
|
|
@ -169,6 +169,8 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||
error->all(FLERR,"Illegal fix ave/time command");
|
||||
if (nfreq % nevery || (nrepeat-1)*nevery >= nfreq)
|
||||
error->all(FLERR,"Illegal fix ave/time command");
|
||||
if (ave != RUNNING && overwrite)
|
||||
error->all(FLERR,"Illegal fix ave/time command");
|
||||
|
||||
for (int i = 0; i < nvalues; i++) {
|
||||
if (which[i] == COMPUTE && mode == SCALAR) {
|
||||
|
@ -220,7 +222,8 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_array_cols)
|
||||
error->all(FLERR,"Fix ave/time fix array is accessed out-of-range");
|
||||
if (nevery % modify->fix[ifix]->global_freq)
|
||||
error->all(FLERR,"Fix for fix ave/time not computed at compatible time");
|
||||
error->all(FLERR,
|
||||
"Fix for fix ave/time not computed at compatible time");
|
||||
|
||||
} else if (which[i] == VARIABLE) {
|
||||
int ivariable = input->variable->find(ids[i]);
|
||||
|
@ -281,6 +284,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||
}
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
filepos = ftell(fp);
|
||||
}
|
||||
|
||||
delete [] title1;
|
||||
|
@ -626,6 +630,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep)
|
|||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
fprintf(fp,BIGINT_FORMAT,ntimestep);
|
||||
for (i = 0; i < nvalues; i++) fprintf(fp," %g",vector_total[i]/norm);
|
||||
fprintf(fp,"\n");
|
||||
|
@ -764,6 +769,7 @@ void FixAveTime::invoke_vector(bigint ntimestep)
|
|||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
fprintf(fp,BIGINT_FORMAT " %d\n",ntimestep,nrows);
|
||||
for (i = 0; i < nrows; i++) {
|
||||
fprintf(fp,"%d",i+1);
|
||||
|
@ -821,6 +827,7 @@ void FixAveTime::options(int narg, char **arg)
|
|||
mode = SCALAR;
|
||||
noff = 0;
|
||||
offlist = NULL;
|
||||
overwrite = 0;
|
||||
title1 = NULL;
|
||||
title2 = NULL;
|
||||
title3 = NULL;
|
||||
|
@ -868,6 +875,9 @@ void FixAveTime::options(int narg, char **arg)
|
|||
memory->grow(offlist,noff+1,"ave/time:offlist");
|
||||
offlist[noff++] = atoi(arg[iarg+1]);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"rewrite") == 0) {
|
||||
overwrite = 1;
|
||||
iarg += 1;
|
||||
} else if (strcmp(arg[iarg],"title1") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/spatial command");
|
||||
delete [] title1;
|
||||
|
|
|
@ -48,9 +48,10 @@ class FixAveTime : public Fix {
|
|||
int nrows;
|
||||
|
||||
int ave,nwindow,nsum,startstep,mode;
|
||||
int noff;
|
||||
int noff,overwrite;
|
||||
int *offlist;
|
||||
char *title1,*title2,*title3;
|
||||
long filepos;
|
||||
|
||||
int norm,iwindow,window_limit;
|
||||
double *vector;
|
||||
|
|
Loading…
Reference in New Issue