fix saed/vtk does not use the overwrite option anywhere
This commit is contained in:
@ -28,7 +28,6 @@ Syntax
|
||||
Nstart = start averaging on this timestep
|
||||
*file* arg = filename
|
||||
filename = name of file to output time averages to
|
||||
*overwrite* arg = none = overwrite output file with only latest output
|
||||
|
||||
Examples
|
||||
""""""""
|
||||
@ -161,10 +160,6 @@ the *file* keyword and this string is appended with _N.vtk where N is
|
||||
an index (0,1,2...) to account for situations with multiple diffraction
|
||||
intensity outputs.
|
||||
|
||||
The *overwrite* keyword will continuously overwrite the output file
|
||||
with the latest output, so that it only contains one timestep worth of
|
||||
output. This option can only be used with the *ave running* setting.
|
||||
|
||||
Restart, fix_modify, output, run start/stop, minimize info
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
|
||||
@ -100,8 +101,6 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) :
|
||||
error->all(FLERR,"Illegal fix saed/vtk command");
|
||||
if (nfreq % nevery || nrepeat*nevery > nfreq)
|
||||
error->all(FLERR,"Illegal fix saed/vtk command");
|
||||
if (ave != RUNNING && overwrite)
|
||||
error->all(FLERR,"Illegal fix saed/vtk command");
|
||||
|
||||
// allocate memory for averaging
|
||||
|
||||
@ -315,7 +314,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
|
||||
|
||||
if (irepeat == 0)
|
||||
for (int i = 0; i < nrows; i++)
|
||||
vector[i] = 0.0;
|
||||
vector[i] = 0.0;
|
||||
|
||||
// accumulate results of computes,fixes,variables to local copy
|
||||
// compute/fix/variable may invoke computes so wrap with clear/add
|
||||
@ -369,7 +368,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
|
||||
for (int i = 0; i < nrows; i++) {
|
||||
vector_total[i] += vector[i];
|
||||
if (window_limit) vector_total[i] -= vector_list[iwindow][i];
|
||||
vector_list[iwindow][i] = vector[i];
|
||||
vector_list[iwindow][i] = vector[i];
|
||||
}
|
||||
|
||||
iwindow++;
|
||||
@ -391,8 +390,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
|
||||
fp = fopen(nName.c_str(),"w");
|
||||
|
||||
if (fp == nullptr)
|
||||
error->one(FLERR,"Cannot open fix saed/vtk file {}: {}",
|
||||
nName,utils::getsyserror());
|
||||
error->one(FLERR,"Cannot open fix saed/vtk file {}: {}", nName,utils::getsyserror());
|
||||
}
|
||||
|
||||
fprintf(fp,"# vtk DataFile Version 3.0 c_%s\n",ids);
|
||||
@ -406,71 +404,68 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
|
||||
fprintf(fp,"SCALARS intensity float\n");
|
||||
fprintf(fp,"LOOKUP_TABLE default\n");
|
||||
|
||||
filepos = ftell(fp);
|
||||
|
||||
if (overwrite) fseek(fp,filepos,SEEK_SET);
|
||||
// Finding the intersection of the reciprical space and Ewald sphere
|
||||
int NROW1 = 0;
|
||||
int NROW2 = 0;
|
||||
double dinv2 = 0.0;
|
||||
double r = 0.0;
|
||||
double K[3];
|
||||
|
||||
// Finding the intersection of the reciprical space and Ewald sphere
|
||||
int NROW1 = 0;
|
||||
int NROW2 = 0;
|
||||
double dinv2 = 0.0;
|
||||
double r = 0.0;
|
||||
double K[3];
|
||||
|
||||
// Zone flag to capture entire recrocal space volume
|
||||
if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) {
|
||||
for (int k = Knmin[2]; k <= Knmax[2]; k++) {
|
||||
for (int j = Knmin[1]; j <= Knmax[1]; j++) {
|
||||
for (int i = Knmin[0]; i <= Knmax[0]; i++) {
|
||||
K[0] = i * dK[0];
|
||||
K[1] = j * dK[1];
|
||||
K[2] = k * dK[2];
|
||||
dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]);
|
||||
if (dinv2 < Kmax * Kmax) {
|
||||
fprintf(fp,"%g\n",vector_total[NROW1]/norm);
|
||||
fflush(fp);
|
||||
NROW1++;
|
||||
NROW2++;
|
||||
} else {
|
||||
// Zone flag to capture entire recrocal space volume
|
||||
if ((Zone[0] == 0) && (Zone[1] == 0) && (Zone[2] == 0)) {
|
||||
for (int k = Knmin[2]; k <= Knmax[2]; k++) {
|
||||
for (int j = Knmin[1]; j <= Knmax[1]; j++) {
|
||||
for (int i = Knmin[0]; i <= Knmax[0]; i++) {
|
||||
K[0] = i * dK[0];
|
||||
K[1] = j * dK[1];
|
||||
K[2] = k * dK[2];
|
||||
dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]);
|
||||
if (dinv2 < Kmax * Kmax) {
|
||||
fprintf(fp,"%g\n",vector_total[NROW1]/norm);
|
||||
fflush(fp);
|
||||
NROW1++;
|
||||
NROW2++;
|
||||
} else {
|
||||
fprintf(fp,"%d\n",-1);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int k = Knmin[2]; k <= Knmax[2]; k++) {
|
||||
for (int j = Knmin[1]; j <= Knmax[1]; j++) {
|
||||
for (int i = Knmin[0]; i <= Knmax[0]; i++) {
|
||||
K[0] = i * dK[0];
|
||||
K[1] = j * dK[1];
|
||||
K[2] = k * dK[2];
|
||||
dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]);
|
||||
if (dinv2 < Kmax * Kmax) {
|
||||
r=0.0;
|
||||
for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0);
|
||||
r = sqrt(r);
|
||||
if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) )) {
|
||||
fprintf(fp,"%g\n",vector_total[NROW1]/norm);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
NROW1++;
|
||||
} else {
|
||||
fprintf(fp,"%d\n",-1);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int k = Knmin[2]; k <= Knmax[2]; k++) {
|
||||
for (int j = Knmin[1]; j <= Knmax[1]; j++) {
|
||||
for (int i = Knmin[0]; i <= Knmax[0]; i++) {
|
||||
K[0] = i * dK[0];
|
||||
K[1] = j * dK[1];
|
||||
K[2] = k * dK[2];
|
||||
dinv2 = (K[0] * K[0] + K[1] * K[1] + K[2] * K[2]);
|
||||
if (dinv2 < Kmax * Kmax) {
|
||||
r=0.0;
|
||||
for (int m=0; m<3; m++) r += pow(K[m] - Zone[m],2.0);
|
||||
r = sqrt(r);
|
||||
if ( (r > (R_Ewald - dR_Ewald) ) && (r < (R_Ewald + dR_Ewald) )) {
|
||||
fprintf(fp,"%g\n",vector_total[NROW1]/norm);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
NROW1++;
|
||||
} else {
|
||||
fprintf(fp,"%d\n",-1);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
}
|
||||
} else {
|
||||
fprintf(fp,"%d\n",-1);
|
||||
fflush(fp);
|
||||
NROW2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nOutput++;
|
||||
}
|
||||
|
||||
@ -497,7 +492,6 @@ void FixSAEDVTK::options(int narg, char **arg)
|
||||
fp = nullptr;
|
||||
ave = ONE;
|
||||
startstep = 0;
|
||||
overwrite = 0;
|
||||
|
||||
// optional args
|
||||
int iarg = 7;
|
||||
@ -534,9 +528,6 @@ void FixSAEDVTK::options(int narg, char **arg)
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal fix saed/vtk command");
|
||||
startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"overwrite") == 0) {
|
||||
overwrite = 1;
|
||||
iarg += 1;
|
||||
} else error->all(FLERR,"Illegal fix saed/vtk command");
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,8 +43,6 @@ class FixSAEDVTK : public Fix {
|
||||
int nrows;
|
||||
|
||||
int ave, nwindow, nsum, startstep;
|
||||
int overwrite;
|
||||
long filepos;
|
||||
|
||||
int norm, iwindow, window_limit;
|
||||
double *vector;
|
||||
|
||||
Reference in New Issue
Block a user