git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1193 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
90
src/min.cpp
90
src/min.cpp
@ -14,6 +14,8 @@
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "min.h"
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
@ -29,6 +31,18 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp)
|
||||
dmin = 1.0e-5;
|
||||
dmax = 0.1;
|
||||
lineiter = 10;
|
||||
|
||||
elist_atom = NULL;
|
||||
vlist_global = vlist_atom = NULL;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Min::~Min()
|
||||
{
|
||||
delete [] elist_atom;
|
||||
delete [] vlist_global;
|
||||
delete [] vlist_atom;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -60,3 +74,79 @@ void Min::modify_params(int narg, char **arg)
|
||||
} else error->all("Illegal min_modify command");
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
setup lists of computes for global and per-atom PE and pressure
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Min::ev_setup()
|
||||
{
|
||||
delete [] elist_atom;
|
||||
delete [] vlist_global;
|
||||
delete [] vlist_atom;
|
||||
elist_atom = NULL;
|
||||
vlist_global = vlist_atom = NULL;
|
||||
|
||||
nelist_atom = 0;
|
||||
nvlist_global = nvlist_atom = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++) {
|
||||
if (modify->compute[i]->peatomflag) nelist_atom++;
|
||||
if (modify->compute[i]->pressflag) nvlist_global++;
|
||||
if (modify->compute[i]->pressatomflag) nvlist_atom++;
|
||||
}
|
||||
|
||||
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_atom = 0;
|
||||
nvlist_global = nvlist_atom = 0;
|
||||
for (int i = 0; i < modify->ncompute; 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
|
||||
always set eflag_global = 1, since need energy every iteration
|
||||
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 Min::ev_set(int ntimestep)
|
||||
{
|
||||
int i;
|
||||
|
||||
int eflag_global = 1;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user