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 INTEGRATE_CLASS
15 // clang-format off
16 IntegrateStyle(respa,Respa);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_RESPA_H
21 #define LMP_RESPA_H
22 
23 #include "integrate.h"
24 
25 namespace LAMMPS_NS {
26 
27 class Respa : public Integrate {
28  public:
29   // public so Fixes, Pairs, Neighbor can see them
30   int nlevels;         // number of rRESPA levels
31                        // 0 = innermost level, nlevels-1 = outermost level
32   double *step;        // timestep at each level
33   int *loop;           // sub-cycling factor at each level
34   double cutoff[4];    // cutoff[0] and cutoff[1] = between inner and middle
35                        // cutoff[2] and cutoff[3] = between middle and outer
36                        // if no middle then 0,1 = 2,3
37 
38   int level_bond, level_angle, level_dihedral;    // level to compute forces at
39   int level_improper, level_pair, level_kspace;
40   int level_inner, level_middle, level_outer;
41 
42   int nhybrid_styles;     // number of hybrid pair styles
43   int *hybrid_level;      // level to compute pair hybrid sub-style at
44   int *hybrid_compute;    // selects whether to compute sub-style forces
45   int tally_global;       // 1 if pair style should tally global accumulators
46   int pair_compute;       // 1 if pair force need to be computed
47 
48   Respa(class LAMMPS *, int, char **);
49   virtual ~Respa();
50   virtual void init();
51   virtual void setup(int);
52   virtual void setup_minimal(int);
53   virtual void run(int);
54   virtual void cleanup();
55   virtual void reset_dt();
56 
57   void copy_f_flevel(int);
58   void copy_flevel_f(int);
59 
60  protected:
61   int triclinic;    // 0 if domain is orthog, 1 if triclinic
62   int torqueflag, extraflag;
63 
64   int *newton;                  // newton flag at each level
65   class FixRespa *fix_respa;    // Fix to store the force level array
66 
67   virtual void recurse(int);
68   void force_clear(int);
69   void sum_flevel_f();
70   void set_compute_flags(int ilevel);
71 };
72 
73 }    // namespace LAMMPS_NS
74 
75 #endif
76 #endif
77 
78 /* ERROR/WARNING messages:
79 
80 E: Illegal ... command
81 
82 Self-explanatory.  Check the input script syntax and compare to the
83 documentation for the command.  You can use -echo screen as a
84 command-line option when running LAMMPS to see the offending line.
85 
86 E: Respa levels must be >= 1
87 
88 Self-explanatory.
89 
90 E: Cannot set both respa pair and inner/middle/outer
91 
92 In the rRESPA integrator, you must compute pairwise potentials either
93 all together (pair), or in pieces (inner/middle/outer).  You can't do
94 both.
95 
96 E: Must set both respa inner and outer
97 
98 Cannot use just the inner or outer option with respa without using the
99 other.
100 
101 E: Cannot set respa middle without inner/outer
102 
103 In the rRESPA integrator, you must define both a inner and outer
104 setting in order to use a middle setting.
105 
106 E: Cannot set respa hybrid and any of pair/inner/middle/outer
107 
108 In the rRESPA integrator, you must compute pairwise potentials either
109 all together (pair), with different cutoff regions (inner/middle/outer),
110 or per hybrid sub-style (hybrid).  You cannot mix those.
111 
112 E: Invalid order of forces within respa levels
113 
114 For respa, ordering of force computations within respa levels must
115 obey certain rules.  E.g. bonds cannot be compute less frequently than
116 angles, pairwise forces cannot be computed less frequently than
117 kspace, etc.
118 
119 W: One or more respa levels compute no forces
120 
121 This is computationally inefficient.
122 
123 E: Respa inner cutoffs are invalid
124 
125 The first cutoff must be <= the second cutoff.
126 
127 E: Respa middle cutoffs are invalid
128 
129 The first cutoff must be <= the second cutoff.
130 
131 W: No fixes defined, atoms won't move
132 
133 If you are not using a fix like nve, nvt, npt then atom velocities and
134 coordinates will not be updated during timestepping.
135 
136 E: Pair style does not support rRESPA inner/middle/outer
137 
138 You are attempting to use rRESPA options with a pair style that
139 does not support them.
140 
141 */
142