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

This commit is contained in:
sjplimp
2008-05-16 21:58:06 +00:00
parent 07ed5774a3
commit e520a220a3
3 changed files with 22 additions and 2 deletions

View File

@ -119,6 +119,15 @@ void Compute::modify_params(int narg, char **arg)
}
}
/* ----------------------------------------------------------------------
reset extra_dof to its default value
------------------------------------------------------------------------- */
void Compute::reset_extra_dof()
{
extra_dof = domain->dimension;
}
/* ----------------------------------------------------------------------
add ntimestep to list of timesteps the compute will be called on
do not add if already in list

View File

@ -58,12 +58,14 @@ class Compute : protected Pointers {
double dof; // degrees-of-freedom for temperature
int comm_forward; // size of forward communication (0 if none)
int comm_reverse; // size of reverse communication (0 if none)
int comm_forward; // size of forward communication (0 if none)
int comm_reverse; // size of reverse communication (0 if none)
Compute(class LAMMPS *, int, char **);
virtual ~Compute();
void modify_params(int, char **);
void reset_extra_dof();
virtual void init() = 0;
virtual void init_list(int, class NeighList *) {}
virtual double compute_scalar() {return 0.0;}

View File

@ -28,6 +28,7 @@
#include "pair.h"
#include "min.h"
#include "modify.h"
#include "compute.h"
#include "bond.h"
#include "angle.h"
#include "dihedral.h"
@ -802,6 +803,14 @@ void Input::dimension()
if (domain->box_exist)
error->all("Dimension command after simulation box is defined");
domain->dimension = atoi(arg[0]);
if (domain->dimension != 2 && domain->dimension != 3)
error->all("Illegal dimension command");
// must reset default extra_dof of all computes
// since some were created before dimension command is encountered
for (int i = 0; i < modify->ncompute; i++)
modify->compute[i]->reset_extra_dof();
}
/* ---------------------------------------------------------------------- */