From a85f125ee75717a286becd8149a9871785a2ae06 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 26 Aug 2021 16:58:14 -0400 Subject: [PATCH] whitespace --- doc/src/fix_ttm.rst | 4 ++-- src/EXTRA-FIX/fix_ttm.cpp | 18 ++++++++--------- src/EXTRA-FIX/fix_ttm_grid.cpp | 36 +++++++++++++++++----------------- src/EXTRA-FIX/fix_ttm_mod.cpp | 10 +++++----- src/EXTRA-FIX/fix_ttm_mod.h | 2 +- src/fix.h | 2 +- src/gridcomm.cpp | 16 +++++++-------- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/doc/src/fix_ttm.rst b/doc/src/fix_ttm.rst index 184324fa1a..8136bf5d35 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -15,7 +15,7 @@ Syntax .. parsed-literal:: - fix ID group-ID ttm seed C_e rho_e kappa_e gamma_p gamma_s v_0 Nx Ny Nz keyword value ... + fix ID group-ID ttm seed C_e rho_e kappa_e gamma_p gamma_s v_0 Nx Ny Nz keyword value ... fix ID group-ID ttm/mod seed init_file Nx Ny Nz keyword value ... * ID, group-ID are documented in :doc:`fix ` command @@ -103,7 +103,7 @@ are given below. Heat transfer between the electronic and atomic subsystems is carried out via an inhomogeneous Langevin thermostat. Only atoms in the fix -group contribute to and are affected by this heat transfer. +group contribute to and are affected by this heat transfer. This thermostatting differs from the regular Langevin thermostat (:doc:`fix langevin `) in three important ways. First, diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index e7f15666f6..803246b394 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -42,7 +42,7 @@ using namespace FixConst; // OFFSET avoids outside-of-box atoms being rounded to grid pts incorrectly // SHIFT = 0.0 assigns atoms to lower-left grid pt // SHIFT = 0.5 assigns atoms to nearest grid pt -// use SHIFT = 0.0 for now since it allows fix ave/chunk +// use SHIFT = 0.0 for now since it allows fix ave/chunk // to spatially average consistent with the TTM grid #define OFFSET 16384 @@ -52,9 +52,9 @@ using namespace FixConst; FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(nullptr), + random(nullptr), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), - T_electron(nullptr), T_electron_old(nullptr), + T_electron(nullptr), T_electron_old(nullptr), net_energy_transfer(nullptr), net_energy_transfer_all(nullptr) { if (narg < 13) error->all(FLERR,"Illegal fix ttm command"); @@ -77,16 +77,16 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : nxgrid = utils::inumeric(FLERR,arg[10],false,lmp); nygrid = utils::inumeric(FLERR,arg[11],false,lmp); nzgrid = utils::inumeric(FLERR,arg[12],false,lmp); - + tinit = 0.0; infile = outfile = NULL; - + int iarg = 13; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ttm command"); tinit = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (tinit <= 0.0) + if (tinit <= 0.0) error->all(FLERR,"Fix ttm initial temperature must be > 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"infile") == 0) { @@ -426,7 +426,7 @@ void FixTTM::end_of_step() // finite difference iterations to update T_electron for (int istep = 0; istep < num_inner_timesteps; istep++) { - + for (iz = 0; iz < nzgrid; iz++) for (iy = 0; iy < nygrid; iy++) for (ix = 0; ix < nxgrid; ix++) @@ -461,7 +461,7 @@ void FixTTM::end_of_step() 2.0*T_electron_old[iz][iy][ix])/dy/dy + (T_electron_old[zright][iy][ix] + T_electron_old[zleft][iy][ix] - 2.0*T_electron_old[iz][iy][ix])/dz/dz) - - + (net_energy_transfer_all[iz][iy][ix])/del_vol); } } @@ -546,7 +546,7 @@ void FixTTM::read_electron_temperatures(const char *filename) void FixTTM::write_electron_temperatures(const char *filename) { if (comm->me) return; - + FILE *fp = fopen(filename,"w"); if (!fp) error->one(FLERR,"Fix ttm could not open output file"); diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index 31996acd37..e7cb60731a 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -42,7 +42,7 @@ static constexpr int CHUNK = 1024; /* ---------------------------------------------------------------------- */ -FixTTMGrid::FixTTMGrid(LAMMPS *lmp, int narg, char **arg) : +FixTTMGrid::FixTTMGrid(LAMMPS *lmp, int narg, char **arg) : FixTTM(lmp, narg, arg) { skin_original = neighbor->skin; @@ -72,7 +72,7 @@ void FixTTMGrid::post_constructor() for (iy = nylo_out; iy <= nyhi_out; iy++) for (ix = nxlo_out; ix <= nxhi_out; ix++) T_electron[iz][iy][ix] = tinit; - + // zero net_energy_transfer // in case compute_vector accesses it on timestep 0 @@ -131,7 +131,7 @@ void FixTTMGrid::post_force(int /*vflag*/) // flag if ix,iy,iz is not within my ghost cell range - if (ix < nxlo_out || ix > nxhi_out || + if (ix < nxlo_out || ix > nxhi_out || iy < nylo_out || iy > nyhi_out || iz < nzlo_out || iz > nzhi_out) { flag = 1; @@ -225,7 +225,7 @@ void FixTTMGrid::end_of_step() &T_electron[nzlo_out][nylo_out][nxlo_out],ngridout*sizeof(double)); // compute new electron T profile - + for (iz = nzlo_in; iz <= nzhi_in; iz++) for (iy = nylo_in; iy <= nyhi_in; iy++) for (ix = nxlo_in; ix <= nxhi_in; ix++) { @@ -240,7 +240,7 @@ void FixTTMGrid::end_of_step() 2.0*T_electron_old[iz][iy][ix])*dyinv*dyinv + (T_electron_old[iz-1][iy][ix] + T_electron_old[iz+1][iy][ix] - 2.0*T_electron_old[iz][iy][ix])*dzinv*dzinv) - - + net_energy_transfer[iz][iy][ix]/volgrid); } @@ -289,7 +289,7 @@ void FixTTMGrid::read_electron_temperatures(const char *filename) } // read electron temperature values from file, one chunk at a time - + char **values = new char*[4]; char *buffer = new char[CHUNK*MAXLINE]; bigint ntotal = (bigint) nxgrid * nygrid * nzgrid; @@ -308,21 +308,21 @@ void FixTTMGrid::read_electron_temperatures(const char *filename) *next = '\n'; if (nwords != 4) error->all(FLERR,"Incorrect format in fix ttm data file"); - + // loop over lines of grid point values // tokenize the line into ix,iy,iz grid index plus temperature value // if I own grid point, store the value - + for (i = 0; i < nchunk; i++) { next = strchr(buf,'\n'); - + for (j = 0; j < nwords; j++) { buf += strspn(buf," \t\n\r\f"); buf[strcspn(buf," \t\n\r\f")] = '\0'; values[j] = buf; buf += strlen(buf)+1; } - + ix = utils::inumeric(FLERR,values[0],false,lmp); iy = utils::inumeric(FLERR,values[1],false,lmp); iz = utils::inumeric(FLERR,values[2],false,lmp); @@ -330,7 +330,7 @@ void FixTTMGrid::read_electron_temperatures(const char *filename) if (ix < 0 || ix >= nxgrid || iy < 0 || iy >= nygrid || iz < 0 || iz >= nzgrid) error->all(FLERR,"Fix ttm/grid invalid grid index in input"); - + if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in && iz >= nzlo_in && iz <= nzhi_in) { @@ -367,7 +367,7 @@ void FixTTMGrid::read_electron_temperatures(const char *filename) int flagall; MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) + if (flagall) error->all(FLERR,"Fix ttm/grid infile did not set all temperatures"); memory->destroy3d_offset(T_initial_set,nzlo_in,nylo_in,nxlo_in); @@ -386,7 +386,7 @@ void FixTTMGrid::write_electron_temperatures(const char *filename) } gc->gather(GridComm::FIX,this,1,sizeof(double),1,NULL,MPI_DOUBLE); - + if (comm->me == 0) fclose(FPout); } @@ -424,7 +424,7 @@ void FixTTMGrid::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { double *buf = (double *) vbuf; double *src = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out]; - + for (int i = 0; i < nlist; i++) buf[i] = src[list[i]]; } @@ -486,13 +486,13 @@ void FixTTMGrid::allocate_grid() nzhi_out = MAX(nhi,nzhi_in+1); bigint totalmine; - totalmine = (bigint) (nxhi_out-nxlo_out+1) * (nyhi_out-nylo_out+1) * + totalmine = (bigint) (nxhi_out-nxlo_out+1) * (nyhi_out-nylo_out+1) * (nzhi_out-nzlo_out+1); if (totalmine > MAXSMALLINT) error->one(FLERR,"Too many owned+ghost grid points in fix ttm"); ngridout = totalmine; - totalmine = (bigint) (nxhi_in-nxlo_in+1) * (nyhi_in-nylo_in+1) * + totalmine = (bigint) (nxhi_in-nxlo_in+1) * (nyhi_in-nylo_in+1) * (nzhi_in-nzlo_in+1); ngridmine = totalmine; @@ -627,7 +627,7 @@ void FixTTMGrid::pack_gather_grid(int which, void *vbuf) ------------------------------------------------------------------------- */ void FixTTMGrid::unpack_gather_grid(int which, void *vbuf, void *vgbuf, - int xlo, int xhi, int ylo, int yhi, + int xlo, int xhi, int ylo, int yhi, int zlo, int zhi) { int ix,iy,iz; @@ -660,7 +660,7 @@ void FixTTMGrid::unpack_gather_grid(int which, void *vbuf, void *vgbuf, } /* ---------------------------------------------------------------------- - return the energy of the electronic subsystem + return the energy of the electronic subsystem or the net_energy transfer between the subsystems ------------------------------------------------------------------------- */ diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index b2d13b36c1..cd60faae99 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -45,7 +45,7 @@ using namespace MathConst; // OFFSET avoids outside-of-box atoms being rounded to grid pts incorrectly // SHIFT = 0.0 assigns atoms to lower-left grid pt // SHIFT = 0.5 assigns atoms to nearest grid pt -// use SHIFT = 0.0 for now since it allows fix ave/chunk +// use SHIFT = 0.0 for now since it allows fix ave/chunk // to spatially average consistent with the TTM grid #define OFFSET 16384 @@ -108,7 +108,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"set") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ttm/mod command"); tinit = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (tinit <= 0.0) + if (tinit <= 0.0) error->all(FLERR,"Fix ttm/mod initial temperature must be > 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"infile") == 0) { @@ -135,7 +135,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix ttm/mod grid sizes must be > 0"); // check for allowed maximum number of total grid points - + bigint total_nnodes = (bigint) nxnodes * nynodes * nznodes; if (total_nnodes > MAXSMALLINT) error->all(FLERR,"Too many grid points in fix ttm/mod"); @@ -653,7 +653,7 @@ void FixTTMMod::read_electron_temperatures(const char *filename) void FixTTMMod::write_electron_temperatures(const char *filename) { if (comm->me) return; - + FILE *fp = fopen(filename,"w"); if (!fp) error->one(FLERR,"Fix ttm/mod could not open output file"); @@ -662,7 +662,7 @@ void FixTTMMod::write_electron_temperatures(const char *filename) for (ix = 0; ix < nxnodes; ix++) for (iy = 0; iy < nynodes; iy++) for (iz = 0; iz < nznodes; iz++) { - if (movsur == 1 && T_electron[ix][iy][iz] == 0.0) + if (movsur == 1 && T_electron[ix][iy][iz] == 0.0) T_electron[ix][iy][iz] = electron_temperature_min; fprintf(fp,"%d %d %d %20.16g\n",ix,iy,iz,T_electron[ix][iy][iz]); } diff --git a/src/EXTRA-FIX/fix_ttm_mod.h b/src/EXTRA-FIX/fix_ttm_mod.h index 883b799b09..b4a09b8f38 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.h +++ b/src/EXTRA-FIX/fix_ttm_mod.h @@ -76,7 +76,7 @@ class FixTTMMod : public Fix { double gamma_p, gamma_s, v_0, v_0_sq; int skin_layer, surface_l, surface_r, t_surface_l, t_surface_r; int movsur; - double esheat_0, esheat_1, esheat_2, esheat_3, esheat_4, + double esheat_0, esheat_1, esheat_2, esheat_3, esheat_4, C_limit, electronic_density; double el_th_diff, T_damp; double intensity, width, duration, surface_double; diff --git a/src/fix.h b/src/fix.h index cacbf04a2a..44b9978052 100644 --- a/src/fix.h +++ b/src/fix.h @@ -210,7 +210,7 @@ class Fix : protected Pointers { virtual void pack_reverse_grid(int, void *, int, int *) {}; virtual void unpack_reverse_grid(int, void *, int, int *) {}; virtual void pack_gather_grid(int, void *) {}; - virtual void unpack_gather_grid(int, void *, void *, + virtual void unpack_gather_grid(int, void *, void *, int, int, int, int, int, int) {}; virtual double compute_scalar() { return 0.0; } diff --git a/src/gridcomm.cpp b/src/gridcomm.cpp index d403b706d3..1463671316 100644 --- a/src/gridcomm.cpp +++ b/src/gridcomm.cpp @@ -165,13 +165,13 @@ GridComm::~GridComm() void GridComm::initialize(MPI_Comm gcomm, int gnx, int gny, int gnz, - int ixlo, int ixhi, int iylo, int iyhi, + int ixlo, int ixhi, int iylo, int iyhi, int izlo, int izhi, - int oxlo, int oxhi, int oylo, int oyhi, + int oxlo, int oxhi, int oylo, int oyhi, int ozlo, int ozhi, - int fxlo, int fxhi, int fylo, int fyhi, + int fxlo, int fxhi, int fylo, int fyhi, int fzlo, int fzhi, - int pxlo, int pxhi, int pylo, int pyhi, + int pxlo, int pxhi, int pylo, int pyhi, int pzlo, int pzhi) { gridcomm = gcomm; @@ -955,7 +955,7 @@ void GridComm::forward_comm(int caller, void *ptr, int nper, int nbyte, int whic forward comm on regular grid of procs via list of swaps with 6 neighbor procs ------------------------------------------------------------------------- */ -template < class T > +template < class T > void GridComm:: forward_comm_regular(T *ptr, int nper, int /*nbyte*/, int which, void *buf1, void *buf2, MPI_Datatype datatype) @@ -985,7 +985,7 @@ forward_comm_regular(T *ptr, int nper, int /*nbyte*/, int which, forward comm on tiled grid decomp via Send/Recv lists of each neighbor proc ------------------------------------------------------------------------- */ -template < class T > +template < class T > void GridComm:: forward_comm_tiled(T *ptr, int nper, int nbyte, int which, void *buf1, void *vbuf2, MPI_Datatype datatype) @@ -1054,7 +1054,7 @@ void GridComm::reverse_comm(int caller, void *ptr, int nper, int nbyte, int whic reverse comm on regular grid of procs via list of swaps with 6 neighbor procs ------------------------------------------------------------------------- */ -template < class T > +template < class T > void GridComm:: reverse_comm_regular(T *ptr, int nper, int /*nbyte*/, int which, void *buf1, void *buf2, MPI_Datatype datatype) @@ -1084,7 +1084,7 @@ reverse_comm_regular(T *ptr, int nper, int /*nbyte*/, int which, reverse comm on tiled grid decomp via Send/Recv lists of each neighbor proc ------------------------------------------------------------------------- */ -template < class T > +template < class T > void GridComm:: reverse_comm_tiled(T *ptr, int nper, int nbyte, int which, void *buf1, void *vbuf2, MPI_Datatype datatype)