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(table,PairTable);
17 // clang-format on
18 #else
19 
20 #ifndef LMP_PAIR_TABLE_H
21 #define LMP_PAIR_TABLE_H
22 
23 #include "pair.h"
24 
25 namespace LAMMPS_NS {
26 
27 class PairTable : public Pair {
28  public:
29   PairTable(class LAMMPS *);
30   virtual ~PairTable();
31 
32   virtual void compute(int, int);
33   virtual void settings(int, char **);
34   void coeff(int, char **);
35   virtual double init_one(int, int);
36   void write_restart(FILE *);
37   void read_restart(FILE *);
38   void write_restart_settings(FILE *);
39   void read_restart_settings(FILE *);
40   virtual double single(int, int, int, int, double, double, double, double &);
41   void *extract(const char *, int &);
42 
43   enum { LOOKUP, LINEAR, SPLINE, BITMAP };
44 
45  protected:
46   int tabstyle, tablength;
47   struct Table {
48     int ninput, rflag, fpflag, match, ntablebits;
49     int nshiftbits, nmask;
50     double rlo, rhi, fplo, fphi, cut;
51     double *rfile, *efile, *ffile;
52     double *e2file, *f2file;
53     double innersq, delta, invdelta, deltasq6;
54     double *rsq, *drsq, *e, *de, *f, *df, *e2, *f2;
55   };
56   int ntables;
57   Table *tables;
58 
59   int **tabindex;
60 
61   virtual void allocate();
62   void read_table(Table *, char *, char *);
63   void param_extract(Table *, char *);
64   void bcast_table(Table *);
65   void spline_table(Table *);
66   virtual void compute_table(Table *);
67   void null_table(Table *);
68   void free_table(Table *);
69   static void spline(double *, double *, int, double, double, double *);
70   static double splint(double *, double *, double *, int, double);
71 };
72 
73 }    // namespace LAMMPS_NS
74 
75 #endif
76 #endif
77 
78 /* ERROR/WARNING messages:
79 
80 E: Pair distance < table inner cutoff: ijtype %d %d dist %g
81 
82 UNDOCUMENTED
83 
84 E: Pair distance > table outer cutoff: ijtype %d %d dist %g
85 
86 UNDOCUMENTED
87 
88 E: Illegal ... command
89 
90 Self-explanatory.  Check the input script syntax and compare to the
91 documentation for the command.  You can use -echo screen as a
92 command-line option when running LAMMPS to see the offending line.
93 
94 E: Unknown table style in pair_style command
95 
96 Style of table is invalid for use with pair_style table command.
97 
98 E: Illegal number of pair table entries
99 
100 There must be at least 2 table entries.
101 
102 E: Invalid pair table length
103 
104 Length of read-in pair table is invalid
105 
106 E: Invalid pair table cutoff
107 
108 Cutoffs in pair_coeff command are not valid with read-in pair table.
109 
110 E: Bitmapped table in file does not match requested table
111 
112 Setting for bitmapped table in pair_coeff command must match table
113 in file exactly.
114 
115 E: All pair coeffs are not set
116 
117 All pair coefficients must be set in the data file or by the
118 pair_coeff command before running a simulation.
119 
120 E: Cannot open file %s
121 
122 The specified file cannot be opened.  Check that the path and name are
123 correct. If the file is a compressed file, also check that the gzip
124 executable can be found and run.
125 
126 E: Did not find keyword in table file
127 
128 Keyword used in pair_coeff command was not found in table file.
129 
130 E: Bitmapped table is incorrect length in table file
131 
132 Number of table entries is not a correct power of 2.
133 
134 E: Premature end of file in pair table
135 
136 UNDOCUMENTED
137 
138 W: %d of %d force values in table are inconsistent with -dE/dr.\n  Should only be flagged at inflection points
139 
140 UNDOCUMENTED
141 
142 W: %d of %d distance values in table with relative error\n  over %g to re-computed values
143 
144 UNDOCUMENTED
145 
146 W: %d of %d lines in table were incomplete\n  or could not be parsed completely
147 
148 UNDOCUMENTED
149 
150 E: Invalid keyword in pair table parameters
151 
152 Keyword used in list of table parameters is not recognized.
153 
154 E: Pair table parameters did not set N
155 
156 List of pair table parameters must include N setting.
157 
158 E: Pair distance < table inner cutoff
159 
160 Two atoms are closer together than the pairwise table allows.
161 
162 E: Pair distance > table outer cutoff
163 
164 Two atoms are further apart than the pairwise table allows.
165 
166 E: Pair table cutoffs must all be equal to use with KSpace
167 
168 When using pair style table with a long-range KSpace solver, the
169 cutoffs for all atom type pairs must all be the same, since the
170 long-range solver starts at that cutoff.
171 
172 */
173