Commit 0a4007c5 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

add parallel file read capability to ReadDump

parent 85c8877a
Loading
Loading
Loading
Loading
+661 −299

File changed.

Preview size limit exceeded, changes collapsed.

+34 −13
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ CommandStyle(read_dump,ReadDump)
#ifndef LMP_READ_DUMP_H
#define LMP_READ_DUMP_H

#include <mpi.h>
#include <cstdio>
#include "pointers.h"

@@ -43,14 +44,25 @@ class ReadDump : protected Pointers {

private:
  int me,nprocs;
  FILE *fp;

  int dimension;
  int triclinic;
  char **files;            // list of input dump files to process
  int nfile;               // # of dump files to process (each may be parallel)
  int currentfile;         // current open file (0 to nfile-1)

  MPI_Comm clustercomm;    // comm for proc cluster that reads/shares a file
  int me_cluster,nprocs_cluster;  // proc ID and count for my read cluster

  int multiproc;           // 0 = each dump file is a single file
                           // 1 = each dump file is parallel (multiple files)
  int multiproc_nfile;     // number of parallel files in one dump file

  int nfile;               // # of dump files to process
  char **files;            // list of file names
  int currentfile;         // currently open file
  int nreader;             // # of parallel dump files read by my cluster
  int firstfile;           // index of 1st dump file my cluster reads
                           //   (0 to multiproc_nfile-1)
  int filereader;          // 1 if this proc reads from a dump file(s)

  int dimension;           // same as in Domain
  int triclinic;

  int boxflag;             // overwrite simulation with dump file box params
  int replaceflag,addflag; // flags for processing dump snapshot atoms
@@ -59,10 +71,13 @@ private:
  int wrapflag;            // user 0/1 if dump file coords are unwrapped/wrapped
  char *readerstyle;       // style of dump files to read

  int nnew;                // # of dump file atoms this proc owns
  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 maxnew;              // allocation size of fields array
  double **buf;            // read buffer

  int scaled;              // 0/1 if dump file coords are unscaled/scaled
  int wrapped;             // 0/1 if dump file coords are unwrapped/wrapped
@@ -71,20 +86,26 @@ private:
  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
  bigint *nsnapatoms;       // # of atoms in one snapshot from 
                            //   one (parallel) dump file
                            // nreader-length vector b/c a reader proc
                            //   may read from multiple parallel dump files

  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 **readers;   // class that reads a dump file
                            // nreader-length list of readers if proc reads
                            //   from multiple parallel dump files

  class Reader *reader;           // class that reads dump file
  void read_atoms();
  void process_atoms();
  void migrate_old_atoms();
  void migrate_new_atoms();
  void migrate_atoms_by_coords();

  void setup_multiproc();
  int whichtype(char *);
  void process_atoms(int);
  void delete_atoms();

  double xfield(int, int);
  double yfield(int, int);
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ void Rerun::command(int narg, char **arg)
  if (nfile == 0 || nfile == narg) error->all(FLERR,"Illegal rerun command");

  // parse optional args up until "dump"
  // user MAXBIGINT -1 so Output can add 1 to it and still be a big int
  // use MAXBIGINT -1 so Output can add 1 to it and still be a big int

  bigint first = 0;
  bigint last = MAXBIGINT - 1;