git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12955 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -32,10 +32,16 @@ using namespace LAMMPS_NS;
|
|||||||
#define DELTA 4
|
#define DELTA 4
|
||||||
#define BIG MAXTAGINT
|
#define BIG MAXTAGINT
|
||||||
|
|
||||||
|
// allocate space for static class instance variable and initialize it
|
||||||
|
|
||||||
|
int Compute::instance_total = 0;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
|
instance_me = instance_total++;
|
||||||
|
|
||||||
if (narg < 3) error->all(FLERR,"Illegal compute command");
|
if (narg < 3) error->all(FLERR,"Illegal compute command");
|
||||||
|
|
||||||
// compute ID, group, and style
|
// compute ID, group, and style
|
||||||
|
|||||||
@ -20,6 +20,8 @@ namespace LAMMPS_NS {
|
|||||||
|
|
||||||
class Compute : protected Pointers {
|
class Compute : protected Pointers {
|
||||||
public:
|
public:
|
||||||
|
static int instance_total; // # of Compute classes ever instantiated
|
||||||
|
|
||||||
char *id,*style;
|
char *id,*style;
|
||||||
int igroup,groupbit;
|
int igroup,groupbit;
|
||||||
|
|
||||||
@ -122,6 +124,8 @@ class Compute : protected Pointers {
|
|||||||
virtual int unsigned data_mask_ext() {return datamask_ext;}
|
virtual int unsigned data_mask_ext() {return datamask_ext;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int instance_me; // which Compute class instantiation I am
|
||||||
|
|
||||||
int extra_dof; // extra DOF for temperature computes
|
int extra_dof; // extra DOF for temperature computes
|
||||||
int fix_dof; // DOF due to fixes
|
int fix_dof; // DOF due to fixes
|
||||||
int dynamic; // recount atoms for temperature computes
|
int dynamic; // recount atoms for temperature computes
|
||||||
|
|||||||
@ -23,10 +23,16 @@
|
|||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|
||||||
|
// allocate space for static class instance variable and initialize it
|
||||||
|
|
||||||
|
int Fix::instance_total = 0;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
|
instance_me = instance_total++;
|
||||||
|
|
||||||
// fix ID, group, and style
|
// fix ID, group, and style
|
||||||
// ID must be all alphanumeric chars or underscores
|
// ID must be all alphanumeric chars or underscores
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,8 @@ namespace LAMMPS_NS {
|
|||||||
|
|
||||||
class Fix : protected Pointers {
|
class Fix : protected Pointers {
|
||||||
public:
|
public:
|
||||||
|
static int instance_total; // # of Fix classes ever instantiated
|
||||||
|
|
||||||
char *id,*style;
|
char *id,*style;
|
||||||
int igroup,groupbit;
|
int igroup,groupbit;
|
||||||
|
|
||||||
@ -199,6 +201,8 @@ class Fix : protected Pointers {
|
|||||||
virtual unsigned int data_mask_ext() {return datamask_ext;}
|
virtual unsigned int data_mask_ext() {return datamask_ext;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int instance_me; // which Fix class instantiation I am
|
||||||
|
|
||||||
int evflag;
|
int evflag;
|
||||||
int vflag_global,vflag_atom;
|
int vflag_global,vflag_atom;
|
||||||
int maxvatom;
|
int maxvatom;
|
||||||
|
|||||||
@ -224,6 +224,8 @@ void NeighList::print_attributes()
|
|||||||
NeighRequest *rq = neighbor->requests[index];
|
NeighRequest *rq = neighbor->requests[index];
|
||||||
|
|
||||||
printf("Neighbor list/request %d:\n",index);
|
printf("Neighbor list/request %d:\n",index);
|
||||||
|
printf(" %p = requestor ptr (instance %d id %d)\n",
|
||||||
|
rq->requestor,rq->requestor_instance,rq->id);
|
||||||
printf(" %d = build flag\n",buildflag);
|
printf(" %d = build flag\n",buildflag);
|
||||||
printf(" %d = grow flag\n",growflag);
|
printf(" %d = grow flag\n",growflag);
|
||||||
printf(" %d = stencil flag\n",stencilflag);
|
printf(" %d = stencil flag\n",stencilflag);
|
||||||
|
|||||||
@ -90,7 +90,7 @@ void NeighRequest::archive()
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
compare this request to other request
|
compare this request to other request
|
||||||
identical means all params set by requester are the same
|
identical means all params set by requestor are the same
|
||||||
compare to original values in other if Neighbor may have changed them
|
compare to original values in other if Neighbor may have changed them
|
||||||
return 1 if identical, 0 if not
|
return 1 if identical, 0 if not
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -100,10 +100,15 @@ int NeighRequest::identical(NeighRequest *other)
|
|||||||
int same = 1;
|
int same = 1;
|
||||||
|
|
||||||
// set same = 0 if old list was never processed
|
// set same = 0 if old list was never processed
|
||||||
|
// use of requestor_instance and instance counter
|
||||||
|
// prevents an old fix from being unfix/refix in same memory location
|
||||||
|
// and appearing to be old, when it is really new
|
||||||
|
// only needed for classes with persistent neigh lists: Fix, Compute, Pair
|
||||||
|
|
||||||
if (other->unprocessed) same = 0;
|
if (other->unprocessed) same = 0;
|
||||||
|
|
||||||
if (requestor != other->requestor) same = 0;
|
if (requestor != other->requestor) same = 0;
|
||||||
|
if (requestor_instance != other->requestor_instance) same = 0;
|
||||||
if (id != other->id) same = 0;
|
if (id != other->id) same = 0;
|
||||||
|
|
||||||
if (pair != other->pair) same = 0;
|
if (pair != other->pair) same = 0;
|
||||||
|
|||||||
@ -21,7 +21,8 @@ namespace LAMMPS_NS {
|
|||||||
class NeighRequest : protected Pointers {
|
class NeighRequest : protected Pointers {
|
||||||
public:
|
public:
|
||||||
void *requestor; // class that made request
|
void *requestor; // class that made request
|
||||||
int id; // ID of request
|
int requestor_instance; // instance of that class (only Fix, Compute, Pair)
|
||||||
|
int id; // ID of request as stored by requestor
|
||||||
// used to track multiple requests from one class
|
// used to track multiple requests from one class
|
||||||
int unprocessed; // 1 when first requested
|
int unprocessed; // 1 when first requested
|
||||||
// 0 after processed by Neighbor class
|
// 0 after processed by Neighbor class
|
||||||
@ -100,7 +101,7 @@ class NeighRequest : protected Pointers {
|
|||||||
|
|
||||||
int otherlist; // index of other list to copy or skip from
|
int otherlist; // index of other list to copy or skip from
|
||||||
|
|
||||||
// original params by requester
|
// original params by requestor
|
||||||
// stored to compare against in identical() in case Neighbor changes them
|
// stored to compare against in identical() in case Neighbor changes them
|
||||||
|
|
||||||
int half_original;
|
int half_original;
|
||||||
|
|||||||
@ -908,7 +908,7 @@ void Neighbor::init()
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int Neighbor::request(void *requestor)
|
int Neighbor::request(void *requestor, int instance)
|
||||||
{
|
{
|
||||||
if (nrequest == maxrequest) {
|
if (nrequest == maxrequest) {
|
||||||
maxrequest += RQDELTA;
|
maxrequest += RQDELTA;
|
||||||
@ -919,6 +919,7 @@ int Neighbor::request(void *requestor)
|
|||||||
|
|
||||||
requests[nrequest] = new NeighRequest(lmp);
|
requests[nrequest] = new NeighRequest(lmp);
|
||||||
requests[nrequest]->requestor = requestor;
|
requests[nrequest]->requestor = requestor;
|
||||||
|
requests[nrequest]->requestor_instance = instance;
|
||||||
nrequest++;
|
nrequest++;
|
||||||
return nrequest-1;
|
return nrequest-1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ class Neighbor : protected Pointers {
|
|||||||
Neighbor(class LAMMPS *);
|
Neighbor(class LAMMPS *);
|
||||||
virtual ~Neighbor();
|
virtual ~Neighbor();
|
||||||
virtual void init();
|
virtual void init();
|
||||||
int request(void *); // another class requests a neighbor list
|
int request(void *, int instance=0); // another class requests a neigh list
|
||||||
void print_lists_of_lists(); // debug print out
|
void print_lists_of_lists(); // debug print out
|
||||||
int decide(); // decide whether to build or not
|
int decide(); // decide whether to build or not
|
||||||
virtual int check_distance(); // check max distance moved since last build
|
virtual int check_distance(); // check max distance moved since last build
|
||||||
|
|||||||
11
src/pair.cpp
11
src/pair.cpp
@ -44,10 +44,16 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
enum{NONE,RLINEAR,RSQ,BMP};
|
enum{NONE,RLINEAR,RSQ,BMP};
|
||||||
|
|
||||||
|
// allocate space for static class instance variable and initialize it
|
||||||
|
|
||||||
|
int Pair::instance_total = 0;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
|
instance_me = instance_total++;
|
||||||
|
|
||||||
THIRD = 1.0/3.0;
|
THIRD = 1.0/3.0;
|
||||||
|
|
||||||
eng_vdwl = eng_coul = 0.0;
|
eng_vdwl = eng_coul = 0.0;
|
||||||
@ -70,7 +76,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = 0;
|
ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = 0;
|
||||||
reinitflag = 1;
|
reinitflag = 1;
|
||||||
|
|
||||||
// pair_modify settings
|
// pair_modify settingsx
|
||||||
|
|
||||||
compute_flag = 1;
|
compute_flag = 1;
|
||||||
manybody_flag = 0;
|
manybody_flag = 0;
|
||||||
@ -246,7 +252,6 @@ void Pair::reinit()
|
|||||||
if (!reinitflag)
|
if (!reinitflag)
|
||||||
error->all(FLERR,"Fix adapt interface to this pair style not supported");
|
error->all(FLERR,"Fix adapt interface to this pair style not supported");
|
||||||
|
|
||||||
|
|
||||||
etail = ptail = 0.0;
|
etail = ptail = 0.0;
|
||||||
|
|
||||||
for (int i = 1; i <= atom->ntypes; i++)
|
for (int i = 1; i <= atom->ntypes; i++)
|
||||||
@ -273,7 +278,7 @@ void Pair::reinit()
|
|||||||
|
|
||||||
void Pair::init_style()
|
void Pair::init_style()
|
||||||
{
|
{
|
||||||
neighbor->request(this);
|
neighbor->request(this,instance_me);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|||||||
@ -30,6 +30,8 @@ class Pair : protected Pointers {
|
|||||||
friend class ThrOMP;
|
friend class ThrOMP;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static int instance_total; // # of Pair classes ever instantiated
|
||||||
|
|
||||||
double eng_vdwl,eng_coul; // accumulated energies
|
double eng_vdwl,eng_coul; // accumulated energies
|
||||||
double virial[6]; // accumulated virial
|
double virial[6]; // accumulated virial
|
||||||
double *eatom,**vatom; // accumulated per-atom energy/virial
|
double *eatom,**vatom; // accumulated per-atom energy/virial
|
||||||
@ -182,6 +184,8 @@ class Pair : protected Pointers {
|
|||||||
virtual unsigned int data_mask_ext() {return datamask_ext;}
|
virtual unsigned int data_mask_ext() {return datamask_ext;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
int instance_me; // which Pair class instantiation I am
|
||||||
|
|
||||||
enum{GEOMETRIC,ARITHMETIC,SIXTHPOWER}; // mixing options
|
enum{GEOMETRIC,ARITHMETIC,SIXTHPOWER}; // mixing options
|
||||||
|
|
||||||
int special_lj[4]; // copied from force->special_lj for Kokkos
|
int special_lj[4]; // copied from force->special_lj for Kokkos
|
||||||
|
|||||||
@ -431,7 +431,7 @@ void PairHybrid::init_style()
|
|||||||
for (i = 0; i < neighbor->nrequest; i++) {
|
for (i = 0; i < neighbor->nrequest; i++) {
|
||||||
if (!neighbor->requests[i]->pair) continue;
|
if (!neighbor->requests[i]->pair) continue;
|
||||||
|
|
||||||
// istyle = associated sub-style
|
// istyle = associated sub-style for that request
|
||||||
|
|
||||||
for (istyle = 0; istyle < nstyles; istyle++)
|
for (istyle = 0; istyle < nstyles; istyle++)
|
||||||
if (styles[istyle] == neighbor->requests[i]->requestor) break;
|
if (styles[istyle] == neighbor->requests[i]->requestor) break;
|
||||||
@ -582,7 +582,7 @@ void PairHybrid::modify_requests()
|
|||||||
|
|
||||||
if (j < neighbor->nrequest) irq->otherlist = j;
|
if (j < neighbor->nrequest) irq->otherlist = j;
|
||||||
else {
|
else {
|
||||||
int newrequest = neighbor->request(this);
|
int newrequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[newrequest]->copy_request(irq);
|
neighbor->requests[newrequest]->copy_request(irq);
|
||||||
irq->otherlist = newrequest;
|
irq->otherlist = newrequest;
|
||||||
}
|
}
|
||||||
@ -725,7 +725,7 @@ void PairHybrid::modify_params(int narg, char **arg)
|
|||||||
if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break;
|
if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break;
|
||||||
if (m == nstyles)
|
if (m == nstyles)
|
||||||
error->all(FLERR,"Unknown pair_modify hybrid sub-style");
|
error->all(FLERR,"Unknown pair_modify hybrid sub-style");
|
||||||
Pair::modify_params(narg-2,&arg[3]);
|
Pair::modify_params(narg-3,&arg[3]);
|
||||||
styles[m]->modify_params(narg-3,&arg[3]);
|
styles[m]->modify_params(narg-3,&arg[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -490,32 +490,32 @@ void PairLJCut::init_style()
|
|||||||
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
|
||||||
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
|
||||||
|
|
||||||
if (respa == 0) irequest = neighbor->request(this);
|
if (respa == 0) irequest = neighbor->request(this,instance_me);
|
||||||
else if (respa == 1) {
|
else if (respa == 1) {
|
||||||
irequest = neighbor->request(this);
|
irequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[irequest]->id = 1;
|
neighbor->requests[irequest]->id = 1;
|
||||||
neighbor->requests[irequest]->half = 0;
|
neighbor->requests[irequest]->half = 0;
|
||||||
neighbor->requests[irequest]->respainner = 1;
|
neighbor->requests[irequest]->respainner = 1;
|
||||||
irequest = neighbor->request(this);
|
irequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[irequest]->id = 3;
|
neighbor->requests[irequest]->id = 3;
|
||||||
neighbor->requests[irequest]->half = 0;
|
neighbor->requests[irequest]->half = 0;
|
||||||
neighbor->requests[irequest]->respaouter = 1;
|
neighbor->requests[irequest]->respaouter = 1;
|
||||||
} else {
|
} else {
|
||||||
irequest = neighbor->request(this);
|
irequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[irequest]->id = 1;
|
neighbor->requests[irequest]->id = 1;
|
||||||
neighbor->requests[irequest]->half = 0;
|
neighbor->requests[irequest]->half = 0;
|
||||||
neighbor->requests[irequest]->respainner = 1;
|
neighbor->requests[irequest]->respainner = 1;
|
||||||
irequest = neighbor->request(this);
|
irequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[irequest]->id = 2;
|
neighbor->requests[irequest]->id = 2;
|
||||||
neighbor->requests[irequest]->half = 0;
|
neighbor->requests[irequest]->half = 0;
|
||||||
neighbor->requests[irequest]->respamiddle = 1;
|
neighbor->requests[irequest]->respamiddle = 1;
|
||||||
irequest = neighbor->request(this);
|
irequest = neighbor->request(this,instance_me);
|
||||||
neighbor->requests[irequest]->id = 3;
|
neighbor->requests[irequest]->id = 3;
|
||||||
neighbor->requests[irequest]->half = 0;
|
neighbor->requests[irequest]->half = 0;
|
||||||
neighbor->requests[irequest]->respaouter = 1;
|
neighbor->requests[irequest]->respaouter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else irequest = neighbor->request(this);
|
} else irequest = neighbor->request(this,instance_me);
|
||||||
|
|
||||||
// set rRESPA cutoffs
|
// set rRESPA cutoffs
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user