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

This commit is contained in:
sjplimp
2007-11-30 21:54:30 +00:00
parent d9df67ded2
commit 8fb52958ce
124 changed files with 4220 additions and 3618 deletions

View File

@ -13,6 +13,7 @@
#include "stdlib.h"
#include "integrate.h"
#include "modify.h"
#include "compute.h"
using namespace LAMMPS_NS;
@ -21,33 +22,99 @@ using namespace LAMMPS_NS;
Integrate::Integrate(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
{
elist = vlist = NULL;
elist_global = elist_atom = NULL;
vlist_global = vlist_atom = NULL;
}
/* ---------------------------------------------------------------------- */
Integrate::~Integrate()
{
delete [] elist;
delete [] vlist;
delete [] elist_global;
delete [] elist_atom;
delete [] vlist_global;
delete [] vlist_atom;
}
/* ----------------------------------------------------------------------
set eflag if a pe compute is called this timestep
set vflag if a pressure compute is called this timestep
setup lists of computes for global and per-atom PE and pressure
------------------------------------------------------------------------- */
void Integrate::ev_setup()
{
delete [] elist_global;
delete [] elist_atom;
delete [] vlist_global;
delete [] vlist_atom;
elist_global = elist_atom = NULL;
vlist_global = vlist_atom = NULL;
nelist_global = nelist_atom = 0;
nvlist_global = nvlist_atom = 0;
for (int i = 0; i < modify->ncompute; i++) {
if (modify->compute[i]->peflag) nelist_global++;
if (modify->compute[i]->peatomflag) nelist_atom++;
if (modify->compute[i]->pressflag) nvlist_global++;
if (modify->compute[i]->pressatomflag) nvlist_atom++;
}
if (nelist_global) elist_global = new Compute*[nelist_global];
if (nelist_atom) elist_atom = new Compute*[nelist_atom];
if (nvlist_global) vlist_global = new Compute*[nvlist_global];
if (nvlist_atom) vlist_atom = new Compute*[nvlist_atom];
nelist_global = nelist_atom = 0;
nvlist_global = nvlist_atom = 0;
for (int i = 0; i < modify->ncompute; i++) {
if (modify->compute[i]->peflag)
elist_global[nelist_global++] = modify->compute[i];
if (modify->compute[i]->peatomflag)
elist_atom[nelist_atom++] = modify->compute[i];
if (modify->compute[i]->pressflag)
vlist_global[nvlist_global++] = modify->compute[i];
if (modify->compute[i]->pressatomflag)
vlist_atom[nvlist_atom++] = modify->compute[i];
}
}
/* ----------------------------------------------------------------------
set eflag,vflag for current iteration with ntimestep
eflag = 0 = no energy computation
eflag = 1 = global energy only
eflag = 2 = per-atom energy only
eflag = 3 = both global and per-atom energy
vflag = 0 = no virial computation (pressure)
vflag = 1 = global virial with pair portion via sum of pairwise interactions
vflag = 2 = global virial with pair portion via F dot r including ghosts
vflag = 4 = per-atom virial only
vflag = 5 or 6 = both global and per-atom virial
------------------------------------------------------------------------- */
void Integrate::ev_set(int ntimestep)
{
int i;
eflag = 0;
for (i = 0; i < nelist; i++)
if (elist[i]->match_step(ntimestep)) break;
if (i < nelist) eflag = 1;
int eflag_global = 0;
for (i = 0; i < nelist_global; i++)
if (elist_global[i]->match_step(ntimestep)) break;
if (i < nelist_global) eflag_global = 1;
vflag = 0;
for (i = 0; i < nvlist; i++)
if (vlist[i]->match_step(ntimestep)) break;
if (i < nvlist) vflag = virial_style;
int eflag_atom = 0;
for (i = 0; i < nelist_atom; i++)
if (elist_atom[i]->match_step(ntimestep)) break;
if (i < nelist_atom) eflag_atom = 2;
eflag = eflag_global + eflag_atom;
int vflag_global = 0;
for (i = 0; i < nvlist_global; i++)
if (vlist_global[i]->match_step(ntimestep)) break;
if (i < nvlist_global) vflag_global = virial_style;
int vflag_atom = 0;
for (i = 0; i < nvlist_atom; i++)
if (vlist_atom[i]->match_step(ntimestep)) break;
if (i < nvlist_atom) vflag_atom = 4;
vflag = vflag_global + vflag_atom;
}