Fix wrong group name output in fix ave/chunk
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Chunk-averaged data for fix 5 and group file
|
||||
# Chunk-averaged data for fix 5 and group all
|
||||
# Timestep Number-of-chunks Total-count
|
||||
# Chunk Coord1 Ncount vx
|
||||
6000 20 800
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Chunk-averaged data for fix 4 and group file
|
||||
# Chunk-averaged data for fix 4 and group all
|
||||
# Timestep Number-of-chunks Total-count
|
||||
# Chunk Coord1 Ncount vx
|
||||
10000 20 800
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Chunk-averaged data for fix 4 and group file
|
||||
# Chunk-averaged data for fix 4 and group all
|
||||
# Timestep Number-of-chunks Total-count
|
||||
# Chunk Coord1 Ncount vx
|
||||
10000 20 1020
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
#include "arg_info.h"
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "compute.h"
|
||||
#include "compute_chunk_atom.h"
|
||||
#include "domain.h"
|
||||
@ -52,8 +53,6 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
{
|
||||
if (narg < 7) error->all(FLERR,"Illegal fix ave/chunk command");
|
||||
|
||||
MPI_Comm_rank(world,&me);
|
||||
|
||||
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
nrepeat = utils::inumeric(FLERR,arg[4],false,lmp);
|
||||
nfreq = utils::inumeric(FLERR,arg[5],false,lmp);
|
||||
@ -65,6 +64,8 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
global_freq = nfreq;
|
||||
no_change_box = 1;
|
||||
|
||||
char * group = arg[1];
|
||||
|
||||
// expand args if any have wildcard character "*"
|
||||
|
||||
int expand = 0;
|
||||
@ -206,7 +207,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
} else if (strcmp(arg[iarg],"file") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command");
|
||||
if (me == 0) {
|
||||
if (comm->me == 0) {
|
||||
fp = fopen(arg[iarg+1],"w");
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,fmt::format("Cannot open fix ave/chunk file {}: {}",
|
||||
@ -328,11 +329,11 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
// print file comment lines
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (fp && comm->me == 0) {
|
||||
clearerr(fp);
|
||||
if (title1) fprintf(fp,"%s\n",title1);
|
||||
else fprintf(fp,"# Chunk-averaged data for fix %s and group %s\n",
|
||||
id,arg[1]);
|
||||
id, group);
|
||||
if (title2) fprintf(fp,"%s\n",title2);
|
||||
else fprintf(fp,"# Timestep Number-of-chunks Total-count\n");
|
||||
if (title3) fprintf(fp,"%s\n",title3);
|
||||
@ -423,7 +424,7 @@ FixAveChunk::~FixAveChunk()
|
||||
delete [] ids;
|
||||
delete [] value2index;
|
||||
|
||||
if (fp && me == 0) fclose(fp);
|
||||
if (fp && comm->me == 0) fclose(fp);
|
||||
|
||||
memory->destroy(varatom);
|
||||
memory->destroy(count_one);
|
||||
@ -949,7 +950,7 @@ void FixAveChunk::end_of_step()
|
||||
|
||||
// output result to file
|
||||
|
||||
if (fp && me == 0) {
|
||||
if (fp && comm->me == 0) {
|
||||
clearerr(fp);
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
double count = 0.0;
|
||||
|
||||
@ -36,7 +36,7 @@ class FixAveChunk : public Fix {
|
||||
double memory_usage();
|
||||
|
||||
private:
|
||||
int me,nvalues;
|
||||
int nvalues;
|
||||
int nrepeat,nfreq,irepeat;
|
||||
int normflag,scaleflag,overwrite,biasflag,colextra;
|
||||
bigint nvalid,nvalid_last;
|
||||
|
||||
Reference in New Issue
Block a user