Commit 22f99be5 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

Merge remote-tracking branch 'github/read-dump-parallel' into collected-post-stable-patches

# Conflicts:
#	src/read_dump.cpp
parents 55077cea 4e9b987f
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@ field = {x} or {y} or {z} or {vx} or {vy} or {vz} or {q} or {ix} or {iy} or {iz}
  {ix},{iy},{iz} = image flags in each dimension
  {fx},{fy},{fz} = force components :pre
zero or more keyword/value pairs may be appended :l
keyword = {box} or {replace} or {purge} or {trim} or {add} or {label} or {scaled} or {wrapped} or {format} :l
keyword = {nfile} or {box} or {replace} or {purge} or {trim} or {add} or {label} or {scaled} or {wrapped} or {format} :l
  {nfile} value = Nfiles = how many parallel dump files exist
  {box} value = {yes} or {no} = replace simulation box with dump box
  {replace} value = {yes} or {no} = overwrite atoms with dump atoms
  {purge} value = {yes} or {no} = delete all atoms before adding dump atoms
@@ -85,9 +86,18 @@ command, after the dump snapshot is read.

If the dump filename specified as {file} ends with ".gz", the dump
file is read in gzipped format.  You cannot (yet) read a dump file
that was written in binary format with a ".bin" suffix, or to multiple
files via the "%" option in the dump file name.  See the
"dump"_dump.html command for details.
that was written in binary format with a ".bin" suffix.

You can read dump files that were written (in parallel) to multiple
files via the "%" wild-card character in the dump file name.  If any
specified dump file name contains a "%", they must all contain it.
See the "dump"_dump.html command for details.
The "%" wild-card character is only supported by the {native} format
for dump files, described next.

If reading parallel dump files, you must also use the {nfile} keyword
to tell LAMMPS how many parallel files exist, via its specified
{Nfiles} value.

The format of the dump file is selected through the {format} keyword.
If specified, it must be the last keyword used, since all remaining
+18 −7
Original line number Diff line number Diff line
@@ -89,12 +89,23 @@ this auxiliary information should be defined in the usual way, e.g. in
a data file read in by a "read_data"_read_data.html command, before
using the rerun command.

Also note that the frequency of thermodynamic or dump output from the
rerun simulation will depend on settings made in the rerun script, the
same as for output from any LAMMPS simulation.  See further info below
as to what that means if the timesteps for snapshots read from dump
files do not match the specified output frequency.

:line

If more than one dump file is specified, the dump files are read one
after the other.  It is assumed that snapshot timesteps will be in
ascending order.  If a snapshot is encountered that is not in
ascending order, it will cause the rerun command to complete.
ascending order, it will skip the snapshot until it reads one that is.
This allows skipping of a duplicate snapshot (same timestep),
e.g. that appeared at the end of one file and beginning of the next.
However if you specify a series of dump files in an incorrect order
(with respect to the timesteps they contain), you may skip large
numbers of snapshots

The {first}, {last}, {every}, {skip} keywords determine which
snapshots are read from the dump file(s).  Snapshots are skipped until
@@ -177,12 +188,12 @@ a timestep it expects to be, LAMMPS will flag an error.

The various forms of LAMMPS output, as defined by the
"thermo_style"_thermo_style.html, "thermo"_thermo.html,
"dump"_dump.html, and "restart"_restart.html commands occur on
specific timesteps.  If successive dump snapshots skip those
timesteps, then no output will be produced.  E.g. if you request
thermodynamic output every 100 steps, but the dump file snapshots are
every 1000 steps, then you will only see thermodynamic output every
1000 steps.
"dump"_dump.html, and "restart"_restart.html commands occur with
specified frequency, e.g. every N steps.  If the timestep for a dump
snapshot is not a multiple of N, then it will be read and processed,
but no output will be produced.  If you want output for every dump
snapshot, you can simply use N=1 for an output frequency, e.g. for
thermodyanmic output or new dump file output.

:line

+665 −304

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);

src/read_dump2.cpp

0 → 100644
+1011 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading