From ec6c602730195fd3f7e4a1f73e67451e971e86b4 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 20 Nov 2013 17:21:27 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11027 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/DIPOLE/atom_vec_dipole.cpp | 93 ++++---- src/MOLECULE/atom_vec_angle.cpp | 176 +++++++-------- src/MOLECULE/atom_vec_bond.cpp | 160 ++++++------- src/MOLECULE/atom_vec_full.cpp | 290 ++++++++++++------------ src/MOLECULE/atom_vec_molecular.cpp | 296 +++++++++++++------------ src/PERI/atom_vec_peri.cpp | 92 ++++---- src/USER-AWPMD/atom_vec_wavepacket.cpp | 167 +++++++------- src/USER-EFF/atom_vec_electron.cpp | 128 +++++------ src/USER-SPH/atom_vec_meso.cpp | 149 ++++++++----- src/atom_vec.cpp | 4 +- src/atom_vec_atomic.cpp | 90 ++++---- src/atom_vec_body.cpp | 198 +++++++++-------- src/atom_vec_charge.cpp | 91 ++++---- src/atom_vec_ellipsoid.cpp | 146 ++++++------ src/atom_vec_hybrid.cpp | 61 ++--- src/atom_vec_line.cpp | 177 +++++++-------- src/atom_vec_tri.cpp | 176 +++++++-------- 17 files changed, 1273 insertions(+), 1221 deletions(-) diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index 8d2dc979f5..ed08a88c15 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -347,9 +347,9 @@ int AtomVecDipole::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = mu[j][0]; buf[m++] = mu[j][1]; @@ -371,9 +371,9 @@ int AtomVecDipole::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = mu[j][0]; buf[m++] = mu[j][1]; @@ -404,9 +404,9 @@ int AtomVecDipole::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = mu[j][0]; buf[m++] = mu[j][1]; @@ -432,9 +432,9 @@ int AtomVecDipole::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = mu[j][0]; buf[m++] = mu[j][1]; @@ -453,9 +453,9 @@ int AtomVecDipole::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = mu[j][0]; buf[m++] = mu[j][1]; @@ -512,9 +512,9 @@ void AtomVecDipole::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; mu[i][0] = buf[m++]; mu[i][1] = buf[m++]; @@ -541,9 +541,9 @@ void AtomVecDipole::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; mu[i][0] = buf[m++]; mu[i][1] = buf[m++]; @@ -592,10 +592,10 @@ int AtomVecDipole::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = q[i]; buf[m++] = mu[i][0]; @@ -625,10 +625,10 @@ int AtomVecDipole::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; q[nlocal] = buf[m++]; mu[nlocal][0] = buf[m++]; @@ -677,10 +677,10 @@ int AtomVecDipole::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -716,10 +716,10 @@ int AtomVecDipole::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -837,8 +837,8 @@ void AtomVecDipole::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = q[i]; buf[i][3] = x[i][0]; buf[i][4] = x[i][1]; @@ -846,9 +846,9 @@ void AtomVecDipole::pack_data(double **buf) buf[i][6] = mu[i][0]; buf[i][7] = mu[i][1]; buf[i][8] = mu[i][2]; - buf[i][9] = (image[i] & IMGMASK) - IMGMAX; - buf[i][10] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][11] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][9] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][10] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][11] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -874,10 +874,11 @@ void AtomVecDipole::write_data(FILE *fp, int n, double **buf) for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e " "%-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],buf[i][2], - buf[i][3],buf[i][4],buf[i][5], - buf[i][6],buf[i][7],buf[i][8], - (int) buf[i][9],(int) buf[i][10],(int) buf[i][11]); + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4], + buf[i][5],buf[i][6],buf[i][7],buf[i][8], + (int) ubuf(buf[i][9]).i,(int) ubuf(buf[i][10]).i, + (int) ubuf(buf[i][11]).i); } /* ---------------------------------------------------------------------- diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index e7af84e6d3..1ade8a1d54 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -334,10 +334,10 @@ int AtomVecAngle::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } else { if (domain->triclinic == 0) { @@ -354,10 +354,10 @@ int AtomVecAngle::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } @@ -383,10 +383,10 @@ int AtomVecAngle::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -407,10 +407,10 @@ int AtomVecAngle::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -424,10 +424,10 @@ int AtomVecAngle::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -457,7 +457,7 @@ int AtomVecAngle::pack_border_hybrid(int n, int *list, double *buf) m = 0; for (i = 0; i < n; i++) { j = list[i]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; } return m; } @@ -475,10 +475,10 @@ void AtomVecAngle::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -500,10 +500,10 @@ void AtomVecAngle::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -524,7 +524,7 @@ int AtomVecAngle::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; return m; } @@ -544,31 +544,31 @@ int AtomVecAngle::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = bond_type[i][k]; - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(bond_type[i][k]).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = num_angle[i]; + buf[m++] = ubuf(num_angle[i]).d; for (k = 0; k < num_angle[i]; k++) { - buf[m++] = angle_type[i][k]; - buf[m++] = angle_atom1[i][k]; - buf[m++] = angle_atom2[i][k]; - buf[m++] = angle_atom3[i][k]; + buf[m++] = ubuf(angle_type[i][k]).d; + buf[m++] = ubuf(angle_atom1[i][k]).d; + buf[m++] = ubuf(angle_atom2[i][k]).d; + buf[m++] = ubuf(angle_atom3[i][k]).d; } - buf[m++] = nspecial[i][0]; - buf[m++] = nspecial[i][1]; - buf[m++] = nspecial[i][2]; - for (k = 0; k < nspecial[i][2]; k++) buf[m++] = special[i][k]; + buf[m++] = ubuf(nspecial[i][0]).d; + buf[m++] = ubuf(nspecial[i][1]).d; + buf[m++] = ubuf(nspecial[i][2]).d; + for (k = 0; k < nspecial[i][2]; k++) buf[m++] = ubuf(special[i][k]).d; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -594,32 +594,32 @@ int AtomVecAngle::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } - nspecial[nlocal][0] = static_cast (buf[m++]); - nspecial[nlocal][1] = static_cast (buf[m++]); - nspecial[nlocal][2] = static_cast (buf[m++]); + nspecial[nlocal][0] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][1] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][2] = (int) ubuf(buf[m++]).i; for (k = 0; k < nspecial[nlocal][2]; k++) - special[nlocal][k] = static_cast (buf[m++]); + special[nlocal][k] = (int) ubuf(buf[m++]).i; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -717,28 +717,28 @@ int AtomVecAngle::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0; @@ -842,15 +842,15 @@ void AtomVecAngle::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; buf[i][3] = x[i][0]; buf[i][4] = x[i][1]; buf[i][5] = x[i][2]; - buf[i][6] = (image[i] & IMGMASK) - IMGMAX; - buf[i][7] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][6] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -860,7 +860,7 @@ void AtomVecAngle::pack_data(double **buf) int AtomVecAngle::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; + buf[0] = ubuf(molecule[i]).d; return 1; } @@ -872,9 +872,11 @@ void AtomVecAngle::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5], - (int) buf[i][6],(int) buf[i][7],(int) buf[i][8]); + (int) ubuf(buf[i][6]).i,(int) ubuf(buf[i][7]).i, + (int) ubuf(buf[i][8]).i); } /* ---------------------------------------------------------------------- @@ -883,7 +885,7 @@ void AtomVecAngle::write_data(FILE *fp, int n, double **buf) int AtomVecAngle::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d",(int) buf[0]); + fprintf(fp," %d",(int) ubuf(buf[0]).i); return 1; } diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index 377c552ee5..6d9f916d71 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -313,10 +313,10 @@ int AtomVecBond::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } else { if (domain->triclinic == 0) { @@ -333,10 +333,10 @@ int AtomVecBond::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } @@ -362,10 +362,10 @@ int AtomVecBond::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -386,10 +386,10 @@ int AtomVecBond::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -403,10 +403,10 @@ int AtomVecBond::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -454,10 +454,10 @@ void AtomVecBond::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -479,10 +479,10 @@ void AtomVecBond::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -503,7 +503,7 @@ int AtomVecBond::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; return m; } @@ -523,23 +523,23 @@ int AtomVecBond::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = bond_type[i][k]; - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(bond_type[i][k]).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = nspecial[i][0]; - buf[m++] = nspecial[i][1]; - buf[m++] = nspecial[i][2]; - for (k = 0; k < nspecial[i][2]; k++) buf[m++] = special[i][k]; + buf[m++] = ubuf(nspecial[i][0]).d; + buf[m++] = ubuf(nspecial[i][1]).d; + buf[m++] = ubuf(nspecial[i][2]).d; + for (k = 0; k < nspecial[i][2]; k++) buf[m++] = ubuf(special[i][k]).d; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -565,24 +565,24 @@ int AtomVecBond::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - nspecial[nlocal][0] = static_cast (buf[m++]); - nspecial[nlocal][1] = static_cast (buf[m++]); - nspecial[nlocal][2] = static_cast (buf[m++]); + nspecial[nlocal][0] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][1] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][2] = (int) ubuf(buf[m++]).i; for (k = 0; k < nspecial[nlocal][2]; k++) - special[nlocal][k] = static_cast (buf[m++]); + special[nlocal][k] = (int) ubuf(buf[m++]).i; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -629,20 +629,20 @@ int AtomVecBond::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = MAX(bond_type[i][k],-bond_type[i][k]); - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(MAX(bond_type[i][k],-bond_type[i][k])).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } if (atom->nextra_restart) @@ -672,20 +672,20 @@ int AtomVecBond::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0; @@ -786,15 +786,15 @@ void AtomVecBond::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; buf[i][3] = x[i][0]; buf[i][4] = x[i][1]; buf[i][5] = x[i][2]; - buf[i][6] = (image[i] & IMGMASK) - IMGMAX; - buf[i][7] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][6] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -804,7 +804,7 @@ void AtomVecBond::pack_data(double **buf) int AtomVecBond::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; + buf[0] = ubuf(molecule[i]).d; return 1; } @@ -816,9 +816,11 @@ void AtomVecBond::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5], - (int) buf[i][6],(int) buf[i][7],(int) buf[i][8]); + (int) ubuf(buf[i][6]).i,(int) ubuf(buf[i][7]).i, + (int) ubuf(buf[i][8]).i); } /* ---------------------------------------------------------------------- @@ -827,7 +829,7 @@ void AtomVecBond::write_data(FILE *fp, int n, double **buf) int AtomVecBond::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d",(int) buf[0]); + fprintf(fp," %d",(int) ubuf(buf[0]).i); return 1; } diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 8f4022bd36..7045b9d5c4 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -393,11 +393,11 @@ int AtomVecFull::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; } } else { if (domain->triclinic == 0) { @@ -414,11 +414,11 @@ int AtomVecFull::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; } } @@ -444,11 +444,11 @@ int AtomVecFull::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -487,11 +487,11 @@ int AtomVecFull::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -522,7 +522,7 @@ int AtomVecFull::pack_border_hybrid(int n, int *list, double *buf) for (i = 0; i < n; i++) { j = list[i]; buf[m++] = q[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(molecule[j]).d; } return m; } @@ -540,11 +540,11 @@ void AtomVecFull::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -566,11 +566,11 @@ void AtomVecFull::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -592,7 +592,7 @@ int AtomVecFull::unpack_border_hybrid(int n, int first, double *buf) last = first + n; for (i = first; i < last; i++) { q[i] = buf[m++]; - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; } return m; } @@ -613,50 +613,50 @@ int AtomVecFull::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = q[i]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = bond_type[i][k]; - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(bond_type[i][k]).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = num_angle[i]; + buf[m++] = ubuf(num_angle[i]).d; for (k = 0; k < num_angle[i]; k++) { - buf[m++] = angle_type[i][k]; - buf[m++] = angle_atom1[i][k]; - buf[m++] = angle_atom2[i][k]; - buf[m++] = angle_atom3[i][k]; + buf[m++] = ubuf(angle_type[i][k]).d; + buf[m++] = ubuf(angle_atom1[i][k]).d; + buf[m++] = ubuf(angle_atom2[i][k]).d; + buf[m++] = ubuf(angle_atom3[i][k]).d; } - buf[m++] = num_dihedral[i]; + buf[m++] = ubuf(num_dihedral[i]).d; for (k = 0; k < num_dihedral[i]; k++) { - buf[m++] = dihedral_type[i][k]; - buf[m++] = dihedral_atom1[i][k]; - buf[m++] = dihedral_atom2[i][k]; - buf[m++] = dihedral_atom3[i][k]; - buf[m++] = dihedral_atom4[i][k]; + buf[m++] = ubuf(dihedral_type[i][k]).d; + buf[m++] = ubuf(dihedral_atom1[i][k]).d; + buf[m++] = ubuf(dihedral_atom2[i][k]).d; + buf[m++] = ubuf(dihedral_atom3[i][k]).d; + buf[m++] = ubuf(dihedral_atom4[i][k]).d; } - buf[m++] = num_improper[i]; + buf[m++] = ubuf(num_improper[i]).d; for (k = 0; k < num_improper[i]; k++) { - buf[m++] = improper_type[i][k]; - buf[m++] = improper_atom1[i][k]; - buf[m++] = improper_atom2[i][k]; - buf[m++] = improper_atom3[i][k]; - buf[m++] = improper_atom4[i][k]; + buf[m++] = ubuf(improper_type[i][k]).d; + buf[m++] = ubuf(improper_atom1[i][k]).d; + buf[m++] = ubuf(improper_atom2[i][k]).d; + buf[m++] = ubuf(improper_atom3[i][k]).d; + buf[m++] = ubuf(improper_atom4[i][k]).d; } - buf[m++] = nspecial[i][0]; - buf[m++] = nspecial[i][1]; - buf[m++] = nspecial[i][2]; - for (k = 0; k < nspecial[i][2]; k++) buf[m++] = special[i][k]; + buf[m++] = ubuf(nspecial[i][0]).d; + buf[m++] = ubuf(nspecial[i][1]).d; + buf[m++] = ubuf(nspecial[i][2]).d; + for (k = 0; k < nspecial[i][2]; k++) buf[m++] = ubuf(special[i][k]).d; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -682,51 +682,51 @@ int AtomVecFull::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; q[nlocal] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_dihedral[nlocal] = static_cast (buf[m++]); + num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { - dihedral_type[nlocal][k] = static_cast (buf[m++]); - dihedral_atom1[nlocal][k] = static_cast (buf[m++]); - dihedral_atom2[nlocal][k] = static_cast (buf[m++]); - dihedral_atom3[nlocal][k] = static_cast (buf[m++]); - dihedral_atom4[nlocal][k] = static_cast (buf[m++]); + dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_improper[nlocal] = static_cast (buf[m++]); + num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { - improper_type[nlocal][k] = static_cast (buf[m++]); - improper_atom1[nlocal][k] = static_cast (buf[m++]); - improper_atom2[nlocal][k] = static_cast (buf[m++]); - improper_atom3[nlocal][k] = static_cast (buf[m++]); - improper_atom4[nlocal][k] = static_cast (buf[m++]); + improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - nspecial[nlocal][0] = static_cast (buf[m++]); - nspecial[nlocal][1] = static_cast (buf[m++]); - nspecial[nlocal][2] = static_cast (buf[m++]); + nspecial[nlocal][0] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][1] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][2] = (int) ubuf(buf[m++]).i; for (k = 0; k < nspecial[nlocal][2]; k++) - special[nlocal][k] = static_cast (buf[m++]); + special[nlocal][k] = (int) ubuf(buf[m++]).i; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -774,47 +774,47 @@ int AtomVecFull::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; buf[m++] = q[i]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = MAX(bond_type[i][k],-bond_type[i][k]); - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(MAX(bond_type[i][k],-bond_type[i][k])).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = num_angle[i]; + buf[m++] = ubuf(num_angle[i]).d; for (k = 0; k < num_angle[i]; k++) { - buf[m++] = MAX(angle_type[i][k],-angle_type[i][k]); - buf[m++] = angle_atom1[i][k]; - buf[m++] = angle_atom2[i][k]; - buf[m++] = angle_atom3[i][k]; + buf[m++] = ubuf(MAX(angle_type[i][k],-angle_type[i][k])).d; + buf[m++] = ubuf(angle_atom1[i][k]).d; + buf[m++] = ubuf(angle_atom2[i][k]).d; + buf[m++] = ubuf(angle_atom3[i][k]).d; } - buf[m++] = num_dihedral[i]; + buf[m++] = ubuf(num_dihedral[i]).d; for (k = 0; k < num_dihedral[i]; k++) { - buf[m++] = MAX(dihedral_type[i][k],-dihedral_type[i][k]); - buf[m++] = dihedral_atom1[i][k]; - buf[m++] = dihedral_atom2[i][k]; - buf[m++] = dihedral_atom3[i][k]; - buf[m++] = dihedral_atom4[i][k]; + buf[m++] = ubuf(MAX(dihedral_type[i][k],-dihedral_type[i][k])).d; + buf[m++] = ubuf(dihedral_atom1[i][k]).d; + buf[m++] = ubuf(dihedral_atom2[i][k]).d; + buf[m++] = ubuf(dihedral_atom3[i][k]).d; + buf[m++] = ubuf(dihedral_atom4[i][k]).d; } - buf[m++] = num_improper[i]; + buf[m++] = ubuf(num_improper[i]).d; for (k = 0; k < num_improper[i]; k++) { - buf[m++] = MAX(improper_type[i][k],-improper_type[i][k]); - buf[m++] = improper_atom1[i][k]; - buf[m++] = improper_atom2[i][k]; - buf[m++] = improper_atom3[i][k]; - buf[m++] = improper_atom4[i][k]; + buf[m++] = ubuf(MAX(improper_type[i][k],-improper_type[i][k])).d; + buf[m++] = ubuf(improper_atom1[i][k]).d; + buf[m++] = ubuf(improper_atom2[i][k]).d; + buf[m++] = ubuf(improper_atom3[i][k]).d; + buf[m++] = ubuf(improper_atom4[i][k]).d; } if (atom->nextra_restart) @@ -844,47 +844,47 @@ int AtomVecFull::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; q[nlocal] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_dihedral[nlocal] = static_cast (buf[m++]); + num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { - dihedral_type[nlocal][k] = static_cast (buf[m++]); - dihedral_atom1[nlocal][k] = static_cast (buf[m++]); - dihedral_atom2[nlocal][k] = static_cast (buf[m++]); - dihedral_atom3[nlocal][k] = static_cast (buf[m++]); - dihedral_atom4[nlocal][k] = static_cast (buf[m++]); + dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_improper[nlocal] = static_cast (buf[m++]); + num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { - improper_type[nlocal][k] = static_cast (buf[m++]); - improper_atom1[nlocal][k] = static_cast (buf[m++]); - improper_atom2[nlocal][k] = static_cast (buf[m++]); - improper_atom3[nlocal][k] = static_cast (buf[m++]); - improper_atom4[nlocal][k] = static_cast (buf[m++]); + improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0; @@ -998,16 +998,16 @@ void AtomVecFull::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; buf[i][3] = q[i]; buf[i][4] = x[i][0]; buf[i][5] = x[i][1]; buf[i][6] = x[i][2]; - buf[i][7] = (image[i] & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][7] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1017,7 +1017,7 @@ void AtomVecFull::pack_data(double **buf) int AtomVecFull::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; + buf[0] = ubuf(molecule[i]).d; buf[1] = q[i]; return 2; } @@ -1030,9 +1030,11 @@ void AtomVecFull::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5],buf[i][6], - (int) buf[i][7],(int) buf[i][8],(int) buf[i][9]); + (int) ubuf(buf[i][7]).i,(int) ubuf(buf[i][8]).i, + (int) ubuf(buf[i][9]).i); } /* ---------------------------------------------------------------------- @@ -1041,7 +1043,7 @@ void AtomVecFull::write_data(FILE *fp, int n, double **buf) int AtomVecFull::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d %-1.16e",(int) buf[0],buf[1]); + fprintf(fp," %d %-1.16e",(int) ubuf(buf[0]).i,buf[1]); return 2; } diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 57e275f04c..2640a79a67 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -391,10 +391,10 @@ int AtomVecMolecular::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } else { if (domain->triclinic == 0) { @@ -411,10 +411,10 @@ int AtomVecMolecular::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; } } @@ -440,10 +440,10 @@ int AtomVecMolecular::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -464,10 +464,10 @@ int AtomVecMolecular::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -481,10 +481,10 @@ int AtomVecMolecular::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -532,10 +532,10 @@ void AtomVecMolecular::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -557,10 +557,10 @@ void AtomVecMolecular::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -581,7 +581,7 @@ int AtomVecMolecular::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) - molecule[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; return m; } @@ -601,49 +601,49 @@ int AtomVecMolecular::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = bond_type[i][k]; - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(bond_type[i][k]).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = num_angle[i]; + buf[m++] = ubuf(num_angle[i]).d; for (k = 0; k < num_angle[i]; k++) { - buf[m++] = angle_type[i][k]; - buf[m++] = angle_atom1[i][k]; - buf[m++] = angle_atom2[i][k]; - buf[m++] = angle_atom3[i][k]; + buf[m++] = ubuf(angle_type[i][k]).d; + buf[m++] = ubuf(angle_atom1[i][k]).d; + buf[m++] = ubuf(angle_atom2[i][k]).d; + buf[m++] = ubuf(angle_atom3[i][k]).d; } - buf[m++] = num_dihedral[i]; + buf[m++] = ubuf(num_dihedral[i]).d; for (k = 0; k < num_dihedral[i]; k++) { - buf[m++] = dihedral_type[i][k]; - buf[m++] = dihedral_atom1[i][k]; - buf[m++] = dihedral_atom2[i][k]; - buf[m++] = dihedral_atom3[i][k]; - buf[m++] = dihedral_atom4[i][k]; + buf[m++] = ubuf(dihedral_type[i][k]).d; + buf[m++] = ubuf(dihedral_atom1[i][k]).d; + buf[m++] = ubuf(dihedral_atom2[i][k]).d; + buf[m++] = ubuf(dihedral_atom3[i][k]).d; + buf[m++] = ubuf(dihedral_atom4[i][k]).d; } - buf[m++] = num_improper[i]; + buf[m++] = ubuf(num_improper[i]).d; for (k = 0; k < num_improper[i]; k++) { - buf[m++] = improper_type[i][k]; - buf[m++] = improper_atom1[i][k]; - buf[m++] = improper_atom2[i][k]; - buf[m++] = improper_atom3[i][k]; - buf[m++] = improper_atom4[i][k]; + buf[m++] = ubuf(improper_type[i][k]).d; + buf[m++] = ubuf(improper_atom1[i][k]).d; + buf[m++] = ubuf(improper_atom2[i][k]).d; + buf[m++] = ubuf(improper_atom3[i][k]).d; + buf[m++] = ubuf(improper_atom4[i][k]).d; } - buf[m++] = nspecial[i][0]; - buf[m++] = nspecial[i][1]; - buf[m++] = nspecial[i][2]; - for (k = 0; k < nspecial[i][2]; k++) buf[m++] = special[i][k]; + buf[m++] = ubuf(nspecial[i][0]).d; + buf[m++] = ubuf(nspecial[i][1]).d; + buf[m++] = ubuf(nspecial[i][2]).d; + for (k = 0; k < nspecial[i][2]; k++) buf[m++] = ubuf(special[i][k]).d; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -669,50 +669,50 @@ int AtomVecMolecular::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_dihedral[nlocal] = static_cast (buf[m++]); + num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { - dihedral_type[nlocal][k] = static_cast (buf[m++]); - dihedral_atom1[nlocal][k] = static_cast (buf[m++]); - dihedral_atom2[nlocal][k] = static_cast (buf[m++]); - dihedral_atom3[nlocal][k] = static_cast (buf[m++]); - dihedral_atom4[nlocal][k] = static_cast (buf[m++]); + dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_improper[nlocal] = static_cast (buf[m++]); + num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { - improper_type[nlocal][k] = static_cast (buf[m++]); - improper_atom1[nlocal][k] = static_cast (buf[m++]); - improper_atom2[nlocal][k] = static_cast (buf[m++]); - improper_atom3[nlocal][k] = static_cast (buf[m++]); - improper_atom4[nlocal][k] = static_cast (buf[m++]); + improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - nspecial[nlocal][0] = static_cast (buf[m++]); - nspecial[nlocal][1] = static_cast (buf[m++]); - nspecial[nlocal][2] = static_cast (buf[m++]); + nspecial[nlocal][0] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][1] = (int) ubuf(buf[m++]).i; + nspecial[nlocal][2] = (int) ubuf(buf[m++]).i; for (k = 0; k < nspecial[nlocal][2]; k++) - special[nlocal][k] = static_cast (buf[m++]); + special[nlocal][k] = (int) ubuf(buf[m++]).i; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -760,46 +760,46 @@ int AtomVecMolecular::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; - buf[m++] = num_bond[i]; + buf[m++] = ubuf(num_bond[i]).d; for (k = 0; k < num_bond[i]; k++) { - buf[m++] = MAX(bond_type[i][k],-bond_type[i][k]); - buf[m++] = bond_atom[i][k]; + buf[m++] = ubuf(MAX(bond_type[i][k],-bond_type[i][k])).d; + buf[m++] = ubuf(bond_atom[i][k]).d; } - buf[m++] = num_angle[i]; + buf[m++] = ubuf(num_angle[i]).d; for (k = 0; k < num_angle[i]; k++) { - buf[m++] = MAX(angle_type[i][k],-angle_type[i][k]); - buf[m++] = angle_atom1[i][k]; - buf[m++] = angle_atom2[i][k]; - buf[m++] = angle_atom3[i][k]; + buf[m++] = ubuf(MAX(angle_type[i][k],-angle_type[i][k])).d; + buf[m++] = ubuf(angle_atom1[i][k]).d; + buf[m++] = ubuf(angle_atom2[i][k]).d; + buf[m++] = ubuf(angle_atom3[i][k]).d; } - buf[m++] = num_dihedral[i]; + buf[m++] = ubuf(num_dihedral[i]).d; for (k = 0; k < num_dihedral[i]; k++) { - buf[m++] = MAX(dihedral_type[i][k],-dihedral_type[i][k]); - buf[m++] = dihedral_atom1[i][k]; - buf[m++] = dihedral_atom2[i][k]; - buf[m++] = dihedral_atom3[i][k]; - buf[m++] = dihedral_atom4[i][k]; + buf[m++] = ubuf(MAX(dihedral_type[i][k],-dihedral_type[i][k])).d; + buf[m++] = ubuf(dihedral_atom1[i][k]).d; + buf[m++] = ubuf(dihedral_atom2[i][k]).d; + buf[m++] = ubuf(dihedral_atom3[i][k]).d; + buf[m++] = ubuf(dihedral_atom4[i][k]).d; } - buf[m++] = num_improper[i]; + buf[m++] = ubuf(num_improper[i]).d; for (k = 0; k < num_improper[i]; k++) { - buf[m++] = MAX(improper_type[i][k],-improper_type[i][k]); - buf[m++] = improper_atom1[i][k]; - buf[m++] = improper_atom2[i][k]; - buf[m++] = improper_atom3[i][k]; - buf[m++] = improper_atom4[i][k]; + buf[m++] = ubuf(MAX(improper_type[i][k],-improper_type[i][k])).d; + buf[m++] = ubuf(improper_atom1[i][k]).d; + buf[m++] = ubuf(improper_atom2[i][k]).d; + buf[m++] = ubuf(improper_atom3[i][k]).d; + buf[m++] = ubuf(improper_atom4[i][k]).d; } if (atom->nextra_restart) @@ -829,46 +829,46 @@ int AtomVecMolecular::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; - num_bond[nlocal] = static_cast (buf[m++]); + num_bond[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_bond[nlocal]; k++) { - bond_type[nlocal][k] = static_cast (buf[m++]); - bond_atom[nlocal][k] = static_cast (buf[m++]); + bond_type[nlocal][k] = (int) ubuf(buf[m++]).i; + bond_atom[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_angle[nlocal] = static_cast (buf[m++]); + num_angle[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_angle[nlocal]; k++) { - angle_type[nlocal][k] = static_cast (buf[m++]); - angle_atom1[nlocal][k] = static_cast (buf[m++]); - angle_atom2[nlocal][k] = static_cast (buf[m++]); - angle_atom3[nlocal][k] = static_cast (buf[m++]); + angle_type[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + angle_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_dihedral[nlocal] = static_cast (buf[m++]); + num_dihedral[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_dihedral[nlocal]; k++) { - dihedral_type[nlocal][k] = static_cast (buf[m++]); - dihedral_atom1[nlocal][k] = static_cast (buf[m++]); - dihedral_atom2[nlocal][k] = static_cast (buf[m++]); - dihedral_atom3[nlocal][k] = static_cast (buf[m++]); - dihedral_atom4[nlocal][k] = static_cast (buf[m++]); + dihedral_type[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + dihedral_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } - num_improper[nlocal] = static_cast (buf[m++]); + num_improper[nlocal] = (int) ubuf(buf[m++]).i; for (k = 0; k < num_improper[nlocal]; k++) { - improper_type[nlocal][k] = static_cast (buf[m++]); - improper_atom1[nlocal][k] = static_cast (buf[m++]); - improper_atom2[nlocal][k] = static_cast (buf[m++]); - improper_atom3[nlocal][k] = static_cast (buf[m++]); - improper_atom4[nlocal][k] = static_cast (buf[m++]); + improper_type[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom1[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom2[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom3[nlocal][k] = (int) ubuf(buf[m++]).i; + improper_atom4[nlocal][k] = (int) ubuf(buf[m++]).i; } nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0; @@ -978,15 +978,15 @@ void AtomVecMolecular::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; buf[i][3] = x[i][0]; buf[i][4] = x[i][1]; buf[i][5] = x[i][2]; - buf[i][6] = (image[i] & IMGMASK) - IMGMAX; - buf[i][7] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][6] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -996,7 +996,7 @@ void AtomVecMolecular::pack_data(double **buf) int AtomVecMolecular::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; + buf[0] = ubuf(molecule[i]).d; return 1; } @@ -1008,9 +1008,11 @@ void AtomVecMolecular::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5], - (int) buf[i][6],(int) buf[i][7],(int) buf[i][8]); + (int) ubuf(buf[i][6]).i,(int) ubuf(buf[i][7]).i, + (int) ubuf(buf[i][8]).i); } /* ---------------------------------------------------------------------- @@ -1019,7 +1021,7 @@ void AtomVecMolecular::write_data(FILE *fp, int n, double **buf) int AtomVecMolecular::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d",(int) buf[0]); + fprintf(fp," %d",(int) ubuf(buf[0]).i); return 1; } diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index 6f3a9d6279..cbe14d3624 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -352,9 +352,9 @@ int AtomVecPeri::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = vfrac[j]; buf[m++] = s0[j]; buf[m++] = x0[j][0]; @@ -376,9 +376,9 @@ int AtomVecPeri::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = vfrac[j]; buf[m++] = s0[j]; buf[m++] = x0[j][0]; @@ -409,9 +409,9 @@ int AtomVecPeri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = vfrac[j]; buf[m++] = s0[j]; buf[m++] = x0[j][0]; @@ -437,9 +437,9 @@ int AtomVecPeri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = vfrac[j]; buf[m++] = s0[j]; buf[m++] = x0[j][0]; @@ -458,9 +458,9 @@ int AtomVecPeri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = vfrac[j]; buf[m++] = s0[j]; buf[m++] = x0[j][0]; @@ -517,9 +517,9 @@ void AtomVecPeri::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; vfrac[i] = buf[m++]; s0[i] = buf[m++]; x0[i][0] = buf[m++]; @@ -546,9 +546,9 @@ void AtomVecPeri::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; vfrac[i] = buf[m++]; s0[i] = buf[m++]; x0[i][0] = buf[m++]; @@ -597,10 +597,10 @@ int AtomVecPeri::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = vfrac[i]; buf[m++] = rmass[i]; @@ -631,10 +631,10 @@ int AtomVecPeri::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; vfrac[nlocal] = buf[m++]; rmass[nlocal] = buf[m++]; @@ -685,10 +685,10 @@ int AtomVecPeri::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -725,10 +725,10 @@ int AtomVecPeri::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -850,16 +850,16 @@ void AtomVecPeri::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = vfrac[i]; buf[i][3] = rmass[i]; buf[i][4] = x[i][0]; buf[i][5] = x[i][1]; buf[i][6] = x[i][2]; - buf[i][7] = (image[i] & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][7] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -882,10 +882,10 @@ void AtomVecPeri::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1], - buf[i][2],buf[i][3], - buf[i][4],buf[i][5],buf[i][6], - (int) buf[i][7],(int) buf[i][8],(int) buf[i][9]); + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4],buf[i][5],buf[i][6], + (int) ubuf(buf[i][7]).i,(int) ubuf(buf[i][8]).i, + (int) ubuf(buf[i][9]).i); } /* ---------------------------------------------------------------------- diff --git a/src/USER-AWPMD/atom_vec_wavepacket.cpp b/src/USER-AWPMD/atom_vec_wavepacket.cpp index e2354b5bb7..f5bfb44c9d 100644 --- a/src/USER-AWPMD/atom_vec_wavepacket.cpp +++ b/src/USER-AWPMD/atom_vec_wavepacket.cpp @@ -31,7 +31,6 @@ using namespace LAMMPS_NS; #define DELTA 10000 - /* ---------------------------------------------------------------------- */ AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp) @@ -440,13 +439,13 @@ int AtomVecWavepacket::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; } } else { if (domain->triclinic == 0) { @@ -463,13 +462,13 @@ int AtomVecWavepacket::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; } } @@ -495,19 +494,18 @@ int AtomVecWavepacket::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; - buf[m++] = ervel[j]; buf[m++] = cs[2*j]; buf[m++] = cs[2*j+1]; @@ -528,13 +526,13 @@ int AtomVecWavepacket::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; @@ -554,13 +552,13 @@ int AtomVecWavepacket::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; @@ -596,10 +594,10 @@ int AtomVecWavepacket::pack_border_hybrid(int n, int *list, double *buf) for (i = 0; i < n; i++) { j = list[i]; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; - buf[m++] = etag[j]; + buf[m++] = ubuf(etag[j]).d; buf[m++] = ervel[j]; buf[m++] = cs[2*j]; buf[m++] = cs[2*j+1]; @@ -620,13 +618,13 @@ void AtomVecWavepacket::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; - etag[i] = (int)buf[m++]; + etag[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -648,13 +646,13 @@ void AtomVecWavepacket::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; - etag[i] = (int)buf[m++]; + etag[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -679,10 +677,9 @@ int AtomVecWavepacket::unpack_border_hybrid(int n, int first, double *buf) last = first + n; for (i = first; i < last; i++) { q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; - - etag[i] = (int)buf[m++]; + etag[i] = (int) ubuf(buf[m++]).i; ervel[i] = buf[m++]; cs[2*i] = buf[m++]; cs[2*i+1] = buf[m++]; @@ -704,17 +701,17 @@ int AtomVecWavepacket::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = q[i]; - buf[m++] = spin[i]; + buf[m++] = ubuf(spin[i]).d; buf[m++] = eradius[i]; buf[m++] = ervel[i]; - buf[m++] = etag[i]; + buf[m++] = ubuf(etag[i]).d; buf[m++] = cs[2*i]; buf[m++] = cs[2*i+1]; @@ -740,17 +737,17 @@ int AtomVecWavepacket::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; q[nlocal] = buf[m++]; - spin[nlocal] = static_cast (buf[m++]); + spin[nlocal] = (int) ubuf(buf[m++]).i; eradius[nlocal] = buf[m++]; ervel[nlocal] = buf[m++]; - etag[nlocal] = buf[m++]; + etag[nlocal] = (int) ubuf(buf[m++]).i; cs[2*nlocal] = buf[m++]; cs[2*nlocal+1] = buf[m++]; @@ -795,20 +792,20 @@ int AtomVecWavepacket::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; buf[m++] = q[i]; - buf[m++] = spin[i]; + buf[m++] = ubuf(spin[i]).d; buf[m++] = eradius[i]; buf[m++] = ervel[i]; - buf[m++] = etag[i]; + buf[m++] = ubuf(etag[i]).d; buf[m++] = cs[2*i]; buf[m++] = cs[2*i+1]; @@ -837,20 +834,20 @@ int AtomVecWavepacket::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; q[nlocal] = buf[m++]; - spin[nlocal] = static_cast (buf[m++]); + spin[nlocal] = (int) ubuf(buf[m++]).i; eradius[nlocal] = buf[m++]; ervel[nlocal] = buf[m++]; - etag[nlocal] = buf[m++]; + etag[nlocal] = (int) ubuf(buf[m++]).i; cs[2*nlocal] = buf[m++]; cs[2*nlocal+1] = buf[m++]; @@ -888,11 +885,11 @@ void AtomVecWavepacket::create_atom(int itype, double *coord) v[nlocal][2] = 0.0; q[nlocal] = 1.; - spin[nlocal] = 0.; + spin[nlocal] = 0; eradius[nlocal] = 0.0; ervel[nlocal] = 0.0; - etag[nlocal]= 0.; + etag[nlocal] = 0; cs[2*nlocal] = 0.; cs[2*nlocal+1] = 0.; @@ -1003,20 +1000,20 @@ void AtomVecWavepacket::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = q[i]; - buf[i][3] = spin[i]; + buf[i][3] = ubuf(spin[i]).d; buf[i][4] = eradius[i]; - buf[i][5] = etag[i]; + buf[i][5] = ubuf(etag[i]).d; buf[i][6] = cs[2*i]; buf[i][7] = cs[2*i+1]; buf[i][8] = x[i][0]; buf[i][9] = x[i][1]; buf[i][10] = x[i][2]; - buf[i][11] = (image[i] & IMGMASK) - IMGMAX; - buf[i][12] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][13] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][11] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][12] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][13] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1027,9 +1024,9 @@ void AtomVecWavepacket::pack_data(double **buf) int AtomVecWavepacket::pack_data_hybrid(int i, double *buf) { buf[0] = q[i]; - buf[1] = spin[i]; + buf[1] = ubuf(spin[i]).d; buf[2] = eradius[i]; - buf[3] = etag[i]; + buf[3] = ubuf(etag[i]).d; buf[4] = cs[2*i]; buf[5] = cs[2*i+1]; return 6; @@ -1044,11 +1041,12 @@ void AtomVecWavepacket::write_data(FILE *fp, int n, double **buf) for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %d %-1.16e %d %-1.16e %-1.16e %-1.16e " "%-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1], - buf[i][2],(int) buf[i][3],buf[i][4], - (int) buf[i][5],buf[i][6],buf[i][7], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],(int) ubuf(buf[i][3]).i,buf[i][4], + (int) ubuf(buf[i][5]).i,buf[i][6],buf[i][8], buf[i][8],buf[i][9],buf[i][10], - (int) buf[i][11],(int) buf[i][12],(int) buf[i][13]); + (int) ubuf(buf[i][11]).i,(int) ubuf(buf[i][12]).i, + (int) ubuf(buf[i][13]).i); } /* ---------------------------------------------------------------------- @@ -1058,7 +1056,8 @@ void AtomVecWavepacket::write_data(FILE *fp, int n, double **buf) int AtomVecWavepacket::write_data_hybrid(FILE *fp, double *buf) { fprintf(fp," %-1.16e %d %-1.16e %d %-1.16e %-1.16e", - buf[0],(int) buf[1],buf[2],(int) buf[3],buf[4],buf[5]); + buf[0],(int) ubuf(buf[1]).i,buf[2],(int) ubuf(buf[3]).i, + buf[4],buf[5]); return 6; } @@ -1070,7 +1069,7 @@ void AtomVecWavepacket::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -1096,7 +1095,7 @@ void AtomVecWavepacket::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]); + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3],buf[i][4]); } /* ---------------------------------------------------------------------- diff --git a/src/USER-EFF/atom_vec_electron.cpp b/src/USER-EFF/atom_vec_electron.cpp index f78263b3f4..bf3d79bee9 100644 --- a/src/USER-EFF/atom_vec_electron.cpp +++ b/src/USER-EFF/atom_vec_electron.cpp @@ -381,11 +381,11 @@ int AtomVecElectron::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; } } else { @@ -403,11 +403,11 @@ int AtomVecElectron::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; } } @@ -434,11 +434,11 @@ int AtomVecElectron::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; buf[m++] = v[j][0]; buf[m++] = v[j][1]; @@ -460,11 +460,11 @@ int AtomVecElectron::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; buf[m++] = v[j][0]; buf[m++] = v[j][1]; @@ -479,11 +479,11 @@ int AtomVecElectron::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; @@ -515,7 +515,7 @@ int AtomVecElectron::pack_border_hybrid(int n, int *list, double *buf) for (i = 0; i < n; i++) { j = list[i]; buf[m++] = q[j]; - buf[m++] = spin[j]; + buf[m++] = ubuf(spin[j]).d; buf[m++] = eradius[j]; } return m; @@ -534,11 +534,11 @@ void AtomVecElectron::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; } @@ -561,11 +561,11 @@ void AtomVecElectron::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; v[i][0] = buf[m++]; v[i][1] = buf[m++]; @@ -588,7 +588,7 @@ int AtomVecElectron::unpack_border_hybrid(int n, int first, double *buf) last = first + n; for (i = first; i < last; i++) { q[i] = buf[m++]; - spin[i] = static_cast (buf[m++]); + spin[i] = (int) ubuf(buf[m++]).i; eradius[i] = buf[m++]; } return m; @@ -608,12 +608,12 @@ int AtomVecElectron::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = q[i]; - buf[m++] = spin[i]; + buf[m++] = ubuf(spin[i]).d; buf[m++] = eradius[i]; buf[m++] = ervel[i]; @@ -639,12 +639,12 @@ int AtomVecElectron::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; q[nlocal] = buf[m++]; - spin[nlocal] = static_cast (buf[m++]); + spin[nlocal] = (int) ubuf(buf[m++]).i; eradius[nlocal] = buf[m++]; ervel[nlocal] = buf[m++]; @@ -689,16 +689,16 @@ int AtomVecElectron::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; buf[m++] = q[i]; - buf[m++] = spin[i]; + buf[m++] = ubuf(spin[i]).d; buf[m++] = eradius[i]; buf[m++] = ervel[i]; @@ -727,16 +727,16 @@ int AtomVecElectron::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; q[nlocal] = buf[m++]; - spin[nlocal] = static_cast (buf[m++]); + spin[nlocal] = (int) ubuf(buf[m++]).i; eradius[nlocal] = buf[m++]; ervel[nlocal] = buf[m++]; @@ -871,17 +871,17 @@ void AtomVecElectron::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = q[i]; - buf[i][3] = spin[i]; + buf[i][3] = ubuf(spin[i]).d; buf[i][4] = eradius[i]; buf[i][5] = x[i][0]; buf[i][6] = x[i][1]; buf[i][7] = x[i][2]; - buf[i][8] = (image[i] & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][8] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][10] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -892,7 +892,7 @@ void AtomVecElectron::pack_data(double **buf) int AtomVecElectron::pack_data_hybrid(int i, double *buf) { buf[0] = q[i]; - buf[1] = spin[i]; + buf[1] = ubuf(spin[i]).d; buf[2] = eradius[i]; return 3; } @@ -905,10 +905,10 @@ void AtomVecElectron::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],buf[i][2], - (int) buf[i][3],buf[i][4], - buf[i][5],buf[i][6],buf[i][7], - (int) buf[i][8],(int) buf[i][9],(int) buf[i][10]); + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i,buf[i][2], + (int) ubuf(buf[i][3]).i,buf[i][4],buf[i][5],buf[i][6],buf[i][7], + (int) ubuf(buf[i][8]).i,(int) ubuf(buf[i][9]).i, + (int) ubuf(buf[i][10]).i); } /* ---------------------------------------------------------------------- @@ -917,7 +917,7 @@ void AtomVecElectron::write_data(FILE *fp, int n, double **buf) int AtomVecElectron::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %-1.16e %d %-1.16e",buf[0],(int) buf[1],buf[2]); + fprintf(fp," %-1.16e %d %-1.16e",buf[0],(int) ubuf(buf[1]).i,buf[2]); return 3; } @@ -929,7 +929,7 @@ void AtomVecElectron::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -955,7 +955,7 @@ void AtomVecElectron::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3],buf[i][4]); + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3],buf[i][4]); } /* ---------------------------------------------------------------------- diff --git a/src/USER-SPH/atom_vec_meso.cpp b/src/USER-SPH/atom_vec_meso.cpp index 9ddb59b2ab..f20b031604 100644 --- a/src/USER-SPH/atom_vec_meso.cpp +++ b/src/USER-SPH/atom_vec_meso.cpp @@ -425,9 +425,9 @@ int AtomVecMeso::pack_border(int n, int *list, double *buf, int pbc_flag, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = rho[j]; buf[m++] = e[j]; buf[m++] = cv[j]; @@ -450,9 +450,9 @@ int AtomVecMeso::pack_border(int n, int *list, double *buf, int pbc_flag, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = rho[j]; buf[m++] = e[j]; buf[m++] = cv[j]; @@ -472,10 +472,10 @@ int AtomVecMeso::pack_border(int n, int *list, double *buf, int pbc_flag, /* ---------------------------------------------------------------------- */ int AtomVecMeso::pack_border_vel(int n, int *list, double *buf, int pbc_flag, - int *pbc) { - //printf("in AtomVecMeso::pack_border_vel\n"); - int i, j, m; - double dx, dy, dz; + int *pbc) +{ + int i,j,m; + double dx,dy,dz,dvx,dvy,dvz; m = 0; if (pbc_flag == 0) { @@ -484,9 +484,9 @@ int AtomVecMeso::pack_border_vel(int n, int *list, double *buf, int pbc_flag, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -507,23 +507,53 @@ int AtomVecMeso::pack_border_vel(int n, int *list, double *buf, int pbc_flag, dy = pbc[1]; dz = pbc[2]; } - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = x[j][0] + dx; - buf[m++] = x[j][1] + dy; - buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = v[j][0]; - buf[m++] = v[j][1]; - buf[m++] = v[j][2]; - buf[m++] = rho[j]; - buf[m++] = e[j]; - buf[m++] = cv[j]; - buf[m++] = vest[j][0]; - buf[m++] = vest[j][1]; - buf[m++] = vest[j][2]; + if (!deform_vremap) { + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + buf[m++] = rho[j]; + buf[m++] = e[j]; + buf[m++] = cv[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } + } else { + dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; + dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; + dvz = pbc[2]*h_rate[2]; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = x[j][0] + dx; + buf[m++] = x[j][1] + dy; + buf[m++] = x[j][2] + dz; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (mask[i] & deform_groupbit) { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + } else { + buf[m++] = v[j][0]; + buf[m++] = v[j][1]; + buf[m++] = v[j][2]; + } + buf[m++] = rho[j]; + buf[m++] = e[j]; + buf[m++] = cv[j]; + buf[m++] = vest[j][0]; + buf[m++] = vest[j][1]; + buf[m++] = vest[j][2]; + } } } @@ -548,9 +578,9 @@ void AtomVecMeso::unpack_border(int n, int first, double *buf) { x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; rho[i] = buf[m++]; e[i] = buf[m++]; cv[i] = buf[m++]; @@ -579,9 +609,9 @@ void AtomVecMeso::unpack_border_vel(int n, int first, double *buf) { x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -613,10 +643,10 @@ int AtomVecMeso::pack_exchange(int i, double *buf) { buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = rho[i]; buf[m++] = e[i]; buf[m++] = cv[i]; @@ -647,10 +677,10 @@ int AtomVecMeso::unpack_exchange(double *buf) { v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; rho[nlocal] = buf[m++]; e[nlocal] = buf[m++]; cv[nlocal] = buf[m++]; @@ -697,10 +727,10 @@ int AtomVecMeso::pack_restart(int i, double *buf) { buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -735,10 +765,10 @@ int AtomVecMeso::unpack_restart(double *buf) { x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -860,17 +890,17 @@ void AtomVecMeso::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = rho[i]; buf[i][3] = e[i]; buf[i][4] = cv[i]; buf[i][5] = x[i][0]; buf[i][6] = x[i][1]; buf[i][7] = x[i][2]; - buf[i][8] = (image[i] & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][8] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][10] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -895,10 +925,11 @@ void AtomVecMeso::write_data(FILE *fp, int n, double **buf) for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e " "%d %d %d\n", - (int) buf[i][0],(int) buf[i][1], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, buf[i][2],buf[i][3],buf[i][4], buf[i][5],buf[i][6],buf[i][7], - (int) buf[i][8],(int) buf[i][9],(int) buf[i][10]); + (int) ubuf(buf[i][8]).i,(int) ubuf(buf[i][9]).i, + (int) ubuf(buf[i][10]).i); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 9f9326f457..02b38db5cf 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -77,7 +77,7 @@ void AtomVec::pack_vel(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -92,7 +92,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3]); + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3]); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_atomic.cpp b/src/atom_vec_atomic.cpp index c4399baaf8..33f39ab8c9 100644 --- a/src/atom_vec_atomic.cpp +++ b/src/atom_vec_atomic.cpp @@ -280,9 +280,9 @@ int AtomVecAtomic::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; } } else { if (domain->triclinic == 0) { @@ -299,9 +299,9 @@ int AtomVecAtomic::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; } } @@ -327,9 +327,9 @@ int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -350,9 +350,9 @@ int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -366,9 +366,9 @@ int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -402,9 +402,9 @@ void AtomVecAtomic::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; } if (atom->nextra_border) @@ -426,9 +426,9 @@ void AtomVecAtomic::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -454,10 +454,10 @@ int AtomVecAtomic::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -481,10 +481,10 @@ int AtomVecAtomic::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) @@ -527,10 +527,10 @@ int AtomVecAtomic::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -560,10 +560,10 @@ int AtomVecAtomic::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -643,14 +643,14 @@ void AtomVecAtomic::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = x[i][0]; buf[i][3] = x[i][1]; buf[i][4] = x[i][2]; - buf[i][5] = (image[i] & IMGMASK) - IMGMAX; - buf[i][6] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][7] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][5] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][6] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -662,8 +662,10 @@ void AtomVecAtomic::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],buf[i][2],buf[i][3],buf[i][4], - (int) buf[i][5],(int) buf[i][6],(int) buf[i][7]); + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4], + (int) ubuf(buf[i][5]).i,(int) ubuf(buf[i][6]).i, + (int) ubuf(buf[i][7]).i); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index db4e5b1dab..bf83dadc94 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -591,12 +591,12 @@ int AtomVecBody::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (body[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -606,8 +606,8 @@ int AtomVecBody::pack_border(int n, int *list, double *buf, buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } } @@ -626,12 +626,12 @@ int AtomVecBody::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (body[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -641,8 +641,8 @@ int AtomVecBody::pack_border(int n, int *list, double *buf, buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } } @@ -671,12 +671,12 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (body[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -686,8 +686,8 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } buf[m++] = v[j][0]; @@ -713,12 +713,12 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (body[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -728,8 +728,8 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } buf[m++] = v[j][0]; @@ -748,12 +748,12 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (body[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -763,8 +763,8 @@ int AtomVecBody::pack_border_vel(int n, int *list, double *buf, buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } if (mask[i] & deform_groupbit) { @@ -800,9 +800,9 @@ int AtomVecBody::pack_border_hybrid(int n, int *list, double *buf) m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (body[j] < 0) buf[m++] = 0; + if (body[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; inertia = bonus[body[j]].inertia; buf[m++] = quat[0]; @@ -812,8 +812,8 @@ int AtomVecBody::pack_border_hybrid(int n, int *list, double *buf) buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[body[j]].ninteger; - buf[m++] = bonus[body[j]].ndouble; + buf[m++] = ubuf(bonus[body[j]].ninteger).d; + buf[m++] = ubuf(bonus[body[j]].ndouble).d; m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); } } @@ -834,10 +834,10 @@ void AtomVecBody::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - body[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + body[i] = (int) ubuf(buf[m++]).i; if (body[i] == 0) body[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -851,8 +851,8 @@ void AtomVecBody::unpack_border(int n, int first, double *buf) inertia[0] = buf[m++]; inertia[1] = buf[m++]; inertia[2] = buf[m++]; - bonus[j].ninteger = static_cast (buf[m++]); - bonus[j].ndouble = static_cast (buf[m++]); + bonus[j].ninteger = (int) ubuf(buf[m++]).i; + bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); m += bptr->unpack_border_body(&bonus[j],&buf[m]); @@ -882,10 +882,10 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - body[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + body[i] = (int) ubuf(buf[m++]).i; if (body[i] == 0) body[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -899,8 +899,8 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf) inertia[0] = buf[m++]; inertia[1] = buf[m++]; inertia[2] = buf[m++]; - bonus[j].ninteger = static_cast (buf[m++]); - bonus[j].ndouble = static_cast (buf[m++]); + bonus[j].ninteger = (int) ubuf(buf[m++]).i; + bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); m += bptr->unpack_border_body(&bonus[j],&buf[m]); @@ -932,7 +932,7 @@ int AtomVecBody::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - body[i] = static_cast (buf[m++]); + body[i] = (int) ubuf(buf[m++]).i; if (body[i] == 0) body[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -946,8 +946,8 @@ int AtomVecBody::unpack_border_hybrid(int n, int first, double *buf) inertia[0] = buf[m++]; inertia[1] = buf[m++]; inertia[2] = buf[m++]; - bonus[j].ninteger = static_cast (buf[m++]); - bonus[j].ndouble = static_cast (buf[m++]); + bonus[j].ninteger = (int) ubuf(buf[m++]).i; + bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); m += bptr->unpack_border_body(&bonus[j],&buf[m]); @@ -973,19 +973,19 @@ int AtomVecBody::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = rmass[i]; buf[m++] = angmom[i][0]; buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (body[i] < 0) buf[m++] = 0; + if (body[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = body[i]; double *quat = bonus[j].quat; double *inertia = bonus[j].inertia; @@ -996,8 +996,8 @@ int AtomVecBody::pack_exchange(int i, double *buf) buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[j].ninteger; - buf[m++] = bonus[j].ndouble; + buf[m++] = ubuf(bonus[j].ninteger).d; + buf[m++] = ubuf(bonus[j].ndouble).d; memcpy(&buf[m],bonus[j].ivalue,bonus[j].ninteger*sizeof(int)); if (intdoubleratio == 1) m += bonus[j].ninteger; else m += (bonus[j].ninteger+1)/2; @@ -1027,17 +1027,17 @@ int AtomVecBody::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; angmom[nlocal][0] = buf[m++]; angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - body[nlocal] = static_cast (buf[m++]); + body[nlocal] = (int) ubuf(buf[m++]).i; if (body[nlocal] == 0) body[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1050,8 +1050,8 @@ int AtomVecBody::unpack_exchange(double *buf) inertia[0] = buf[m++]; inertia[1] = buf[m++]; inertia[2] = buf[m++]; - bonus[nlocal_bonus].ninteger = static_cast (buf[m++]); - bonus[nlocal_bonus].ndouble = static_cast (buf[m++]); + bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i; + bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, bonus[nlocal_bonus].iindex); bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, @@ -1116,10 +1116,10 @@ int AtomVecBody::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -1129,9 +1129,9 @@ int AtomVecBody::pack_restart(int i, double *buf) buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (body[i] < 0) buf[m++] = 0; + if (body[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = body[i]; double *quat = bonus[j].quat; double *inertia = bonus[j].inertia; @@ -1142,8 +1142,8 @@ int AtomVecBody::pack_restart(int i, double *buf) buf[m++] = inertia[0]; buf[m++] = inertia[1]; buf[m++] = inertia[2]; - buf[m++] = bonus[j].ninteger; - buf[m++] = bonus[j].ndouble; + buf[m++] = ubuf(bonus[j].ninteger).d; + buf[m++] = ubuf(bonus[j].ndouble).d; memcpy(&buf[m],bonus[j].ivalue,bonus[j].ninteger*sizeof(int)); if (intdoubleratio == 1) m += bonus[j].ninteger; else m += (bonus[j].ninteger+1)/2; @@ -1176,10 +1176,10 @@ int AtomVecBody::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -1189,7 +1189,7 @@ int AtomVecBody::unpack_restart(double *buf) angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - body[nlocal] = static_cast (buf[m++]); + body[nlocal] = (int) ubuf(buf[m++]).i; if (body[nlocal] == 0) body[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1202,8 +1202,8 @@ int AtomVecBody::unpack_restart(double *buf) inertia[0] = buf[m++]; inertia[1] = buf[m++]; inertia[2] = buf[m++]; - bonus[nlocal_bonus].ninteger = static_cast (buf[m++]); - bonus[nlocal_bonus].ndouble = static_cast (buf[m++]); + bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i; + bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, bonus[nlocal_bonus].iindex); bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, @@ -1409,17 +1409,17 @@ void AtomVecBody::pack_data(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; - if (body[i] < 0) buf[i][2] = 0; - else buf[i][2] = 1; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; + if (body[i] < 0) buf[i][2] = ubuf(0).d; + else buf[i][2] = ubuf(1).d; buf[i][3] = rmass[i]; buf[i][4] = x[i][0]; buf[i][5] = x[i][1]; buf[i][6] = x[i][2]; - buf[i][7] = (image[i] & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][7] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1429,8 +1429,8 @@ void AtomVecBody::pack_data(double **buf) int AtomVecBody::pack_data_hybrid(int i, double *buf) { - if (body[i] < 0) buf[0] = 0; - else buf[0] = 1; + if (body[i] < 0) buf[0] = ubuf(0).d; + else buf[0] = ubuf(1).d; buf[1] = rmass[i]; return 2; } @@ -1443,9 +1443,11 @@ void AtomVecBody::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %g %g %g %g %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5],buf[i][6], - (int) buf[i][7],(int) buf[i][8],(int) buf[i][9]); + (int) ubuf(buf[i][7]).i,(int) ubuf(buf[i][8]).i, + (int) ubuf(buf[i][9]).i); } /* ---------------------------------------------------------------------- @@ -1454,7 +1456,7 @@ void AtomVecBody::write_data(FILE *fp, int n, double **buf) int AtomVecBody::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d %g",(int) buf[0],buf[1]); + fprintf(fp," %d %g",(int) ubuf(buf[0]).i,buf[1]); return 2; } @@ -1466,7 +1468,7 @@ void AtomVecBody::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -1496,7 +1498,7 @@ void AtomVecBody::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %g %g %g %g %g %g\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3], + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); } diff --git a/src/atom_vec_charge.cpp b/src/atom_vec_charge.cpp index 8a74af12c3..92dc8d276c 100644 --- a/src/atom_vec_charge.cpp +++ b/src/atom_vec_charge.cpp @@ -287,9 +287,9 @@ int AtomVecCharge::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; } } else { @@ -307,9 +307,9 @@ int AtomVecCharge::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; } } @@ -336,9 +336,9 @@ int AtomVecCharge::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = v[j][0]; buf[m++] = v[j][1]; @@ -360,9 +360,9 @@ int AtomVecCharge::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; buf[m++] = v[j][0]; buf[m++] = v[j][1]; @@ -377,9 +377,9 @@ int AtomVecCharge::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = q[j]; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; @@ -428,9 +428,9 @@ void AtomVecCharge::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; } @@ -453,9 +453,9 @@ void AtomVecCharge::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; q[i] = buf[m++]; v[i][0] = buf[m++]; v[i][1] = buf[m++]; @@ -495,10 +495,10 @@ int AtomVecCharge::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = q[i]; @@ -524,10 +524,10 @@ int AtomVecCharge::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; q[nlocal] = buf[m++]; @@ -572,10 +572,10 @@ int AtomVecCharge::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -607,10 +607,10 @@ int AtomVecCharge::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -708,15 +708,15 @@ void AtomVecCharge::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = q[i]; buf[i][3] = x[i][0]; buf[i][4] = x[i][1]; buf[i][5] = x[i][2]; - buf[i][6] = (image[i] & IMGMASK) - IMGMAX; - buf[i][7] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][6] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][7] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -738,9 +738,10 @@ void AtomVecCharge::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],buf[i][2], - buf[i][3],buf[i][4],buf[i][5], - (int) buf[i][6],(int) buf[i][7],(int) buf[i][8]); + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + buf[i][2],buf[i][3],buf[i][4],buf[i][5], + (int) ubuf(buf[i][6]).i,(int) ubuf(buf[i][7]).i, + (int) ubuf(buf[i][8]).i); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 9a90f5ddad..dae8f392fc 100755 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -543,12 +543,12 @@ int AtomVecEllipsoid::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (ellipsoid[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -575,12 +575,12 @@ int AtomVecEllipsoid::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (ellipsoid[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -617,12 +617,12 @@ int AtomVecEllipsoid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (ellipsoid[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -656,12 +656,12 @@ int AtomVecEllipsoid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (ellipsoid[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -688,12 +688,12 @@ int AtomVecEllipsoid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - if (ellipsoid[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -737,9 +737,9 @@ int AtomVecEllipsoid::pack_border_hybrid(int n, int *list, double *buf) m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (ellipsoid[j] < 0) buf[m++] = 0; + if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; quat = bonus[ellipsoid[j]].quat; buf[m++] = shape[0]; @@ -768,10 +768,10 @@ void AtomVecEllipsoid::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - ellipsoid[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + ellipsoid[i] = (int) ubuf(buf[m++]).i; if (ellipsoid[i] == 0) ellipsoid[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -811,10 +811,10 @@ void AtomVecEllipsoid::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - ellipsoid[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + ellipsoid[i] = (int) ubuf(buf[m++]).i; if (ellipsoid[i] == 0) ellipsoid[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -856,7 +856,7 @@ int AtomVecEllipsoid::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - ellipsoid[i] = static_cast (buf[m++]); + ellipsoid[i] = (int) ubuf(buf[m++]).i; if (ellipsoid[i] == 0) ellipsoid[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -892,19 +892,19 @@ int AtomVecEllipsoid::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = rmass[i]; buf[m++] = angmom[i][0]; buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (ellipsoid[i] < 0) buf[m++] = 0; + if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = ellipsoid[i]; double *shape = bonus[j].shape; double *quat = bonus[j].quat; @@ -939,17 +939,17 @@ int AtomVecEllipsoid::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; angmom[nlocal][0] = buf[m++]; angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - ellipsoid[nlocal] = static_cast (buf[m++]); + ellipsoid[nlocal] = (int) ubuf(buf[m++]).i; if (ellipsoid[nlocal] == 0) ellipsoid[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1010,10 +1010,10 @@ int AtomVecEllipsoid::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; @@ -1023,9 +1023,9 @@ int AtomVecEllipsoid::pack_restart(int i, double *buf) buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (ellipsoid[i] < 0) buf[m++] = 0; + if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = ellipsoid[i]; buf[m++] = bonus[j].shape[0]; buf[m++] = bonus[j].shape[1]; @@ -1061,10 +1061,10 @@ int AtomVecEllipsoid::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; @@ -1074,7 +1074,7 @@ int AtomVecEllipsoid::unpack_restart(double *buf) angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - ellipsoid[nlocal] = static_cast (buf[m++]); + ellipsoid[nlocal] = (int) ubuf(buf[m++]).i; if (ellipsoid[nlocal] == 0) ellipsoid[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1265,10 +1265,10 @@ void AtomVecEllipsoid::pack_data(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; - if (ellipsoid[i] < 0) buf[i][2] = 0; - else buf[i][2] = 1; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; + if (ellipsoid[i] < 0) buf[i][2] = ubuf(0).d; + else buf[i][2] = ubuf(1).d; if (ellipsoid[i] < 0) buf[i][3] = rmass[i]; else { shape = bonus[ellipsoid[i]].shape; @@ -1277,9 +1277,9 @@ void AtomVecEllipsoid::pack_data(double **buf) buf[i][4] = x[i][0]; buf[i][5] = x[i][1]; buf[i][6] = x[i][2]; - buf[i][7] = (image[i] & IMGMASK) - IMGMAX; - buf[i][8] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][7] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][8] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1289,8 +1289,8 @@ void AtomVecEllipsoid::pack_data(double **buf) int AtomVecEllipsoid::pack_data_hybrid(int i, double *buf) { - if (ellipsoid[i] < 0) buf[0] = 0; - else buf[0] = 1; + if (ellipsoid[i] < 0) buf[0] = ubuf(0).d; + else buf[0] = ubuf(1).d; if (ellipsoid[i] < 0) buf[1] = rmass[i]; else { double *shape = bonus[ellipsoid[i]].shape; @@ -1307,9 +1307,11 @@ void AtomVecEllipsoid::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i, buf[i][3],buf[i][4],buf[i][5],buf[i][6], - (int) buf[i][7],(int) buf[i][8],(int) buf[i][9]); + (int) ubuf(buf[i][7]).i,(int) ubuf(buf[i][8]).i, + (int) ubuf(buf[i][9]).i); } /* ---------------------------------------------------------------------- @@ -1318,7 +1320,7 @@ void AtomVecEllipsoid::write_data(FILE *fp, int n, double **buf) int AtomVecEllipsoid::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d %-1.16e",(int) buf[0],buf[1]); + fprintf(fp," %d %-1.16e",(int) ubuf(buf[0]).i,buf[1]); return 2; } @@ -1330,7 +1332,7 @@ void AtomVecEllipsoid::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -1360,7 +1362,7 @@ void AtomVecEllipsoid::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3], + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); } diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 0f686d8aac..0ced6310cd 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -452,9 +452,9 @@ int AtomVecHybrid::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; } } else { if (domain->triclinic == 0) { @@ -471,9 +471,9 @@ int AtomVecHybrid::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; } } @@ -506,9 +506,9 @@ int AtomVecHybrid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -539,9 +539,9 @@ int AtomVecHybrid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; buf[m++] = v[j][0]; buf[m++] = v[j][1]; buf[m++] = v[j][2]; @@ -565,9 +565,9 @@ int AtomVecHybrid::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; if (mask[i] & deform_groupbit) { buf[m++] = v[j][0] + dvx; buf[m++] = v[j][1] + dvy; @@ -616,9 +616,9 @@ void AtomVecHybrid::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; } // unpack sub-style contributions as contiguous chunks @@ -647,9 +647,9 @@ void AtomVecHybrid::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; v[i][0] = buf[m++]; v[i][1] = buf[m++]; v[i][2] = buf[m++]; @@ -929,8 +929,8 @@ void AtomVecHybrid::pack_data(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = type[i]; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(type[i]).d; buf[i][2] = x[i][0]; buf[i][3] = x[i][1]; buf[i][4] = x[i][2]; @@ -939,9 +939,9 @@ void AtomVecHybrid::pack_data(double **buf) for (k = 0; k < nstyles; k++) m += styles[k]->pack_data_hybrid(i,&buf[i][m]); - buf[i][m] = (image[i] & IMGMASK) - IMGMAX; - buf[i][m+1] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][m+2] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][m] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][m+1] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][m+2] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -955,7 +955,7 @@ void AtomVecHybrid::write_data(FILE *fp, int n, double **buf) for (int i = 0; i < n; i++) { fprintf(fp,"%d %d %-1.16e %-1.16e %-1.16e", - (int) buf[i][0],(int) buf[i][1], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, buf[i][2],buf[i][3],buf[i][4]); m = 5; @@ -963,7 +963,8 @@ void AtomVecHybrid::write_data(FILE *fp, int n, double **buf) m += styles[k]->write_data_hybrid(fp,&buf[i][m]); fprintf(fp," %d %d %d\n", - (int) buf[i][m],(int) buf[i][m+1],(int) buf[i][m+2]); + (int) ubuf(buf[i][m]).i,(int) ubuf(buf[i][m+1]).i, + (int) ubuf(buf[i][m+2]).i); } } @@ -977,7 +978,7 @@ void AtomVecHybrid::pack_vel(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -998,7 +999,7 @@ void AtomVecHybrid::write_vel(FILE *fp, int n, double **buf) for (int i = 0; i < n; i++) { fprintf(fp,"%d %g %g %g", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3]); + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3]); m = 4; for (k = 0; k < nstyles; k++) diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index de95a29fbd..68a5c2c076 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -480,13 +480,13 @@ int AtomVecLine::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -506,13 +506,13 @@ int AtomVecLine::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -541,13 +541,13 @@ int AtomVecLine::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -574,13 +574,13 @@ int AtomVecLine::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -600,13 +600,13 @@ int AtomVecLine::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -643,9 +643,9 @@ int AtomVecLine::pack_border_hybrid(int n, int *list, double *buf) for (i = 0; i < n; i++) { j = list[i]; buf[m++] = molecule[j]; - if (line[j] < 0) buf[m++] = 0; + if (line[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; buf[m++] = bonus[line[j]].theta; } @@ -666,11 +666,11 @@ void AtomVecLine::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); - line[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; + line[i] = (int) ubuf(buf[m++]).i; if (line[i] == 0) line[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -702,11 +702,11 @@ void AtomVecLine::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); - line[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; + line[i] = (int) ubuf(buf[m++]).i; if (line[i] == 0) line[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -740,8 +740,8 @@ int AtomVecLine::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - molecule[i] = static_cast (buf[m++]); - line[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; + line[i] = (int) ubuf(buf[m++]).i; if (line[i] == 0) line[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -770,20 +770,20 @@ int AtomVecLine::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; buf[m++] = rmass[i]; buf[m++] = omega[i][0]; buf[m++] = omega[i][1]; buf[m++] = omega[i][2]; - if (line[i] < 0) buf[m++] = 0; + if (line[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = line[i]; buf[m++] = bonus[j].length; buf[m++] = bonus[j].theta; @@ -811,18 +811,18 @@ int AtomVecLine::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; omega[nlocal][0] = buf[m++]; omega[nlocal][1] = buf[m++]; omega[nlocal][2] = buf[m++]; - line[nlocal] = static_cast (buf[m++]); + line[nlocal] = (int) ubuf(buf[m++]).i; if (line[nlocal] == 0) line[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -876,23 +876,23 @@ int AtomVecLine::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; buf[m++] = rmass[i]; buf[m++] = omega[i][0]; buf[m++] = omega[i][1]; buf[m++] = omega[i][2]; - if (line[i] < 0) buf[m++] = 0; + if (line[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = line[i]; buf[m++] = bonus[j].length; buf[m++] = bonus[j].theta; @@ -923,21 +923,21 @@ int AtomVecLine::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; omega[nlocal][0] = buf[m++]; omega[nlocal][1] = buf[m++]; omega[nlocal][2] = buf[m++]; - line[nlocal] = static_cast (buf[m++]); + line[nlocal] = (int) ubuf(buf[m++]).i; if (line[nlocal] == 0) line[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1133,19 +1133,19 @@ void AtomVecLine::pack_data(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; - if (line[i] < 0) buf[i][3] = 0; - else buf[i][3] = 1; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; + if (line[i] < 0) buf[i][3] = ubuf(0).d; + else buf[i][3] = ubuf(1).d; if (line[i] < 0) buf[i][4] = rmass[i]; else buf[i][4] = rmass[i]/bonus[line[i]].length; buf[i][5] = x[i][0]; buf[i][6] = x[i][1]; buf[i][7] = x[i][2]; - buf[i][8] = (image[i] & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][8] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][10] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1155,9 +1155,9 @@ void AtomVecLine::pack_data(double **buf) int AtomVecLine::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; - if (line[i] < 0) buf[1] = 0; - else buf[1] = 1; + buf[0] = ubuf(molecule[i]).d; + if (line[i] < 0) buf[1] = ubuf(0).d; + else buf[1] = ubuf(1).d; if (line[i] < 0) buf[2] = rmass[i]; else buf[2] = rmass[i]/bonus[line[i]].length; return 3; @@ -1171,9 +1171,11 @@ void AtomVecLine::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2],(int) buf[i][3], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i,(int) ubuf(buf[i][3]).i, buf[i][4],buf[i][5],buf[i][6],buf[i][7], - (int) buf[i][8],(int) buf[i][9],(int) buf[i][10]); + (int) ubuf(buf[i][8]).i,(int) ubuf(buf[i][9]).i, + (int) ubuf(buf[i][10]).i); } /* ---------------------------------------------------------------------- @@ -1182,7 +1184,7 @@ void AtomVecLine::write_data(FILE *fp, int n, double **buf) int AtomVecLine::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d %d %-1.16e",(int) buf[0],(int) buf[1],buf[2]); + fprintf(fp," %d %d %-1.16e",(int) ubuf(buf[0]).i,(int) ubuf(buf[1]).i,buf[2]); return 3; } @@ -1194,7 +1196,7 @@ void AtomVecLine::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -1224,7 +1226,7 @@ void AtomVecLine::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3], + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); } @@ -1257,7 +1259,8 @@ bigint AtomVecLine::memory_usage() if (atom->memcheck("molecule")) bytes += memory->usage(molecule,nmax); if (atom->memcheck("rmass")) bytes += memory->usage(rmass,nmax); if (atom->memcheck("omega")) bytes += memory->usage(omega,nmax,3); - if (atom->memcheck("torque")) bytes += memory->usage(torque,nmax*comm->nthreads,3); + if (atom->memcheck("torque")) + bytes += memory->usage(torque,nmax*comm->nthreads,3); if (atom->memcheck("line")) bytes += memory->usage(line,nmax); bytes += nmax_bonus*sizeof(Bonus); diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 85a86aca84..999df0e69d 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -579,13 +579,13 @@ int AtomVecTri::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -624,13 +624,13 @@ int AtomVecTri::pack_border(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -679,13 +679,13 @@ int AtomVecTri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0]; buf[m++] = x[j][1]; buf[m++] = x[j][2]; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -731,13 +731,13 @@ int AtomVecTri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -776,13 +776,13 @@ int AtomVecTri::pack_border_vel(int n, int *list, double *buf, buf[m++] = x[j][0] + dx; buf[m++] = x[j][1] + dy; buf[m++] = x[j][2] + dz; - buf[m++] = tag[j]; - buf[m++] = type[j]; - buf[m++] = mask[j]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(tag[j]).d; + buf[m++] = ubuf(type[j]).d; + buf[m++] = ubuf(mask[j]).d; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -838,10 +838,10 @@ int AtomVecTri::pack_border_hybrid(int n, int *list, double *buf) m = 0; for (i = 0; i < n; i++) { j = list[i]; - buf[m++] = molecule[j]; - if (tri[j] < 0) buf[m++] = 0; + buf[m++] = ubuf(molecule[j]).d; + if (tri[j] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; c1 = bonus[tri[j]].c1; c2 = bonus[tri[j]].c2; @@ -882,11 +882,11 @@ void AtomVecTri::unpack_border(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); - tri[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; + tri[i] = (int) ubuf(buf[m++]).i; if (tri[i] == 0) tri[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -938,11 +938,11 @@ void AtomVecTri::unpack_border_vel(int n, int first, double *buf) x[i][0] = buf[m++]; x[i][1] = buf[m++]; x[i][2] = buf[m++]; - tag[i] = static_cast (buf[m++]); - type[i] = static_cast (buf[m++]); - mask[i] = static_cast (buf[m++]); - molecule[i] = static_cast (buf[m++]); - tri[i] = static_cast (buf[m++]); + tag[i] = (int) ubuf(buf[m++]).i; + type[i] = (int) ubuf(buf[m++]).i; + mask[i] = (int) ubuf(buf[m++]).i; + molecule[i] = (int) ubuf(buf[m++]).i; + tri[i] = (int) ubuf(buf[m++]).i; if (tri[i] == 0) tri[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -996,8 +996,8 @@ int AtomVecTri::unpack_border_hybrid(int n, int first, double *buf) m = 0; last = first + n; for (i = first; i < last; i++) { - molecule[i] = static_cast (buf[m++]); - tri[i] = static_cast (buf[m++]); + molecule[i] = (int) ubuf(buf[m++]).i; + tri[i] = (int) ubuf(buf[m++]).i; if (tri[i] == 0) tri[i] = -1; else { j = nlocal_bonus + nghost_bonus; @@ -1045,20 +1045,20 @@ int AtomVecTri::pack_exchange(int i, double *buf) buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; buf[m++] = rmass[i]; buf[m++] = angmom[i][0]; buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (tri[i] < 0) buf[m++] = 0; + if (tri[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = tri[i]; double *quat = bonus[j].quat; double *c1 = bonus[j].c1; @@ -1105,18 +1105,18 @@ int AtomVecTri::unpack_exchange(double *buf) v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; angmom[nlocal][0] = buf[m++]; angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - tri[nlocal] = static_cast (buf[m++]); + tri[nlocal] = (int) ubuf(buf[m++]).i; if (tri[nlocal] == 0) tri[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1189,23 +1189,23 @@ int AtomVecTri::pack_restart(int i, double *buf) buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; - buf[m++] = tag[i]; - buf[m++] = type[i]; - buf[m++] = mask[i]; - *((tagint *) &buf[m++]) = image[i]; + buf[m++] = ubuf(tag[i]).d; + buf[m++] = ubuf(type[i]).d; + buf[m++] = ubuf(mask[i]).d; + buf[m++] = ubuf(image[i]).d; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; - buf[m++] = molecule[i]; + buf[m++] = ubuf(molecule[i]).d; buf[m++] = rmass[i]; buf[m++] = angmom[i][0]; buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; - if (tri[i] < 0) buf[m++] = 0; + if (tri[i] < 0) buf[m++] = ubuf(0).d; else { - buf[m++] = 1; + buf[m++] = ubuf(1).d; int j = tri[i]; double *quat = bonus[j].quat; double *c1 = bonus[j].c1; @@ -1255,21 +1255,21 @@ int AtomVecTri::unpack_restart(double *buf) x[nlocal][0] = buf[m++]; x[nlocal][1] = buf[m++]; x[nlocal][2] = buf[m++]; - tag[nlocal] = static_cast (buf[m++]); - type[nlocal] = static_cast (buf[m++]); - mask[nlocal] = static_cast (buf[m++]); - image[nlocal] = *((tagint *) &buf[m++]); + tag[nlocal] = (int) ubuf(buf[m++]).i; + type[nlocal] = (int) ubuf(buf[m++]).i; + mask[nlocal] = (int) ubuf(buf[m++]).i; + image[nlocal] = (tagint) ubuf(buf[m++]).i; v[nlocal][0] = buf[m++]; v[nlocal][1] = buf[m++]; v[nlocal][2] = buf[m++]; - molecule[nlocal] = static_cast (buf[m++]); + molecule[nlocal] = (int) ubuf(buf[m++]).i; rmass[nlocal] = buf[m++]; angmom[nlocal][0] = buf[m++]; angmom[nlocal][1] = buf[m++]; angmom[nlocal][2] = buf[m++]; - tri[nlocal] = static_cast (buf[m++]); + tri[nlocal] = (int) ubuf(buf[m++]).i; if (tri[nlocal] == 0) tri[nlocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); @@ -1568,11 +1568,11 @@ void AtomVecTri::pack_data(double **buf) int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; - buf[i][1] = molecule[i]; - buf[i][2] = type[i]; - if (tri[i] < 0) buf[i][3] = 0; - else buf[i][3] = 1; + buf[i][0] = ubuf(tag[i]).d; + buf[i][1] = ubuf(molecule[i]).d; + buf[i][2] = ubuf(type[i]).d; + if (tri[i] < 0) buf[i][3] = ubuf(0).d; + else buf[i][3] = ubuf(1).d; if (tri[i] < 0) buf[i][4] = rmass[i]; else { MathExtra::sub3(bonus[tri[i]].c2,bonus[tri[i]].c1,c2mc1); @@ -1584,9 +1584,9 @@ void AtomVecTri::pack_data(double **buf) buf[i][5] = x[i][0]; buf[i][6] = x[i][1]; buf[i][7] = x[i][2]; - buf[i][8] = (image[i] & IMGMASK) - IMGMAX; - buf[i][9] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; - buf[i][10] = (image[i] >> IMG2BITS) - IMGMAX; + buf[i][8] = ubuf((image[i] & IMGMASK) - IMGMAX).d; + buf[i][9] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; + buf[i][10] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d; } } @@ -1596,9 +1596,9 @@ void AtomVecTri::pack_data(double **buf) int AtomVecTri::pack_data_hybrid(int i, double *buf) { - buf[0] = molecule[i]; - if (tri[i] < 0) buf[1] = 0; - else buf[1] = 1; + buf[0] = ubuf(molecule[i]).d; + if (tri[i] < 0) buf[1] = ubuf(0).d; + else buf[1] = ubuf(1).d; if (tri[i] < 0) buf[2] = rmass[i]; else { double c2mc1[2],c3mc1[3],norm[3]; @@ -1619,9 +1619,11 @@ void AtomVecTri::write_data(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %d %d %d %-1.16e %-1.16e %-1.16e %-1.16e %d %d %d\n", - (int) buf[i][0],(int) buf[i][1],(int) buf[i][2],(int) buf[i][3], + (int) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, + (int) ubuf(buf[i][2]).i,(int) ubuf(buf[i][3]).i, buf[i][4],buf[i][5],buf[i][6],buf[i][7], - (int) buf[i][8],(int) buf[i][9],(int) buf[i][10]); + (int) ubuf(buf[i][8]).i,(int) ubuf(buf[i][9]).i, + (int) ubuf(buf[i][10]).i); } /* ---------------------------------------------------------------------- @@ -1630,7 +1632,7 @@ void AtomVecTri::write_data(FILE *fp, int n, double **buf) int AtomVecTri::write_data_hybrid(FILE *fp, double *buf) { - fprintf(fp," %d %d %-1.16e",(int) buf[0],(int) buf[1],buf[2]); + fprintf(fp," %d %d %-1.16e",(int) ubuf(buf[0]).i,(int) ubuf(buf[1]).i,buf[2]); return 3; } @@ -1642,7 +1644,7 @@ void AtomVecTri::pack_vel(double **buf) { int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { - buf[i][0] = tag[i]; + buf[i][0] = ubuf(tag[i]).d; buf[i][1] = v[i][0]; buf[i][2] = v[i][1]; buf[i][3] = v[i][2]; @@ -1672,7 +1674,7 @@ void AtomVecTri::write_vel(FILE *fp, int n, double **buf) { for (int i = 0; i < n; i++) fprintf(fp,"%d %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e %-1.16e\n", - (int) buf[i][0],buf[i][1],buf[i][2],buf[i][3], + (int) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3], buf[i][4],buf[i][5],buf[i][6]); }