more changes

This commit is contained in:
Plimpton
2021-01-21 12:16:39 -07:00
parent 2c1b6adce3
commit 20650dc7ce
5 changed files with 15 additions and 11 deletions

View File

@ -149,7 +149,7 @@ void ComputeCentroidStressAtom::init()
if (fixflag) {
for (int ifix = 0; ifix < modify->nfix; ifix++)
if (modify->fix[ifix]->virial_flag &&
if (modify->fix[ifix]->virial_peratom_flag &&
modify->fix[ifix]->centroidstressflag == CENTROID_NOTAVAIL)
error->all(FLERR, "Fix style does not support compute centroid/stress/atom");
}
@ -273,9 +273,11 @@ void ComputeCentroidStressAtom::compute_peratom()
// fix styles are CENTROID_SAME or CENTROID_NOTAVAIL
if (fixflag) {
for (int ifix = 0; ifix < modify->nfix; ifix++)
if (modify->fix[ifix]->virial_flag) {
double **vatom = modify->fix[ifix]->vatom;
Fix **fix = modify->fix;
int nfix = modify->nfix;
for (int ifix = 0; ifix < nfix; ifix++)
if (fix[ifix]->virial_peratom_flag && fix[ifix]->thermo_virial) {
double **vatom = fix[ifix]->vatom;
if (vatom)
for (i = 0; i < nlocal; i++) {
for (j = 0; j < 6; j++)

View File

@ -222,7 +222,7 @@ void ComputeStressAtom::compute_peratom()
Fix **fix = modify->fix;
int nfix = modify->nfix;
for (int ifix = 0; ifix < nfix; ifix++)
if (fix[i]->virial_peratom_flag && fix[ifix]->virial_flag) {
if (fix[i]->virial_peratom_flag && fix[ifix]->thermo_virial) {
double **vatom = modify->fix[ifix]->vatom;
if (vatom)
for (i = 0; i < nlocal; i++)

View File

@ -67,7 +67,6 @@ Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) :
virial_global_flag = virial_peratom_flag = 0;
ecouple_flag = 0;
rigid_flag = 0;
peatom_flag = 0;
no_change_box = 0;
time_integrate = 0;
time_depend = 0;
@ -152,7 +151,8 @@ void Fix::modify_params(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
if (strcmp(arg[iarg+1],"no") == 0) thermo_energy = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) {
if (energy_flag == 0) error->all(FLERR,"Illegal fix_modify command");
if (energy_global_flag == 0 && energy_peratom_flag == 0)
error->all(FLERR,"Illegal fix_modify command");
thermo_energy = 1;
} else error->all(FLERR,"Illegal fix_modify command");
iarg += 2;
@ -160,7 +160,8 @@ void Fix::modify_params(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command");
if (strcmp(arg[iarg+1],"no") == 0) thermo_virial = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) {
if (virial_flag == 0) error->all(FLERR,"Illegal fix_modify command");
if (virial_global_flag == 0 && virial_peratom_flag == 0)
error->all(FLERR,"Illegal fix_modify command");
thermo_virial = 1;
} else error->all(FLERR,"Illegal fix_modify command");
iarg += 2;

View File

@ -510,7 +510,7 @@ double Modify::energy_couple()
double Modify::energy_global()
{
double energy = 0.0;
for (i = 0; i < n_energy_global; i++)
for (int i = 0; i < n_energy_global; i++)
energy += fix[list_energy_global[i]]->compute_scalar();
return energy;
}

View File

@ -1366,7 +1366,8 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
compute_enthalpy();
} else if (strcmp(word,"ecouple") == 0) compute_ecouple();
} else if (strcmp(word,"econserve") == 0) {
else if (strcmp(word,"econserve") == 0) {
if (!pe)
error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe");
@ -1765,7 +1766,7 @@ void Thermo::compute_etotal()
void Thermo::compute_ecouple()
{
dvalue = modify->ecouple();
dvalue = modify->energy_couple();
}
/* ---------------------------------------------------------------------- */