mirror of https://github.com/lammps/lammps.git
Merge pull request #1406 from akohlmey/fix-some-64-bit-integer-issues
Fix some 64 bit integer issues
This commit is contained in:
commit
605524ab66
|
@ -637,14 +637,14 @@ void FixPIMD::comm_exec(double **ptr)
|
|||
if(nsend > max_nsend)
|
||||
{
|
||||
max_nsend = nsend+200;
|
||||
tag_send = (int*) memory->srealloc(tag_send, sizeof(int)*max_nsend, "FixPIMD:tag_send");
|
||||
tag_send = (tagint*) memory->srealloc(tag_send, sizeof(tagint)*max_nsend, "FixPIMD:tag_send");
|
||||
buf_send = (double*) memory->srealloc(buf_send, sizeof(double)*max_nsend*3, "FixPIMD:x_send");
|
||||
}
|
||||
|
||||
// send tags
|
||||
|
||||
MPI_Sendrecv( atom->tag, nlocal, MPI_INT, plan_send[iplan], 0,
|
||||
tag_send, nsend, MPI_INT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);
|
||||
MPI_Sendrecv( atom->tag, nlocal, MPI_LMP_TAGINT, plan_send[iplan], 0,
|
||||
tag_send, nsend, MPI_LMP_TAGINT, plan_recv[iplan], 0, universe->uworld, MPI_STATUS_IGNORE);
|
||||
|
||||
// wrap positions
|
||||
|
||||
|
@ -661,7 +661,7 @@ void FixPIMD::comm_exec(double **ptr)
|
|||
|
||||
sprintf(error_line, "Atom " TAGINT_FORMAT " is missing at world [%d] "
|
||||
"rank [%d] required by rank [%d] (" TAGINT_FORMAT ", "
|
||||
TAGINT_FORMAT ", " TAGINT_FORMAT ").\n",tag_send[i],
|
||||
TAGINT_FORMAT ", " TAGINT_FORMAT ").\n", tag_send[i],
|
||||
universe->iworld, comm->me, plan_recv[iplan],
|
||||
atom->tag[0], atom->tag[1], atom->tag[2]);
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class FixPIMD : public Fix {
|
|||
/* inter-partition communication */
|
||||
|
||||
int max_nsend;
|
||||
int* tag_send;
|
||||
tagint* tag_send;
|
||||
double *buf_send;
|
||||
|
||||
int max_nlocal;
|
||||
|
|
|
@ -23,6 +23,16 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
// declaration to indicate intended fallthrough cases in switch statements
|
||||
// and thus silence the warnings produced by g++ -Wextra
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define _fallthrough __attribute__ ((fallthrough))
|
||||
#else
|
||||
#define _fallthrough
|
||||
#endif
|
||||
|
||||
|
||||
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
||||
|
||||
/*
|
||||
|
@ -291,17 +301,17 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
|
|||
/*-------------------------------- last block: affect all 32 bits of (c) */
|
||||
switch(length) /* all the case statements fall through */
|
||||
{
|
||||
case 12: c+=((uint32_t)k[11])<<24;
|
||||
case 11: c+=((uint32_t)k[10])<<16;
|
||||
case 10: c+=((uint32_t)k[9])<<8;
|
||||
case 9 : c+=k[8];
|
||||
case 8 : b+=((uint32_t)k[7])<<24;
|
||||
case 7 : b+=((uint32_t)k[6])<<16;
|
||||
case 6 : b+=((uint32_t)k[5])<<8;
|
||||
case 5 : b+=k[4];
|
||||
case 4 : a+=((uint32_t)k[3])<<24;
|
||||
case 3 : a+=((uint32_t)k[2])<<16;
|
||||
case 2 : a+=((uint32_t)k[1])<<8;
|
||||
case 12: c+=((uint32_t)k[11])<<24; _fallthrough;
|
||||
case 11: c+=((uint32_t)k[10])<<16; _fallthrough;
|
||||
case 10: c+=((uint32_t)k[9])<<8; _fallthrough;
|
||||
case 9 : c+=k[8]; _fallthrough;
|
||||
case 8 : b+=((uint32_t)k[7])<<24; _fallthrough;
|
||||
case 7 : b+=((uint32_t)k[6])<<16; _fallthrough;
|
||||
case 6 : b+=((uint32_t)k[5])<<8; _fallthrough;
|
||||
case 5 : b+=k[4]; _fallthrough;
|
||||
case 4 : a+=((uint32_t)k[3])<<24; _fallthrough;
|
||||
case 3 : a+=((uint32_t)k[2])<<16; _fallthrough;
|
||||
case 2 : a+=((uint32_t)k[1])<<8; _fallthrough;
|
||||
case 1 : a+=k[0];
|
||||
break;
|
||||
case 0 : return c;
|
||||
|
|
|
@ -921,7 +921,7 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf)
|
|||
|
||||
// post all receives, starting after self copies
|
||||
|
||||
bigint offset = num_self*nbytes;
|
||||
bigint offset = num_self*(bigint)nbytes;
|
||||
for (int irecv = 0; irecv < nrecv_proc; irecv++) {
|
||||
MPI_Irecv(&recvbuf[offset],num_recv[irecv]*nbytes,MPI_CHAR,
|
||||
proc_recv[irecv],0,world,&request[irecv]);
|
||||
|
@ -964,13 +964,6 @@ void Irregular::exchange_data(char *sendbuf, int nbytes, char *recvbuf)
|
|||
// wait on all incoming messages
|
||||
|
||||
if (nrecv_proc) MPI_Waitall(nrecv_proc,request,status);
|
||||
|
||||
// approximate memory tally
|
||||
// DEBUG lines
|
||||
|
||||
//bigint irregular_bytes = 2*nprocs*sizeof(int);
|
||||
//irregular_bytes += maxindex*sizeof(int);
|
||||
//irregular_bytes += maxbuf;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
201
src/special.cpp
201
src/special.cpp
|
@ -821,21 +821,26 @@ void Special::angle_trim()
|
|||
|
||||
int nsend = 0;
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
if (num_angle) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
|
||||
if (num_dihedral) {
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m < 0 || m >= nlocal) nsend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -852,51 +857,55 @@ void Special::angle_trim()
|
|||
|
||||
nsend = 0;
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
if (num_angle) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = angle_atom1[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = angle_atom1[i][j];
|
||||
inbuf[nsend].partnerID = angle_atom3[i][j];
|
||||
nsend++;
|
||||
}
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = angle_atom1[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = angle_atom1[i][j];
|
||||
inbuf[nsend].partnerID = angle_atom3[i][j];
|
||||
nsend++;
|
||||
}
|
||||
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = angle_atom3[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = angle_atom3[i][j];
|
||||
inbuf[nsend].partnerID = angle_atom1[i][j];
|
||||
nsend++;
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = angle_atom3[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = angle_atom3[i][j];
|
||||
inbuf[nsend].partnerID = angle_atom1[i][j];
|
||||
nsend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
if (num_dihedral) {
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom1[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom3[i][j];
|
||||
nsend++;
|
||||
}
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom1[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom1[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom3[i][j];
|
||||
nsend++;
|
||||
}
|
||||
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom3[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom3[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom1[i][j];
|
||||
nsend++;
|
||||
}
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom3[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom3[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom1[i][j];
|
||||
nsend++;
|
||||
}
|
||||
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom4[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom2[i][j];
|
||||
nsend++;
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m < 0 || m >= nlocal) {
|
||||
proclist[nsend] = dihedral_atom4[i][j] % nprocs;
|
||||
inbuf[nsend].atomID = dihedral_atom4[i][j];
|
||||
inbuf[nsend].partnerID = dihedral_atom2[i][j];
|
||||
nsend++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -932,56 +941,60 @@ void Special::angle_trim()
|
|||
// output datums = pairs of atoms that are 1-3 neighbors
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
if (num_angle) {
|
||||
for (j = 0; j < num_angle[i]; j++) {
|
||||
if (tag[i] != angle_atom2[i][j]) continue;
|
||||
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == angle_atom3[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m = atom->map(angle_atom1[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == angle_atom3[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == angle_atom1[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
m = atom->map(angle_atom3[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == angle_atom1[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
if (num_dihedral) {
|
||||
for (j = 0; j < num_dihedral[i]; j++) {
|
||||
if (tag[i] != dihedral_atom2[i][j]) continue;
|
||||
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom3[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m = atom->map(dihedral_atom1[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom3[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom1[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m = atom->map(dihedral_atom3[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom1[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom2[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
m = atom->map(dihedral_atom4[i][j]);
|
||||
if (m >= 0 && m < nlocal) {
|
||||
for (k = 0; k < nspecial[m][1]; k++)
|
||||
if (onethree[m][k] == dihedral_atom2[i][j]) {
|
||||
flag[m][k] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1012,7 +1025,7 @@ void Special::angle_trim()
|
|||
|
||||
memory->destroy(flag);
|
||||
|
||||
// if no angles or dihedrals are defined, delete all 1-3 neighs
|
||||
// if no angles or dihedrals are defined, delete all 1-3 neighs
|
||||
|
||||
} else {
|
||||
for (i = 0; i < nlocal; i++) nspecial[i][1] = 0;
|
||||
|
|
Loading…
Reference in New Issue