1 /* ----------------------------------------------------------------------
2     This is the
3 
4     ██╗     ██╗ ██████╗  ██████╗  ██████╗ ██╗  ██╗████████╗███████╗
5     ██║     ██║██╔════╝ ██╔════╝ ██╔════╝ ██║  ██║╚══██╔══╝██╔════╝
6     ██║     ██║██║  ███╗██║  ███╗██║  ███╗███████║   ██║   ███████╗
7     ██║     ██║██║   ██║██║   ██║██║   ██║██╔══██║   ██║   ╚════██║
8     ███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║  ██║   ██║   ███████║
9     ╚══════╝╚═╝ ╚═════╝  ╚═════╝  ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝®
10 
11     DEM simulation engine, released by
12     DCS Computing Gmbh, Linz, Austria
13     http://www.dcs-computing.com, office@dcs-computing.com
14 
15     LIGGGHTS® is part of CFDEM®project:
16     http://www.liggghts.com | http://www.cfdem.com
17 
18     Core developer and main author:
19     Christoph Kloss, christoph.kloss@dcs-computing.com
20 
21     LIGGGHTS® is open-source, distributed under the terms of the GNU Public
22     License, version 2 or later. It is distributed in the hope that it will
23     be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
24     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
25     received a copy of the GNU General Public License along with LIGGGHTS®.
26     If not, see http://www.gnu.org/licenses . See also top-level README
27     and LICENSE files.
28 
29     LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
30     the producer of the LIGGGHTS® software and the CFDEM®coupling software
31     See http://www.cfdem.com/terms-trademark-policy for details.
32 
33 -------------------------------------------------------------------------
34     Contributing author and copyright for this file:
35     This file is from LAMMPS
36     LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
37     http://lammps.sandia.gov, Sandia National Laboratories
38     Steve Plimpton, sjplimp@sandia.gov
39 
40     Copyright (2003) Sandia Corporation.  Under the terms of Contract
41     DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
42     certain rights in this software.  This software is distributed under
43     the GNU General Public License.
44 ------------------------------------------------------------------------- */
45 
46 #ifndef LMP_MIN_H
47 #define LMP_MIN_H
48 
49 #include "pointers.h"
50 
51 namespace LAMMPS_NS {
52 
53 class Min : protected Pointers {
54  public:
55   double einitial,efinal,eprevious;
56   double fnorm2_init,fnorminf_init,fnorm2_final,fnorminf_final;
57   double alpha_final;
58   int niter,neval;
59   int stop_condition;
60   char *stopstr;
61   int searchflag;     // 0 if damped dynamics, 1 if sub-cycles on local search
62 
63   Min(class LAMMPS *);
64   virtual ~Min();
65   virtual void init();
66   void setup();
67   void setup_minimal(int);
68   void run(int);
69   void cleanup();
70   int request(class Pair *, int, double);
memory_usage()71   virtual bigint memory_usage() {return 0;}
72   void modify_params(int, char **);
73   double fnorm_sqr();
74   double fnorm_inf();
75 
init_style()76   virtual void init_style() {}
77   virtual void setup_style() = 0;
78   virtual void reset_vectors() = 0;
79   virtual int iterate(int) = 0;
80 
81  protected:
82   int eflag,vflag;            // flags for energy/virial computation
83   int virial_style;           // compute virial explicitly or implicitly
84   int external_force_clear;   // clear forces locally or externally
85 
86   double dmax;                // max dist to move any atom in one step
87   int linestyle;              // 0 = backtrack, 1 = quadratic, 2 = forcezero
88 
89   int nelist_global,nelist_atom;    // # of PE,virial computes to check
90   int nvlist_global,nvlist_atom;
91   class Compute **elist_global;     // lists of PE,virial Computes
92   class Compute **elist_atom;
93   class Compute **vlist_global;
94   class Compute **vlist_atom;
95 
96   int triclinic;              // 0 if domain is orthog, 1 if triclinic
97   int pairflag;
98   int torqueflag,erforceflag;
99   int e_flag,rho_flag;
100 
101   int pair_compute_flag;            // 0 if pair->compute is skipped
102   int kspace_compute_flag;          // 0 if kspace->compute is skipped
103 
104   int narray;                       // # of arrays stored by fix_minimize
105   class FixMinimize *fix_minimize;  // fix that stores auxiliary data
106 
107   class Compute *pe_compute;        // compute for potential energy
108   double ecurrent;                  // current potential energy
109 
110   bigint ndoftotal;           // total dof for entire problem
111 
112   int nvec;                   // local atomic dof = length of xvec
113   double *xvec;               // variables for atomic dof, as 1d vector
114   double *fvec;               // force vector for atomic dof, as 1d vector
115 
116   int nextra_global;          // # of extra global dof due to fixes
117   double *fextra;             // force vector for extra global dof
118                               // xextra is stored by fix
119 
120   int nextra_atom;            // # of extra per-atom variables
121   double **xextra_atom;       // ptr to the variable
122   double **fextra_atom;       // ptr to the force on the variable
123   int *extra_peratom;         // # of values in variable, e.g. 3 in x
124   int *extra_nlen;            // total local length of variable, e.g 3*nlocal
125   double *extra_max;          // max allowed change per iter for atom's var
126   class Pair **requestor;     // Pair that stores/manipulates the variable
127 
128   int neigh_every,neigh_delay,neigh_dist_check;  // neighboring params
129 
130   double energy_force(int);
131   void force_clear();
132 
133   double compute_force_norm_sqr();
134   double compute_force_norm_inf();
135 
136   void ev_setup();
137   void ev_set(bigint);
138 
139   char *stopstrings(int);
140 };
141 
142 }
143 
144 #endif
145 
146 /* ERROR/WARNING messages:
147 
148 W: Resetting reneighboring criteria during minimization
149 
150 Minimization requires that neigh_modify settings be delay = 0, every =
151 1, check = yes.  Since these settings were not in place, LAMMPS
152 changed them and will restore them to their original values after the
153 minimization.
154 
155 E: Minimization could not find thermo_pe compute
156 
157 This compute is created by the thermo command.  It must have been
158 explicitly deleted by a uncompute command.
159 
160 E: Cannot use a damped dynamics min style with fix box/relax
161 
162 This is a current restriction in LAMMPS.  Use another minimizer
163 style.
164 
165 E: Cannot use a damped dynamics min style with per-atom DOF
166 
167 This is a current restriction in LAMMPS.  Use another minimizer
168 style.
169 
170 E: Illegal ... command
171 
172 Self-explanatory.  Check the input script syntax and compare to the
173 documentation for the command.  You can use -echo screen as a
174 command-line option when running LAMMPS to see the offending line.
175 
176 */
177