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

This commit is contained in:
sjplimp
2016-06-06 23:21:39 +00:00
parent 1a52795e1d
commit 0f3e4182e8
67 changed files with 236 additions and 151 deletions

View File

@ -46,7 +46,7 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -45,5 +45,5 @@ FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -50,7 +50,7 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -68,5 +68,5 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -50,7 +50,7 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -68,5 +68,5 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -49,5 +49,5 @@ FixNVTBody::FixNVTBody(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -47,7 +47,7 @@ FixNPHKokkos<DeviceType>::FixNPHKokkos(LAMMPS *lmp, int narg, char **arg) :
this->modify->add_compute(3,newarg);
delete [] newarg;
this->tflag = 1;
this->tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -65,7 +65,7 @@ FixNPHKokkos<DeviceType>::FixNPHKokkos(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = this->id_temp;
this->modify->add_compute(4,newarg);
delete [] newarg;
this->pflag = 1;
this->pcomputeflag = 1;
}
namespace LAMMPS_NS {

View File

@ -47,7 +47,7 @@ FixNPTKokkos<DeviceType>::FixNPTKokkos(LAMMPS *lmp, int narg, char **arg) :
this->modify->add_compute(3,newarg);
delete [] newarg;
this->tflag = 1;
this->tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -65,7 +65,7 @@ FixNPTKokkos<DeviceType>::FixNPTKokkos(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = this->id_temp;
this->modify->add_compute(4,newarg);
delete [] newarg;
this->pflag = 1;
this->pcomputeflag = 1;
}
namespace LAMMPS_NS {

View File

@ -46,7 +46,7 @@ FixNVTKokkos<DeviceType>::FixNVTKokkos(LAMMPS *lmp, int narg, char **arg) :
this->modify->add_compute(3,newarg);
delete [] newarg;
this->tflag = 1;
this->tcomputeflag = 1;
}
namespace LAMMPS_NS {

View File

@ -488,13 +488,16 @@ void PairVashishta::setup_params()
// set cutsq using shortcut to reduce neighbor list for accelerated
// calculations. cut must remain unchanged as it is a potential parameter
double tmp_par;
for (m = 0; m < nparams; m++) {
params[m].cutsq = params[m].cut * params[m].cut;
params[m].cutsq2 = params[m].r0 * params[m].r0;
params[m].lam1inv = 1.0/params[m].lambda1;
params[m].lam4inv = 1.0/params[m].lambda4;
tmp_par = params[m].lambda1;
params[m].lam1inv = (tmp_par == 0.0) ? 0.0 : 1.0/tmp_par;
tmp_par = params[m].lambda4;
params[m].lam4inv = (tmp_par == 0.0) ? 0.0 : 1.0/tmp_par;
params[m].zizj = params[m].zi*params[m].zj * force->qqr2e;
// note that bigd does not have 1/2 factor
params[m].mbigd = params[m].bigd;
@ -502,8 +505,9 @@ void PairVashishta::setup_params()
params[m].big2b = 2.0*params[m].bigb;
params[m].big6w = 6.0*params[m].bigw;
params[m].rcinv = 1.0/params[m].cut;
params[m].rc2inv = 1.0/params[m].cutsq;
tmp_par = params[m].cut;
params[m].rcinv = (tmp_par == 0.0) ? 0.0 : 1.0/tmp_par;
params[m].rc2inv = params[m].rcinv*params[m].rcinv;
params[m].rc4inv = params[m].rc2inv*params[m].rc2inv;
params[m].rc6inv = params[m].rc2inv*params[m].rc4inv;
params[m].rceta = pow(params[m].rcinv,params[m].eta);

View File

@ -229,9 +229,12 @@ void FixTFMC::initial_integrate(int vflag)
// zero com motion
if (comflag == 1 && group->count(igroup) != 0) {
MPI_Allreduce(xcm_d,xcm_dall,3,MPI_DOUBLE,MPI_SUM,world);
if (masstotal > 0.0) {
xcm_dall[0] /= masstotal;
xcm_dall[1] /= masstotal;
xcm_dall[2] /= masstotal;
} else xcm_dall[0] = xcm_dall[1] = xcm_dall[2] = 0.0;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) {
if (xflag) x[i][0] -= xcm_dall[0];

View File

@ -148,6 +148,9 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) :
tcomputeflag = 0;
pcomputeflag = 0;
id_temp = NULL;
id_press = NULL;
}
/* ---------------------------------------------------------------------- */
@ -162,10 +165,8 @@ FixRigidNH::~FixRigidNH()
if (rfix) delete [] rfix;
if (tcomputeflag) {
modify->delete_compute(id_temp);
if (tcomputeflag) modify->delete_compute(id_temp);
delete [] id_temp;
}
// delete pressure if fix created it
@ -1265,7 +1266,6 @@ int FixRigidNH::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"temp") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (!pstat_flag) error->all(FLERR,"Illegal fix_modify command");
if (tcomputeflag) {
modify->delete_compute(id_temp);
tcomputeflag = 0;

View File

@ -69,7 +69,7 @@ class FixRigidNH : public FixRigid {
char *id_temp,*id_press;
class Compute *temperature,*pressure;
int tcomputeflag,pcomputeflag;
int tcomputeflag,pcomputeflag; // 1 = compute was created by fix. 0 = external
void couple();
void remap();

View File

@ -163,6 +163,9 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) :
tcomputeflag = 0;
pcomputeflag = 0;
id_temp = NULL;
id_press = NULL;
}
/* ---------------------------------------------------------------------- */
@ -176,10 +179,8 @@ FixRigidNHSmall::~FixRigidNHSmall()
if (rfix) delete [] rfix;
if (tcomputeflag) {
modify->delete_compute(id_temp);
if (tcomputeflag) modify->delete_compute(id_temp);
delete [] id_temp;
}
// delete pressure if fix created it
@ -1374,7 +1375,6 @@ int FixRigidNHSmall::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"temp") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (!pstat_flag) error->all(FLERR,"Illegal fix_modify command");
if (tcomputeflag) {
modify->delete_compute(id_temp);
tcomputeflag = 0;

View File

@ -68,7 +68,7 @@ class FixRigidNHSmall : public FixRigidSmall {
char *id_temp,*id_press;
class Compute *temperature,*pressure;
int tcomputeflag,pcomputeflag;
int tcomputeflag,pcomputeflag; // 1 = compute was created by fix. 0 = external
void couple();
void remap();

View File

@ -135,7 +135,7 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -153,7 +153,7 @@ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
// create a new compute potential energy compute

View File

@ -46,7 +46,7 @@ FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,5 +46,5 @@ FixNVTEff::FixNVTEff(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -58,7 +58,7 @@ FixNVTSllodEff::FixNVTSllodEff(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}
/* ---------------------------------------------------------------------- */

View File

@ -46,7 +46,7 @@ FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -45,6 +45,6 @@ FixNVTIntel::FixNVTIntel(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -59,7 +59,7 @@ FixNVTSllodIntel::FixNVTSllodIntel(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}
/* ---------------------------------------------------------------------- */

View File

@ -46,7 +46,7 @@ FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -135,7 +135,7 @@ FixNPHugOMP::FixNPHugOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -153,7 +153,7 @@ FixNPHugOMP::FixNPHugOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
// create a new compute potential energy compute

View File

@ -46,7 +46,7 @@ FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -45,5 +45,5 @@ FixNVTAsphereOMP::FixNVTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -45,5 +45,5 @@ FixNVTOMP::FixNVTOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -65,7 +65,7 @@ FixNVTSllodOMP::FixNVTSllodOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}
/* ---------------------------------------------------------------------- */

View File

@ -45,5 +45,5 @@ FixNVTSphereOMP::FixNVTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -386,7 +386,6 @@ void PairReaxC::init_style( )
delete [] fixarg;
fix_reax = (FixReaxC *) modify->fix[modify->nfix-1];
}
}
/* ---------------------------------------------------------------------- */

View File

@ -56,6 +56,7 @@ ComputeForceTally::ComputeForceTally(LAMMPS *lmp, int narg, char **arg) :
ComputeForceTally::~ComputeForceTally()
{
if (force && force->pair) force->pair->del_tally_callback(this);
memory->destroy(fatom);
delete[] vector;
}

View File

@ -55,6 +55,7 @@ ComputePETally::ComputePETally(LAMMPS *lmp, int narg, char **arg) :
ComputePETally::~ComputePETally()
{
if (force && force->pair) force->pair->del_tally_callback(this);
memory->destroy(eatom);
delete[] vector;
}

View File

@ -56,6 +56,7 @@ ComputeStressTally::ComputeStressTally(LAMMPS *lmp, int narg, char **arg) :
ComputeStressTally::~ComputeStressTally()
{
if (force && force->pair) force->pair->del_tally_callback(this);
memory->destroy(stress);
delete[] vector;
}

View File

@ -688,6 +688,10 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
int maxbytes;
MPI_Allreduce(&nbytes,&maxbytes,1,MPI_INT,MPI_MAX,world);
// no need to communicate without data
if (maxbytes == 0) return;
char *buf,*bufcopy;
memory->create(buf,maxbytes,"comm:buf");
memory->create(bufcopy,maxbytes,"comm:bufcopy");

View File

@ -136,10 +136,12 @@ void ComputeAngmomChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// compute angmom for each chunk

View File

@ -159,11 +159,12 @@ void ComputeDipoleChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] == 0.0) masstotal[i] = 1.0;
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// compute dipole for each chunk

View File

@ -109,6 +109,7 @@ void ComputeGyration::compute_vector()
}
MPI_Allreduce(rg,vector,6,MPI_DOUBLE,MPI_SUM,world);
if (masstotal == 0.0) return;
for (int i = 0; i < 6; i++) vector[i] = vector[i]/masstotal;
if (masstotal > 0.0)
for (int i = 0; i < 6; i++)
vector[i] /= masstotal;
}

View File

@ -143,6 +143,7 @@ void ComputeGyrationChunk::compute_vector()
MPI_Allreduce(rg,rgall,nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++)
if (masstotal[i] > 0.0)
rgall[i] = sqrt(rgall[i]/masstotal[i]);
}
@ -191,10 +192,13 @@ void ComputeGyrationChunk::compute_array()
if (nchunk)
MPI_Allreduce(&rgt[0][0],&rgtall[0][0],nchunk*6,MPI_DOUBLE,MPI_SUM,world);
for (i = 0; i < nchunk; i++)
for (i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
for (j = 0; j < 6; j++)
rgtall[i][j] = rgtall[i][j]/masstotal[i];
}
}
}
/* ----------------------------------------------------------------------
@ -253,11 +257,13 @@ void ComputeGyrationChunk::com_chunk()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
}
/* ----------------------------------------------------------------------
lock methods: called by fix ave/time

View File

@ -136,10 +136,12 @@ void ComputeInertiaChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// compute inertia tensor for each chunk

View File

@ -201,10 +201,12 @@ void ComputeMSDChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// MSD is difference between current and initial COM
// cominit is initilialized by setup() when firstflag is set

View File

@ -138,10 +138,12 @@ void ComputeOmegaChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// compute inertia tensor for each chunk

View File

@ -472,9 +472,13 @@ void ComputeTempChunk::vcm_compute()
MPI_Allreduce(massproc,masstotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
for (i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
vcmall[i][0] /= masstotal[i];
vcmall[i][1] /= masstotal[i];
vcmall[i][2] /= masstotal[i];
} else {
vcmall[i][0] = vcmall[i][1] = vcmall[i][2] = 0.0;
}
}
}
@ -689,7 +693,7 @@ void ComputeTempChunk::internal(int icol)
void ComputeTempChunk::remove_bias(int i, double *v)
{
int index = cchunk->ichunk[i];
int index = cchunk->ichunk[i]-1;
if (index < 0) return;
v[0] -= vcmall[index][0];
v[1] -= vcmall[index][1];
@ -711,11 +715,11 @@ void ComputeTempChunk::remove_bias_all()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
index = ichunk[i];
index = ichunk[i]-1;
if (index < 0) continue;
v[i][0] -= vbias[0];
v[i][1] -= vbias[1];
v[i][2] -= vbias[2];
v[i][0] -= vcmall[index][0];
v[i][1] -= vcmall[index][1];
v[i][2] -= vcmall[index][2];
}
}
@ -726,7 +730,7 @@ void ComputeTempChunk::remove_bias_all()
void ComputeTempChunk::restore_bias(int i, double *v)
{
int index = cchunk->ichunk[i];
int index = cchunk->ichunk[i]-1;
if (index < 0) return;
v[0] += vcmall[index][0];
v[1] += vcmall[index][1];
@ -749,11 +753,11 @@ void ComputeTempChunk::restore_bias_all()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) {
index = ichunk[i];
index = ichunk[i]-1;
if (index < 0) continue;
v[i][0] += vbias[0];
v[i][1] += vbias[1];
v[i][2] += vbias[2];
v[i][0] += vcmall[index][0];
v[i][1] += vcmall[index][1];
v[i][2] += vcmall[index][2];
}
}

View File

@ -209,7 +209,7 @@ void ComputeTempRegion::remove_bias_all()
int *mask = atom->mask;
int nlocal = atom->nlocal;
if (nlocal > maxbias) {
if (atom->nmax > maxbias) {
memory->destroy(vbiasall);
maxbias = atom->nmax;
memory->create(vbiasall,maxbias,3,"temp/region:vbiasall");

View File

@ -136,10 +136,12 @@ void ComputeTorqueChunk::compute_array()
MPI_Allreduce(&com[0][0],&comall[0][0],3*nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
comall[i][0] /= masstotal[i];
comall[i][1] /= masstotal[i];
comall[i][2] /= masstotal[i];
}
}
// compute torque on each chunk

View File

@ -146,9 +146,11 @@ void ComputeVCMChunk::compute_array()
MPI_Allreduce(massproc,masstotal,nchunk,MPI_DOUBLE,MPI_SUM,world);
for (int i = 0; i < nchunk; i++) {
if (masstotal[i] > 0.0) {
vcmall[i][0] /= masstotal[i];
vcmall[i][1] /= masstotal[i];
vcmall[i][2] /= masstotal[i];
} else vcmall[i][0] = vcmall[i][1] = vcmall[i][2] = 0.0;
}
}

View File

@ -34,8 +34,8 @@ FixDeprecated::FixDeprecated(LAMMPS *lmp, int narg, char **arg) :
" dim, origin, delta, region, bound, discard, units\n\n";
if (comm->me == 0) {
if (screen) fprintf(screen,message);
if (logfile) fprintf(logfile,message);
if (screen) fputs(message,screen);
if (logfile) fputs(message,logfile);
}
}
error->all(FLERR,"This fix command has been removed from LAMMPS");

View File

@ -133,6 +133,8 @@ void FixHeat::init()
if (group->count(igroup) == 0)
error->all(FLERR,"Fix heat group has no atoms");
masstotal = group->mass(igroup);
if (masstotal <= 0.0)
error->all(FLERR,"Fix heat group has invalid mass");
}
/* ---------------------------------------------------------------------- */

View File

@ -80,6 +80,11 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
flipflag = 1;
dipole_flag = 0;
tcomputeflag = 0;
pcomputeflag = 0;
id_temp = NULL;
id_press = NULL;
// turn on tilt factor scaling, whenever applicable
dimension = domain->dimension;
@ -558,7 +563,7 @@ FixNH::~FixNH()
// delete temperature and pressure if fix created them
if (tflag) modify->delete_compute(id_temp);
if (tcomputeflag) modify->delete_compute(id_temp);
delete [] id_temp;
if (tstat_flag) {
@ -569,7 +574,7 @@ FixNH::~FixNH()
}
if (pstat_flag) {
if (pflag) modify->delete_compute(id_press);
if (pcomputeflag) modify->delete_compute(id_press);
delete [] id_press;
if (mpchain) {
delete [] etap;
@ -1347,9 +1352,9 @@ int FixNH::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"temp") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (tflag) {
if (tcomputeflag) {
modify->delete_compute(id_temp);
tflag = 0;
tcomputeflag = 0;
}
delete [] id_temp;
int n = strlen(arg[1]) + 1;
@ -1381,9 +1386,9 @@ int FixNH::modify_param(int narg, char **arg)
} else if (strcmp(arg[0],"press") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (!pstat_flag) error->all(FLERR,"Illegal fix_modify command");
if (pflag) {
if (pcomputeflag) {
modify->delete_compute(id_press);
pflag = 0;
pcomputeflag = 0;
}
delete [] id_press;
int n = strlen(arg[1]) + 1;

View File

@ -76,7 +76,7 @@ class FixNH : public Fix {
char *id_temp,*id_press;
class Compute *temperature,*pressure;
int tflag,pflag;
int tcomputeflag,pcomputeflag; // 1 = compute was created by fix. 0 = external
double *eta,*eta_dot; // chain thermostat for particles
double *eta_dotdot;

View File

@ -46,7 +46,7 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPH::FixNPH(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPT::FixNPT(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -46,7 +46,7 @@ FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
@ -64,5 +64,5 @@ FixNPTSphere::FixNPTSphere(LAMMPS *lmp, int narg, char **arg) :
newarg[3] = id_temp;
modify->add_compute(4,newarg);
delete [] newarg;
pflag = 1;
pcomputeflag = 1;
}

View File

@ -45,5 +45,5 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -63,7 +63,7 @@ FixNVTSllod::FixNVTSllod(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}
/* ---------------------------------------------------------------------- */

View File

@ -45,5 +45,5 @@ FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) :
modify->add_compute(3,newarg);
delete [] newarg;
tflag = 1;
tcomputeflag = 1;
}

View File

@ -52,6 +52,7 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
extscalar = 1;
extvector = 1;
global_freq = 1;
dynamic_group_allow = 1;
/* ---------------------------------------------------------------------- */
@ -186,6 +187,9 @@ void FixRecenter::initial_integrate(int vflag)
// current COM
double xcm[3];
if (group->dynamic[igroup])
masstotal = group->mass(igroup);
group->xcm(igroup,masstotal,xcm);
// shift coords by difference between actual COM and requested COM

View File

@ -47,6 +47,7 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1;
extscalar = 1;
extvector = 1;
dynamic_group_allow = 1;
group2 = NULL;
@ -166,6 +167,10 @@ void FixSpring::post_force(int vflag)
void FixSpring::spring_tether()
{
double xcm[3];
if (group->dynamic[igroup])
masstotal = group->mass(igroup);
group->xcm(igroup,masstotal,xcm);
// fx,fy,fz = components of k * (r-r0) / masstotal
@ -192,9 +197,11 @@ void FixSpring::spring_tether()
if (dr < 0.0) ftotal[3] = -ftotal[3];
espring = 0.5*k_spring * dr*dr;
if (masstotal > 0.0) {
fx /= masstotal;
fy /= masstotal;
fz /= masstotal;
}
// apply restoring force to atoms in group
@ -231,6 +238,13 @@ void FixSpring::spring_tether()
void FixSpring::spring_couple()
{
double xcm[3],xcm2[3];
if (group->dynamic[igroup])
masstotal = group->mass(igroup);
if (group->dynamic[igroup2])
masstotal2 = group->mass(igroup2);
group->xcm(igroup,masstotal,xcm);
group->xcm(igroup2,masstotal2,xcm2);
@ -259,12 +273,16 @@ void FixSpring::spring_couple()
if (dr < 0.0) ftotal[3] = -ftotal[3];
espring = 0.5*k_spring * dr*dr;
if (masstotal2 > 0.0) {
fx2 = fx/masstotal2;
fy2 = fy/masstotal2;
fz2 = fz/masstotal2;
}
if (masstotal > 0.0) {
fx /= masstotal;
fy /= masstotal;
fz /= masstotal;
}
// apply restoring force to atoms in group
// f = -k*(r-r0)*mass/masstotal

View File

@ -42,6 +42,8 @@ FixSpringRG::FixSpringRG(LAMMPS *lmp, int narg, char **arg) :
rg0_flag = 0;
if (strcmp(arg[4],"NULL") == 0) rg0_flag = 1;
else rg0 = force->numeric(FLERR,arg[4]);
dynamic_group_allow = 1;
}
/* ---------------------------------------------------------------------- */
@ -94,6 +96,8 @@ void FixSpringRG::post_force(int vflag)
// compute current Rg and center-of-mass
double xcm[3];
if (group->dynamic[igroup])
masstotal = group->mass(igroup);
group->xcm(igroup,masstotal,xcm);
double rg = group->gyration(igroup,masstotal,xcm);
@ -108,6 +112,7 @@ void FixSpringRG::post_force(int vflag)
int *type = atom->type;
imageint *image = atom->image;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
double massfrac;
@ -120,12 +125,16 @@ void FixSpringRG::post_force(int vflag)
dy = unwrap[1] - xcm[1];
dz = unwrap[2] - xcm[2];
term1 = 2.0 * k * (1.0 - rg0/rg);
massfrac = mass[type[i]]/masstotal;
if (masstotal > 0.0) {
if (rmass) massfrac = rmass[i]/masstotal;
else massfrac = mass[type[i]]/masstotal;
f[i][0] -= term1*dx*massfrac;
f[i][1] -= term1*dy*massfrac;
f[i][2] -= term1*dz*massfrac;
}
}
}
/* ---------------------------------------------------------------------- */

View File

@ -85,6 +85,8 @@ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
}
masstotal = group->mass(igroup);
if (masstotal == 0.0)
error->all(FLERR,"Cannot use fix TMD on massless group");
// rho_start = initial rho
// xold = initial x or 0.0 if not in group
@ -155,10 +157,7 @@ void FixTMD::init()
int flag = 0;
for (int i = 0; i < modify->nfix; i++) {
if (strcmp(modify->fix[i]->style,"tmd") == 0) flag = 1;
if (flag && strcmp(modify->fix[i]->style,"nve") == 0) flag = 2;
if (flag && strcmp(modify->fix[i]->style,"nvt") == 0) flag = 2;
if (flag && strcmp(modify->fix[i]->style,"npt") == 0) flag = 2;
if (flag && strcmp(modify->fix[i]->style,"nph") == 0) flag = 2;
if (flag && modify->fix[i]->time_integrate) flag = 2;
}
if (flag == 2) error->all(FLERR,"Fix tmd must come after integration fixes");

View File

@ -53,7 +53,16 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
if (style == NONE) {
if (narg != 2) error->all(FLERR,"Illegal lattice command");
// Domain defines a default lattice of style "none" with
// spacing 1.0 before the force class is initialized, so
// we have to fall back to using atof() in that case.
if (force)
xlattice = ylattice = zlattice = force->numeric(FLERR,arg[1]);
else
xlattice = ylattice = zlattice = atof(arg[1]);
if (xlattice <= 0.0) error->all(FLERR,"Illegal lattice command");
return;
}

View File

@ -245,10 +245,12 @@ void Molecule::compute_com()
com[1] += x[i][1]*onemass;
com[2] += x[i][2]*onemass;
}
if (masstotal > 0.0) {
com[0] /= masstotal;
com[1] /= masstotal;
com[2] /= masstotal;
}
}
memory->destroy(dxcom);
memory->create(dxcom,natoms,3,"molecule:dxcom");

View File

@ -116,9 +116,9 @@ void Replicate::command(int narg, char **arg)
// also set atomKK for Kokkos version of Atom class
Atom *old = atom;
if (lmp->kokkos) atom = new AtomKokkos(lmp);
atomKK = NULL;
if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp);
else atom = new Atom(lmp);
atomKK = (AtomKokkos*) atom;
atom->settings(old);
atom->create_avec(old->atom_style,old->avec->nargcopy,old->avec->argcopy,0);