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

This commit is contained in:
sjplimp
2008-01-29 18:43:51 +00:00
parent 5023f0e3cb
commit 067f2ce963
4 changed files with 23 additions and 40 deletions

View File

@ -54,16 +54,6 @@ PairLJCutCoulLongTIP4P::PairLJCutCoulLongTIP4P(LAMMPS *lmp) :
PairLJCutCoulLong(lmp)
{
single_enable = 0;
nmax = 0;
ftmp = NULL;
}
/* ---------------------------------------------------------------------- */
PairLJCutCoulLongTIP4P::~PairLJCutCoulLongTIP4P()
{
memory->destroy_2d_double_array(ftmp);
}
/* ---------------------------------------------------------------------- */
@ -524,15 +514,3 @@ void *PairLJCutCoulLongTIP4P::extract(char *str)
else if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul;
return NULL;
}
/* ----------------------------------------------------------------------
memory usage of local atom-based arrays
------------------------------------------------------------------------- */
double PairLJCutCoulLongTIP4P::memory_usage()
{
double bytes = maxeatom * sizeof(double);
bytes += maxvatom*6 * sizeof(double);
bytes += 3 * nmax * sizeof(double);
return bytes;
}

View File

@ -21,14 +21,12 @@ namespace LAMMPS_NS {
class PairLJCutCoulLongTIP4P : public PairLJCutCoulLong {
public:
PairLJCutCoulLongTIP4P(class LAMMPS *);
~PairLJCutCoulLongTIP4P();
void compute(int, int);
void settings(int, char **);
void init_style();
void write_restart_settings(FILE *fp);
void read_restart_settings(FILE *fp);
void *extract(char *);
double memory_usage();
private:
int typeH,typeO; // atom types of TIP4P water H and O atoms
@ -36,10 +34,6 @@ class PairLJCutCoulLongTIP4P : public PairLJCutCoulLong {
double qdist; // distance from O site to negative charge
double alpha; // geometric constraint parameter for TIP4P
int nmax;
double **ftmp;
double virialtmp[6];
void find_M(int, int &, int &, double *);
};

View File

@ -59,6 +59,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
style = SINGLE;
multilo = multihi = NULL;
cutghostmulti = NULL;
// initialize comm buffers & exchange memory

View File

@ -51,12 +51,6 @@ void DeleteAtoms::command(int narg, char **arg)
int natoms_previous = static_cast<int> (atom->natoms);
// allocate and initialize deletion list
int nlocal = atom->nlocal;
dlist = (int *) memory->smalloc(nlocal*sizeof(int),"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0;
// delete the atoms
if (strcmp(arg[0],"group") == 0) delete_group(narg,arg);
@ -64,10 +58,11 @@ void DeleteAtoms::command(int narg, char **arg)
else if (strcmp(arg[0],"overlap") == 0) delete_overlap(narg,arg);
else error->all("Illegal delete_atoms command");
// delete local atoms in list
// delete local atoms flagged in dlist
// reset nlocal
AtomVec *avec = atom->avec;
int nlocal = atom->nlocal;
int i = 0;
while (i < nlocal) {
@ -77,6 +72,7 @@ void DeleteAtoms::command(int narg, char **arg)
nlocal--;
} else i++;
}
atom->nlocal = nlocal;
memory->sfree(dlist);
@ -85,8 +81,6 @@ void DeleteAtoms::command(int narg, char **arg)
if (atom->molecular == 0) {
int *tag = atom->tag;
int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) tag[i] = 0;
atom->tag_extend();
}
@ -127,8 +121,13 @@ void DeleteAtoms::delete_group(int narg, char **arg)
int igroup = group->find(arg[1]);
if (igroup == -1) error->all("Could not find delete_atoms group ID");
int *mask = atom->mask;
// allocate and initialize deletion list
int nlocal = atom->nlocal;
dlist = (int *) memory->smalloc(nlocal*sizeof(int),"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0;
int *mask = atom->mask;
int groupbit = group->bitmask[igroup];
for (int i = 0; i < nlocal; i++)
@ -146,8 +145,13 @@ void DeleteAtoms::delete_region(int narg, char **arg)
int iregion = domain->find_region(arg[1]);
if (iregion == -1) error->all("Could not find delete_atoms region ID");
double **x = atom->x;
// allocate and initialize deletion list
int nlocal = atom->nlocal;
dlist = (int *) memory->smalloc(nlocal*sizeof(int),"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0;
double **x = atom->x;
for (int i = 0; i < nlocal; i++)
if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) dlist[i] = 1;
@ -215,6 +219,13 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
NeighList *list = neighbor->lists[irequest];
neighbor->build_one(irequest);
// allocate and initialize deletion list
// must be after exchange potentially changes nlocal
int nlocal = atom->nlocal;
dlist = (int *) memory->smalloc(nlocal*sizeof(int),"delete_atoms:dlist");
for (int i = 0; i < nlocal; i++) dlist[i] = 0;
// double loop over owned atoms and their full neighbor list
// at end of loop, there are no more overlaps
// only ever delete owned atom I, never J even if owned
@ -223,7 +234,6 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
int *type = atom->type;
int *mask = atom->mask;
double **x = atom->x;
int nlocal = atom->nlocal;
int nall = atom->nlocal + atom->nghost;
double *special_coul = force->special_coul;
double *special_lj = force->special_lj;