From 20650dc7ceb616c336be8266c1cf14fb624cac79 Mon Sep 17 00:00:00 2001 From: Plimpton Date: Thu, 21 Jan 2021 12:16:39 -0700 Subject: [PATCH] more changes --- src/compute_centroid_stress_atom.cpp | 10 ++++++---- src/compute_stress_atom.cpp | 2 +- src/fix.cpp | 7 ++++--- src/modify.cpp | 2 +- src/thermo.cpp | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 1b814961a0..fa3122f5d6 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -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++) diff --git a/src/compute_stress_atom.cpp b/src/compute_stress_atom.cpp index 5f6b336802..88b092ecba 100644 --- a/src/compute_stress_atom.cpp +++ b/src/compute_stress_atom.cpp @@ -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++) diff --git a/src/fix.cpp b/src/fix.cpp index c63893ea13..074040a4d8 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -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; diff --git a/src/modify.cpp b/src/modify.cpp index 1dcd439c8e..71fce8937a 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -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; } diff --git a/src/thermo.cpp b/src/thermo.cpp index 626dc09c3f..9e4658fcdb 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -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(); } /* ---------------------------------------------------------------------- */