git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5498 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -431,7 +431,7 @@ void PRD::dephase()
|
|||||||
timer->barrier_start(TIME_LOOP);
|
timer->barrier_start(TIME_LOOP);
|
||||||
|
|
||||||
for (int i = 0; i < n_dephase; i++) {
|
for (int i = 0; i < n_dephase; i++) {
|
||||||
int seed = static_cast<int> (random_dephase->uniform() * MAXINT32);
|
int seed = static_cast<int> (random_dephase->uniform() * MAXSMALLINT);
|
||||||
if (seed == 0) seed = 1;
|
if (seed == 0) seed = 1;
|
||||||
velocity->create(temp_dephase,seed);
|
velocity->create(temp_dephase,seed);
|
||||||
update->integrate->run(t_dephase);
|
update->integrate->run(t_dephase);
|
||||||
|
|||||||
@ -67,9 +67,11 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
|
|||||||
|
|
||||||
// allocate global array for atom coords
|
// allocate global array for atom coords
|
||||||
|
|
||||||
if (igroup == 0) natoms = static_cast<int> (atom->natoms);
|
bigint n;
|
||||||
else natoms = static_cast<int> (group->count(igroup));
|
if (igroup == 0) n = static_cast<int> (atom->natoms);
|
||||||
if (natoms <= 0) error->all("Invalid natoms for dump xtc");
|
else n = static_cast<int> (group->count(igroup));
|
||||||
|
if (n > MAXSMALLINT) error->all("Too many atoms for dump xtc");
|
||||||
|
natoms = n;
|
||||||
|
|
||||||
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
|
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
|
||||||
|
|
||||||
|
|||||||
@ -604,7 +604,7 @@ bigint ComputeReduce::count(int m)
|
|||||||
} else if (flavor[m] == LOCAL) {
|
} else if (flavor[m] == LOCAL) {
|
||||||
bigint ncount = compute->size_local_rows;
|
bigint ncount = compute->size_local_rows;
|
||||||
bigint ncountall;
|
bigint ncountall;
|
||||||
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&ncount,&ncountall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
return ncountall;
|
return ncountall;
|
||||||
}
|
}
|
||||||
} else if (which[m] == FIX) {
|
} else if (which[m] == FIX) {
|
||||||
@ -614,7 +614,7 @@ bigint ComputeReduce::count(int m)
|
|||||||
} else if (flavor[m] == LOCAL) {
|
} else if (flavor[m] == LOCAL) {
|
||||||
bigint ncount = fix->size_local_rows;
|
bigint ncount = fix->size_local_rows;
|
||||||
bigint ncountall;
|
bigint ncountall;
|
||||||
MPI_Allreduce(&ncount,&ncountall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&ncount,&ncountall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
return ncountall;
|
return ncountall;
|
||||||
}
|
}
|
||||||
} else if (which[m] == VARIABLE)
|
} else if (which[m] == VARIABLE)
|
||||||
|
|||||||
@ -169,7 +169,7 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
// new total # of atoms
|
// new total # of atoms
|
||||||
|
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
// print status
|
// print status
|
||||||
|
|
||||||
@ -185,8 +185,8 @@ void CreateAtoms::command(int narg, char **arg)
|
|||||||
// if global map exists, reset it
|
// if global map exists, reset it
|
||||||
// if a molecular system, set nspecial to 0 for new atoms
|
// if a molecular system, set nspecial to 0 for new atoms
|
||||||
|
|
||||||
if (atom->natoms > MAXINT32) atom->tag_enable = 0;
|
if (atom->natoms > MAXTAGINT) atom->tag_enable = 0;
|
||||||
if (atom->natoms <= MAXINT32) atom->tag_extend();
|
if (atom->natoms <= MAXTAGINT) atom->tag_extend();
|
||||||
|
|
||||||
if (atom->map_style) {
|
if (atom->map_style) {
|
||||||
atom->nghost = 0;
|
atom->nghost = 0;
|
||||||
|
|||||||
@ -93,7 +93,7 @@ void DeleteAtoms::command(int narg, char **arg)
|
|||||||
// set nghost to 0 so old ghosts of deleted atoms won't be mapped
|
// set nghost to 0 so old ghosts of deleted atoms won't be mapped
|
||||||
|
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (atom->map_style) {
|
if (atom->map_style) {
|
||||||
atom->nghost = 0;
|
atom->nghost = 0;
|
||||||
atom->map_init();
|
atom->map_init();
|
||||||
|
|||||||
@ -341,7 +341,7 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
if (atom->avec->bonds_allow) {
|
if (atom->avec->bonds_allow) {
|
||||||
bigint nbonds = 0;
|
bigint nbonds = 0;
|
||||||
for (i = 0; i < nlocal; i++) nbonds += atom->num_bond[i];
|
for (i = 0; i < nlocal; i++) nbonds += atom->num_bond[i];
|
||||||
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_UNSIGNED_LONG_LONG,
|
MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT,
|
||||||
MPI_SUM,world);
|
MPI_SUM,world);
|
||||||
if (force->newton_bond == 0) atom->nbonds /= 2;
|
if (force->newton_bond == 0) atom->nbonds /= 2;
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
if (atom->avec->angles_allow) {
|
if (atom->avec->angles_allow) {
|
||||||
bigint nangles = 0;
|
bigint nangles = 0;
|
||||||
for (i = 0; i < nlocal; i++) nangles += atom->num_angle[i];
|
for (i = 0; i < nlocal; i++) nangles += atom->num_angle[i];
|
||||||
MPI_Allreduce(&nangles,&atom->nangles,1,MPI_UNSIGNED_LONG_LONG,
|
MPI_Allreduce(&nangles,&atom->nangles,1,MPI_LMP_BIGINT,
|
||||||
MPI_SUM,world);
|
MPI_SUM,world);
|
||||||
if (force->newton_bond == 0) atom->nangles /= 3;
|
if (force->newton_bond == 0) atom->nangles /= 3;
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
bigint ndihedrals = 0;
|
bigint ndihedrals = 0;
|
||||||
for (i = 0; i < nlocal; i++) ndihedrals += atom->num_dihedral[i];
|
for (i = 0; i < nlocal; i++) ndihedrals += atom->num_dihedral[i];
|
||||||
MPI_Allreduce(&ndihedrals,&atom->ndihedrals,
|
MPI_Allreduce(&ndihedrals,&atom->ndihedrals,
|
||||||
1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (force->newton_bond == 0) atom->ndihedrals /= 4;
|
if (force->newton_bond == 0) atom->ndihedrals /= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
bigint nimpropers = 0;
|
bigint nimpropers = 0;
|
||||||
for (i = 0; i < nlocal; i++) nimpropers += atom->num_improper[i];
|
for (i = 0; i < nlocal; i++) nimpropers += atom->num_improper[i];
|
||||||
MPI_Allreduce(&nimpropers,&atom->nimpropers,
|
MPI_Allreduce(&nimpropers,&atom->nimpropers,
|
||||||
1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (force->newton_bond == 0) atom->nimpropers /= 4;
|
if (force->newton_bond == 0) atom->nimpropers /= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,9 +386,9 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
for (m = 0; m < atom->num_bond[i]; m++)
|
for (m = 0; m < atom->num_bond[i]; m++)
|
||||||
if (atom->bond_type[i][m] > 0) bond_on++;
|
if (atom->bond_type[i][m] > 0) bond_on++;
|
||||||
else bond_off++;
|
else bond_off++;
|
||||||
MPI_Allreduce(&bond_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&bond_on,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
bond_on = tmp;
|
bond_on = tmp;
|
||||||
MPI_Allreduce(&bond_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&bond_off,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
bond_off = tmp;
|
bond_off = tmp;
|
||||||
if (force->newton_bond == 0) {
|
if (force->newton_bond == 0) {
|
||||||
bond_on /= 2;
|
bond_on /= 2;
|
||||||
@ -402,9 +402,9 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
for (m = 0; m < atom->num_angle[i]; m++)
|
for (m = 0; m < atom->num_angle[i]; m++)
|
||||||
if (atom->angle_type[i][m] > 0) angle_on++;
|
if (atom->angle_type[i][m] > 0) angle_on++;
|
||||||
else angle_off++;
|
else angle_off++;
|
||||||
MPI_Allreduce(&angle_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&angle_on,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
angle_on = tmp;
|
angle_on = tmp;
|
||||||
MPI_Allreduce(&angle_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&angle_off,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
angle_off = tmp;
|
angle_off = tmp;
|
||||||
if (force->newton_bond == 0) {
|
if (force->newton_bond == 0) {
|
||||||
angle_on /= 3;
|
angle_on /= 3;
|
||||||
@ -418,9 +418,9 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
for (m = 0; m < atom->num_dihedral[i]; m++)
|
for (m = 0; m < atom->num_dihedral[i]; m++)
|
||||||
if (atom->dihedral_type[i][m] > 0) dihedral_on++;
|
if (atom->dihedral_type[i][m] > 0) dihedral_on++;
|
||||||
else dihedral_off++;
|
else dihedral_off++;
|
||||||
MPI_Allreduce(&dihedral_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&dihedral_on,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
dihedral_on = tmp;
|
dihedral_on = tmp;
|
||||||
MPI_Allreduce(&dihedral_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&dihedral_off,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
dihedral_off = tmp;
|
dihedral_off = tmp;
|
||||||
if (force->newton_bond == 0) {
|
if (force->newton_bond == 0) {
|
||||||
dihedral_on /= 4;
|
dihedral_on /= 4;
|
||||||
@ -434,9 +434,9 @@ void DeleteBonds::command(int narg, char **arg)
|
|||||||
for (m = 0; m < atom->num_improper[i]; m++)
|
for (m = 0; m < atom->num_improper[i]; m++)
|
||||||
if (atom->improper_type[i][m] > 0) improper_on++;
|
if (atom->improper_type[i][m] > 0) improper_on++;
|
||||||
else improper_off++;
|
else improper_off++;
|
||||||
MPI_Allreduce(&improper_on,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&improper_on,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
improper_on = tmp;
|
improper_on = tmp;
|
||||||
MPI_Allreduce(&improper_off,&tmp,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&improper_off,&tmp,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
improper_off = tmp;
|
improper_off = tmp;
|
||||||
if (force->newton_bond == 0) {
|
if (force->newton_bond == 0) {
|
||||||
improper_on /= 4;
|
improper_on /= 4;
|
||||||
|
|||||||
@ -213,7 +213,7 @@ void DisplaceAtoms::command(int narg, char **arg)
|
|||||||
|
|
||||||
bigint natoms;
|
bigint natoms;
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (natoms != atom->natoms) {
|
if (natoms != atom->natoms) {
|
||||||
char str[128];
|
char str[128];
|
||||||
sprintf(str,"Lost atoms via displace_atoms: original %lu current %lu",
|
sprintf(str,"Lost atoms via displace_atoms: original %lu current %lu",
|
||||||
|
|||||||
@ -379,7 +379,7 @@ void DisplaceBox::command(int narg, char **arg)
|
|||||||
|
|
||||||
bigint natoms;
|
bigint natoms;
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (natoms != atom->natoms) {
|
if (natoms != atom->natoms) {
|
||||||
char str[128];
|
char str[128];
|
||||||
sprintf(str,"Lost atoms via displace_box: original %lu current %lu",
|
sprintf(str,"Lost atoms via displace_box: original %lu current %lu",
|
||||||
|
|||||||
@ -174,7 +174,7 @@ void Dump::init()
|
|||||||
irregular = new Irregular(lmp);
|
irregular = new Irregular(lmp);
|
||||||
|
|
||||||
bigint size = group->count(igroup);
|
bigint size = group->count(igroup);
|
||||||
if (size > MAXINT32) error->all("Too many atoms to dump sort");
|
if (size > MAXSMALLINT) error->all("Too many atoms to dump sort");
|
||||||
|
|
||||||
// set reorderflag = 1 if can simply reorder local atoms rather than sort
|
// set reorderflag = 1 if can simply reorder local atoms rather than sort
|
||||||
// criteria: sorting by ID, atom IDs are consecutive from 1 to Natoms
|
// criteria: sorting by ID, atom IDs are consecutive from 1 to Natoms
|
||||||
|
|||||||
@ -71,7 +71,7 @@ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg)
|
|||||||
bigint n;
|
bigint n;
|
||||||
if (igroup == 0) n = static_cast<int> (atom->natoms);
|
if (igroup == 0) n = static_cast<int> (atom->natoms);
|
||||||
else n = static_cast<int> (group->count(igroup));
|
else n = static_cast<int> (group->count(igroup));
|
||||||
if (n > MAXINT32) error->all("Too many atoms for dump dcd");
|
if (n > MAXSMALLINT) error->all("Too many atoms for dump dcd");
|
||||||
natoms = n;
|
natoms = n;
|
||||||
|
|
||||||
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
|
coords = (float *) memory->smalloc(3*natoms*sizeof(float),"dump:coords");
|
||||||
|
|||||||
@ -86,7 +86,7 @@ void Finish::end(int flag)
|
|||||||
// use actual natoms, in case atoms were lost
|
// use actual natoms, in case atoms were lost
|
||||||
|
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if (screen)
|
if (screen)
|
||||||
|
|||||||
@ -497,7 +497,7 @@ bigint Group::count(int igroup)
|
|||||||
|
|
||||||
bigint nsingle = n;
|
bigint nsingle = n;
|
||||||
bigint nall;
|
bigint nall;
|
||||||
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nsingle,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
return nall;
|
return nall;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ bigint Group::count(int igroup, int iregion)
|
|||||||
|
|
||||||
bigint nsingle = n;
|
bigint nsingle = n;
|
||||||
bigint nall;
|
bigint nall;
|
||||||
MPI_Allreduce(&nsingle,&nall,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nsingle,&nall,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
return nall;
|
return nall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -247,9 +247,9 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
|
|||||||
error->all("No support for 8-byte unsigned integers");
|
error->all("No support for 8-byte unsigned integers");
|
||||||
|
|
||||||
int mpisize;
|
int mpisize;
|
||||||
MPI_Type_size(MPI_UNSIGNED_LONG_LONG,&mpisize);
|
MPI_Type_size(MPI_LMP_BIGINT,&mpisize);
|
||||||
if (mpisize != 8)
|
if (mpisize != 8)
|
||||||
error->all("MPI_UNSIGNED_LONG_LONG is not 8-byte data type");
|
error->all("MPI_LMP_BIGINT is not 8-byte data type");
|
||||||
|
|
||||||
// allocate input class now that MPI is fully setup
|
// allocate input class now that MPI is fully setup
|
||||||
|
|
||||||
|
|||||||
@ -348,7 +348,7 @@ void *lammps_extract_variable(void *ptr, char *name, char *group)
|
|||||||
int lammps_get_natoms(void *ptr)
|
int lammps_get_natoms(void *ptr)
|
||||||
{
|
{
|
||||||
LAMMPS *lmp = (LAMMPS *) ptr;
|
LAMMPS *lmp = (LAMMPS *) ptr;
|
||||||
if (lmp->atom->natoms > MAXINT32) return 0;
|
if (lmp->atom->natoms > MAXSMALLINT) return 0;
|
||||||
int natoms = static_cast<int> (lmp->atom->natoms);
|
int natoms = static_cast<int> (lmp->atom->natoms);
|
||||||
return natoms;
|
return natoms;
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ void lammps_get_coords(void *ptr, double *coords)
|
|||||||
// error if tags are not defined or not consecutive
|
// error if tags are not defined or not consecutive
|
||||||
|
|
||||||
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) return;
|
if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) return;
|
||||||
if (lmp->atom->natoms > MAXINT32) return;
|
if (lmp->atom->natoms > MAXSMALLINT) return;
|
||||||
|
|
||||||
int natoms = static_cast<int> (lmp->atom->natoms);
|
int natoms = static_cast<int> (lmp->atom->natoms);
|
||||||
double *copy = new double[3*natoms];
|
double *copy = new double[3*natoms];
|
||||||
@ -394,7 +394,7 @@ void lammps_put_coords(void *ptr, double *coords)
|
|||||||
// error if no map defined by LAMMPS
|
// error if no map defined by LAMMPS
|
||||||
|
|
||||||
if (lmp->atom->map_style == 0) return;
|
if (lmp->atom->map_style == 0) return;
|
||||||
if (lmp->atom->natoms > MAXINT32) return;
|
if (lmp->atom->natoms > MAXSMALLINT) return;
|
||||||
|
|
||||||
int natoms = static_cast<int> (lmp->atom->natoms);
|
int natoms = static_cast<int> (lmp->atom->natoms);
|
||||||
double **x = lmp->atom->x;
|
double **x = lmp->atom->x;
|
||||||
|
|||||||
@ -11,6 +11,23 @@
|
|||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
// define integer data types used by LAMMPS and associated size limits
|
||||||
|
|
||||||
|
// smallint = variables for system on 1 processor (nlocal, etc)
|
||||||
|
// tagint = variables for atom IDs (tag)
|
||||||
|
// bigint = variables for total system and timesteps (natoms, ntimestep, etc)
|
||||||
|
|
||||||
|
// smallint must be an int, as defined by C compiler
|
||||||
|
// tagint can be 32-bit or 64-bit int, must be >= smallint
|
||||||
|
// bigint can be 32-bit or 64-bit int, must be >= smallint and >= tagint
|
||||||
|
|
||||||
|
// MAXSMALLINT = max value of a smallint
|
||||||
|
// MAXTAGINT = max value of a tagint
|
||||||
|
// MAXBIGINT = max value of a bigint
|
||||||
|
|
||||||
|
// MPI_LMP_TAGINT = MPI data type corresponding to tagint
|
||||||
|
// MPI_LMP_BIGINT = MPI data type corresponding to bigint
|
||||||
|
|
||||||
#ifndef LMP_LMPTYPE_H
|
#ifndef LMP_LMPTYPE_H
|
||||||
#define LMP_LMPTYPE_H
|
#define LMP_LMPTYPE_H
|
||||||
|
|
||||||
@ -18,8 +35,18 @@
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
typedef uint64_t bigint;
|
// default settings: 4-byte smallint, 4-byte tagint, 8-byte bigint
|
||||||
#define MAXINT32 0x7FFFFFFF
|
|
||||||
|
typedef int smallint;
|
||||||
|
typedef int tagint;
|
||||||
|
typedef int64_t bigint;
|
||||||
|
|
||||||
|
#define MAXSMALLINT 0x7FFFFFFF
|
||||||
|
#define MAXTAGINT 0x7FFFFFFF
|
||||||
|
#define MAXBIGINT 0x7FFFFFFFFFFFFFFFL
|
||||||
|
|
||||||
|
#define MPI_LMP_TAGINT MPI_INT
|
||||||
|
#define MPI_LMP_BIGINT MPI_LONG_LONG
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -202,7 +202,7 @@ void Min::setup()
|
|||||||
bigint ndofme = 3*atom->nlocal;
|
bigint ndofme = 3*atom->nlocal;
|
||||||
for (int m = 0; m < nextra_atom; m++)
|
for (int m = 0; m < nextra_atom; m++)
|
||||||
ndofme += extra_peratom[m]*atom->nlocal;
|
ndofme += extra_peratom[m]*atom->nlocal;
|
||||||
MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&ndofme,&ndoftotal,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
ndoftotal += nextra_global;
|
ndoftotal += nextra_global;
|
||||||
|
|
||||||
// setup domain, communication and neighboring
|
// setup domain, communication and neighboring
|
||||||
|
|||||||
@ -51,7 +51,7 @@ int MinCG::iterate(int maxiter)
|
|||||||
// nlimit = max # of CG iterations before restarting
|
// nlimit = max # of CG iterations before restarting
|
||||||
// set to ndoftotal unless too big
|
// set to ndoftotal unless too big
|
||||||
|
|
||||||
int nlimit = static_cast<int> (MIN(MAXINT32,ndoftotal));
|
int nlimit = static_cast<int> (MIN(MAXSMALLINT,ndoftotal));
|
||||||
|
|
||||||
// initialize working vectors
|
// initialize working vectors
|
||||||
|
|
||||||
|
|||||||
@ -435,7 +435,7 @@ void ReadData::atoms()
|
|||||||
// check that all atoms were assigned correctly
|
// check that all atoms were assigned correctly
|
||||||
|
|
||||||
bigint tmp = atom->nlocal;
|
bigint tmp = atom->nlocal;
|
||||||
MPI_Allreduce(&tmp,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&tmp,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
||||||
@ -568,7 +568,7 @@ void ReadData::bonds()
|
|||||||
bigint sum;
|
bigint sum;
|
||||||
bigint n = 0;
|
bigint n = 0;
|
||||||
for (i = 0; i < nlocal; i++) n += atom->num_bond[i];
|
for (i = 0; i < nlocal; i++) n += atom->num_bond[i];
|
||||||
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&n,&sum,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
int factor = 1;
|
int factor = 1;
|
||||||
if (!force->newton_bond) factor = 2;
|
if (!force->newton_bond) factor = 2;
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ void ReadData::angles()
|
|||||||
bigint sum;
|
bigint sum;
|
||||||
bigint n = 0;
|
bigint n = 0;
|
||||||
for (i = 0; i < nlocal; i++) n += atom->num_angle[i];
|
for (i = 0; i < nlocal; i++) n += atom->num_angle[i];
|
||||||
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&n,&sum,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
int factor = 1;
|
int factor = 1;
|
||||||
if (!force->newton_bond) factor = 3;
|
if (!force->newton_bond) factor = 3;
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ void ReadData::dihedrals()
|
|||||||
bigint sum;
|
bigint sum;
|
||||||
bigint n = 0;
|
bigint n = 0;
|
||||||
for (i = 0; i < nlocal; i++) n += atom->num_dihedral[i];
|
for (i = 0; i < nlocal; i++) n += atom->num_dihedral[i];
|
||||||
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&n,&sum,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
int factor = 1;
|
int factor = 1;
|
||||||
if (!force->newton_bond) factor = 4;
|
if (!force->newton_bond) factor = 4;
|
||||||
|
|
||||||
@ -704,7 +704,7 @@ void ReadData::impropers()
|
|||||||
bigint sum;
|
bigint sum;
|
||||||
bigint n = 0;
|
bigint n = 0;
|
||||||
for (i = 0; i < nlocal; i++) n += atom->num_improper[i];
|
for (i = 0; i < nlocal; i++) n += atom->num_improper[i];
|
||||||
MPI_Allreduce(&n,&sum,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&n,&sum,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
int factor = 1;
|
int factor = 1;
|
||||||
if (!force->newton_bond) factor = 4;
|
if (!force->newton_bond) factor = 4;
|
||||||
|
|
||||||
@ -976,7 +976,7 @@ void ReadData::scan(int &bond_per_atom, int &angle_per_atom,
|
|||||||
int i,tmp1,tmp2,atom1,atom2,atom3,atom4;
|
int i,tmp1,tmp2,atom1,atom2,atom3,atom4;
|
||||||
char *eof;
|
char *eof;
|
||||||
|
|
||||||
if (atom->natoms > MAXINT32)
|
if (atom->natoms > MAXSMALLINT)
|
||||||
error->all("Molecular data file has too many atoms");
|
error->all("Molecular data file has too many atoms");
|
||||||
|
|
||||||
int natoms = static_cast<int> (atom->natoms);
|
int natoms = static_cast<int> (atom->natoms);
|
||||||
|
|||||||
@ -293,7 +293,7 @@ void ReadRestart::command(int narg, char **arg)
|
|||||||
|
|
||||||
bigint natoms;
|
bigint natoms;
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
||||||
@ -819,6 +819,6 @@ bigint ReadRestart::read_bigint()
|
|||||||
{
|
{
|
||||||
bigint value;
|
bigint value;
|
||||||
if (me == 0) fread(&value,sizeof(bigint),1,fp);
|
if (me == 0) fread(&value,sizeof(bigint),1,fp);
|
||||||
MPI_Bcast(&value,1,MPI_UNSIGNED_LONG_LONG,0,world);
|
MPI_Bcast(&value,1,MPI_LMP_BIGINT,0,world);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,16 +129,16 @@ void Replicate::command(int narg, char **arg)
|
|||||||
// if molecular, N/Nbonds/etc cannot be > 2^31 else tags/counts invalid
|
// if molecular, N/Nbonds/etc cannot be > 2^31 else tags/counts invalid
|
||||||
|
|
||||||
double rep = nrep;
|
double rep = nrep;
|
||||||
if (rep*old->natoms > MAXINT32) atom->tag_enable = 0;
|
if (rep*old->natoms > MAXSMALLINT) atom->tag_enable = 0;
|
||||||
|
|
||||||
if (atom->tag_enable == 0)
|
if (atom->tag_enable == 0)
|
||||||
for (int i = 0; i < atom->nlocal; i++)
|
for (int i = 0; i < atom->nlocal; i++)
|
||||||
atom->tag[i] = 0;
|
atom->tag[i] = 0;
|
||||||
|
|
||||||
if (atom->molecular) {
|
if (atom->molecular) {
|
||||||
if (rep*old->natoms > MAXINT32 || rep*old->nbonds > MAXINT32 ||
|
if (rep*old->natoms > MAXBIGINT || rep*old->nbonds > MAXBIGINT ||
|
||||||
rep*old->nangles > MAXINT32 || rep*old->ndihedrals > MAXINT32 ||
|
rep*old->nangles > MAXBIGINT || rep*old->ndihedrals > MAXBIGINT ||
|
||||||
rep*old->nimpropers > MAXINT32)
|
rep*old->nimpropers > MAXBIGINT)
|
||||||
error->all("Too big a problem to replicate with molecular atom style");
|
error->all("Too big a problem to replicate with molecular atom style");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +365,7 @@ void Replicate::command(int narg, char **arg)
|
|||||||
|
|
||||||
bigint natoms;
|
bigint natoms;
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
if (screen) fprintf(screen," %lu atoms\n",natoms);
|
||||||
|
|||||||
@ -353,7 +353,7 @@ bigint Thermo::lost_check()
|
|||||||
|
|
||||||
bigint ntotal;
|
bigint ntotal;
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&ntotal,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&ntotal,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (ntotal == atom->natoms) return ntotal;
|
if (ntotal == atom->natoms) return ntotal;
|
||||||
|
|
||||||
// if not checking or already warned, just return
|
// if not checking or already warned, just return
|
||||||
|
|||||||
@ -223,7 +223,7 @@ void Velocity::create(double t_desired, int seed)
|
|||||||
|
|
||||||
// error check
|
// error check
|
||||||
|
|
||||||
if (atom->natoms > MAXINT32)
|
if (atom->natoms > MAXSMALLINT)
|
||||||
error->all("Too big a problem to use velocity create loop all");
|
error->all("Too big a problem to use velocity create loop all");
|
||||||
if (atom->tag_enable == 0)
|
if (atom->tag_enable == 0)
|
||||||
error->all("Cannot use velocity create loop all unless atoms have IDs");
|
error->all("Cannot use velocity create loop all unless atoms have IDs");
|
||||||
|
|||||||
@ -122,7 +122,7 @@ void WriteRestart::write(char *file)
|
|||||||
// if unequal and thermo lostflag is "error", don't write restart file
|
// if unequal and thermo lostflag is "error", don't write restart file
|
||||||
|
|
||||||
bigint nblocal = atom->nlocal;
|
bigint nblocal = atom->nlocal;
|
||||||
MPI_Allreduce(&nblocal,&natoms,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,world);
|
MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world);
|
||||||
if (natoms != atom->natoms && output->thermo->lostflag == ERROR)
|
if (natoms != atom->natoms && output->thermo->lostflag == ERROR)
|
||||||
error->all("Atom count is inconsistent, cannot write restart file");
|
error->all("Atom count is inconsistent, cannot write restart file");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user