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

This commit is contained in:
sjplimp 2007-10-22 23:26:34 +00:00
parent acf51990bf
commit 9c1c10e1c4
4 changed files with 24 additions and 4 deletions

View File

@ -1039,9 +1039,7 @@ void Input::region()
void Input::reset_timestep()
{
if (narg != 1) error->all("Illegal reset_timestep command");
update->ntimestep = atoi(arg[0]);
if (update->ntimestep < 0) error->all("Timestep must be >= 0");
update->reset_timestep(narg,arg);
}
/* ---------------------------------------------------------------------- */

View File

@ -79,6 +79,7 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp)
restart = NULL;
restart1 = restart2 = NULL;
restart_every = 0;
last_restart = -1;
}
/* ----------------------------------------------------------------------
@ -357,6 +358,7 @@ void Output::create_restart(int narg, char **arg)
delete [] restart2;
restart = NULL;
restart1 = restart2 = NULL;
last_restart = -1;
restart_every = atoi(arg[0]);
if (restart_every == 0) {
@ -365,7 +367,6 @@ void Output::create_restart(int narg, char **arg)
}
restart = new WriteRestart(lmp);
last_restart = -1;
int n = strlen(arg[1]) + 3;
restart1 = new char[n];

View File

@ -12,6 +12,7 @@
------------------------------------------------------------------------- */
#include "string.h"
#include "stdlib.h"
#include "update.h"
#include "neighbor.h"
#include "force.h"
@ -179,6 +180,25 @@ void Update::create_minimize(int narg, char **arg)
strcpy(minimize_style,arg[0]);
}
/* ----------------------------------------------------------------------
reset timestep from input script
do not allow dump files or a restart to be defined
------------------------------------------------------------------------- */
void Update::reset_timestep(int narg, char **arg)
{
if (narg != 1) error->all("Illegal reset_timestep command");
for (int i = 0; i < output->ndump; i++)
if (output->last_dump[i] >= 0)
error->all("Cannot reset timestep with dump file already written to");
if (output->restart && output->last_restart >= 0)
error->all("Cannot reset timestep with restart file already written");
ntimestep = atoi(arg[0]);
if (ntimestep < 0) error->all("Timestep must be >= 0");
}
/* ----------------------------------------------------------------------
memory usage of update and integrate/minimize
------------------------------------------------------------------------- */

View File

@ -44,6 +44,7 @@ class Update : protected Pointers {
void set_units(const char *);
void create_integrate(int, char **);
void create_minimize(int, char **);
void reset_timestep(int, char **);
double memory_usage();
};