git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8395 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2012-06-25 22:03:31 +00:00
parent 8f6a8d13d5
commit 66c5617afb
83 changed files with 10821 additions and 639 deletions

View File

@ -609,7 +609,7 @@ int AtomVecDipole::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
q[nlocal] = buf[m++];
mu[nlocal][0] = buf[m++];
@ -700,7 +700,7 @@ int AtomVecDipole::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -737,7 +737,8 @@ void AtomVecDipole::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -756,7 +757,7 @@ void AtomVecDipole::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecDipole::data_atom(double *coord, int imagetmp, char **values)
void AtomVecDipole::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -50,12 +50,13 @@ class AtomVecDipole : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *q,**mu,**omega,**torque;
};

View File

@ -4,8 +4,7 @@ SHELL = /bin/sh
# ---------------------------------------------------------------------
# compiler/linker settings
# generally no need to edit this section
# unless additional compiler/linker flags or libraries needed for your machine
# specify flags and libraries needed for your compiler
CC = g++
CCFLAGS = -O
@ -25,7 +24,7 @@ SIZE = size
# LAMMPS ifdef settings, OPTIONAL
# see possible settings in doc/Section_start.html#2_2 (step 4)
LMP_INC = -DLAMMPS_GZIP
LMP_INC = -DLAMMPS_GZIP -DLAMMPS_BIGBIG
# MPI library, REQUIRED
# see discussion in doc/Section_start.html#2_2 (step 5)

View File

@ -5,6 +5,7 @@ if (test $1 = 1) then
cp fix_qeq_comb.cpp ..
cp pair_adp.cpp ..
cp pair_airebo.cpp ..
cp pair_bop.cpp ..
cp pair_comb.cpp ..
cp pair_eam.cpp ..
cp pair_eam_alloy.cpp ..
@ -19,6 +20,7 @@ if (test $1 = 1) then
cp fix_qeq_comb.h ..
cp pair_adp.h ..
cp pair_airebo.h ..
cp pair_bop.h ..
cp pair_comb.h ..
cp pair_eam.h ..
cp pair_eam_alloy.h ..
@ -35,6 +37,7 @@ elif (test $1 = 0) then
rm -f ../fix_qeq_comb.cpp
rm -f ../pair_adp.cpp
rm -f ../pair_airebo.cpp
rm -f ../pair_bop.cpp
rm -f ../pair_comb.cpp
rm -f ../pair_eam.cpp
rm -f ../pair_eam_alloy.cpp
@ -49,6 +52,7 @@ elif (test $1 = 0) then
rm -f ../fix_qeq_comb.h
rm -f ../pair_adp.h
rm -f ../pair_airebo.h
rm -f ../pair_bop.h
rm -f ../pair_comb.h
rm -f ../pair_eam.h
rm -f ../pair_eam_alloy.h

9896
src/MANYBODY/pair_bop.cpp Normal file

File diff suppressed because it is too large Load Diff

216
src/MANYBODY/pair_bop.h Normal file
View File

@ -0,0 +1,216 @@
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
PairStyle(bop,PairBOP)
#else
#ifndef LMP_PAIR_BOP_H
#define LMP_PAIR_BOP_H
#include "pair.h"
#include "update.h"
namespace LAMMPS_NS {
class PairBOP : public Pair {
public:
PairBOP(class LAMMPS *);
virtual ~PairBOP();
void compute(int, int);
void settings(int, char **);
void coeff(int, char **);
void init_style();
double init_one(int, int);
double memory_usage();
private:
int me;
int maxneigh; // maximum size of neighbor list on this processor
int update_list; // check for changing maximum size of neighbor list
int maxbopn; // maximum size of bop neighbor list for allocation
int maxnall; // maximum size of bop neighbor list for allocation
int *map; // mapping from atom types to elements
int nelements; // # of unique elments
int nr; // increments for the BOP potential
int nBOt; // second BO increments
int bop_types; // number of elments in potential
int npairs; // number of element pairs
char **elements; // names of unique elements
int ***elem2param;
int nparams;
int bop_step;
int allocate_pi;
int allocate_sigma;
int allocate_neigh;
int nb_pi,nb_sg;
int *BOP_index; // index for neighbor list position
int neigh_total; // total number of neighbors stored
int *cos_index; // index for neighbor cosine if not using on the fly
int *neigh_flag; // index for neighbor cosine if not using on the fly
int cos_total; // number of cosines stored if not using on the fly
int neigh_ct; // limit for large arrays
/*Parameters variables*/
int ncutoff,nfunc;
int a_flag;
double *pi_a,*pro_delta,*pi_delta;
double *pi_p,*pi_c,*sigma_r0,*pi_r0,*phi_r0;
double *sigma_rc,*pi_rc,*phi_rc,*r1,*sigma_beta0;
double *pi_beta0,*phi0,*sigma_n,*pi_n,*phi_m;
double *sigma_nc,*pi_nc,*phi_nc;
double *pro,*sigma_delta,*sigma_c,*sigma_a;
double ***sigma_g0,***sigma_g1,***sigma_g2,***sigma_g3;
double ***sigma_g4,*sigma_f,*sigma_k,*small3;
double small1,small2,small3g,small4,small5,small6,small7;
double which,alpha,alpha1,beta1,gamma1,alpha2,beta2,alpha3;
double beta3,rsmall,rbig,rcore;
char **words;
double cutmax; //max cutoff for all elements
int otfly; //Defines whether to do on the fly
//calculations of angles and distances
//on the fly will slow down calculations
//but requires less memory on = 1, off=0
int table; //determines the method for reading in
//potential parameters a preset table
//or generate the tables using a spline
/* Neigh variables */
double *rcut,*dr,*rdr;
double **disij,*rij;
/*Triple variables */
double *cosAng,***dcosAng,***dcAng;
/*Double variables */
double *betaS,*dBetaS,*betaP;
double *dBetaP,*repul,*dRepul;
/*Sigma variables */
int **itypeSigBk,*nSigBk;
double *sigB;
double *sigB1;
/*Pi variables */
int **itypePiBk,*nPiBk;
double *piB;
/*Grids1 variables */
double **pBetaS,**pBetaS1,**pBetaS2,**pBetaS3;
double **pBetaS4,**pBetaS5,**pBetaS6;
/*Grids2 variables */
double **pBetaP,**pBetaP1,**pBetaP2,**pBetaP3;
double **pBetaP4,**pBetaP5,**pBetaP6;
/*Grids3 variables */
double **pRepul,**pRepul1,**pRepul2,**pRepul3;
double **pRepul4,**pRepul5,**pRepul6;
/*Grids4 variables */
double **FsigBO,**FsigBO1,**FsigBO2,**FsigBO3;
double **FsigBO4,**FsigBO5,**FsigBO6;
double dBO,rdBO;
/* End of BOP variables */
double **rcmin,**rcmax,**rcmaxp;
struct B_PI{
double dAA[3];
double dBB[3];
double dPiB[3];
int temp;
int i;
int j;
};
B_PI *bt_pi;
struct B_SG{
double dAA[3];
double dBB[3];
double dCC[3];
double dDD[3];
double dEE[3];
double dEE1[3];
double dFF[3];
double dAAC[3];
double dBBC[3];
double dCCC[3];
double dDDC[3];
double dEEC[3];
double dFFC[3];
double dGGC[3];
double dUT[3];
double dSigB1[3];
double dSigB[3];
int temp;
int i;
int j;
};
B_SG *bt_sg;
void setPbetaS();
void setPbetaP();
void setPrepul();
void setSign();
void gneigh();
void theta();
void theta_mod();
void sigmaBo();
void PiBo();
void sigmaBo_otf();
void PiBo_otf();
void sigmaBo_noa();
void sigmaBo_noa_otf();
void memory_theta_create();
void memory_theta_destroy();
void memory_theta_grow();
double cutoff(double, double, int, double);
double betaSfunc(int, double);
double dBetaSfunc(int, double, double, double);
double betaPfunc(int, double);
double dBetaPfunc(int, double, double, double);
double repulfunc(int, double);
double dRepulfunc(int, double, double, double);
void read_file(char *);
void read_table(char *);
void allocate();
void create_pi(int);
void create_sigma(int);
void destroy_pi();
void destroy_sigma();
void grow_pi(int,int);
void grow_sigma(int,int);
};
}
#endif
#endif

View File

@ -578,7 +578,7 @@ int AtomVecAngle::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
molecule[nlocal] = static_cast<int> (buf[m++]);
@ -701,7 +701,7 @@ int AtomVecAngle::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -748,7 +748,8 @@ void AtomVecAngle::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -766,7 +767,7 @@ void AtomVecAngle::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecAngle::data_atom(double *coord, int imagetmp, char **values)
void AtomVecAngle::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -49,12 +49,13 @@ class AtomVecAngle : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
protected:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
int **nspecial,**special;

View File

@ -549,7 +549,7 @@ int AtomVecBond::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
molecule[nlocal] = static_cast<int> (buf[m++]);
@ -656,7 +656,7 @@ int AtomVecBond::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -695,7 +695,8 @@ void AtomVecBond::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -712,7 +713,7 @@ void AtomVecBond::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecBond::data_atom(double *coord, int imagetmp, char **values)
void AtomVecBond::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -48,12 +48,13 @@ class AtomVecBond : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
int **nspecial,**special;

View File

@ -666,7 +666,7 @@ int AtomVecFull::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
q[nlocal] = buf[m++];
molecule[nlocal] = static_cast<int> (buf[m++]);
@ -828,7 +828,7 @@ int AtomVecFull::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -894,7 +894,8 @@ void AtomVecFull::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -915,7 +916,7 @@ void AtomVecFull::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecFull::data_atom(double *coord, int imagetmp, char **values)
void AtomVecFull::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -49,12 +49,13 @@ class AtomVecFull : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
protected:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *q;
int *molecule;

View File

@ -653,7 +653,7 @@ int AtomVecMolecular::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
molecule[nlocal] = static_cast<int> (buf[m++]);
@ -813,7 +813,7 @@ int AtomVecMolecular::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -878,7 +878,8 @@ void AtomVecMolecular::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -898,7 +899,7 @@ void AtomVecMolecular::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecMolecular::data_atom(double *coord, int imagetmp, char **values)
void AtomVecMolecular::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -48,12 +48,13 @@ class AtomVecMolecular : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
int **nspecial,**special;

View File

@ -601,7 +601,7 @@ int AtomVecPeri::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
vfrac[nlocal] = buf[m++];
rmass[nlocal] = buf[m++];
@ -695,7 +695,7 @@ int AtomVecPeri::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -733,7 +733,8 @@ void AtomVecPeri::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -753,7 +754,7 @@ void AtomVecPeri::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecPeri::data_atom(double *coord, int imagetmp, char **values)
void AtomVecPeri::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -50,12 +50,13 @@ class AtomVecPeri : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *vfrac,*density,*rmass,*s0,**x0;
};

View File

@ -360,7 +360,7 @@ void FixPOEMS::init()
// only count joint atoms in 1st body
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double **x = atom->x;
double **v = atom->v;
@ -379,9 +379,9 @@ void FixPOEMS::init()
for (i = 0; i < nlocal; i++) {
if (natom2body[i]) {
ibody = atom2body[i][0];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
massone = mass[type[i]];
sum[ibody][0] += (x[i][0] + xbox*xprd) * massone;
sum[ibody][1] += (x[i][1] + ybox*yprd) * massone;
@ -416,9 +416,9 @@ void FixPOEMS::init()
if (natom2body[i]) {
ibody = atom2body[i][0];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xcm[ibody][0];
dy = x[i][1] + ybox*yprd - xcm[ibody][1];
dz = x[i][2] + zbox*zprd - xcm[ibody][2];
@ -511,9 +511,9 @@ void FixPOEMS::init()
if (natom2body[i]) {
ibody = atom2body[i][0];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xcm[ibody][0];
dy = x[i][1] + ybox*yprd - xcm[ibody][1];
dz = x[i][2] + zbox*zprd - xcm[ibody][2];
@ -544,9 +544,9 @@ void FixPOEMS::init()
if (natom2body[i]) {
ibody = atom2body[i][0];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xcm[ibody][0];
dy = x[i][1] + ybox*yprd - xcm[ibody][1];
dz = x[i][2] + zbox*zprd - xcm[ibody][2];
@ -596,7 +596,7 @@ void FixPOEMS::setup(int vflag)
// only count joint atoms in 1st body
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double **x = atom->x;
double **v = atom->v;
@ -617,9 +617,9 @@ void FixPOEMS::setup(int vflag)
ibody = atom2body[i][0];
massone = mass[type[i]];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xcm[ibody][0];
dy = x[i][1] + ybox*yprd - xcm[ibody][1];
dz = x[i][2] + zbox*zprd - xcm[ibody][2];
@ -710,7 +710,7 @@ void FixPOEMS::post_force(int vflag)
int xbox,ybox,zbox;
double dx,dy,dz;
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
@ -730,9 +730,9 @@ void FixPOEMS::post_force(int vflag)
sum[ibody][1] += f[i][1];
sum[ibody][2] += f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xcm[ibody][0];
dy = x[i][1] + ybox*yprd - xcm[ibody][1];
dz = x[i][2] + zbox*zprd - xcm[ibody][2];
@ -1341,7 +1341,7 @@ void FixPOEMS::set_xv()
double x0,x1,x2,v0,v1,v2,fc0,fc1,fc2,massone;
double vr[6];
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -1360,9 +1360,9 @@ void FixPOEMS::set_xv()
if (natom2body[i] == 0) continue;
ibody = atom2body[i][0];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
// save old positions and velocities for virial
@ -1445,7 +1445,7 @@ void FixPOEMS::set_v()
double **x = atom->x;
double **v = atom->v;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double xprd = domain->xprd;
@ -1493,9 +1493,9 @@ void FixPOEMS::set_v()
fc1 = massone*(v[i][1] - v1)/dtf - f[i][1];
fc2 = massone*(v[i][2] - v2)/dtf - f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
x0 = x[i][0] + xbox*xprd;
x1 = x[i][1] + ybox*yprd;

View File

@ -96,7 +96,7 @@ double ComputeEventDisplace::compute_scalar()
double **x = atom->x;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double *h = domain->h;
@ -109,9 +109,9 @@ double ComputeEventDisplace::compute_scalar()
if (triclinic == 0) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xevent[i][0];
dy = x[i][1] + ybox*yprd - xevent[i][1];
dz = x[i][2] + zbox*zprd - xevent[i][2];
@ -124,9 +124,9 @@ double ComputeEventDisplace::compute_scalar()
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox - xevent[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - xevent[i][1];
dz = x[i][2] + h[2]*zbox - xevent[i][2];

View File

@ -81,7 +81,7 @@ int FixEvent::setmask()
void FixEvent::store_event()
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++)
@ -97,7 +97,7 @@ void FixEvent::store_event()
void FixEvent::restore_event()
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
@ -108,9 +108,10 @@ void FixEvent::restore_event()
// Since xevent is unwrapped coordinate, need to
// adjust image flags when remapping
image[i] = (512 << 20) | (512 << 10) | 512;
image[i] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMASK << IMGBITS) | IMGMASK;
domain->remap(x[i],image[i]);
// domain->remap(x[i]);
// domain->remap(x[i]);
}
}
@ -125,7 +126,7 @@ void FixEvent::store_state()
{
double **x = atom->x;
double **v = atom->v;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
@ -148,7 +149,7 @@ void FixEvent::restore_state()
{
double **x = atom->x;
double **v = atom->v;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {

View File

@ -830,7 +830,7 @@ void TAD::revert()
{
double **x = atom->x;
double **v = atom->v;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double **array_atom = fix_revert->array_atom;
@ -839,9 +839,10 @@ void TAD::revert()
x[i][0] = array_atom[i][0];
x[i][1] = array_atom[i][1];
x[i][2] = array_atom[i][2];
image[i] = ((int(array_atom[i][5]) + 512 & 1023) << 20) |
((int(array_atom[i][4]) + 512 & 1023) << 10) |
(int(array_atom[i][3]) + 512 & 1023);
image[i] =
((int(array_atom[i][5]) + (tagint) IMGMAX & IMGMASK) << IMG2BITS) |
((int(array_atom[i][4]) + (tagint) IMGMAX & IMGMASK) << IMGBITS) |
(int(array_atom[i][3]) + IMGMAX & IMGMASK);
v[i][0] = -array_atom[i][6];
v[i][1] = -array_atom[i][7];
v[i][2] = -array_atom[i][8];

View File

@ -728,7 +728,7 @@ int AtomVecWavepacket::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
q[nlocal] = buf[m++];
spin[nlocal] = static_cast<int> (buf[m++]);
eradius[nlocal] = buf[m++];
@ -824,7 +824,7 @@ int AtomVecWavepacket::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -865,7 +865,8 @@ void AtomVecWavepacket::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -888,7 +889,7 @@ void AtomVecWavepacket::create_atom(int itype, double *coord)
AWPMD: 0-tag 1-type 2-q 3-spin 4-eradius 5-etag 6-cs_re 7-cs_im
------------------------------------------------------------------------- */
void AtomVecWavepacket::data_atom(double *coord, int imagetmp, char **values)
void AtomVecWavepacket::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;

View File

@ -58,14 +58,15 @@ public:
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
///\en spin: -1 or 1 for electron, 0 for ion (compatible with eff)

View File

@ -607,7 +607,7 @@ int AtomVecElectron::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
q[nlocal] = buf[m++];
spin[nlocal] = static_cast<int> (buf[m++]);
eradius[nlocal] = buf[m++];
@ -695,7 +695,7 @@ int AtomVecElectron::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -731,7 +731,8 @@ void AtomVecElectron::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -749,7 +750,7 @@ void AtomVecElectron::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecElectron::data_atom(double *coord, int imagetmp, char **values)
void AtomVecElectron::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;

View File

@ -53,14 +53,15 @@ class AtomVecElectron : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *spin;
double *q,*eradius,*ervel,*erforce;

View File

@ -109,7 +109,7 @@ double ComputeTempRotate::compute_scalar()
double *mass = atom->mass;
double *rmass = atom->rmass;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -124,9 +124,9 @@ double ComputeTempRotate::compute_scalar()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];
@ -178,7 +178,7 @@ void ComputeTempRotate::compute_vector()
double *mass = atom->mass;
double *rmass = atom->rmass;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -194,9 +194,9 @@ void ComputeTempRotate::compute_vector()
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];

View File

@ -162,7 +162,7 @@ void FixAddTorque::post_force(int vflag)
double **f = atom->f;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -200,9 +200,9 @@ void FixAddTorque::post_force(int vflag)
tlocal[0] = tlocal[1] = tlocal[2] = 0.0;
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];
@ -222,9 +222,9 @@ void FixAddTorque::post_force(int vflag)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];

View File

@ -823,7 +823,7 @@ void FixIMD::post_force(int vflag)
int *tag = atom->tag;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int *mask = atom->mask;
struct commdata *buf;
@ -1036,9 +1036,9 @@ void FixIMD::post_force(int vflag)
if (mask[i] & groupbit) {
const int j = 3*inthash_lookup((inthash_t *)idmap, tag[i]);
if (j != HASH_FAIL) {
int ix = (image[i] & 1023) - 512;
int iy = (image[i] >> 10 & 1023) - 512;
int iz = (image[i] >> 20) - 512;
int ix = (image[i] & IMGMASK) - IMGMAX;
int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int iz = (image[i] >> IMG2BITS) - IMGMAX;
if (domain->triclinic) {
recvcoord[j] = x[i][0] + ix * xprd + iy * xy + iz * xz;
@ -1112,9 +1112,9 @@ void FixIMD::post_force(int vflag)
for (i=0; i<nlocal; ++i) {
if (mask[i] & groupbit) {
int ix = (image[i] & 1023) - 512;
int iy = (image[i] >> 10 & 1023) - 512;
int iz = (image[i] >> 20) - 512;
int ix = (image[i] & IMGMASK) - IMGMAX;
int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int iz = (image[i] >> IMG2BITS) - IMGMAX;
if (domain->triclinic) {
buf[nme].tag = tag[i];

View File

@ -308,7 +308,7 @@ void DumpMolfile::pack(int *ids)
int *tag = atom->tag;
int *type = atom->type;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -323,9 +323,9 @@ void DumpMolfile::pack(int *ids)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
int ix = (image[i] & 1023) - 512;
int iy = (image[i] >> 10 & 1023) - 512;
int iz = (image[i] >> 20) - 512;
int ix = (image[i] & IMGMASK) - IMGMAX;
int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int iz = (image[i] >> IMG2BITS) - IMGMAX;
buf[m++] = type[i];
if (domain->triclinic) {

View File

@ -630,7 +630,7 @@ int AtomVecMeso::unpack_exchange(double *buf) {
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
rho[nlocal] = buf[m++];
e[nlocal] = buf[m++];
cv[nlocal] = buf[m++];
@ -718,7 +718,7 @@ int AtomVecMeso::unpack_restart(double *buf) {
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -756,7 +756,8 @@ void AtomVecMeso::create_atom(int itype, double *coord) {
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -777,7 +778,7 @@ void AtomVecMeso::create_atom(int itype, double *coord) {
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecMeso::data_atom(double *coord, int imagetmp, char **values) {
void AtomVecMeso::data_atom(double *coord, tagint imagetmp, char **values) {
int nlocal = atom->nlocal;
if (nlocal == nmax)
grow(0);

View File

@ -57,12 +57,13 @@ class AtomVecMeso : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *rho, *drho, *e, *de, *cv;
double **vest; // estimated velocity during force computation

View File

@ -195,7 +195,7 @@ void DumpXTC::pack(int *ids)
int *tag = atom->tag;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -210,9 +210,9 @@ void DumpXTC::pack(int *ids)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
int ix = (image[i] & 1023) - 512;
int iy = (image[i] >> 10 & 1023) - 512;
int iz = (image[i] >> 20) - 512;
int ix = (image[i] & IMGMASK) - IMGMAX;
int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int iz = (image[i] >> IMG2BITS) - IMGMAX;
if (domain->triclinic) {
buf[m++] = sfactor * (x[i][0] + ix * xprd + iy * xy + iz * xz);
@ -359,7 +359,7 @@ static int *buf = NULL;
static int magicints[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 10, 12, 16, 20, 25, 32, 40, 50, 64,
80, 101, 128, 161, 203, 256, 322, 406, 512, 645,
80, 101, 128, 161, 203, 256, 322, 406, IMGMAX, 645,
812, 1024, 1290, 1625, 2048, 2580, 3250, 4096, 5060, 6501,
8192, 10321, 13003, 16384, 20642, 26007, 32768, 41285, 52015, 65536,
82570, 104031, 131072, 165140, 208063, 262144, 330280, 416127,

View File

@ -65,7 +65,8 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// initialize atom arrays
// customize by adding new array
tag = type = mask = image = NULL;
tag = type = mask = NULL;
image = NULL;
x = v = f = NULL;
molecule = NULL;
@ -464,7 +465,9 @@ void Atom::tag_extend()
int Atom::tag_consecutive()
{
int idmin = MAXTAGINT;
// change this when allow tagint = bigint
//int idmin = MAXTAGINT;
int idmin = MAXSMALLINT;
int idmax = 0;
for (int i = 0; i < nlocal; i++) {
@ -513,7 +516,8 @@ int Atom::count_words(const char *line)
void Atom::data_atoms(int n, char *buf)
{
int m,imagedata,xptr,iptr;
int m,xptr,iptr;
tagint imagedata;
double xdata[3],lamda[3];
double *coord;
char *next;
@ -593,10 +597,12 @@ void Atom::data_atoms(int n, char *buf)
}
if (imageflag)
imagedata = ((atoi(values[iptr+2]) + 512 & 1023) << 20) |
((atoi(values[iptr+1]) + 512 & 1023) << 10) |
(atoi(values[iptr]) + 512 & 1023);
else imagedata = (512 << 20) | (512 << 10) | 512;
imagedata =
(((tagint) atoi(values[iptr+2]) + IMGMAX & IMGMASK) << IMG2BITS) |
(((tagint) atoi(values[iptr+1]) + IMGMASK & IMGMASK) << IMGBITS) |
(atoi(values[iptr]) + IMGMASK & IMGMASK);
else imagedata = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
xdata[0] = atof(values[xptr]);
xdata[1] = atof(values[xptr+1]);

View File

@ -44,7 +44,8 @@ class Atom : protected Pointers {
// per-atom arrays
// customize by adding new array
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;

View File

@ -77,7 +77,7 @@ class AtomVec : protected Pointers {
virtual int unpack_restart(double *) = 0;
virtual void create_atom(int, double *) = 0;
virtual void data_atom(double *, int, char **) = 0;
virtual void data_atom(double *, tagint, char **) = 0;
virtual void data_atom_bonus(int, char **) {}
virtual int data_atom_hybrid(int, char **) {return 0;}
virtual void data_vel(int, char **);

View File

@ -5,7 +5,7 @@
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
@ -46,7 +46,7 @@ AtomVecAtomic::AtomVecAtomic(LAMMPS *lmp, int narg, char **arg) :
/* ----------------------------------------------------------------------
grow atom arrays
n = 0 grows arrays by DELTA
n > 0 allocates arrays to size n
n > 0 allocates arrays to size n
------------------------------------------------------------------------- */
void AtomVecAtomic::grow(int n)
@ -66,7 +66,7 @@ void AtomVecAtomic::grow(int n)
f = memory->grow(atom->f,nmax*comm->nthreads,3,"atom:f");
if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
modify->fix[atom->extra_grow[iextra]]->grow_arrays(nmax);
}
@ -99,14 +99,14 @@ void AtomVecAtomic::copy(int i, int j, int delflag)
v[j][2] = v[i][2];
if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j);
}
/* ---------------------------------------------------------------------- */
int AtomVecAtomic::pack_comm(int n, int *list, double *buf,
int pbc_flag, int *pbc)
int pbc_flag, int *pbc)
{
int i,j,m;
double dx,dy,dz;
@ -142,7 +142,7 @@ int AtomVecAtomic::pack_comm(int n, int *list, double *buf,
/* ---------------------------------------------------------------------- */
int AtomVecAtomic::pack_comm_vel(int n, int *list, double *buf,
int pbc_flag, int *pbc)
int pbc_flag, int *pbc)
{
int i,j,m;
double dx,dy,dz,dvx,dvy,dvz;
@ -170,32 +170,32 @@ int AtomVecAtomic::pack_comm_vel(int n, int *list, double *buf,
}
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++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[j][2];
j = list[i];
buf[m++] = x[j][0] + dx;
buf[m++] = x[j][1] + dy;
buf[m++] = x[j][2] + dz;
buf[m++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[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;
if (mask[i] & deform_groupbit) {
buf[m++] = v[j][0] + dvx;
buf[m++] = v[j][1] + dvy;
buf[m++] = v[j][2] + dvz;
} else {
buf[m++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[j][2];
}
j = list[i];
buf[m++] = x[j][0] + dx;
buf[m++] = x[j][1] + dy;
buf[m++] = x[j][2] + dz;
if (mask[i] & deform_groupbit) {
buf[m++] = v[j][0] + dvx;
buf[m++] = v[j][1] + dvy;
buf[m++] = v[j][2] + dvz;
} else {
buf[m++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[j][2];
}
}
}
}
@ -269,7 +269,7 @@ void AtomVecAtomic::unpack_reverse(int n, int *list, double *buf)
/* ---------------------------------------------------------------------- */
int AtomVecAtomic::pack_border(int n, int *list, double *buf,
int pbc_flag, int *pbc)
int pbc_flag, int *pbc)
{
int i,j,m;
double dx,dy,dz;
@ -311,7 +311,7 @@ int AtomVecAtomic::pack_border(int n, int *list, double *buf,
/* ---------------------------------------------------------------------- */
int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf,
int pbc_flag, int *pbc)
int pbc_flag, int *pbc)
{
int i,j,m;
double dx,dy,dz,dvx,dvy,dvz;
@ -342,38 +342,38 @@ int AtomVecAtomic::pack_border_vel(int n, int *list, double *buf,
}
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++] = 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];
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];
}
} 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++] = tag[j];
buf[m++] = type[j];
buf[m++] = mask[j];
if (mask[i] & deform_groupbit) {
buf[m++] = v[j][0] + dvx;
buf[m++] = v[j][1] + dvy;
buf[m++] = v[j][2] + dvz;
} else {
buf[m++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[j][2];
}
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];
if (mask[i] & deform_groupbit) {
buf[m++] = v[j][0] + dvx;
buf[m++] = v[j][1] + dvy;
buf[m++] = v[j][2] + dvz;
} else {
buf[m++] = v[j][0];
buf[m++] = v[j][1];
buf[m++] = v[j][2];
}
}
}
}
@ -423,7 +423,7 @@ void AtomVecAtomic::unpack_border_vel(int n, int first, double *buf)
/* ----------------------------------------------------------------------
pack data for atom I for sending to another proc
xyz must be 1st 3 values, so comm::exchange() can test on them
xyz must be 1st 3 values, so comm::exchange() can test on them
------------------------------------------------------------------------- */
int AtomVecAtomic::pack_exchange(int i, double *buf)
@ -441,7 +441,7 @@ int AtomVecAtomic::pack_exchange(int i, double *buf)
buf[m++] = image[i];
if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf[m]);
buf[0] = m;
@ -465,12 +465,12 @@ int AtomVecAtomic::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
if (atom->nextra_grow)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
for (int iextra = 0; iextra < atom->nextra_grow; iextra++)
m += modify->fix[atom->extra_grow[iextra]]->
unpack_exchange(nlocal,&buf[m]);
unpack_exchange(nlocal,&buf[m]);
atom->nlocal++;
return m;
@ -489,9 +489,9 @@ int AtomVecAtomic::size_restart()
int n = 11 * nlocal;
if (atom->nextra_restart)
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
for (i = 0; i < nlocal; i++)
n += modify->fix[atom->extra_restart[iextra]]->size_restart(i);
n += modify->fix[atom->extra_restart[iextra]]->size_restart(i);
return n;
}
@ -499,7 +499,7 @@ int AtomVecAtomic::size_restart()
/* ----------------------------------------------------------------------
pack atom I's data for restart file including extra quantities
xyz must be 1st 3 values, so that read_restart can test on them
molecular types may be negative, but write as positive
molecular types may be negative, but write as positive
------------------------------------------------------------------------- */
int AtomVecAtomic::pack_restart(int i, double *buf)
@ -517,7 +517,7 @@ int AtomVecAtomic::pack_restart(int i, double *buf)
buf[m++] = v[i][2];
if (atom->nextra_restart)
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
for (int iextra = 0; iextra < atom->nextra_restart; iextra++)
m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]);
buf[0] = m;
@ -544,7 +544,7 @@ int AtomVecAtomic::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -575,7 +575,8 @@ void AtomVecAtomic::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -588,7 +589,7 @@ void AtomVecAtomic::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecAtomic::data_atom(double *coord, int imagetmp, char **values)
void AtomVecAtomic::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);
@ -616,7 +617,7 @@ void AtomVecAtomic::data_atom(double *coord, int imagetmp, char **values)
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
return # of bytes of allocated memory
------------------------------------------------------------------------- */
bigint AtomVecAtomic::memory_usage()

View File

@ -47,11 +47,12 @@ class AtomVecAtomic : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
bigint memory_usage();
protected:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
};

View File

@ -508,7 +508,7 @@ int AtomVecCharge::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
q[nlocal] = buf[m++];
@ -591,7 +591,7 @@ int AtomVecCharge::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -624,7 +624,8 @@ void AtomVecCharge::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -639,7 +640,7 @@ void AtomVecCharge::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecCharge::data_atom(double *coord, int imagetmp, char **values)
void AtomVecCharge::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -49,12 +49,13 @@ class AtomVecCharge : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
bigint memory_usage();
protected:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *q;
};

View File

@ -919,7 +919,7 @@ int AtomVecEllipsoid::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
rmass[nlocal] = buf[m++];
angmom[nlocal][0] = buf[m++];
@ -1041,7 +1041,7 @@ int AtomVecEllipsoid::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -1094,7 +1094,8 @@ void AtomVecEllipsoid::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -1113,7 +1114,7 @@ void AtomVecEllipsoid::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecEllipsoid::data_atom(double *coord, int imagetmp, char **values)
void AtomVecEllipsoid::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -60,7 +60,7 @@ class AtomVecEllipsoid : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
@ -76,7 +76,8 @@ class AtomVecEllipsoid : public AtomVec {
void set_shape(int, double, double, double);
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *rmass;
double **angmom,**torque;

View File

@ -803,7 +803,7 @@ void AtomVecHybrid::create_atom(int itype, double *coord)
grow() occurs here so arrays for all sub-styles are grown
------------------------------------------------------------------------- */
void AtomVecHybrid::data_atom(double *coord, int imagetmp, char **values)
void AtomVecHybrid::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -53,13 +53,14 @@ class AtomVecHybrid : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **) {return 0;}
void data_vel(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double **omega,**angmom;
};

View File

@ -793,7 +793,7 @@ int AtomVecLine::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
molecule[nlocal] = static_cast<int> (buf[m++]);
rmass[nlocal] = buf[m++];
@ -905,7 +905,7 @@ int AtomVecLine::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -952,7 +952,8 @@ void AtomVecLine::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -972,7 +973,7 @@ void AtomVecLine::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecLine::data_atom(double *coord, int imagetmp, char **values)
void AtomVecLine::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -60,7 +60,7 @@ class AtomVecLine : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
@ -76,7 +76,8 @@ class AtomVecLine : public AtomVec {
void set_length(int, double);
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
double *rmass;

View File

@ -794,7 +794,7 @@ int AtomVecSphere::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
radius[nlocal] = buf[m++];
rmass[nlocal] = buf[m++];
@ -885,7 +885,7 @@ int AtomVecSphere::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -922,7 +922,8 @@ void AtomVecSphere::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -941,7 +942,7 @@ void AtomVecSphere::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecSphere::data_atom(double *coord, int imagetmp, char **values)
void AtomVecSphere::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -54,14 +54,15 @@ class AtomVecSphere : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
bigint memory_usage();
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
double *radius,*density,*rmass;
double **omega,**torque;

View File

@ -1087,7 +1087,7 @@ int AtomVecTri::unpack_exchange(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
molecule[nlocal] = static_cast<int> (buf[m++]);
rmass[nlocal] = buf[m++];
@ -1237,7 +1237,7 @@ int AtomVecTri::unpack_restart(double *buf)
tag[nlocal] = static_cast<int> (buf[m++]);
type[nlocal] = static_cast<int> (buf[m++]);
mask[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<int> (buf[m++]);
image[nlocal] = static_cast<tagint> (buf[m++]);
v[nlocal][0] = buf[m++];
v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++];
@ -1303,7 +1303,8 @@ void AtomVecTri::create_atom(int itype, double *coord)
x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2];
mask[nlocal] = 1;
image[nlocal] = (512 << 20) | (512 << 10) | 512;
image[nlocal] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMAX << IMGBITS) | IMGMAX;
v[nlocal][0] = 0.0;
v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0;
@ -1323,7 +1324,7 @@ void AtomVecTri::create_atom(int itype, double *coord)
initialize other atom quantities
------------------------------------------------------------------------- */
void AtomVecTri::data_atom(double *coord, int imagetmp, char **values)
void AtomVecTri::data_atom(double *coord, tagint imagetmp, char **values)
{
int nlocal = atom->nlocal;
if (nlocal == nmax) grow(0);

View File

@ -62,7 +62,7 @@ class AtomVecTri : public AtomVec {
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, int, char **);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void data_vel(int, char **);
int data_vel_hybrid(int, char **);
@ -78,7 +78,8 @@ class AtomVecTri : public AtomVec {
void set_equilateral(int, double);
private:
int *tag,*type,*mask,*image;
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
double *rmass;

View File

@ -356,7 +356,7 @@ void ChangeBox::command(int narg, char **arg)
// use irregular() in case box moved a long distance relative to atoms
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);

View File

@ -108,7 +108,7 @@ void ComputeCOMMolecule::compute_array()
int *mask = atom->mask;
int *molecule = atom->molecule;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -119,9 +119,9 @@ void ComputeCOMMolecule::compute_array()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (rmass) massone = rmass[i];
else massone = mass[type[i]];
imol = molecule[i];

View File

@ -104,7 +104,7 @@ void ComputeDisplaceAtom::compute_peratom()
double **x = atom->x;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double *h = domain->h;
@ -118,9 +118,9 @@ void ComputeDisplaceAtom::compute_peratom()
if (domain->triclinic == 0) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - xoriginal[i][2];
@ -134,9 +134,9 @@ void ComputeDisplaceAtom::compute_peratom()
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox - xoriginal[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - xoriginal[i][1];
dz = x[i][2] + h[2]*zbox - xoriginal[i][2];

View File

@ -79,7 +79,7 @@ void ComputeGyration::compute_vector()
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -95,9 +95,9 @@ void ComputeGyration::compute_vector()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];

View File

@ -136,7 +136,7 @@ void ComputeGyrationMolecule::compute_vector()
int *mask = atom->mask;
int *molecule = atom->molecule;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -147,9 +147,9 @@ void ComputeGyrationMolecule::compute_vector()
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
imol = molecule[i];
if (molmap) imol = molmap[imol-idlo];
else imol--;
@ -186,7 +186,7 @@ void ComputeGyrationMolecule::compute_array()
int *mask = atom->mask;
int *molecule = atom->molecule;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -197,9 +197,9 @@ void ComputeGyrationMolecule::compute_array()
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
imol = molecule[i];
if (molmap) imol = molmap[imol-idlo];
else imol--;
@ -243,7 +243,7 @@ void ComputeGyrationMolecule::molcom()
int *mask = atom->mask;
int *molecule = atom->molecule;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -254,9 +254,9 @@ void ComputeGyrationMolecule::molcom()
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (rmass) massone = rmass[i];
else massone = mass[type[i]];
imol = molecule[i];

View File

@ -133,7 +133,7 @@ void ComputeMSD::compute_vector()
double **x = atom->x;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double *h = domain->h;
@ -150,9 +150,9 @@ void ComputeMSD::compute_vector()
if (domain->triclinic == 0) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - cm[0] - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - cm[1] - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - cm[2] - xoriginal[i][2];
@ -165,9 +165,9 @@ void ComputeMSD::compute_vector()
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox -
cm[0] - xoriginal[i][0];
dy = x[i][1] + h[1]*ybox + h[3]*zbox - cm[1] - xoriginal[i][1];

View File

@ -125,7 +125,7 @@ void ComputeMSDMolecule::compute_array()
int *mask = atom->mask;
int *molecule = atom->molecule;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -136,9 +136,9 @@ void ComputeMSDMolecule::compute_array()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (rmass) massone = rmass[i];
else massone = mass[type[i]];
imol = molecule[i];

View File

@ -623,7 +623,7 @@ void ComputePropertyAtom::pack_zs_triclinic(int n)
void ComputePropertyAtom::pack_xu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -631,7 +631,7 @@ void ComputePropertyAtom::pack_xu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit)
buf[n] = x[i][0] + ((image[i] & 1023) - 512) * xprd;
buf[n] = x[i][0] + ((image[i] & IMGMASK) - IMGMAX) * xprd;
else buf[n] = 0.0;
n += nvalues;
}
@ -642,7 +642,7 @@ void ComputePropertyAtom::pack_xu(int n)
void ComputePropertyAtom::pack_yu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -650,7 +650,7 @@ void ComputePropertyAtom::pack_yu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit)
buf[n] = x[i][1] + ((image[i] >> 10 & 1023) - 512) * yprd;
buf[n] = x[i][1] + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd;
else buf[n] = 0.0;
n += nvalues;
}
@ -661,7 +661,7 @@ void ComputePropertyAtom::pack_yu(int n)
void ComputePropertyAtom::pack_zu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -669,7 +669,7 @@ void ComputePropertyAtom::pack_zu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit)
buf[n] = x[i][2] + ((image[i] >> 20) - 512) * zprd;
buf[n] = x[i][2] + ((image[i] >> IMG2BITS) - IMGMAX) * zprd;
else buf[n] = 0.0;
n += nvalues;
}
@ -680,7 +680,7 @@ void ComputePropertyAtom::pack_zu(int n)
void ComputePropertyAtom::pack_xu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -689,9 +689,9 @@ void ComputePropertyAtom::pack_xu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
buf[n] = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox;
} else buf[n] = 0.0;
n += nvalues;
@ -703,7 +703,7 @@ void ComputePropertyAtom::pack_xu_triclinic(int n)
void ComputePropertyAtom::pack_yu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -712,8 +712,8 @@ void ComputePropertyAtom::pack_yu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
buf[n] = x[i][1] + h[1]*ybox + h[3]*zbox;
} else buf[n] = 0.0;
n += nvalues;
@ -725,7 +725,7 @@ void ComputePropertyAtom::pack_yu_triclinic(int n)
void ComputePropertyAtom::pack_zu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -734,7 +734,7 @@ void ComputePropertyAtom::pack_zu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
zbox = (image[i] >> 20) - 512;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
buf[n] = x[i][2] + h[2]*zbox;
} else buf[n] = 0.0;
n += nvalues;
@ -745,12 +745,12 @@ void ComputePropertyAtom::pack_zu_triclinic(int n)
void ComputePropertyAtom::pack_ix(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = (image[i] & 1023) - 512;
if (mask[i] & groupbit) buf[n] = (image[i] & IMGMASK) - IMGMAX;
else buf[n] = 0.0;
n += nvalues;
}
@ -760,12 +760,12 @@ void ComputePropertyAtom::pack_ix(int n)
void ComputePropertyAtom::pack_iy(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = (image[i] >> 10 & 1023) - 512;
if (mask[i] & groupbit) buf[n] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
else buf[n] = 0.0;
n += nvalues;
}
@ -775,12 +775,12 @@ void ComputePropertyAtom::pack_iy(int n)
void ComputePropertyAtom::pack_iz(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = (image[i] >> 20) - 512;
if (mask[i] & groupbit) buf[n] = (image[i] >> IMG2BITS) - IMGMAX;
else buf[n] = 0.0;
n += nvalues;
}

View File

@ -270,7 +270,8 @@ void CreateAtoms::add_single()
// remap atom if requested
if (remapflag) {
int imagetmp = (512 << 20) | (512 << 10) | 512;
tagint imagetmp = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMASK << IMGBITS) | IMGMAX;
domain->remap(xone,imagetmp);
}

View File

@ -195,7 +195,7 @@ void DisplaceAtoms::command(int narg, char **arg)
// use irregular() in case atoms moved a long distance
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);

View File

@ -415,13 +415,14 @@ void Domain::reset_box()
void Domain::pbc()
{
int i,idim,otherdims;
int i;
tagint idim,otherdims;
double *lo,*hi,*period;
int nlocal = atom->nlocal;
double **x = atom->x;
double **v = atom->v;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
if (triclinic == 0) {
lo = boxlo;
@ -438,20 +439,20 @@ void Domain::pbc()
if (x[i][0] < lo[0]) {
x[i][0] += period[0];
if (deform_vremap && mask[i] & deform_groupbit) v[i][0] += h_rate[0];
idim = image[i] & 1023;
idim = image[i] & IMGMASK;
otherdims = image[i] ^ idim;
idim--;
idim &= 1023;
idim &= IMGMASK;
image[i] = otherdims | idim;
}
if (x[i][0] >= hi[0]) {
x[i][0] -= period[0];
x[i][0] = MAX(x[i][0],lo[0]);
if (deform_vremap && mask[i] & deform_groupbit) v[i][0] -= h_rate[0];
idim = image[i] & 1023;
idim = image[i] & IMGMASK;
otherdims = image[i] ^ idim;
idim++;
idim &= 1023;
idim &= IMGMASK;
image[i] = otherdims | idim;
}
}
@ -463,11 +464,11 @@ void Domain::pbc()
v[i][0] += h_rate[5];
v[i][1] += h_rate[1];
}
idim = (image[i] >> 10) & 1023;
otherdims = image[i] ^ (idim << 10);
idim = (image[i] >> IMGBITS) & IMGMASK;
otherdims = image[i] ^ (idim << IMGBITS);
idim--;
idim &= 1023;
image[i] = otherdims | (idim << 10);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMGBITS);
}
if (x[i][1] >= hi[1]) {
x[i][1] -= period[1];
@ -476,11 +477,11 @@ void Domain::pbc()
v[i][0] -= h_rate[5];
v[i][1] -= h_rate[1];
}
idim = (image[i] >> 10) & 1023;
otherdims = image[i] ^ (idim << 10);
idim = (image[i] >> IMGBITS) & IMGMASK;
otherdims = image[i] ^ (idim << IMGBITS);
idim++;
idim &= 1023;
image[i] = otherdims | (idim << 10);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMGBITS);
}
}
@ -492,11 +493,11 @@ void Domain::pbc()
v[i][1] += h_rate[3];
v[i][2] += h_rate[2];
}
idim = image[i] >> 20;
otherdims = image[i] ^ (idim << 20);
idim = image[i] >> IMG2BITS;
otherdims = image[i] ^ (idim << IMG2BITS);
idim--;
idim &= 1023;
image[i] = otherdims | (idim << 20);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMG2BITS);
}
if (x[i][2] >= hi[2]) {
x[i][2] -= period[2];
@ -506,11 +507,11 @@ void Domain::pbc()
v[i][1] -= h_rate[3];
v[i][2] -= h_rate[2];
}
idim = image[i] >> 20;
otherdims = image[i] ^ (idim << 20);
idim = image[i] >> IMG2BITS;
otherdims = image[i] ^ (idim << IMG2BITS);
idim++;
idim &= 1023;
image[i] = otherdims | (idim << 20);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMG2BITS);
}
}
}
@ -852,10 +853,11 @@ void Domain::closest_image(const double * const xi, const double * const xj,
increment/decrement in wrap-around fashion
------------------------------------------------------------------------- */
void Domain::remap(double *x, int &image)
void Domain::remap(double *x, tagint &image)
{
double *lo,*hi,*period,*coord;
double lamda[3];
tagint idim,otherdims;
if (triclinic == 0) {
lo = boxlo;
@ -873,18 +875,18 @@ void Domain::remap(double *x, int &image)
if (xperiodic) {
while (coord[0] < lo[0]) {
coord[0] += period[0];
int idim = image & 1023;
int otherdims = image ^ idim;
idim = image & IMGMASK;
otherdims = image ^ idim;
idim--;
idim &= 1023;
idim &= IMGMASK;
image = otherdims | idim;
}
while (coord[0] >= hi[0]) {
coord[0] -= period[0];
int idim = image & 1023;
int otherdims = image ^ idim;
idim = image & IMGMASK;
otherdims = image ^ idim;
idim++;
idim &= 1023;
idim &= IMGMASK;
image = otherdims | idim;
}
coord[0] = MAX(coord[0],lo[0]);
@ -893,19 +895,19 @@ void Domain::remap(double *x, int &image)
if (yperiodic) {
while (coord[1] < lo[1]) {
coord[1] += period[1];
int idim = (image >> 10) & 1023;
int otherdims = image ^ (idim << 10);
idim = (image >> IMGBITS) & IMGMASK;
otherdims = image ^ (idim << IMGBITS);
idim--;
idim &= 1023;
image = otherdims | (idim << 10);
idim &= IMGMASK;
image = otherdims | (idim << IMGBITS);
}
while (coord[1] >= hi[1]) {
coord[1] -= period[1];
int idim = (image >> 10) & 1023;
int otherdims = image ^ (idim << 10);
idim = (image >> IMGBITS) & IMGMASK;
otherdims = image ^ (idim << IMGBITS);
idim++;
idim &= 1023;
image = otherdims | (idim << 10);
idim &= IMGMASK;
image = otherdims | (idim << IMGBITS);
}
coord[1] = MAX(coord[1],lo[1]);
}
@ -913,19 +915,19 @@ void Domain::remap(double *x, int &image)
if (zperiodic) {
while (coord[2] < lo[2]) {
coord[2] += period[2];
int idim = image >> 20;
int otherdims = image ^ (idim << 20);
idim = image >> IMG2BITS;
otherdims = image ^ (idim << IMG2BITS);
idim--;
idim &= 1023;
image = otherdims | (idim << 20);
idim &= IMGMASK;
image = otherdims | (idim << IMG2BITS);
}
while (coord[2] >= hi[2]) {
coord[2] -= period[2];
int idim = image >> 20;
int otherdims = image ^ (idim << 20);
idim = image >> IMG2BITS;
otherdims = image ^ (idim << IMG2BITS);
idim++;
idim &= 1023;
image = otherdims | (idim << 20);
idim &= IMGMASK;
image = otherdims | (idim << IMG2BITS);
}
coord[2] = MAX(coord[2],lo[2]);
}
@ -1063,11 +1065,11 @@ void Domain::remap_near(double *xnew, double *xold)
for triclinic, use h[] to add in tilt factors in other dims as needed
------------------------------------------------------------------------- */
void Domain::unmap(double *x, int image)
void Domain::unmap(double *x, tagint image)
{
int xbox = (image & 1023) - 512;
int ybox = (image >> 10 & 1023) - 512;
int zbox = (image >> 20) - 512;
int xbox = (image & IMGMASK) - IMGMAX;
int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX;
int zbox = (image >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
x[0] += xbox*xprd;
@ -1086,11 +1088,11 @@ void Domain::unmap(double *x, int image)
for triclinic, use h[] to add in tilt factors in other dims as needed
------------------------------------------------------------------------- */
void Domain::unmap(double *x, int image, double *y)
void Domain::unmap(double *x, tagint image, double *y)
{
int xbox = (image & 1023) - 512;
int ybox = (image >> 10 & 1023) - 512;
int zbox = (image >> 20) - 512;
int xbox = (image & IMGMASK) - IMGMAX;
int ybox = (image >> IMGBITS & IMGMASK) - IMGMAX;
int zbox = (image >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
y[0] = x[0] + xbox*xprd;
@ -1124,19 +1126,20 @@ void Domain::unmap(double *x, int image, double *y)
void Domain::image_flip(int m, int n, int p)
{
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
int xbox = (image[i] & 1023) - 512;
int ybox = (image[i] >> 10 & 1023) - 512;
int zbox = (image[i] >> 20) - 512;
int xbox = (image[i] & IMGMASK) - IMGMAX;
int ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int zbox = (image[i] >> IMG2BITS) - IMGMAX;
ybox -= p*zbox;
xbox -= m*ybox + n*zbox;
image[i] = ((zbox + 512 & 1023) << 20) |
((ybox + 512 & 1023) << 10) | (xbox + 512 & 1023);
image[i] = ((zbox + (tagint) IMGMAX & IMGMASK) << IMG2BITS) |
((ybox + (tagint) IMGMAX & IMGMASK) << IMGBITS) |
(xbox + IMGMAX & IMGMASK);
}
}

View File

@ -100,11 +100,11 @@ class Domain : protected Pointers {
int closest_image(int, int);
void closest_image(const double * const, const double * const,
double * const);
void remap(double *, int &);
void remap(double *, tagint &);
void remap(double *);
void remap_near(double *, double *);
void unmap(double *, int);
void unmap(double *, int, double *);
void unmap(double *, tagint);
void unmap(double *, tagint, double *);
void image_flip(int, int, int);
void set_lattice(int, char **);
void add_region(int, char **);

View File

@ -230,7 +230,7 @@ void DumpAtom::pack_scale_image(int *ids)
int *tag = atom->tag;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
double **x = atom->x;
int nlocal = atom->nlocal;
@ -247,9 +247,9 @@ void DumpAtom::pack_scale_image(int *ids)
buf[m++] = (x[i][0] - boxxlo) * invxprd;
buf[m++] = (x[i][1] - boxylo) * invyprd;
buf[m++] = (x[i][2] - boxzlo) * invzprd;
buf[m++] = (image[i] & 1023) - 512;
buf[m++] = (image[i] >> 10 & 1023) - 512;
buf[m++] = (image[i] >> 20) - 512;
buf[m++] = (image[i] & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMG2BITS) - IMGMAX;
if (ids) ids[n++] = tag[i];
}
}
@ -290,7 +290,7 @@ void DumpAtom::pack_scale_image_triclinic(int *ids)
int *tag = atom->tag;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
double **x = atom->x;
int nlocal = atom->nlocal;
@ -306,9 +306,9 @@ void DumpAtom::pack_scale_image_triclinic(int *ids)
buf[m++] = lamda[0];
buf[m++] = lamda[1];
buf[m++] = lamda[2];
buf[m++] = (image[i] & 1023) - 512;
buf[m++] = (image[i] >> 10 & 1023) - 512;
buf[m++] = (image[i] >> 20) - 512;
buf[m++] = (image[i] & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMG2BITS) - IMGMAX;
if (ids) ids[n++] = tag[i];
}
}
@ -348,7 +348,7 @@ void DumpAtom::pack_noscale_image(int *ids)
int *tag = atom->tag;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
double **x = atom->x;
int nlocal = atom->nlocal;
@ -361,9 +361,9 @@ void DumpAtom::pack_noscale_image(int *ids)
buf[m++] = x[i][0];
buf[m++] = x[i][1];
buf[m++] = x[i][2];
buf[m++] = (image[i] & 1023) - 512;
buf[m++] = (image[i] >> 10 & 1023) - 512;
buf[m++] = (image[i] >> 20) - 512;
buf[m++] = (image[i] & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
buf[m++] = (image[i] >> IMG2BITS) - IMGMAX;
if (ids) ids[n++] = tag[i];
}
}

View File

@ -532,61 +532,61 @@ int DumpCustom::count()
} else if (thresh_array[ithresh] == XU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double xprd = domain->xprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = x[i][0] + ((image[i] & 1023) - 512) * xprd;
dchoose[i] = x[i][0] + ((image[i] & IMGMASK) - IMGMAX) * xprd;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == YU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double yprd = domain->yprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = x[i][1] + ((image[i] >> 10 & 1023) - 512) * yprd;
dchoose[i] = x[i][1] + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == ZU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double zprd = domain->zprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = x[i][2] + ((image[i] >> 20) - 512) * zprd;
dchoose[i] = x[i][2] + ((image[i] >> IMG2BITS) - IMGMAX) * zprd;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == XUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int xbox,ybox,zbox;
for (i = 0; i < nlocal; i++) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dchoose[i] = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox;
}
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == YUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int ybox,zbox;
for (i = 0; i < nlocal; i++) {
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dchoose[i] = x[i][1] + h[1]*ybox + h[3]*zbox;
}
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == ZUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int zbox;
for (i = 0; i < nlocal; i++) {
zbox = (image[i] >> 20) - 512;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dchoose[i] = x[i][2] + h[2]*zbox;
}
ptr = dchoose;
@ -594,85 +594,85 @@ int DumpCustom::count()
} else if (thresh_array[ithresh] == XSU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxxlo = domain->boxlo[0];
double invxprd = 1.0/domain->xprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = (x[i][0] - boxxlo) * invxprd + (image[i] & 1023) - 512;
dchoose[i] = (x[i][0] - boxxlo) * invxprd + (image[i] & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == YSU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxylo = domain->boxlo[1];
double invyprd = 1.0/domain->yprd;
for (i = 0; i < nlocal; i++)
dchoose[i] =
(x[i][1] - boxylo) * invyprd + (image[i] >> 10 & 1023) - 512;
(x[i][1] - boxylo) * invyprd + (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == ZSU) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxzlo = domain->boxlo[2];
double invzprd = 1.0/domain->zprd;
for (i = 0; i < nlocal; i++)
dchoose[i] = (x[i][2] - boxzlo) * invzprd + (image[i] >> 20) - 512;
dchoose[i] = (x[i][2] - boxzlo) * invzprd + (image[i] >> IMG2BITS) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == XSUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
for (i = 0; i < nlocal; i++)
dchoose[i] = h_inv[0]*(x[i][0]-boxlo[0]) +
h_inv[5]*(x[i][1]-boxlo[1]) +
h_inv[4]*(x[i][2]-boxlo[2]) +
(image[i] & 1023) - 512;
(image[i] & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == YSUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
for (i = 0; i < nlocal; i++)
dchoose[i] = h_inv[1]*(x[i][1]-boxlo[1]) +
h_inv[3]*(x[i][2]-boxlo[2]) +
(image[i] >> 10 & 1023) - 512;
(image[i] >> IMGBITS & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == ZSUTRI) {
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
for (i = 0; i < nlocal; i++)
dchoose[i] = h_inv[2]*(x[i][2]-boxlo[2]) +
(image[i] >> 20) - 512;
(image[i] >> IMG2BITS) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == IX) {
int *image = atom->image;
tagint *image = atom->image;
for (i = 0; i < nlocal; i++)
dchoose[i] = (image[i] & 1023) - 512;
dchoose[i] = (image[i] & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == IY) {
int *image = atom->image;
tagint *image = atom->image;
for (i = 0; i < nlocal; i++)
dchoose[i] = (image[i] >> 10 & 1023) - 512;
dchoose[i] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == IZ) {
int *image = atom->image;
tagint *image = atom->image;
for (i = 0; i < nlocal; i++)
dchoose[i] = (image[i] >> 20) - 512;
dchoose[i] = (image[i] >> IMG2BITS) - IMGMAX;
ptr = dchoose;
nstride = 1;
@ -1847,13 +1847,13 @@ void DumpCustom::pack_xu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double xprd = domain->xprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = x[j][0] + ((image[j] & 1023) - 512) * xprd;
buf[n] = x[j][0] + ((image[j] & IMGMASK) - IMGMAX) * xprd;
n += size_one;
}
}
@ -1864,13 +1864,13 @@ void DumpCustom::pack_yu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double yprd = domain->yprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = x[j][1] + ((image[j] >> 10 & 1023) - 512) * yprd;
buf[n] = x[j][1] + ((image[j] >> IMGBITS & IMGMASK) - IMGMAX) * yprd;
n += size_one;
}
}
@ -1881,13 +1881,13 @@ void DumpCustom::pack_zu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double zprd = domain->zprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = x[j][2] + ((image[j] >> 20) - 512) * zprd;
buf[n] = x[j][2] + ((image[j] >> IMG2BITS) - IMGMAX) * zprd;
n += size_one;
}
}
@ -1898,16 +1898,16 @@ void DumpCustom::pack_xu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int xbox,ybox,zbox;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
xbox = (image[j] & 1023) - 512;
ybox = (image[j] >> 10 & 1023) - 512;
zbox = (image[j] >> 20) - 512;
xbox = (image[j] & IMGMASK) - IMGMAX;
ybox = (image[j] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[j] >> IMG2BITS) - IMGMAX;
buf[n] = x[j][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox;
n += size_one;
}
@ -1919,15 +1919,15 @@ void DumpCustom::pack_yu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int ybox,zbox;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
ybox = (image[j] >> 10 & 1023) - 512;
zbox = (image[j] >> 20) - 512;
ybox = (image[j] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[j] >> IMG2BITS) - IMGMAX;
buf[n] = x[j][1] + h[1]*ybox + h[3]*zbox;
n += size_one;
}
@ -1939,14 +1939,14 @@ void DumpCustom::pack_zu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *h = domain->h;
int zbox;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
zbox = (image[j] >> 20) - 512;
zbox = (image[j] >> IMG2BITS) - IMGMAX;
buf[n] = x[j][2] + h[2]*zbox;
n += size_one;
}
@ -1958,14 +1958,14 @@ void DumpCustom::pack_xsu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxxlo = domain->boxlo[0];
double invxprd = 1.0/domain->xprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = (x[j][0] - boxxlo) * invxprd + (image[j] & 1023) - 512;
buf[n] = (x[j][0] - boxxlo) * invxprd + (image[j] & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -1976,14 +1976,14 @@ void DumpCustom::pack_ysu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxylo = domain->boxlo[1];
double invyprd = 1.0/domain->yprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = (x[j][1] - boxylo) * invyprd + (image[j] >> 10 & 1023) - 512;
buf[n] = (x[j][1] - boxylo) * invyprd + (image[j] >> IMGBITS & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -1994,14 +1994,14 @@ void DumpCustom::pack_zsu(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double boxzlo = domain->boxlo[2];
double invzprd = 1.0/domain->zprd;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = (x[j][2] - boxzlo) * invzprd + (image[j] >> 20) - 512;
buf[n] = (x[j][2] - boxzlo) * invzprd + (image[j] >> IMG2BITS) - IMGMAX;
n += size_one;
}
}
@ -2012,7 +2012,7 @@ void DumpCustom::pack_xsu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
@ -2020,7 +2020,7 @@ void DumpCustom::pack_xsu_triclinic(int n)
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = h_inv[0]*(x[j][0]-boxlo[0]) + h_inv[5]*(x[j][1]-boxlo[1]) +
h_inv[4]*(x[j][2]-boxlo[2]) + (image[j] & 1023) - 512;
h_inv[4]*(x[j][2]-boxlo[2]) + (image[j] & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -2031,7 +2031,7 @@ void DumpCustom::pack_ysu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
@ -2039,7 +2039,7 @@ void DumpCustom::pack_ysu_triclinic(int n)
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = h_inv[1]*(x[j][1]-boxlo[1]) + h_inv[3]*(x[j][2]-boxlo[2]) +
(image[j] >> 10 & 1023) - 512;
(image[j] >> IMGBITS & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -2050,14 +2050,14 @@ void DumpCustom::pack_zsu_triclinic(int n)
{
int j;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
double *boxlo = domain->boxlo;
double *h_inv = domain->h_inv;
for (int i = 0; i < nchoose; i++) {
j = clist[i];
buf[n] = h_inv[2]*(x[j][2]-boxlo[2]) + (image[j] >> 20) - 512;
buf[n] = h_inv[2]*(x[j][2]-boxlo[2]) + (image[j] >> IMG2BITS) - IMGMAX;
n += size_one;
}
}
@ -2066,10 +2066,10 @@ void DumpCustom::pack_zsu_triclinic(int n)
void DumpCustom::pack_ix(int n)
{
int *image = atom->image;
tagint *image = atom->image;
for (int i = 0; i < nchoose; i++) {
buf[n] = (image[clist[i]] & 1023) - 512;
buf[n] = (image[clist[i]] & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -2078,10 +2078,10 @@ void DumpCustom::pack_ix(int n)
void DumpCustom::pack_iy(int n)
{
int *image = atom->image;
tagint *image = atom->image;
for (int i = 0; i < nchoose; i++) {
buf[n] = (image[clist[i]] >> 10 & 1023) - 512;
buf[n] = (image[clist[i]] >> IMGBITS & IMGMASK) - IMGMAX;
n += size_one;
}
}
@ -2090,10 +2090,10 @@ void DumpCustom::pack_iy(int n)
void DumpCustom::pack_iz(int n)
{
int *image = atom->image;
tagint *image = atom->image;
for (int i = 0; i < nchoose; i++) {
buf[n] = (image[clist[i]] >> 20) - 512;
buf[n] = (image[clist[i]] >> IMG2BITS) - IMGMAX;
n += size_one;
}
}

View File

@ -180,7 +180,7 @@ void DumpDCD::pack(int *ids)
int *tag = atom->tag;
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -195,9 +195,9 @@ void DumpDCD::pack(int *ids)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
int ix = (image[i] & 1023) - 512;
int iy = (image[i] >> 10 & 1023) - 512;
int iz = (image[i] >> 20) - 512;
int ix = (image[i] & IMGMASK) - IMGMAX;
int iy = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int iz = (image[i] >> IMG2BITS) - IMGMAX;
if (domain->triclinic) {
buf[m++] = x[i][0] + ix * xprd + iy * xy + iz * xz;

View File

@ -226,7 +226,7 @@ void FixAddForce::post_force(int vflag)
double **x = atom->x;
double **f = atom->f;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
// reallocate sforce array if necessary
@ -253,9 +253,9 @@ void FixAddForce::post_force(int vflag)
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
continue;
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
foriginal[0] -= xvalue * (x[i][0]+xbox*xprd) +
yvalue * (x[i][1]+ybox*yprd) + zvalue * (x[i][2]+zbox*zprd);

View File

@ -656,7 +656,7 @@ void FixDeform::pre_exchange()
domain->image_flip(flipxy,flipxz,flipyz);
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);

View File

@ -118,7 +118,7 @@ void FixMomentum::end_of_step()
double **x = atom->x;
double **v = atom->v;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int xbox,ybox,zbox;
@ -129,9 +129,9 @@ void FixMomentum::end_of_step()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];

View File

@ -251,7 +251,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) :
// xoriginal = initial unwrapped positions of atoms
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -870,7 +870,7 @@ void FixMove::copy_arrays(int i, int j)
void FixMove::set_arrays(int i)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
// particle not in group

View File

@ -2246,7 +2246,7 @@ void FixNH::pre_exchange()
domain->image_flip(flipxy,flipxz,flipyz);
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);

View File

@ -90,14 +90,14 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
// read xi and chi reference orientations from files
if (me == 0) {
char line[512];
char line[IMGMAX];
char *result;
int count;
FILE *infile = fopen(xifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
for (int i = 0; i < 6; i++) {
result = fgets(line,512,infile);
result = fgets(line,IMGMAX,infile);
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rxi[i][0],&Rxi[i][1],&Rxi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");
@ -107,7 +107,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) :
infile = fopen(chifilename,"r");
if (infile == NULL) error->one(FLERR,"Fix orient/fcc file open failed");
for (int i = 0; i < 6; i++) {
result = fgets(line,512,infile);
result = fgets(line,IMGMAX,infile);
if (!result) error->one(FLERR,"Fix orient/fcc file read failed");
count = sscanf(line,"%lg %lg %lg",&Rchi[i][0],&Rchi[i][1],&Rchi[i][2]);
if (count != 3) error->one(FLERR,"Fix orient/fcc file read failed");

View File

@ -601,7 +601,7 @@ void FixRigid::setup(int vflag)
// angmom = angular momentum of each rigid body
// torque = torque on each rigid body
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double xprd = domain->xprd;
@ -620,9 +620,9 @@ void FixRigid::setup(int vflag)
if (body[i] < 0) continue;
ibody = body[i];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;
@ -833,7 +833,7 @@ void FixRigid::final_integrate()
// sum over atoms to get force and torque on rigid body
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
@ -860,9 +860,9 @@ void FixRigid::final_integrate()
sum[ibody][1] += f[i][1];
sum[ibody][2] += f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;
@ -1021,7 +1021,7 @@ void FixRigid::final_integrate_respa(int ilevel, int iloop)
void FixRigid::pre_neighbor()
{
int original,oldimage,newimage;
tagint original,oldimage,newimage;
for (int ibody = 0; ibody < nbody; ibody++) {
original = imagebody[ibody];
@ -1029,14 +1029,14 @@ void FixRigid::pre_neighbor()
if (original == imagebody[ibody]) remapflag[ibody][3] = 0;
else {
oldimage = original & 1023;
newimage = imagebody[ibody] & 1023;
oldimage = original & IMGMASK;
newimage = imagebody[ibody] & IMGMASK;
remapflag[ibody][0] = newimage - oldimage;
oldimage = (original >> 10) & 1023;
newimage = (imagebody[ibody] >> 10) & 1023;
oldimage = (original >> IMGBITS) & IMGMASK;
newimage = (imagebody[ibody] >> IMGBITS) & IMGMASK;
remapflag[ibody][1] = newimage - oldimage;
oldimage = original >> 20;
newimage = imagebody[ibody] >> 20;
oldimage = original >> IMG2BITS;
newimage = imagebody[ibody] >> IMG2BITS;
remapflag[ibody][2] = newimage - oldimage;
remapflag[ibody][3] = 1;
}
@ -1044,10 +1044,11 @@ void FixRigid::pre_neighbor()
// adjust image flags of any atom in a rigid body whose xcm was remapped
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int ibody,idim,otherdims;
int ibody;
tagint idim,otherdims;
for (int i = 0; i < nlocal; i++) {
if (body[i] == -1) continue;
@ -1055,25 +1056,25 @@ void FixRigid::pre_neighbor()
ibody = body[i];
if (remapflag[ibody][0]) {
idim = image[i] & 1023;
idim = image[i] & IMGMASK;
otherdims = image[i] ^ idim;
idim -= remapflag[ibody][0];
idim &= 1023;
idim &= IMGMASK;
image[i] = otherdims | idim;
}
if (remapflag[ibody][1]) {
idim = (image[i] >> 10) & 1023;
otherdims = image[i] ^ (idim << 10);
idim = (image[i] >> IMGBITS) & IMGMASK;
otherdims = image[i] ^ (idim << IMGBITS);
idim -= remapflag[ibody][1];
idim &= 1023;
image[i] = otherdims | (idim << 10);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMGBITS);
}
if (remapflag[ibody][2]) {
idim = image[i] >> 20;
otherdims = image[i] ^ (idim << 20);
idim = image[i] >> IMG2BITS;
otherdims = image[i] ^ (idim << IMG2BITS);
idim -= remapflag[ibody][2];
idim &= 1023;
image[i] = otherdims | (idim << 20);
idim &= IMGMASK;
image[i] = otherdims | (idim << IMG2BITS);
}
}
}
@ -1183,7 +1184,7 @@ void FixRigid::set_xv()
double xy,xz,yz;
double ione[3],exone[3],eyone[3],ezone[3],vr[6],p[3][3];
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -1208,9 +1209,9 @@ void FixRigid::set_xv()
if (body[i] < 0) continue;
ibody = body[i];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
// save old positions and velocities for virial
@ -1367,7 +1368,7 @@ void FixRigid::set_v()
double *rmass = atom->rmass;
double *mass = atom->mass;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double xprd = domain->xprd;
@ -1416,9 +1417,9 @@ void FixRigid::set_v()
fc1 = massone*(v[i][1] - v1)/dtf - f[i][1];
fc2 = massone*(v[i][2] - v2)/dtf - f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
x0 = x[i][0] + xbox*xprd;
@ -1581,7 +1582,7 @@ void FixRigid::setup_bodies()
// error if image flag is not 0 in a non-periodic dim
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *periodicity = domain->periodicity;
double xprd = domain->xprd;
@ -1600,9 +1601,9 @@ void FixRigid::setup_bodies()
if (body[i] < 0) continue;
ibody = body[i];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (rmass) massone = rmass[i];
else massone = mass[type[i]];
@ -1650,7 +1651,8 @@ void FixRigid::setup_bodies()
// then remap the xcm of each body back into simulation box if needed
for (ibody = 0; ibody < nbody; ibody++)
imagebody[ibody] = (512 << 20) | (512 << 10) | 512;
imagebody[ibody] = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMASK << IMGBITS) | IMGMAX;
pre_neighbor();
@ -1667,9 +1669,9 @@ void FixRigid::setup_bodies()
if (body[i] < 0) continue;
ibody = body[i];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;
@ -1822,9 +1824,9 @@ void FixRigid::setup_bodies()
ibody = body[i];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;
@ -2287,7 +2289,7 @@ double FixRigid::compute_array(int i, int j)
if (j < 6) return vcm[i][j-3];
if (j < 9) return fcm[i][j-6];
if (j < 12) return torque[i][j-9];
if (j == 12) return (imagebody[i] & 1023) - 512;
if (j == 13) return (imagebody[i] >> 10 & 1023) - 512;
return (imagebody[i] >> 20) - 512;
if (j == 12) return (imagebody[i] & IMGMASK) - IMGMAX;
if (j == 13) return (imagebody[i] >> IMGBITS & IMGMASK) - IMGMAX;
return (imagebody[i] >> IMG2BITS) - IMGMAX;
}

View File

@ -82,7 +82,7 @@ class FixRigid : public Fix {
double **omega; // angular velocity of each in space coords
double **torque; // torque on each rigid body in space coords
double **quat; // quaternion of each rigid body
int *imagebody; // image flags of xcm of each rigid body
tagint *imagebody; // image flags of xcm of each rigid body
double **fflag; // flag for on/off of center-of-mass force
double **tflag; // flag for on/off of center-of-mass torque
double **langextra; // Langevin thermostat forces and torques

View File

@ -155,7 +155,7 @@ void FixRigidNVE::final_integrate()
// sum over atoms to get force and torque on rigid body
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
@ -182,9 +182,9 @@ void FixRigidNVE::final_integrate()
sum[ibody][1] += f[i][1];
sum[ibody][2] += f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;

View File

@ -300,7 +300,7 @@ void FixRigidNVT::final_integrate()
// sum over atoms to get force and torque on rigid body
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double **f = atom->f;
int nlocal = atom->nlocal;
@ -327,9 +327,9 @@ void FixRigidNVT::final_integrate()
sum[ibody][1] += f[i][1];
sum[ibody][2] += f[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
if (triclinic == 0) {
xunwrap = x[i][0] + xbox*xprd;

View File

@ -105,7 +105,7 @@ void FixSpringRG::post_force(int vflag)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
int nlocal = atom->nlocal;
@ -118,9 +118,9 @@ void FixSpringRG::post_force(int vflag)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
term1 = 2.0 * k * (1.0 - rg0/rg);
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];

View File

@ -75,7 +75,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) :
double **x = atom->x;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double xprd = domain->xprd;
@ -85,9 +85,9 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) :
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
xoriginal[i][0] = x[i][0] + xbox*xprd;
xoriginal[i][1] = x[i][1] + ybox*yprd;
xoriginal[i][2] = x[i][2] + zbox*zprd;
@ -158,7 +158,7 @@ void FixSpringSelf::post_force(int vflag)
double **x = atom->x;
double **f = atom->f;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
double xprd = domain->xprd;
@ -170,9 +170,9 @@ void FixSpringSelf::post_force(int vflag)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xoriginal[i][0];
dy = x[i][1] + ybox*yprd - xoriginal[i][1];
dz = x[i][2] + zbox*zprd - xoriginal[i][2];

View File

@ -789,7 +789,7 @@ void FixStoreState::pack_zs_triclinic(int n)
void FixStoreState::pack_xu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -797,7 +797,7 @@ void FixStoreState::pack_xu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
vbuf[n] = x[i][0] + ((image[i] & 1023) - 512) * xprd;
vbuf[n] = x[i][0] + ((image[i] & IMGMASK) - IMGMAX) * xprd;
if (comflag) vbuf[n] -= cm[0];
} else vbuf[n] = 0.0;
n += nvalues;
@ -809,7 +809,7 @@ void FixStoreState::pack_xu(int n)
void FixStoreState::pack_yu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -817,7 +817,7 @@ void FixStoreState::pack_yu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
vbuf[n] = x[i][1] + ((image[i] >> 10 & 1023) - 512) * yprd;
vbuf[n] = x[i][1] + ((image[i] >> IMGBITS & IMGMASK) - IMGMAX) * yprd;
if (comflag) vbuf[n] -= cm[1];
} else vbuf[n] = 0.0;
n += nvalues;
@ -829,7 +829,7 @@ void FixStoreState::pack_yu(int n)
void FixStoreState::pack_zu(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -837,7 +837,7 @@ void FixStoreState::pack_zu(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
vbuf[n] = x[i][2] + ((image[i] >> 20) - 512) * zprd;
vbuf[n] = x[i][2] + ((image[i] >> IMG2BITS) - IMGMAX) * zprd;
if (comflag) vbuf[n] -= cm[2];
} else vbuf[n] = 0.0;
n += nvalues;
@ -849,7 +849,7 @@ void FixStoreState::pack_zu(int n)
void FixStoreState::pack_xu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -858,9 +858,9 @@ void FixStoreState::pack_xu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
vbuf[n] = x[i][0] + h[0]*xbox + h[5]*ybox + h[4]*zbox;
if (comflag) vbuf[n] -= cm[0];
} else vbuf[n] = 0.0;
@ -873,7 +873,7 @@ void FixStoreState::pack_xu_triclinic(int n)
void FixStoreState::pack_yu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -882,8 +882,8 @@ void FixStoreState::pack_yu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
vbuf[n] = x[i][1] + h[1]*ybox + h[3]*zbox;
if (comflag) vbuf[n] -= cm[1];
} else vbuf[n] = 0.0;
@ -896,7 +896,7 @@ void FixStoreState::pack_yu_triclinic(int n)
void FixStoreState::pack_zu_triclinic(int n)
{
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -905,7 +905,7 @@ void FixStoreState::pack_zu_triclinic(int n)
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
zbox = (image[i] >> 20) - 512;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
vbuf[n] = x[i][2] + h[2]*zbox;
if (comflag) vbuf[n] -= cm[2];
} else vbuf[n] = 0.0;
@ -917,12 +917,12 @@ void FixStoreState::pack_zu_triclinic(int n)
void FixStoreState::pack_ix(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) vbuf[n] = (image[i] & 1023) - 512;
if (mask[i] & groupbit) vbuf[n] = (image[i] & IMGMASK) - IMGMAX;
else vbuf[n] = 0.0;
n += nvalues;
}
@ -932,12 +932,12 @@ void FixStoreState::pack_ix(int n)
void FixStoreState::pack_iy(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) vbuf[n] = (image[i] >> 10 & 1023) - 512;
if (mask[i] & groupbit) vbuf[n] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
else vbuf[n] = 0.0;
n += nvalues;
}
@ -947,12 +947,12 @@ void FixStoreState::pack_iy(int n)
void FixStoreState::pack_iz(int n)
{
int *image = atom->image;
tagint *image = atom->image;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) vbuf[n] = (image[i] >> 20) - 512;
if (mask[i] & groupbit) vbuf[n] = (image[i] >> IMG2BITS) - IMGMAX;
else vbuf[n] = 0.0;
n += nvalues;
}

View File

@ -93,7 +93,7 @@ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) :
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double **x = atom->x;
double *mass = atom->mass;
int nlocal = atom->nlocal;
@ -108,9 +108,9 @@ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) :
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xf[i][0];
dy = x[i][1] + ybox*yprd - xf[i][1];
dz = x[i][2] + zbox*zprd - xf[i][2];
@ -198,7 +198,7 @@ void FixTMD::initial_integrate(int vflag)
double **v = atom->v;
double **f = atom->f;
double *mass = atom->mass;
int *image = atom->image;
tagint *image = atom->image;
int *type = atom->type;
int *mask = atom->mask;
int nlocal = atom->nlocal;
@ -216,9 +216,9 @@ void FixTMD::initial_integrate(int vflag)
dxold = xold[i][0] - xf[i][0];
dyold = xold[i][1] - xf[i][1];
dzold = xold[i][2] - xf[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = x[i][0] + xbox*xprd - xf[i][0];
dy = x[i][1] + ybox*yprd - xf[i][1];
dz = x[i][2] + zbox*zprd - xf[i][2];
@ -258,9 +258,9 @@ void FixTMD::initial_integrate(int vflag)
dxold = xold[i][0] - xf[i][0];
dyold = xold[i][1] - xf[i][1];
dzold = xold[i][2] - xf[i][2];
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
xback = x[i][0] + xbox*xprd + gamma_back*dxold;
yback = x[i][1] + ybox*yprd + gamma_back*dyold;
zback = x[i][2] + zbox*zprd + gamma_back*dzold;
@ -314,9 +314,9 @@ void FixTMD::initial_integrate(int vflag)
x[i][2] += gamma_forward*dzold;
v[i][2] += gamma_forward*dzold/dtv;
f[i][2] += gamma_forward*dzold/dtv/dtfm;
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
xold[i][0] = x[i][0] + xbox*xprd;
xold[i][1] = x[i][1] + ybox*yprd;
xold[i][2] = x[i][2] + zbox*zprd;

View File

@ -733,7 +733,7 @@ void Group::xcm(int igroup, double masstotal, double *cm)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -750,9 +750,9 @@ void Group::xcm(int igroup, double masstotal, double *cm)
if (rmass) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
massone = rmass[i];
cmone[0] += (x[i][0] + xbox*xprd) * massone;
cmone[1] += (x[i][1] + ybox*yprd) * massone;
@ -761,9 +761,9 @@ void Group::xcm(int igroup, double masstotal, double *cm)
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
massone = mass[type[i]];
cmone[0] += (x[i][0] + xbox*xprd) * massone;
cmone[1] += (x[i][1] + ybox*yprd) * massone;
@ -794,7 +794,7 @@ void Group::xcm(int igroup, double masstotal, double *cm, int iregion)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -811,9 +811,9 @@ void Group::xcm(int igroup, double masstotal, double *cm, int iregion)
if (rmass) {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
massone = rmass[i];
cmone[0] += (x[i][0] + xbox*xprd) * massone;
cmone[1] += (x[i][1] + ybox*yprd) * massone;
@ -822,9 +822,9 @@ void Group::xcm(int igroup, double masstotal, double *cm, int iregion)
} else {
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
massone = mass[type[i]];
cmone[0] += (x[i][0] + xbox*xprd) * massone;
cmone[1] += (x[i][1] + ybox*yprd) * massone;
@ -1071,7 +1071,7 @@ double Group::gyration(int igroup, double masstotal, double *cm)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1085,9 +1085,9 @@ double Group::gyration(int igroup, double masstotal, double *cm)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1116,7 +1116,7 @@ double Group::gyration(int igroup, double masstotal, double *cm, int iregion)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1130,9 +1130,9 @@ double Group::gyration(int igroup, double masstotal, double *cm, int iregion)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1161,7 +1161,7 @@ void Group::angmom(int igroup, double *cm, double *lmom)
double **v = atom->v;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1176,9 +1176,9 @@ void Group::angmom(int igroup, double *cm, double *lmom)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1207,7 +1207,7 @@ void Group::angmom(int igroup, double *cm, double *lmom, int iregion)
double **v = atom->v;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1222,9 +1222,9 @@ void Group::angmom(int igroup, double *cm, double *lmom, int iregion)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1251,7 +1251,7 @@ void Group::torque(int igroup, double *cm, double *tq)
double **x = atom->x;
double **f = atom->f;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int xbox,ybox,zbox;
@ -1264,9 +1264,9 @@ void Group::torque(int igroup, double *cm, double *tq)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1292,7 +1292,7 @@ void Group::torque(int igroup, double *cm, double *tq, int iregion)
double **x = atom->x;
double **f = atom->f;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int xbox,ybox,zbox;
@ -1305,9 +1305,9 @@ void Group::torque(int igroup, double *cm, double *tq, int iregion)
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1333,7 +1333,7 @@ void Group::inertia(int igroup, double *cm, double itensor[3][3])
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1350,9 +1350,9 @@ void Group::inertia(int igroup, double *cm, double itensor[3][3])
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];
@ -1387,7 +1387,7 @@ void Group::inertia(int igroup, double *cm, double itensor[3][3], int iregion)
double **x = atom->x;
int *mask = atom->mask;
int *type = atom->type;
int *image = atom->image;
tagint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
@ -1404,9 +1404,9 @@ void Group::inertia(int igroup, double *cm, double itensor[3][3], int iregion)
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMAX;
dx = (x[i][0] + xbox*xprd) - cm[0];
dy = (x[i][1] + ybox*yprd) - cm[1];
dz = (x[i][2] + zbox*zprd) - cm[2];

View File

@ -1,11 +1,11 @@
/* ----------------------------------------------------------------------
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
@ -91,9 +91,15 @@ typedef int64_t bigint;
#define ATOTAGINT atoi
#define ATOBIGINT ATOLL
#define IMGMASK 1023
#define IMGMAX 512
#define IMGBITS 10
#define IMG2BITS 20
#endif
// for molecular problems that exceed 2 billion (2^31) atoms
// or problems where atoms wrap around the periodic box more than 512 times
// 32-bit smallint, 64-bit tagint and bigint
#ifdef LAMMPS_BIGBIG
@ -115,6 +121,11 @@ typedef int64_t bigint;
#define ATOTAGINT ATOLL
#define ATOBIGINT ATOLL
#define IMGMASK 2097151
#define IMGMAX 1048576
#define IMGBITS 21
#define IMG2BITS 42
#endif
// for machines that do not support 64-bit ints
@ -139,6 +150,11 @@ typedef int bigint;
#define ATOTAGINT atoi
#define ATOBIGINT atoi
#define IMGMASK 1023
#define IMGMAX 512
#define IMGBITS 10
#define IMG2BITS 20
#endif
}

View File

@ -506,7 +506,7 @@ void ReadDump::atoms()
// use irregular() in case atoms moved a long distance
double **x = atom->x;
int *image = atom->image;
tagint *image = atom->image;
nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);
@ -666,7 +666,7 @@ void ReadDump::process_atoms(int n)
double **x = atom->x;
double **v = atom->v;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
for (i = 0; i < n; i++) {
@ -687,9 +687,9 @@ void ReadDump::process_atoms(int n)
// current image flags
xbox = (image[m] & 1023) - 512;
ybox = (image[m] >> 10 & 1023) - 512;
zbox = (image[m] >> 20) - 512;
xbox = (image[m] & IMGMASK) - IMGMAX;
ybox = (image[m] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[m] >> IMG2BITS) - IMGMAX;
// overwrite atom attributes with field info
// start from field 1 since 0 = id, 1 will be skipped if type
@ -728,7 +728,8 @@ void ReadDump::process_atoms(int n)
// replace image flag in case changed by ix,iy,iz fields
image[m] = (xbox << 20) | (ybox << 10) | zbox;
image[m] = ((tagint) xbox << IMG2BITS) |
((tagint) ybox << IMGBITS) | zbox;
}
}
@ -784,9 +785,9 @@ void ReadDump::process_atoms(int n)
m = atom->nlocal;
// set atom attributes from other dump file fields
// xyzbox = 512 is default value set by create_atom()
// xyzbox = IMGMAX is default value set by create_atom()
xbox = ybox = zbox = 512;
xbox = ybox = zbox = IMGMAX;
for (ifield = 1; ifield < nfield; ifield++) {
switch (fieldtype[ifield]) {
@ -812,7 +813,8 @@ void ReadDump::process_atoms(int n)
// replace image flag in case changed by ix,iy,iz fields
image[m] = (xbox << 20) | (ybox << 10) | zbox;
image[m] = ((tagint) xbox << IMG2BITS) |
((tagint) ybox << IMGBITS) | zbox;
}
}

View File

@ -255,7 +255,8 @@ void Replicate::command(int narg, char **arg)
AtomVec *old_avec = old->avec;
AtomVec *avec = atom->avec;
int ix,iy,iz,image,atom_offset,mol_offset;
int ix,iy,iz,atom_offset,mol_offset;
tagint image;
double x[3],lamda[3];
double *coord;
int tag_enable = atom->tag_enable;
@ -276,7 +277,8 @@ void Replicate::command(int narg, char **arg)
m = 0;
while (m < n) {
image = (512 << 20) | (512 << 10) | 512;
image = ((tagint) IMGMAX << IMG2BITS) |
((tagint) IMGMASK << IMGBITS) | IMGMAX;
if (triclinic == 0) {
x[0] = buf[m+1] + ix*old_xprd;
x[1] = buf[m+2] + iy*old_yprd;

View File

@ -490,14 +490,15 @@ void Set::set(int keyword)
// reset any or all of 3 image flags
} else if (keyword == IMAGE) {
int xbox = (atom->image[i] & 1023) - 512;
int ybox = (atom->image[i] >> 10 & 1023) - 512;
int zbox = (atom->image[i] >> 20) - 512;
int xbox = (atom->image[i] & IMGMASK) - IMGMAX;
int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX;
int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX;
if (ximageflag) xbox = ximage;
if (yimageflag) ybox = yimage;
if (zimageflag) zbox = zimage;
atom->image[i] = ((zbox + 512 & 1023) << 20) |
((ybox + 512 & 1023) << 10) | (xbox + 512 & 1023);
atom->image[i] = ((zbox + (tagint) IMGMAX & IMGMASK) << IMG2BITS) |
((ybox + (tagint) IMGMAX & IMGMASK) << IMGBITS) |
(xbox + IMGMAX & IMGMASK);
// set dipole moment

View File

@ -715,7 +715,7 @@ void Velocity::zero_rotation()
double **x = atom->x;
double **v = atom->v;
int *mask = atom->mask;
int *image = atom->image;
tagint *image = atom->image;
int nlocal = atom->nlocal;
int xbox,ybox,zbox;
@ -726,9 +726,9 @@ void Velocity::zero_rotation()
for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
xbox = (image[i] & 1023) - 512;
ybox = (image[i] >> 10 & 1023) - 512;
zbox = (image[i] >> 20) - 512;
xbox = (image[i] & IMGMASK) - IMGMAX;
ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
zbox = (image[i] >> IMG2BITS) - IMGMASK;
dx = (x[i][0] + xbox*xprd) - xcm[0];
dy = (x[i][1] + ybox*yprd) - xcm[1];
dz = (x[i][2] + zbox*zprd) - xcm[2];