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

This commit is contained in:
sjplimp 2014-11-17 18:11:29 +00:00
parent c5556a4cf7
commit b7ece0fb51
19 changed files with 68 additions and 22 deletions

View File

@ -127,6 +127,8 @@ void ComputeTempAsphere::init()
void ComputeTempAsphere::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -89,6 +89,9 @@ ComputeTempCuda::~ComputeTempCuda()
void ComputeTempCuda::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);

View File

@ -103,6 +103,9 @@ ComputeTempPartialCuda::~ComputeTempPartialCuda()
void ComputeTempPartialCuda::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = 0;
for (int i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);

View File

@ -70,15 +70,9 @@ ComputeTempDeformEff::~ComputeTempDeformEff()
void ComputeTempDeformEff::init()
{
int i;
fix_dof = 0;
for (i = 0; i < modify->nfix; i++)
fix_dof += modify->fix[i]->dof(igroup);
dof_compute();
// check fix deform remap settings
int i;
for (i = 0; i < modify->nfix; i++)
if (strcmp(modify->fix[i]->style,"deform") == 0) {
if (((FixDeform *) modify->fix[i])->remapflag == X_REMAP &&
@ -88,7 +82,18 @@ void ComputeTempDeformEff::init()
break;
}
if (i == modify->nfix && comm->me == 0)
error->warning(FLERR,"Using compute temp/deform/eff with no fix deform defined");
error->warning(FLERR,
"Using compute temp/deform/eff with no fix deform defined");
}
/* ---------------------------------------------------------------------- */
void ComputeTempDeformEff::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}
/* ---------------------------------------------------------------------- */

View File

@ -56,6 +56,8 @@ ComputeTempEff::~ComputeTempEff()
void ComputeTempEff::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -83,6 +83,8 @@ void ComputeTempRegionEff::init()
void ComputeTempRegionEff::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
dof = 0.0;
}

View File

@ -68,6 +68,8 @@ void ComputeTempRotate::init()
void ComputeTempRotate::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -70,6 +70,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
timeflag = 0;
comm_forward = comm_reverse = 0;
dynamic = 0;
dynamic_group_allow = 1;
cudable = 0;
@ -80,7 +81,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
// set modify defaults
extra_dof = domain->dimension;
dynamic = 0;
dynamic_user = 0;
// setup list of timesteps
@ -120,8 +121,8 @@ void Compute::modify_params(int narg, char **arg)
iarg += 2;
} else if (strcmp(arg[iarg],"dynamic") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command");
if (strcmp(arg[iarg+1],"no") == 0) dynamic = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic = 1;
if (strcmp(arg[iarg+1],"no") == 0) dynamic_user = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) dynamic_user = 1;
else error->all(FLERR,"Illegal compute_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"thermo") == 0) {

View File

@ -125,6 +125,7 @@ class Compute : protected Pointers {
int extra_dof; // extra DOF for temperature computes
int fix_dof; // DOF due to fixes
int dynamic; // recount atoms for temperature computes
int dynamic_user; // user request for temp compute to be dynamic
int thermoflag; // 1 if include fix PE for PE computes
double vbias[3]; // stored velocity bias for one atom

View File

@ -50,6 +50,8 @@ ComputeTemp::~ComputeTemp()
void ComputeTemp::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -60,6 +60,8 @@ void ComputeTempCOM::init()
void ComputeTempCOM::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -86,6 +86,8 @@ void ComputeTempDeform::init()
void ComputeTempDeform::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -61,6 +61,8 @@ ComputeTempPartial::~ComputeTempPartial()
void ComputeTempPartial::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -187,6 +187,8 @@ void ComputeTempProfile::init()
void ComputeTempProfile::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -117,6 +117,8 @@ ComputeTempRamp::~ComputeTempRamp()
void ComputeTempRamp::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -108,6 +108,8 @@ void ComputeTempSphere::init()
void ComputeTempSphere::setup()
{
dynamic = 0;
if (dynamic_user || group->dynamic[igroup]) dynamic = 1;
fix_dof = -1;
dof_compute();
}

View File

@ -131,7 +131,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
pcouple = XYZ;
p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_period[0] = p_period[1] = p_period[2] =
force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = p_flag[1] = p_flag[2] = 1;
if (dimension == 2) {
p_start[2] = p_stop[2] = p_period[2] = 0.0;
@ -143,7 +144,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
pcouple = NONE;
p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_period[0] = p_period[1] = p_period[2] =
force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = p_flag[1] = p_flag[2] = 1;
if (dimension == 2) {
p_start[2] = p_stop[2] = p_period[2] = 0.0;
@ -156,11 +158,13 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
scalexy = scalexz = scaleyz = 0;
p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]);
p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]);
p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]);
p_period[0] = p_period[1] = p_period[2] =
force->numeric(FLERR,arg[iarg+3]);
p_flag[0] = p_flag[1] = p_flag[2] = 1;
p_start[3] = p_start[4] = p_start[5] = 0.0;
p_stop[3] = p_stop[4] = p_stop[5] = 0.0;
p_period[3] = p_period[4] = p_period[5] = force->numeric(FLERR,arg[iarg+3]);
p_period[3] = p_period[4] = p_period[5] =
force->numeric(FLERR,arg[iarg+3]);
p_flag[3] = p_flag[4] = p_flag[5] = 1;
if (dimension == 2) {
p_start[2] = p_stop[2] = p_period[2] = 0.0;
@ -692,10 +696,6 @@ void FixNH::init()
void FixNH::setup(int vflag)
{
// initialize some quantities that were not available earlier
tdof = temperature->dof;
// t_target is needed by NPH and NPT in compute_scalar()
// If no thermostat or using fix nphug,
// t_target must be defined by other means.
@ -723,6 +723,8 @@ void FixNH::setup(int vflag)
if (pstat_flag) compute_press_target();
t_current = temperature->compute_scalar();
tdof = temperature->dof;
if (pstat_flag) {
if (pstyle == ISO) pressure->compute_scalar();
else pressure->compute_vector();
@ -851,6 +853,8 @@ void FixNH::final_integrate()
// compute appropriately coupled elements of mvv_current
t_current = temperature->compute_scalar();
tdof = temperature->dof;
if (pstat_flag) {
if (pstyle == ISO) pressure->compute_scalar();
else pressure->compute_vector();
@ -903,7 +907,7 @@ void FixNH::initial_integrate_respa(int vflag, int ilevel, int iloop)
temperature->compute_scalar();
pressure->compute_scalar();
} else {
temperature->compute_vector();
temperature->compute_vector();
pressure->compute_vector();
}
couple();

View File

@ -135,6 +135,8 @@ void FixTempBerendsen::init()
void FixTempBerendsen::end_of_step()
{
double t_current = temperature->compute_scalar();
double tdof = temperature->dof;
if (t_current == 0.0)
error->all(FLERR,
"Computed temperature for fix temp/berendsen cannot be 0.0");
@ -162,7 +164,7 @@ void FixTempBerendsen::end_of_step()
// OK to not test returned v = 0, since lamda is multiplied by v
double lamda = sqrt(1.0 + update->dt/t_period*(t_target/t_current - 1.0));
double efactor = 0.5 * force->boltz * temperature->dof;
double efactor = 0.5 * force->boltz * tdof;
energy += t_current * (1.0-lamda*lamda) * efactor;
double **v = atom->v;

View File

@ -271,7 +271,12 @@ void Modify::init()
void Modify::setup(int vflag)
{
// compute setup needs to come before fix setup
// b/c NH fixes need DOF of temperature computes
// b/c NH fixes need DOF of temperature computes
// fix group setup() is special case since populates a dynamic group
// needs to be done before temperature compute setup
for (int i = 0; i < nfix; i++)
if (strcmp(fix[i]->style,"GROUP") == 0) fix[i]->setup(vflag);
for (int i = 0; i < ncompute; i++) compute[i]->setup();