remove old versions of read_dump and rerun w/o parallel reading support
This commit is contained in:
1011
src/read_dump2.cpp
1011
src/read_dump2.cpp
File diff suppressed because it is too large
Load Diff
172
src/read_dump2.h
172
src/read_dump2.h
@ -1,172 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
|
||||
Contributed by Timothy Sirk
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef COMMAND_CLASS
|
||||
|
||||
CommandStyle(read_dump2,ReadDump2)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_READ_DUMP2_H
|
||||
#define LMP_READ_DUMP2_H
|
||||
|
||||
#include <cstdio>
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class ReadDump2 : protected Pointers {
|
||||
public:
|
||||
ReadDump2(class LAMMPS *);
|
||||
~ReadDump2();
|
||||
void command(int, char **);
|
||||
|
||||
void store_files(int, char **);
|
||||
void setup_reader(int, char **);
|
||||
bigint seek(bigint, int);
|
||||
void header(int);
|
||||
bigint next(bigint, bigint, int, int);
|
||||
void atoms();
|
||||
int fields_and_keywords(int, char **);
|
||||
|
||||
private:
|
||||
int me,nprocs;
|
||||
FILE *fp;
|
||||
|
||||
int dimension;
|
||||
int triclinic;
|
||||
|
||||
int nfile; // # of dump files to process
|
||||
char **files; // list of file names
|
||||
int currentfile; // currently open file
|
||||
|
||||
int boxflag; // overwrite simulation with dump file box params
|
||||
int replaceflag,addflag; // flags for processing dump snapshot atoms
|
||||
int trimflag,purgeflag;
|
||||
int scaleflag; // user 0/1 if dump file coords are unscaled/scaled
|
||||
int wrapflag; // user 0/1 if dump file coords are unwrapped/wrapped
|
||||
char *readerstyle; // style of dump files to read
|
||||
|
||||
int nfield; // # of fields to extract from dump file
|
||||
int *fieldtype; // type of each field = X,VY,IZ,etc
|
||||
char **fieldlabel; // user specified label for field
|
||||
double **fields; // per-atom field values
|
||||
|
||||
int scaled; // 0/1 if dump file coords are unscaled/scaled
|
||||
int wrapped; // 0/1 if dump file coords are unwrapped/wrapped
|
||||
|
||||
double box[3][3]; // dump file box parameters
|
||||
double xlo,xhi,ylo,yhi,zlo,zhi,xy,xz,yz; // dump snapshot box params
|
||||
double xprd,yprd,zprd;
|
||||
|
||||
bigint nsnapatoms; // # of atoms in dump file shapshot
|
||||
|
||||
int npurge,nreplace,ntrim,nadd; // stats on processed atoms
|
||||
int addproc; // proc that should add next atom
|
||||
int yindex,zindex; // field index for Y,Z coords
|
||||
|
||||
int *uflag; // set to 1 if snapshot atom matches owned atom
|
||||
int *ucflag,*ucflag_all; // set to 1 if snapshot chunk atom was processed
|
||||
|
||||
class Reader *reader; // class that reads dump file
|
||||
|
||||
int whichtype(char *);
|
||||
void process_atoms(int);
|
||||
void delete_atoms();
|
||||
|
||||
double xfield(int, int);
|
||||
double yfield(int, int);
|
||||
double zfield(int, int);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Read_dump command before simulation box is defined
|
||||
|
||||
The read_dump command cannot be used before a read_data, read_restart,
|
||||
or create_box command.
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Dump file does not contain requested snapshot
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Unknown dump reader style
|
||||
|
||||
The choice of dump reader style via the format keyword is unknown.
|
||||
|
||||
E: No box information in dump, must use 'box no'
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Read_dump triclinic status does not match simulation
|
||||
|
||||
Both the dump snapshot and the current LAMMPS simulation must
|
||||
be using either an orthogonal or triclinic box.
|
||||
|
||||
E: Read_dump field not found in dump file
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Read_dump xyz fields do not have consistent scaling/wrapping
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: All read_dump x,y,z fields must be specified for scaled, triclinic coords
|
||||
|
||||
For triclinic boxes and scaled coordinates you must specify all 3 of
|
||||
the x,y,z fields, else LAMMPS cannot reconstruct the unscaled
|
||||
coordinates.
|
||||
|
||||
E: Too many total atoms
|
||||
|
||||
See the setting for bigint in the src/lmptype.h file.
|
||||
|
||||
E: Read dump of atom property that isn't allocated
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Duplicate fields in read_dump command
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: If read_dump purges it cannot replace or trim
|
||||
|
||||
These operations are not compatible. See the read_dump doc
|
||||
page for details.
|
||||
|
||||
E: Read_dump cannot use 'add keep' without atom IDs
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
E: Cannot add atoms if dump file does not store atom type
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
U: No box information in dump. You have to use 'box no'
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
*/
|
||||
193
src/rerun2.cpp
193
src/rerun2.cpp
@ -1,193 +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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include "rerun2.h"
|
||||
#include "read_dump2.h"
|
||||
#include "domain.h"
|
||||
#include "update.h"
|
||||
#include "integrate.h"
|
||||
#include "modify.h"
|
||||
#include "output.h"
|
||||
#include "finish.h"
|
||||
#include "timer.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Rerun2::Rerun2(LAMMPS *lmp) : Pointers(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Rerun2::command(int narg, char **arg)
|
||||
{
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,"Rerun command before simulation box is defined");
|
||||
|
||||
if (narg < 2) error->all(FLERR,"Illegal rerun command");
|
||||
|
||||
// list of dump files = args until a keyword
|
||||
|
||||
int iarg = 0;
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"first") == 0) break;
|
||||
if (strcmp(arg[iarg],"last") == 0) break;
|
||||
if (strcmp(arg[iarg],"every") == 0) break;
|
||||
if (strcmp(arg[iarg],"skip") == 0) break;
|
||||
if (strcmp(arg[iarg],"start") == 0) break;
|
||||
if (strcmp(arg[iarg],"stop") == 0) break;
|
||||
if (strcmp(arg[iarg],"dump") == 0) break;
|
||||
iarg++;
|
||||
}
|
||||
int nfile = iarg;
|
||||
if (nfile == 0 || nfile == narg) error->all(FLERR,"Illegal rerun command");
|
||||
|
||||
// parse optional args up until "dump"
|
||||
// use MAXBIGINT -1 so Output can add 1 to it and still be a big int
|
||||
|
||||
bigint first = 0;
|
||||
bigint last = MAXBIGINT - 1;
|
||||
int nevery = 0;
|
||||
int nskip = 1;
|
||||
int startflag = 0;
|
||||
int stopflag = 0;
|
||||
bigint start = -1;
|
||||
bigint stop = -1;
|
||||
|
||||
while (iarg < narg) {
|
||||
if (strcmp(arg[iarg],"first") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
first = force->bnumeric(FLERR,arg[iarg+1]);
|
||||
if (first < 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"last") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
last = force->bnumeric(FLERR,arg[iarg+1]);
|
||||
if (last < 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"every") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
nevery = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (nevery < 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"skip") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
nskip = force->inumeric(FLERR,arg[iarg+1]);
|
||||
if (nskip <= 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"start") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
startflag = 1;
|
||||
start = force->bnumeric(FLERR,arg[iarg+1]);
|
||||
if (start < 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"stop") == 0) {
|
||||
if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command");
|
||||
stopflag = 1;
|
||||
stop = force->bnumeric(FLERR,arg[iarg+1]);
|
||||
if (stop < 0) error->all(FLERR,"Illegal rerun command");
|
||||
iarg += 2;
|
||||
} else if (strcmp(arg[iarg],"dump") == 0) {
|
||||
break;
|
||||
} else error->all(FLERR,"Illegal rerun command");
|
||||
}
|
||||
|
||||
int nremain = narg - iarg - 1;
|
||||
if (nremain <= 0) error->all(FLERR,"Illegal rerun command");
|
||||
if (first > last) error->all(FLERR,"Illegal rerun command");
|
||||
if (startflag && stopflag && start > stop)
|
||||
error->all(FLERR,"Illegal rerun command");
|
||||
|
||||
// pass list of filenames to ReadDump
|
||||
// along with post-"dump" args and post-"format" args
|
||||
|
||||
ReadDump2 *rd = new ReadDump2(lmp);
|
||||
|
||||
rd->store_files(nfile,arg);
|
||||
if (nremain)
|
||||
nremain = rd->fields_and_keywords(nremain,&arg[narg-nremain]);
|
||||
else nremain = rd->fields_and_keywords(0,NULL);
|
||||
if (nremain) rd->setup_reader(nremain,&arg[narg-nremain]);
|
||||
else rd->setup_reader(0,NULL);
|
||||
|
||||
// perform the pseudo run
|
||||
// invoke lmp->init() only once
|
||||
// read all relevant snapshots
|
||||
// use setup_minimal() since atoms are already owned by correct procs
|
||||
// addstep_compute_all() insures energy/virial computed on every snapshot
|
||||
|
||||
update->whichflag = 1;
|
||||
|
||||
if (startflag) update->beginstep = update->firststep = start;
|
||||
else update->beginstep = update->firststep = first;
|
||||
if (stopflag) update->endstep = update->laststep = stop;
|
||||
else update->endstep = update->laststep = last;
|
||||
|
||||
int firstflag = 1;
|
||||
int ndump = 0;
|
||||
|
||||
lmp->init();
|
||||
|
||||
timer->init();
|
||||
timer->barrier_start();
|
||||
|
||||
bigint ntimestep = rd->seek(first,0);
|
||||
if (ntimestep < 0)
|
||||
error->all(FLERR,"Rerun dump file does not contain requested snapshot");
|
||||
|
||||
while (1) {
|
||||
ndump++;
|
||||
rd->header(firstflag);
|
||||
update->reset_timestep(ntimestep);
|
||||
rd->atoms();
|
||||
modify->init();
|
||||
update->integrate->setup_minimal(1);
|
||||
modify->end_of_step();
|
||||
if (firstflag) output->setup();
|
||||
else if (output->next) output->write(ntimestep);
|
||||
|
||||
firstflag = 0;
|
||||
ntimestep = rd->next(ntimestep,last,nevery,nskip);
|
||||
if (stopflag && ntimestep > stop)
|
||||
error->all(FLERR,"Read rerun dump file timestep > specified stop");
|
||||
if (ntimestep < 0) break;
|
||||
}
|
||||
|
||||
// insure thermo output on last dump timestep
|
||||
|
||||
output->next_thermo = update->ntimestep;
|
||||
output->write(update->ntimestep);
|
||||
|
||||
timer->barrier_stop();
|
||||
|
||||
update->integrate->cleanup();
|
||||
|
||||
// set update->nsteps to ndump for Finish stats to print
|
||||
|
||||
update->nsteps = ndump;
|
||||
|
||||
Finish finish(lmp);
|
||||
finish.end(1);
|
||||
|
||||
update->whichflag = 0;
|
||||
update->firststep = update->laststep = 0;
|
||||
update->beginstep = update->endstep = 0;
|
||||
|
||||
// clean-up
|
||||
|
||||
delete rd;
|
||||
}
|
||||
59
src/rerun2.h
59
src/rerun2.h
@ -1,59 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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 COMMAND_CLASS
|
||||
|
||||
CommandStyle(rerun2,Rerun2)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_RERUN2_H
|
||||
#define LMP_RERUN2_H
|
||||
|
||||
#include "pointers.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class Rerun2 : protected Pointers {
|
||||
public:
|
||||
Rerun2(class LAMMPS *);
|
||||
void command(int, char **);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Rerun command before simulation box is defined
|
||||
|
||||
The rerun command cannot be used before a read_data, read_restart, or
|
||||
create_box command.
|
||||
|
||||
E: Illegal ... command
|
||||
|
||||
Self-explanatory. Check the input script syntax and compare to the
|
||||
documentation for the command. You can use -echo screen as a
|
||||
command-line option when running LAMMPS to see the offending line.
|
||||
|
||||
E: Rerun dump file does not contain requested snapshot
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
E: Read rerun dump file timestep > specified stop
|
||||
|
||||
Self-explanatory.
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user