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 
14 #ifdef COMMAND_CLASS
15 // clang-format off
16 CommandStyle(write_restart,WriteRestart);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_WRITE_RESTART_H
21 #define LMP_WRITE_RESTART_H
22 
23 #include "command.h"
24 
25 namespace LAMMPS_NS {
26 
27 class WriteRestart : public Command {
28  public:
29   WriteRestart(class LAMMPS *);
30   void command(int, char **);
31   void multiproc_options(int, int, int, char **);
32   void write(const std::string &);
33 
34  private:
35   int me, nprocs;
36   FILE *fp;
37   bigint natoms;    // natoms (sum of nlocal) to write into file
38   int noinit;
39 
40   int multiproc;        // 0 = proc 0 writes for all
41                         // else # of procs writing files
42   int nclusterprocs;    // # of procs in my cluster that write to one file
43   int filewriter;       // 1 if this proc writes a file, else 0
44   int fileproc;         // ID of proc in my cluster who writes to file
45   int icluster;         // which cluster I am in
46 
47   // MPI-IO values
48 
49   int mpiioflag;                // 1 for MPIIO output, else 0
50   class RestartMPIIO *mpiio;    // MPIIO for restart file output
51   MPI_Offset headerOffset;
52 
53   void header();
54   void type_arrays();
55   void force_fields();
56   void file_layout(int);
57 
58   void magic_string();
59   void endian();
60   void version_numeric();
61 
62   void write_int(int, int);
63   void write_bigint(int, bigint);
64   void write_double(int, double);
65   void write_string(int, const char *);
66   void write_int_vec(int, int, int *);
67   void write_double_vec(int, int, double *);
68 };
69 
70 }    // namespace LAMMPS_NS
71 
72 #endif
73 #endif
74 
75 /* ERROR/WARNING messages:
76 
77 E: Write_restart command before simulation box is defined
78 
79 The write_restart command cannot be used before a read_data,
80 read_restart, or create_box command.
81 
82 E: Illegal ... command
83 
84 Self-explanatory.  Check the input script syntax and compare to the
85 documentation for the command.  You can use -echo screen as a
86 command-line option when running LAMMPS to see the offending line.
87 
88 E: Restart file MPI-IO output not allowed with % in filename
89 
90 This is because a % signifies one file per processor and MPI-IO
91 creates one large file for all processors.
92 
93 E: Writing to MPI-IO filename when MPIIO package is not installed
94 
95 Self-explanatory.
96 
97 E: Cannot use write_restart fileper without % in restart file name
98 
99 Self-explanatory.
100 
101 E: Cannot use write_restart nfile without % in restart file name
102 
103 Self-explanatory.
104 
105 E: Atom count is inconsistent, cannot write restart file
106 
107 Sum of atoms across processors does not equal initial total count.
108 This is probably because you have lost some atoms.
109 
110 E: Cannot open restart file %s
111 
112 Self-explanatory.
113 
114 */
115