Merge branch 'distributed-grids' of github.com:lammps/lammps into distributed-grids

This commit is contained in:
Steve Plimpton
2022-08-30 16:07:40 -06:00
3 changed files with 18 additions and 18 deletions

View File

@ -459,7 +459,7 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) :
window_newest = 0;
// zero grid_nfreq for output since dump may access it on timestep 0
// also one-time zero of grid_running for ave = RUNNING or WINDOW
// also one-time zero of grid_running for ave = RUNNING or WINDOW
zero_grid(grid_nfreq);
output_grid(grid_nfreq);
@ -645,7 +645,7 @@ void FixAveGrid::end_of_step()
nvalid_last = nvalid;
// if first sample in nfreq, zero owned and ghost grid points
if (irepeat == 0) {
zero_grid(grid_sample);
if (normflag == SAMPLE) zero_grid(grid_nfreq);
@ -768,7 +768,7 @@ void FixAveGrid::end_of_step()
// add grid_nfreq to grid_running
// if window is full, subtract oldest window entry from grid_running
// copy grid_nfreq into window
add_grid(grid_nfreq,grid_running);
if (window_count == nwindow)
subtract_grid(grid_window[window_oldest],grid_running);
@ -1436,7 +1436,7 @@ void FixAveGrid::normalize_grid(int numsamples, GridData *grid)
int ix,iy,iz,m;
double invrepeat = 1.0/numsamples;
if (dimension == 2) {
if (nvalues == 1) {
double **vec2d = grid->vec2d;
@ -1479,7 +1479,7 @@ void FixAveGrid::normalize_count(int numsamples, GridData *grid)
int ix,iy,iz;
double invrepeat = 1.0/numsamples;
if (dimension == 2) {
double **count2d = grid->count2d;
for (iy = nylo_in; iy <= nyhi_in; iy++)
@ -1504,14 +1504,14 @@ void FixAveGrid::allocate_grid(GridData *grid)
{
if (dimension == 2) {
if (nvalues == 1)
memory->create2d_offset(grid->vec2d, nylo_out, nyhi_out,
memory->create2d_offset(grid->vec2d, nylo_out, nyhi_out,
nxlo_out, nxhi_out, "ave/grid:vec2d");
else
memory->create3d_offset_last(grid->array2d, nylo_out, nyhi_out,
nxlo_out, nxhi_out,
memory->create3d_offset_last(grid->array2d, nylo_out, nyhi_out,
nxlo_out, nxhi_out,
nvalues, "ave/grid:array3d");
if (modeatom)
memory->create2d_offset(grid->count2d, nylo_out, nyhi_out,
memory->create2d_offset(grid->count2d, nylo_out, nyhi_out,
nxlo_out, nxhi_out, "ave/grid:count2d");
} else if (dimension == 3) {
@ -1565,10 +1565,10 @@ double FixAveGrid::size_grid(GridData *grid)
double bytes;
if (dimension == 2)
bytes = nper * (nxhi_out - nxlo_out + 1) *
bytes = nper * (nxhi_out - nxlo_out + 1) *
(nyhi_out - nylo_out + 1) * sizeof(double);
else
bytes = nper * (nxhi_out - nxlo_out + 1) *
bytes = nper * (nxhi_out - nxlo_out + 1) *
(nyhi_out - nylo_out + 1) * (nzhi_out - nzlo_out + 1) * sizeof(double);
return bytes;
@ -1589,7 +1589,7 @@ void FixAveGrid::zero_grid(GridData *grid)
else
memset(&grid->array2d[nylo_out][nxlo_out][0],0,
ngridout*nvalues*sizeof(double));
if (modeatom)
if (modeatom)
memset(&grid->count2d[nylo_out][nxlo_out],0,ngridout*sizeof(double));
} else if (dimension == 3) {
@ -1803,7 +1803,7 @@ void FixAveGrid::output_grid(GridData *src)
grid_output->vec2d = src->vec2d;
else
grid_output->array2d = src->array2d;
if (modeatom)
if (modeatom)
grid_output->count2d = src->count2d;
} else if (dimension == 3) {
@ -1811,7 +1811,7 @@ void FixAveGrid::output_grid(GridData *src)
grid_output->vec3d = src->vec3d;
else
grid_output->array3d = src->array3d;
if (modeatom)
if (modeatom)
grid_output->count3d = src->count3d;
}
}
@ -2000,9 +2000,9 @@ double FixAveGrid::memory_usage()
bytes += size_grid(grid_sample);
bytes += size_grid(grid_nfreq);
if (aveflag == RUNNING || aveflag == WINDOW)
if (aveflag == RUNNING || aveflag == WINDOW)
bytes += size_grid(grid_running);
if (aveflag == WINDOW)
if (aveflag == WINDOW)
bytes += nwindow * size_grid(grid_window[0]);
if (modeatom) {

View File

@ -55,7 +55,7 @@ class FixAveGrid : public Fix {
int running_count;
int window_count,window_oldest,window_newest;
int biasflag;
char *id_bias;
class Compute *tbias; // ptr to additional bias compute

View File

@ -639,7 +639,7 @@ void tribbox(double *h, double radius, double *dist)
double xz = h[4];
double xy = h[5];
dist[0] = radius * sqrt(ly*ly*lz*lz + ly*ly*xz*xz - 2.0*ly*xy*xz*yz +
dist[0] = radius * sqrt(ly*ly*lz*lz + ly*ly*xz*xz - 2.0*ly*xy*xz*yz +
lz*lz*xy*xy + xy*xy*yz*yz) / (lx*ly*lz);
dist[1] = radius * sqrt(lz*lz + yz*yz) / (ly*lz);
dist[2] = radius / lz;