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 FIX_CLASS
15 // clang-format off
16 FixStyle(box/relax,FixBoxRelax);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_FIX_BOX_RELAX_H
21 #define LMP_FIX_BOX_RELAX_H
22 
23 #include "fix.h"
24 
25 namespace LAMMPS_NS {
26 
27 class FixBoxRelax : public Fix {
28  public:
29   FixBoxRelax(class LAMMPS *, int, char **);
30   ~FixBoxRelax();
31   int setmask();
32   void init();
33 
34   double min_energy(double *);
35   void min_store();
36   void min_clearstore();
37   void min_pushstore();
38   void min_popstore();
39   int min_reset_ref();
40   void min_step(double, double *);
41   double max_alpha(double *);
42   int min_dof();
43 
44   int modify_param(int, char **);
45 
46  private:
47   int p_flag[6];
48   int pstyle, pcouple, allremap;
49   int dimension;
50   double p_target[6], p_current[6];
51   double vol0, xprdinit, yprdinit, zprdinit;
52   double vmax, pv2e, pflagsum;
53   int kspace_flag;
54 
55   int current_lifo;       // LIFO stack pointer
56   double boxlo0[2][3];    // box bounds at start of line search
57   double boxhi0[2][3];
58   double boxtilt0[2][3];    // xy,xz,yz tilts at start of line search
59   double ds[6];             // increment in scale matrix
60 
61   int scaleyz;    // 1 if yz scaled with lz
62   int scalexz;    // 1 if xz scaled with lz
63   int scalexy;    // 1 if xy scaled with ly
64 
65   double fixedpoint[3];    // Location of dilation fixed-point
66 
67   char *id_temp, *id_press;
68   class Compute *temperature, *pressure;
69   int tflag, pflag;
70 
71   int nrigid;
72   int *rfix;
73 
74   double sigma[6];        // scaled target stress
75   double utsigma[3];      // weighting for upper-tri elements
76                           // of modified sigma
77   int sigmamod_flag;      // 1 if modified sigma to be used
78   double fdev[6];         // Deviatoric force on cell
79   int deviatoric_flag;    // 0 if target stress tensor is hydrostatic
80   double h0[6];           // h_inv of reference (zero strain) box
81   double h0_inv[6];       // h_inv of reference (zero strain) box
82   int nreset_h0;          // interval for resetting h0
83   double p_hydro;         // hydrostatic component of target stress
84 
85   void remap();
86   void couple();
87 
88   void compute_sigma();
89   void compute_deviatoric();
90   double compute_strain_energy();
91   void compute_press_target();
92   double compute_scalar();
93 };
94 
95 }    // namespace LAMMPS_NS
96 
97 #endif
98 #endif
99 
100 /* ERROR/WARNING messages:
101 
102 E: Illegal ... command
103 
104 Self-explanatory.  Check the input script syntax and compare to the
105 documentation for the command.  You can use -echo screen as a
106 command-line option when running LAMMPS to see the offending line.
107 
108 E: Invalid fix box/relax command for a 2d simulation
109 
110 Fix box/relax styles involving the z dimension cannot be used in
111 a 2d simulation.
112 
113 E: Invalid fix box/relax command pressure settings
114 
115 If multiple dimensions are coupled, those dimensions must be specified.
116 
117 E: Cannot use fix box/relax on a non-periodic dimension
118 
119 When specifying a diagonal pressure component, the dimension must be
120 periodic.
121 
122 E: Cannot use fix box/relax on a 2nd non-periodic dimension
123 
124 When specifying an off-diagonal pressure component, the 2nd of the two
125 dimensions must be periodic.  E.g. if the xy component is specified,
126 then the y dimension must be periodic.
127 
128 E: Cannot use fix box/relax with tilt factor scaling on a 2nd non-periodic dimension
129 
130 When specifying scaling on a tilt factor component, the 2nd of the two
131 dimensions must be periodic.  E.g. if the xy component is specified,
132 then the y dimension must be periodic.
133 
134 E: Cannot use fix box/relax with both relaxation and scaling on a tilt factor
135 
136 When specifying scaling on a tilt factor component, that component can not
137 also be controlled by the barostat. E.g. if scalexy yes is specified and
138 also keyword tri or xy, this is wrong.
139 
140 E: Can not specify Pxy/Pxz/Pyz in fix box/relax with non-triclinic box
141 
142 Only triclinic boxes can be used with off-diagonal pressure components.
143 See the region prism command for details.
144 
145 E: Invalid fix box/relax pressure settings
146 
147 Settings for coupled dimensions must be the same.
148 
149 E: Temperature ID for fix box/relax does not exist
150 
151 Self-explanatory.
152 
153 E: Pressure ID for fix box/relax does not exist
154 
155 The compute ID needed to compute pressure for the fix does not
156 exist.
157 
158 E: Attempt to push beyond stack limit in fix box/relax
159 
160 Internal LAMMPS error.  Please report it to the developers.
161 
162 E: Attempt to pop empty stack in fix box/relax
163 
164 Internal LAMMPS error.  Please report it to the developers.
165 
166 E: Fix box/relax generated negative box length
167 
168 The pressure being applied is likely too large.  Try applying
169 it incrementally, to build to the high pressure.
170 
171 E: Could not find fix_modify temperature ID
172 
173 The compute ID for computing temperature does not exist.
174 
175 E: Fix_modify temperature ID does not compute temperature
176 
177 The compute ID assigned to the fix must compute temperature.
178 
179 W: Temperature for fix modify is not for group all
180 
181 The temperature compute is being used with a pressure calculation
182 which does operate on group all, so this may be inconsistent.
183 
184 E: Pressure ID for fix modify does not exist
185 
186 Self-explanatory.
187 
188 E: Could not find fix_modify pressure ID
189 
190 The compute ID for computing pressure does not exist.
191 
192 E: Fix_modify pressure ID does not compute pressure
193 
194 The compute ID assigned to the fix must compute pressure.
195 
196 */
197