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 PAIR_CLASS
15 // clang-format off
16 PairStyle(extep,PairExTeP);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_PAIR_EXTEP_H
21 #define LMP_PAIR_EXTEP_H
22 
23 #include "pair.h"
24 
25 #define MAXTYPES 8
26 #define NSPLINE 5
27 
28 namespace LAMMPS_NS {
29 
30 class PairExTeP : public Pair {
31  public:
32   PairExTeP(class LAMMPS *);
33   virtual ~PairExTeP();
34   virtual void compute(int, int);
35   void settings(int, char **);
36   void coeff(int, char **);
37   void init_style();
38   double init_one(int, int);
39 
40  protected:
41   struct Param {
42     double lam1, lam2, lam3;
43     double c, d, h;
44     double gamma, powerm;
45     double powern, beta;
46     double biga, bigb, bigd, bigr;
47     double cut, cutsq;
48     double c1, c2, c3, c4;
49     int ielement, jelement, kelement;
50     int powermint;
51     double Z_i, Z_j;    // added for ExTePZBL
52     double ZBLcut, ZBLexpscale;
53     double c5, ca1, ca4;    // added for ExTePMOD
54     double powern_del;
55   };
56 
57   Param *params;    // parameter set for an I-J-K interaction
58   double cutmax;    // max cutoff for all elements
59 
60   int maxlocal;           // size of numneigh, firstneigh arrays
61   int maxpage;            // # of pages currently allocated
62   int pgsize;             // size of neighbor page
63   int oneatom;            // max # of neighbors for one atom
64   MyPage<int> *ipage;     // neighbor list pages
65   int *SR_numneigh;       // # of pair neighbors for each atom
66   int **SR_firstneigh;    // ptr to 1st neighbor of each atom
67 
68   double *Nt, *Nd;    // sum of cutoff fns ( f_C ) with SR neighs
69 
70   void allocate();
71   void spline_init();
72   virtual void read_file(char *);
73   virtual void setup();
74   virtual void repulsive(Param *, double, double &, int, double &);
75   virtual double zeta(Param *, double, double, double *, double *);
76   virtual void force_zeta(Param *, double, double, double &, double &, int, double &);
77   void attractive(Param *, double, double, double, double *, double *, double *, double *,
78                   double *);
79 
80   virtual double ters_fc(double, Param *);
81   virtual double ters_fc_d(double, Param *);
82   virtual double ters_fa(double, Param *);
83   virtual double ters_fa_d(double, Param *);
84   virtual double ters_bij(double, Param *);
85   virtual double ters_bij_d(double, Param *);
86 
87   virtual void ters_zetaterm_d(double, double *, double, double *, double, double *, double *,
88                                double *, Param *);
89   void costheta_d(double *, double, double *, double, double *, double *, double *);
90 
91   // inlined functions for efficiency
92 
ters_gijk(const double costheta,const Param * const param)93   inline double ters_gijk(const double costheta, const Param *const param) const
94   {
95     const double ters_c = param->c * param->c;
96     const double ters_d = param->d * param->d;
97     const double hcth = param->h - costheta;
98 
99     return param->gamma * (1.0 + ters_c / ters_d - ters_c / (ters_d + hcth * hcth));
100   }
101 
ters_gijk_d(const double costheta,const Param * const param)102   inline double ters_gijk_d(const double costheta, const Param *const param) const
103   {
104     const double ters_c = param->c * param->c;
105     const double ters_d = param->d * param->d;
106     const double hcth = param->h - costheta;
107     const double numerator = -2.0 * ters_c * hcth;
108     const double denominator = 1.0 / (ters_d + hcth * hcth);
109     return param->gamma * numerator * denominator * denominator;
110   }
111 
112   // splines parameters
113   // F[Ni=0-1, 1-2, 2-3,
114   //   Nj=...,
115   struct TF_corr_param {
116     double f_00, f_01, f_10, f_11, f_x_00, f_x_01, f_x_10, f_x_11, f_y_00, f_y_01, f_y_10, f_y_11;
117   } F_corr_param[MAXTYPES][MAXTYPES][NSPLINE][NSPLINE];
118 
119   double F_corr_data[MAXTYPES][MAXTYPES][NSPLINE][NSPLINE][3];
120 
121   double F_corr(int, int, double, double, double *, double *);
122   void SR_neigh();
123 
124   double envelop_function(double, double, double *);
125 };
126 
127 }    // namespace LAMMPS_NS
128 
129 #endif
130 #endif
131 
132 /* ERROR/WARNING messages:
133 
134 E: Illegal ... command
135 
136 Self-explanatory.  Check the input script syntax and compare to the
137 documentation for the command.  You can use -echo screen as a
138 command-line option when running LAMMPS to see the offending line.
139 
140 E: Incorrect args for pair coefficients
141 
142 Self-explanatory.  Check the input script or data file.
143 
144 E: Pair style ExTeP requires atom IDs
145 
146 This is a requirement to use the ExTeP potential.
147 
148 E: Pair style ExTeP requires newton pair on
149 
150 See the newton command.  This is a restriction to use the ExTeP
151 potential.
152 
153 E: All pair coeffs are not set
154 
155 All pair coefficients must be set in the data file or by the
156 pair_coeff command before running a simulation.
157 
158 E: Cannot open ExTeP potential file %s
159 
160 The specified potential file cannot be opened.  Check that the path
161 and name are correct.
162 
163 E: Incorrect format in ExTeP potential file
164 
165 Incorrect number of words per line in the potential file.
166 
167 E: Illegal ExTeP parameter
168 
169 One or more of the coefficients defined in the potential file is
170 invalid.
171 
172 E: Potential file has duplicate entry
173 
174 The potential file for a SW or ExTeP potential has more than
175 one entry for the same 3 ordered elements.
176 
177 E: Potential file is missing an entry
178 
179 The potential file for a SW or ExTeP potential does not have a
180 needed entry.
181 
182 */
183