1 /* -*- c++ -*- ---------------------------------------------------------- 2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator 3 https://www.lammps.org/, Sandia National Laboratories 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 See the README file in the top-level LAMMPS directory. 12 13 Contributed by Timothy Sirk 14 ------------------------------------------------------------------------- */ 15 16 #ifdef COMMAND_CLASS 17 // clang-format off 18 CommandStyle(read_dump,ReadDump); 19 // clang-format on 20 #else 21 22 #ifndef LMP_READ_DUMP_H 23 #define LMP_READ_DUMP_H 24 25 #include "command.h" 26 27 namespace LAMMPS_NS { 28 29 class ReadDump : public Command { 30 public: 31 ReadDump(class LAMMPS *); 32 ~ReadDump(); 33 void command(int, char **); 34 35 void store_files(int, char **); 36 void setup_reader(int, char **); 37 bigint seek(bigint, int); 38 void header(int); 39 bigint next(bigint, bigint, int, int); 40 void atoms(); 41 int fields_and_keywords(int, char **); 42 43 private: 44 int me, nprocs; 45 46 char **files; // list of input dump files to process 47 int nfile; // # of dump files to process (each may be parallel) 48 int currentfile; // current open file (0 to nfile-1) 49 50 MPI_Comm clustercomm; // comm for proc cluster that reads/shares a file 51 int me_cluster, nprocs_cluster; // proc ID and count for my read cluster 52 53 int multiproc; // 0 = each dump file is a single file 54 // 1 = each dump file is parallel (multiple files) 55 int multiproc_nfile; // number of parallel files in one dump file 56 57 int nreader; // # of parallel dump files read by my cluster 58 int firstfile; // index of 1st dump file my cluster reads 59 // (0 to multiproc_nfile-1) 60 int filereader; // 1 if this proc reads from a dump file(s) 61 int parallel; // 1 if parallel reading (e.g. via ADIOS2) 62 63 int dimension; // same as in Domain 64 int triclinic; 65 66 int boxflag; // overwrite simulation with dump file box params 67 int replaceflag, addflag; // flags for processing dump snapshot atoms 68 int trimflag, purgeflag; 69 int scaleflag; // user 0/1 if dump file coords are unscaled/scaled 70 int wrapflag; // user 0/1 if dump file coords are unwrapped/wrapped 71 char *readerstyle; // style of dump files to read 72 73 int nnew; // # of dump file atoms this proc owns 74 int nfield; // # of fields to extract from dump file 75 int *fieldtype; // type of each field = X,VY,IZ,etc 76 char **fieldlabel; // user specified label for field 77 double **fields; // per-atom field values 78 int maxnew; // allocation size of fields array 79 double **buf; // read buffer 80 81 int scaled; // 0/1 if dump file coords are unscaled/scaled 82 int wrapped; // 0/1 if dump file coords are unwrapped/wrapped 83 84 double box[3][3]; // dump file box parameters 85 double xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz; // dump snapshot box params 86 double xprd, yprd, zprd; 87 88 bigint *nsnapatoms; // # of atoms in one snapshot from 89 // one (parallel) dump file 90 // nreader-length vector b/c a reader proc 91 // may read from multiple parallel dump files 92 93 int npurge, nreplace, ntrim, nadd; // stats on processed atoms 94 int yindex, zindex; // field index for Y,Z coords 95 96 class Reader **readers; // class that reads a dump file 97 // nreader-length list of readers if proc reads 98 // from multiple parallel dump files 99 100 void read_atoms(); 101 void process_atoms(); 102 void migrate_old_atoms(); 103 void migrate_new_atoms(); 104 void migrate_atoms_by_coords(); 105 106 void setup_multiproc(); 107 int whichtype(char *); 108 109 double xfield(int, int); 110 double yfield(int, int); 111 double zfield(int, int); 112 }; 113 114 } // namespace LAMMPS_NS 115 116 #endif 117 #endif 118 119 /* ERROR/WARNING messages: 120 121 E: Read_dump command before simulation box is defined 122 123 The read_dump command cannot be used before a read_data, read_restart, 124 or create_box command. 125 126 E: Illegal ... command 127 128 Self-explanatory. Check the input script syntax and compare to the 129 documentation for the command. You can use -echo screen as a 130 command-line option when running LAMMPS to see the offending line. 131 132 E: Dump file does not contain requested snapshot 133 134 Self-explanatory. 135 136 E: Unrecognized dump reader style 137 138 The choice of dump reader style via the format keyword is unknown. 139 140 E: No box information in dump, must use 'box no' 141 142 UNDOCUMENTED 143 144 E: Read_dump triclinic status does not match simulation 145 146 Both the dump snapshot and the current LAMMPS simulation must 147 be using either an orthogonal or triclinic box. 148 149 E: Read_dump field not found in dump file 150 151 Self-explanatory. 152 153 E: Read_dump xyz fields do not have consistent scaling/wrapping 154 155 Self-explanatory. 156 157 E: All read_dump x,y,z fields must be specified for scaled, triclinic coords 158 159 For triclinic boxes and scaled coordinates you must specify all 3 of 160 the x,y,z fields, else LAMMPS cannot reconstruct the unscaled 161 coordinates. 162 163 E: Too many total atoms 164 165 See the setting for bigint in the src/lmptype.h file. 166 167 E: Read dump of atom property that isn't allocated 168 169 Self-explanatory. 170 171 E: Duplicate fields in read_dump command 172 173 Self-explanatory. 174 175 E: If read_dump purges it cannot replace or trim 176 177 These operations are not compatible. See the read_dump doc 178 page for details. 179 180 E: Read_dump cannot use 'add keep' without atom IDs 181 182 UNDOCUMENTED 183 184 E: Cannot add atoms if dump file does not store atom type 185 186 UNDOCUMENTED 187 188 U: No box information in dump. You have to use 'box no' 189 190 Self-explanatory. 191 192 */ 193