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

This commit is contained in:
sjplimp
2013-02-14 22:43:22 +00:00
parent ef1541ad5b
commit 614d5987b2
3 changed files with 26 additions and 29 deletions

View File

@ -72,7 +72,6 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) :
virial_flag = 1; virial_flag = 1;
create_attribute = 1; create_attribute = 1;
MPI_Comm_rank(world,&me); MPI_Comm_rank(world,&me);
MPI_Comm_size(world,&nprocs); MPI_Comm_size(world,&nprocs);
@ -291,6 +290,20 @@ void FixRigidSmall::init()
step_respa = ((Respa *) update->integrate)->step; step_respa = ((Respa *) update->integrate)->step;
} }
/* ----------------------------------------------------------------------
one-time initialization of rigid body attributes via local comm
extended flags, mass, COM, inertia tensor, displacement of each atom
require communication stencil have been setup by comm->borders()
------------------------------------------------------------------------- */
void FixRigidSmall::setup_pre_neighbor()
{
if (firstflag) {
firstflag = 0;
setup_bodies();
}
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixRigidSmall::setup(int vflag) void FixRigidSmall::setup(int vflag)
@ -298,14 +311,6 @@ void FixRigidSmall::setup(int vflag)
int i,n,ibody; int i,n,ibody;
double massone,radone; double massone,radone;
// one-time initialization of rigid body attributes via local comm
// extended flags, mass, COM, inertia tensor, displacement of each atom
if (firstflag) {
firstflag = 0;
setup_bodies();
}
//check(1); //check(1);
// sum vcm, fcm, angmom, torque across all rigid bodies // sum vcm, fcm, angmom, torque across all rigid bodies
@ -722,11 +727,6 @@ void FixRigidSmall::final_integrate_respa(int ilevel, int iloop)
void FixRigidSmall::pre_neighbor() void FixRigidSmall::pre_neighbor()
{ {
// do nothing if bodies are not yet initialized
// i.e. pre_neighbor() is being called from Verlet::setup()
if (firstflag) return;
// remap xcm and image flags of each body as needed // remap xcm and image flags of each body as needed
tagint original,oldimage,newimage; tagint original,oldimage,newimage;
@ -812,13 +812,6 @@ int FixRigidSmall::dof(int tgroup)
int tgroupbit = group->bitmask[tgroup]; int tgroupbit = group->bitmask[tgroup];
// if firstflag, just return 0
// is being called by first run init()
// local comm stencil is not setup and rigid body inertia is not calculated
// will be called again by temperature compute setup()
if (firstflag) return 0;
// counts = 3 values per rigid body I own // counts = 3 values per rigid body I own
// 0 = # of point particles in rigid body and in temperature group // 0 = # of point particles in rigid body and in temperature group
// 1 = # of finite-size particles in rigid body and in temperature group // 1 = # of finite-size particles in rigid body and in temperature group
@ -1545,7 +1538,6 @@ void FixRigidSmall::setup_bodies()
reset_atom2body(); reset_atom2body();
// compute mass & center-of-mass of each rigid body // compute mass & center-of-mass of each rigid body
// error if image flag is not 0 in a non-periodic dim
double **x = atom->x; double **x = atom->x;
tagint *image = atom->image; tagint *image = atom->image;
@ -2084,7 +2076,10 @@ int FixRigidSmall::unpack_exchange(int nlocal, double *buf)
// atom not in a rigid body // atom not in a rigid body
if (!bodytag[nlocal]) return m; if (!bodytag[nlocal]) {
bodyown[nlocal] = -1;
return m;
}
// atom does not own its rigid body // atom does not own its rigid body

View File

@ -55,6 +55,7 @@ class FixRigidSmall : public Fix {
int pack_reverse_comm(int, int, double *); int pack_reverse_comm(int, int, double *);
void unpack_reverse_comm(int, int *, double *); void unpack_reverse_comm(int, int *, double *);
void setup_pre_neighbor();
void pre_neighbor(); void pre_neighbor();
int dof(int); int dof(int);
void deform(int); void deform(int);

View File

@ -158,10 +158,10 @@ void Modify::init()
list_init(MIN_ENERGY,n_min_energy,list_min_energy); list_init(MIN_ENERGY,n_min_energy,list_min_energy);
// init each fix // init each fix
// needs to come before compute init // not sure if now needs to come before compute init
// this is b/c some computes call fix->dof() // used to b/c temperature computes called fix->dof() in their init,
// FixRigid::dof() depends on its own init having been called // and fix rigid required its own init before its dof() could be called,
// NOTE: 2/13, this may no longer be needed b/c computes do dof in setup() // but computes now do their DOF in setup()
for (i = 0; i < nfix; i++) fix[i]->init(); for (i = 0; i < nfix; i++) fix[i]->init();
@ -228,8 +228,9 @@ void Modify::init()
void Modify::setup(int vflag) void Modify::setup(int vflag)
{ {
// invoke computes before fixes // setup each compute
// this is b/c NH fixes need temperature compute DOF // needs to come before fix setup
// this is b/c NH fixes need use DOF of temperature computes
for (int i = 0; i < ncompute; i++) compute[i]->setup(); for (int i = 0; i < ncompute; i++) compute[i]->setup();