mirror of https://github.com/lammps/lammps.git
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@2364 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
d2dd4068b6
commit
25baa261e9
|
@ -198,7 +198,8 @@ void PPPM::init()
|
|||
while (order > 0) {
|
||||
|
||||
if (iteration && me == 0)
|
||||
error->warning("Reducing PPPM order b/c stencil extends beyond neighbor processor");
|
||||
error->warning("Reducing PPPM order b/c stencil extends "
|
||||
"beyond neighbor processor");
|
||||
iteration++;
|
||||
|
||||
set_grid();
|
||||
|
|
|
@ -39,6 +39,7 @@ enum{ID,MOL,TYPE,MASS,X,Y,Z,XS,YS,ZS,XU,YU,ZU,IX,IY,IZ,
|
|||
COMPUTE,FIX,VARIABLE};
|
||||
enum{LT,LE,GT,GE,EQ,NEQ};
|
||||
enum{INT,DOUBLE};
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
@ -267,15 +268,14 @@ int DumpCustom::count()
|
|||
}
|
||||
|
||||
// invoke Computes for per-atom dump quantities
|
||||
// only if not already invoked
|
||||
|
||||
if (ncompute) {
|
||||
int ntimestep = update->ntimestep;
|
||||
for (i = 0; i < ncompute; i++) {
|
||||
if (compute[i]->invoked_peratom != ntimestep)
|
||||
for (i = 0; i < ncompute; i++)
|
||||
if (!(compute[i]->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute[i]->compute_peratom();
|
||||
compute[i]->invoked_flag = 1;
|
||||
}
|
||||
compute[i]->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
}
|
||||
|
||||
// evaluate atom-style Variables for per-atom dump quantities
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{X,V,F,COMPUTE,FIX,VARIABLE};
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
@ -309,8 +310,10 @@ void FixAveAtom::end_of_step()
|
|||
|
||||
} else if (which[m] == COMPUTE) {
|
||||
Compute *compute = modify->compute[n];
|
||||
if (compute->invoked_peratom != ntimestep) compute->compute_peratom();
|
||||
compute->invoked_flag = 1;
|
||||
if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
|
||||
if (j == 0) {
|
||||
double *compute_scalar = compute->scalar_atom;
|
||||
|
|
|
@ -36,6 +36,7 @@ enum{X,V,F,DENSITY_NUMBER,DENSITY_MASS,COMPUTE,FIX,VARIABLE};
|
|||
enum{SAMPLE,ALL};
|
||||
enum{BOX,LATTICE,REDUCED};
|
||||
enum{ONE,RUNNING,WINDOW};
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
#define BIG 1000000000
|
||||
|
||||
|
@ -622,8 +623,10 @@ void FixAveSpatial::end_of_step()
|
|||
|
||||
} else if (which[m] == COMPUTE) {
|
||||
Compute *compute = modify->compute[n];
|
||||
if (compute->invoked_peratom != ntimestep) compute->compute_peratom();
|
||||
compute->invoked_flag = 1;
|
||||
if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
double *scalar = compute->scalar_atom;
|
||||
double **vector = compute->vector_atom;
|
||||
int jm1 = j - 1;
|
||||
|
|
|
@ -31,6 +31,7 @@ using namespace LAMMPS_NS;
|
|||
|
||||
enum{COMPUTE,FIX,VARIABLE};
|
||||
enum{ONE,RUNNING,WINDOW};
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
@ -351,13 +352,17 @@ void FixAveTime::end_of_step()
|
|||
Compute *compute = modify->compute[m];
|
||||
|
||||
if (argindex[i] == 0) {
|
||||
if (compute->invoked_scalar == ntimestep) vector[i] += compute->scalar;
|
||||
else vector[i] += compute->compute_scalar();
|
||||
compute->invoked_flag = 1;
|
||||
if (!(compute->invoked_flag & INVOKED_SCALAR)) {
|
||||
compute->compute_scalar();
|
||||
compute->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
vector[i] += compute->compute_scalar();
|
||||
} else {
|
||||
if (compute->invoked_vector != ntimestep) compute->compute_vector();
|
||||
if (!(compute->invoked_flag & INVOKED_VECTOR)) {
|
||||
compute->compute_vector();
|
||||
compute->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
vector[i] += compute->vector[argindex[i]-1];
|
||||
compute->invoked_flag = 1;
|
||||
}
|
||||
|
||||
// access fix fields, guaranteed to be ready
|
||||
|
|
|
@ -684,21 +684,22 @@ int Modify::find_compute(char *id)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
loop only over computes that store invocation times
|
||||
clear their invoked flag for this step
|
||||
called before computes are invoked
|
||||
clear invoked flag of all computes
|
||||
called everywhere that computes are used, before computes are invoked
|
||||
invoked flag used to avoid re-invoking same compute multiple times
|
||||
and to flag computes that store invocation times as having been invoked
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Modify::clearstep_compute()
|
||||
{
|
||||
for (int icompute = 0; icompute < n_timeflag; icompute++)
|
||||
for (int icompute = 0; icompute < ncompute; icompute++)
|
||||
compute[list_timeflag[icompute]]->invoked_flag = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
loop only over computes that store invocation times
|
||||
if its invoked flag set on this timestep, schedule the next invocation
|
||||
called after computes are invoked
|
||||
loop over computes that store invocation times
|
||||
if its invoked flag set on this timestep, schedule next invocation
|
||||
called everywhere that computes are used, after computes are invoked
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Modify::addstep_compute(int newstep)
|
||||
|
@ -709,8 +710,8 @@ void Modify::addstep_compute(int newstep)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
loop over all computes
|
||||
schedule the next invocation for those that store invocation times
|
||||
loop over computes that store invocation times
|
||||
schedule next invocation for all of them
|
||||
called when not sure what computes will be needed on newstep
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -195,7 +195,8 @@ void Run::command(int narg, char **arg)
|
|||
if (postflag || nleft <= nsteps) finish.end(1);
|
||||
else finish.end(0);
|
||||
|
||||
// command string may invoke computes so wrap with clear/add
|
||||
// command string may invoke computes via command with variable
|
||||
// so wrap with clearstep/addstep
|
||||
|
||||
if (commandstr) {
|
||||
modify->clearstep_compute();
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef PairInclude
|
||||
#include "pair_meam.h"
|
||||
#endif
|
||||
|
||||
#ifdef PairClass
|
||||
PairStyle(meam,PairMEAM)
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
http://lammps.sandia.gov, Sandia National Laboratories
|
||||
Steve Plimpton, sjplimp@sandia.gov
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef FixInclude
|
||||
#include "fix_poems.h"
|
||||
#endif
|
||||
|
||||
#ifdef FixClass
|
||||
FixStyle(poems,FixPOEMS)
|
||||
#endif
|
295
src/thermo.cpp
295
src/thermo.cpp
|
@ -53,6 +53,7 @@ using namespace LAMMPS_NS;
|
|||
enum{IGNORE,WARN,ERROR}; // same as write_restart.cpp
|
||||
enum{ONELINE,MULTILINE};
|
||||
enum{INT,FLOAT};
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define DELTA 8
|
||||
|
@ -268,16 +269,18 @@ void Thermo::compute(int flag)
|
|||
// invoke Compute methods needed for thermo keywords
|
||||
// which = 0 is global scalar, which = 1 is global vector
|
||||
|
||||
for (i = 0; i < ncompute; i++) {
|
||||
for (i = 0; i < ncompute; i++)
|
||||
if (compute_which[i] == 0) {
|
||||
if (computes[i]->invoked_scalar != ntimestep)
|
||||
if (!(computes[i]->invoked_flag & INVOKED_SCALAR)) {
|
||||
computes[i]->compute_scalar();
|
||||
computes[i]->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
} else {
|
||||
if (computes[i]->invoked_vector != ntimestep)
|
||||
if (!(computes[i]->invoked_flag & INVOKED_VECTOR)) {
|
||||
computes[i]->compute_vector();
|
||||
computes[i]->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
}
|
||||
computes[i]->invoked_flag = 1;
|
||||
}
|
||||
|
||||
// if lineflag = MULTILINE, prepend step/cpu header line
|
||||
|
||||
|
@ -826,13 +829,12 @@ void Thermo::create_compute(char *id, char *cstyle, char *extra)
|
|||
int Thermo::evaluate_keyword(char *word, double *answer)
|
||||
{
|
||||
// invoke a lo-level thermo routine to compute the variable value
|
||||
// if keyword requires a compute, is error if thermo doesn't use the compute
|
||||
// if in middle of run and needed compute is not current, invoke it
|
||||
// if keyword requires a compute, error if thermo doesn't use the compute
|
||||
// if inbetween runs and needed compute is not current, error
|
||||
// set invoked flag for pe and pressure for keywords that use them
|
||||
// this insures tallying on future needed steps via clearstep/addstep
|
||||
// if in middle of run and needed compute is not current, invoke it
|
||||
// for keywords that use pe indirectly (evdwl, ebond, etc):
|
||||
// check if energy was tallied on this timestep and set pe->invoked_flag
|
||||
// this will trigger next timestep for energy tallying via addstep()
|
||||
|
||||
if (strcmp(word,"step") == 0) {
|
||||
compute_step();
|
||||
|
@ -848,168 +850,196 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
|||
|
||||
} else if (strcmp(word,"temp") == 0) {
|
||||
if (!temperature)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init temp");
|
||||
if (temperature->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else temperature->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init temp");
|
||||
if (update->whichflag < 0) {
|
||||
if (temperature->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) {
|
||||
temperature->compute_scalar();
|
||||
temperature->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
compute_temp();
|
||||
|
||||
} else if (strcmp(word,"press") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_SCALAR)) {
|
||||
pressure->compute_scalar();
|
||||
pressure->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_press();
|
||||
|
||||
} else if (strcmp(word,"pe") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (pe->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pe->compute_scalar();
|
||||
if (update->whichflag < 0) {
|
||||
if (pe->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pe->invoked_flag & INVOKED_SCALAR)) {
|
||||
pe->compute_scalar();
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
pe->invoked_flag = 1;
|
||||
compute_pe();
|
||||
|
||||
} else if (strcmp(word,"ke") == 0) {
|
||||
if (!temperature)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init temp");
|
||||
if (temperature->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else temperature->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init temp");
|
||||
if (update->whichflag < 0) {
|
||||
if (temperature->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) {
|
||||
temperature->compute_scalar();
|
||||
temperature->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
compute_ke();
|
||||
|
||||
} else if (strcmp(word,"etotal") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (pe->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pe->compute_scalar();
|
||||
if (update->whichflag < 0) {
|
||||
if (pe->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pe->invoked_flag & INVOKED_SCALAR)) {
|
||||
pe->compute_scalar();
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
if (!temperature)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init temp");
|
||||
if (temperature->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else temperature->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init temp");
|
||||
if (update->whichflag < 0) {
|
||||
if (temperature->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) {
|
||||
temperature->compute_scalar();
|
||||
temperature->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
pe->invoked_flag = 1;
|
||||
compute_etotal();
|
||||
|
||||
} else if (strcmp(word,"enthalpy") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (pe->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pe->compute_scalar();
|
||||
if (update->whichflag < 0) {
|
||||
if (pe->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pe->invoked_flag & INVOKED_SCALAR)) {
|
||||
pe->compute_scalar();
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
if (!temperature)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init temp");
|
||||
if (temperature->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else temperature->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init temp");
|
||||
if (update->whichflag < 0) {
|
||||
if (temperature->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) {
|
||||
temperature->compute_scalar();
|
||||
temperature->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_scalar();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_SCALAR)) {
|
||||
pressure->compute_scalar();
|
||||
pressure->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
pe->invoked_flag = 1;
|
||||
pressure->invoked_flag = 1;
|
||||
compute_enthalpy();
|
||||
|
||||
} else if (strcmp(word,"evdwl") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_evdwl();
|
||||
|
||||
} else if (strcmp(word,"ecoul") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_ecoul();
|
||||
|
||||
} else if (strcmp(word,"epair") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_epair();
|
||||
|
||||
} else if (strcmp(word,"ebond") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_ebond();
|
||||
|
||||
} else if (strcmp(word,"eangle") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_eangle();
|
||||
|
||||
} else if (strcmp(word,"edihed") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_edihed();
|
||||
|
||||
} else if (strcmp(word,"eimp") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_eimp();
|
||||
|
||||
} else if (strcmp(word,"emol") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_emol();
|
||||
|
||||
} else if (strcmp(word,"elong") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_elong();
|
||||
|
||||
} else if (strcmp(word,"etail") == 0) {
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
if (update->eflag_global != update->ntimestep)
|
||||
error->all("Energy was not tallied on needed timestep");
|
||||
pe->invoked_flag = 1;
|
||||
if (!pe)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init pe");
|
||||
pe->invoked_flag |= INVOKED_SCALAR;
|
||||
compute_etail();
|
||||
|
||||
} else if (strcmp(word,"vol") == 0) compute_vol();
|
||||
|
@ -1030,68 +1060,86 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
|||
|
||||
else if (strcmp(word,"pxx") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pxx();
|
||||
|
||||
} else if (strcmp(word,"pyy") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pyy();
|
||||
|
||||
} else if (strcmp(word,"pzz") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pzz();
|
||||
|
||||
} else if (strcmp(word,"pxy") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pxy();
|
||||
|
||||
} else if (strcmp(word,"pxz") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pxz();
|
||||
|
||||
} else if (strcmp(word,"pyz") == 0) {
|
||||
if (!pressure)
|
||||
error->all("Thermo keyword in variable requires thermo to use/init press");
|
||||
if (pressure->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable thermo keyword is not current");
|
||||
else pressure->compute_vector();
|
||||
error->all("Thermo keyword in variable requires "
|
||||
"thermo to use/init press");
|
||||
if (update->whichflag < 0) {
|
||||
if (pressure->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable thermo keyword between runs "
|
||||
"is not current");
|
||||
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) {
|
||||
pressure->compute_vector();
|
||||
pressure->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
pressure->invoked_flag = 1;
|
||||
compute_pyz();
|
||||
|
||||
} else return 1;
|
||||
|
@ -1146,8 +1194,7 @@ void Thermo::compute_fix()
|
|||
|
||||
void Thermo::compute_variable()
|
||||
{
|
||||
int index = field2index[ifield];
|
||||
dvalue = input->variable->compute_equal(variables[index]);
|
||||
dvalue = input->variable->compute_equal(variables[field2index[ifield]]);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -37,6 +37,7 @@ using namespace LAMMPS_NS;
|
|||
|
||||
#define MYROUND(a) (( a-floor(a) ) >= .5) ? ceil(a) : floor(a)
|
||||
|
||||
enum{DUMMY0,INVOKED_SCALAR,INVOKED_VECTOR,DUMMMY3,INVOKED_PERATOM};
|
||||
enum{INDEX,LOOP,EQUAL,WORLD,UNIVERSE,ULOOP,ATOM};
|
||||
enum{ARG,OP};
|
||||
enum{DONE,ADD,SUBTRACT,MULTIPLY,DIVIDE,CARAT,UNARY,
|
||||
|
@ -642,7 +643,6 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
int icompute = modify->find_compute(id);
|
||||
if (icompute < 0) error->all("Invalid compute ID in variable formula");
|
||||
Compute *compute = modify->compute[icompute];
|
||||
compute->invoked_flag = 1;
|
||||
delete [] id;
|
||||
|
||||
if (domain->box_exist == 0)
|
||||
|
@ -670,11 +670,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
|
||||
if (nbracket == 0 && compute->scalar_flag) {
|
||||
|
||||
if (compute->invoked_scalar != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_scalar();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_scalar != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_SCALAR)) {
|
||||
compute->compute_scalar();
|
||||
compute->invoked_flag |= INVOKED_SCALAR;
|
||||
}
|
||||
|
||||
value1 = compute->scalar;
|
||||
if (tree) {
|
||||
Tree *newtree = new Tree();
|
||||
|
@ -690,11 +694,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
|
||||
if (index1 > compute->size_vector)
|
||||
error->all("Compute vector in variable formula is too small");
|
||||
if (compute->invoked_vector != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_vector();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_vector != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_VECTOR)) {
|
||||
compute->compute_vector();
|
||||
compute->invoked_flag |= INVOKED_VECTOR;
|
||||
}
|
||||
|
||||
value1 = compute->vector[index1-1];
|
||||
if (tree) {
|
||||
Tree *newtree = new Tree();
|
||||
|
@ -711,11 +719,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
|
||||
if (tree == NULL)
|
||||
error->all("Per-atom compute in equal-style variable formula");
|
||||
if (compute->invoked_peratom != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_peratom();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_peratom != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
|
||||
Tree *newtree = new Tree();
|
||||
newtree->type = ATOMARRAY;
|
||||
newtree->array = compute->scalar_atom;
|
||||
|
@ -728,11 +740,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
} else if (nbracket == 1 && index1 > 0 &&
|
||||
compute->peratom_flag && compute->size_peratom == 0) {
|
||||
|
||||
if (compute->invoked_peratom != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_peratom();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_peratom != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
|
||||
peratom2global(1,NULL,compute->scalar_atom,1,index1,
|
||||
tree,treestack,ntreestack,argstack,nargstack);
|
||||
|
||||
|
@ -745,11 +761,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
error->all("Per-atom compute in equal-style variable formula");
|
||||
if (index2 > compute->size_peratom)
|
||||
error->all("Compute vector in variable formula is too small");
|
||||
if (compute->invoked_peratom != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_peratom();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_peratom != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
|
||||
Tree *newtree = new Tree();
|
||||
newtree->type = ATOMARRAY;
|
||||
newtree->array = &compute->vector_atom[0][index2-1];
|
||||
|
@ -764,11 +784,15 @@ double Variable::evaluate(char *str, Tree **tree)
|
|||
|
||||
if (index2 > compute->size_peratom)
|
||||
error->all("Compute vector in variable formula is too small");
|
||||
if (compute->invoked_peratom != update->ntimestep) {
|
||||
if (update->whichflag < 0)
|
||||
error->all("Compute used in variable is not current");
|
||||
else compute->compute_peratom();
|
||||
if (update->whichflag < 0) {
|
||||
if (compute->invoked_peratom != update->ntimestep)
|
||||
error->all("Compute used in variable between runs "
|
||||
"is not current");
|
||||
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) {
|
||||
compute->compute_peratom();
|
||||
compute->invoked_flag |= INVOKED_PERATOM;
|
||||
}
|
||||
|
||||
peratom2global(1,NULL,&compute->vector_atom[0][index2-1],
|
||||
compute->size_peratom,index1,
|
||||
tree,treestack,ntreestack,argstack,nargstack);
|
||||
|
|
Loading…
Reference in New Issue