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

This commit is contained in:
sjplimp 2009-07-21 15:00:56 +00:00
parent 1bd17c65d2
commit 08577f42a7
16 changed files with 75 additions and 17 deletions

View File

@ -22,7 +22,6 @@
#include "comm.h"
#include "modify.h"
#include "fix_gravity.h"
#include "fix_shear_history.h"
#include "domain.h"
#include "region.h"
#include "region_block.h"
@ -270,15 +269,6 @@ void FixPour::init()
fabs(zgrav) > EPSILON)
error->all("Gravity must point in -y to use with fix pour in 2d");
}
// check if a shear history fix exists
fix_history = NULL;
if (force->pair_match("gran/hooke/history",1) ||
force->pair_match("gran/hertz/history",1))
for (int i = 0; i < modify->nfix; i++)
if (strcmp(modify->fix[i]->style,"SHEAR_HISTORY") == 0)
fix_history = (FixShearHistory *) modify->fix[i];
}
/* ----------------------------------------------------------------------
@ -419,12 +409,15 @@ void FixPour::pre_exchange()
// set npartner for new atom to 0 (assume not touching any others)
AtomVec *avec = atom->avec;
int m,flag;
int j,m,flag;
double denstmp,vxtmp,vytmp,vztmp;
double g = 1.0;
double *sublo = domain->sublo;
double *subhi = domain->subhi;
int nfix = modify->nfix;
Fix **fix = modify->fix;
for (i = nprevious; i < nnear; i++) {
coord[0] = xnear[i][0];
coord[1] = xnear[i][1];
@ -464,7 +457,8 @@ void FixPour::pre_exchange()
atom->v[m][0] = vxtmp;
atom->v[m][1] = vytmp;
atom->v[m][2] = vztmp;
if (fix_history) fix_history->npartner[m] = 0;
for (j = 0; j < nfix; j++)
if (fix[j]->create_attribute) fix[j]->set_arrays(m);
}
}

View File

@ -52,6 +52,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
error->all("Fix wall/gran requires atom attributes radius, omega, torque");
restart_peratom = 1;
create_attribute = 1;
// wall/particle coefficients
@ -689,6 +690,15 @@ void FixWallGran::copy_arrays(int i, int j)
shear[j][2] = shear[i][2];
}
/* ----------------------------------------------------------------------
initialize one atom's array values, called when atom is created
------------------------------------------------------------------------- */
void FixWallGran::set_arrays(int i)
{
shear[i][0] = shear[i][1] = shear[i][2] = 0.0;
}
/* ----------------------------------------------------------------------
pack values in local atom-based arrays for exchange with another proc
------------------------------------------------------------------------- */

View File

@ -31,6 +31,7 @@ class FixWallGran : public Fix {
double memory_usage();
void grow_arrays(int);
void copy_arrays(int, int);
void set_arrays(int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);
int pack_restart(int, double *);

View File

@ -569,6 +569,7 @@ void AtomVecAngle::create_atom(int itype, double *coord)
molecule[nlocal] = 0;
num_bond[nlocal] = 0;
num_angle[nlocal] = 0;
nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0;
atom->nlocal++;
}

View File

@ -512,6 +512,7 @@ void AtomVecBond::create_atom(int itype, double *coord)
molecule[nlocal] = 0;
num_bond[nlocal] = 0;
nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0;
atom->nlocal++;
}

View File

@ -713,6 +713,7 @@ void AtomVecFull::create_atom(int itype, double *coord)
num_angle[nlocal] = 0;
num_dihedral[nlocal] = 0;
num_improper[nlocal] = 0;
nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0;
atom->nlocal++;
}

View File

@ -700,6 +700,7 @@ void AtomVecMolecular::create_atom(int itype, double *coord)
num_angle[nlocal] = 0;
num_dihedral[nlocal] = 0;
num_improper[nlocal] = 0;
nspecial[nlocal][0] = nspecial[nlocal][1] = nspecial[nlocal][2] = 0;
atom->nlocal++;
}

View File

@ -54,6 +54,7 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
no_change_box = 0;
time_integrate = 0;
time_depend = 0;
create_attribute = 0;
restart_pbc = 0;
scalar_flag = vector_flag = peratom_flag = 0;

View File

@ -35,6 +35,8 @@ class Fix : protected Pointers {
int no_change_box; // 1 if cannot swap ortho <-> triclinic
int time_integrate; // 1 if fix performs time integration, 0 if no
int time_depend; // 1 if fix is timestep dependent, 0 if not
int create_attribute; // 1 if fix stores attributes that need
// setting when a new atom is created
int restart_pbc; // 1 if fix moves atoms (except integrate)
// so that write_restart must remap to PBC
@ -88,6 +90,7 @@ class Fix : protected Pointers {
virtual void grow_arrays(int) {}
virtual void copy_arrays(int, int) {}
virtual void set_arrays(int) {}
virtual int pack_exchange(int, double *) {return 0;}
virtual int unpack_exchange(int, double *) {return 0;}
virtual int pack_restart(int, double *) {return 0;}

View File

@ -19,6 +19,8 @@
#include "atom_vec.h"
#include "force.h"
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "comm.h"
#include "domain.h"
#include "lattice.h"
@ -155,6 +157,7 @@ int FixDeposit::setmask()
void FixDeposit::pre_exchange()
{
int i,j;
int flag,flagall;
double coord[3],lamda[3],delx,dely,delz,rsq;
double *newcoord;
@ -179,6 +182,9 @@ void FixDeposit::pre_exchange()
// attempt an insertion until successful
int nfix = modify->nfix;
Fix **fix = modify->fix;
int success = 0;
int attempt = 0;
while (attempt < maxattempt) {
@ -218,7 +224,7 @@ void FixDeposit::pre_exchange()
double **x = atom->x;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
for (i = 0; i < nlocal; i++) {
if (localflag) {
delx = coord[0] - x[i][0];
dely = coord[1] - x[i][1];
@ -245,7 +251,7 @@ void FixDeposit::pre_exchange()
int nlocal = atom->nlocal;
flag = 0;
for (int i = 0; i < nlocal; i++) {
for (i = 0; i < nlocal; i++) {
delx = coord[0] - x[i][0];
dely = coord[1] - x[i][1];
delz = coord[2] - x[i][2];
@ -293,6 +299,8 @@ void FixDeposit::pre_exchange()
atom->v[m][0] = vxtmp;
atom->v[m][1] = vytmp;
atom->v[m][2] = vztmp;
for (j = 0; j < nfix; j++)
if (fix[j]->create_attribute) fix[j]->set_arrays(m);
}
MPI_Allreduce(&flag,&success,1,MPI_INT,MPI_MAX,world);
break;

View File

@ -49,6 +49,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) :
time_integrate = 1;
rigid_flag = 1;
virial_flag = 1;
create_attribute = 1;
// perform initial allocation of atom-based arrays
// register with Atom class
@ -2053,6 +2054,18 @@ void FixRigid::copy_arrays(int i, int j)
}
}
/* ----------------------------------------------------------------------
initialize one atom's array values, called when atom is created
------------------------------------------------------------------------- */
void FixRigid::set_arrays(int i)
{
body[i] = -1;
displace[i][0] = 0.0;
displace[i][1] = 0.0;
displace[i][2] = 0.0;
}
/* ----------------------------------------------------------------------
pack values in local atom-based arrays for exchange with another proc
------------------------------------------------------------------------- */

View File

@ -33,6 +33,7 @@ class FixRigid : public Fix {
double memory_usage();
void grow_arrays(int);
void copy_arrays(int, int);
void set_arrays(int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);

View File

@ -43,12 +43,14 @@ using namespace LAMMPS_NS;
FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
virial_flag = 1;
MPI_Comm_rank(world,&me);
MPI_Comm_size(world,&nprocs);
PI = 4.0*atan(1.0);
virial_flag = 1;
create_attribute = 1;
// error check
if (atom->molecular == 0)
@ -2176,6 +2178,15 @@ void FixShake::copy_arrays(int i, int j)
}
}
/* ----------------------------------------------------------------------
initialize one atom's array values, called when atom is created
------------------------------------------------------------------------- */
void FixShake::set_arrays(int i)
{
shake_flag[i] = 0;
}
/* ----------------------------------------------------------------------
pack values in local atom-based arrays for exchange with another proc
------------------------------------------------------------------------- */

View File

@ -32,6 +32,7 @@ class FixShake : public Fix {
double memory_usage();
void grow_arrays(int);
void copy_arrays(int, int);
void set_arrays(int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);
int pack_comm(int, int *, double *, int, int *);

View File

@ -34,6 +34,7 @@ FixShearHistory::FixShearHistory(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg)
{
restart_peratom = 1;
create_attribute = 1;
// perform initial allocation of atom-based arrays
// register with atom class
@ -199,6 +200,15 @@ void FixShearHistory::copy_arrays(int i, int j)
}
}
/* ----------------------------------------------------------------------
initialize one atom's array values, called when atom is created
------------------------------------------------------------------------- */
void FixShearHistory::set_arrays(int i)
{
npartner[i] = 0;
}
/* ----------------------------------------------------------------------
pack values in local atom-based arrays for exchange with another proc
------------------------------------------------------------------------- */

View File

@ -33,6 +33,7 @@ class FixShearHistory : public Fix {
double memory_usage();
void grow_arrays(int);
void copy_arrays(int, int);
void set_arrays(int);
int pack_exchange(int, double *);
int unpack_exchange(int, double *);
int pack_restart(int, double *);