1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(eos/table/rx/kk,FixEOStableRXKokkos<LMPDeviceType>)
FixStyle(eos/table/rx/kk/device,FixEOStableRXKokkos<LMPDeviceType>)
FixStyle(eos/table/rx/kk/host,FixEOStableRXKokkos<LMPHostType>)
#else
#ifndef LMP_FIX_EOS_TABLE_RX_KOKKOS_H
#define LMP_FIX_EOS_TABLE_RX_KOKKOS_H
#include "fix_eos_table_rx.h"
#include "kokkos_type.h"
namespace LAMMPS_NS {
struct TagFixEOStableRXInit{};
struct TagFixEOStableRXSetup{};
struct TagFixEOStableRXTemperatureLookup{};
struct TagFixEOStableRXTemperatureLookup2{};
template<class DeviceType>
class FixEOStableRXKokkos : public FixEOStableRX {
public:
typedef DeviceType device_type;
typedef ArrayTypes<DeviceType> AT;
typedef EV_FLOAT value_type;
FixEOStableRXKokkos(class LAMMPS *, int, char **);
virtual ~FixEOStableRXKokkos();
void setup(int);
void init();
void post_integrate();
void end_of_step();
KOKKOS_INLINE_FUNCTION
void operator()(TagFixEOStableRXInit, const int&) const;
KOKKOS_INLINE_FUNCTION
void operator()(TagFixEOStableRXSetup, const int&) const;
KOKKOS_INLINE_FUNCTION
void operator()(TagFixEOStableRXTemperatureLookup, const int&) const;
KOKKOS_INLINE_FUNCTION
void operator()(TagFixEOStableRXTemperatureLookup2, const int&) const;
KOKKOS_INLINE_FUNCTION
void energy_lookup(int, double, double &) const;
KOKKOS_INLINE_FUNCTION
void temperature_lookup(int, double, double &) const;
protected:
//struct Table {
// int ninput;
// double lo,hi;
// double *rfile,*efile;
// double *e2file;
// double delta,invdelta,deltasq6;
// double *r,*e,*de,*e2;
//};
//Table *tables, *tables2;
/*struct TableDeviceConst {
typename ArrayTypes<DeviceType>::t_int_1d_randomread lo,hi;
typename ArrayTypes<DeviceType>::t_ffloat_1d_randomread invdelta;
typename ArrayTypes<DeviceType>::t_ffloat_2d_randomread r,e,de;
};*/
//Its faster not to use texture fetch if the number of tables is less than 32!
struct TableDeviceConst {
typename ArrayTypes<DeviceType>::t_int_1d lo,hi;
typename ArrayTypes<DeviceType>::t_ffloat_1d invdelta;
typename ArrayTypes<DeviceType>::t_ffloat_2d_randomread r,e,de;
};
struct TableDevice {
typename ArrayTypes<DeviceType>::t_int_1d lo,hi;
typename ArrayTypes<DeviceType>::t_ffloat_1d invdelta;
typename ArrayTypes<DeviceType>::t_ffloat_2d r,e,de;
};
struct TableHost {
typename ArrayTypes<LMPHostType>::t_int_1d lo,hi;
typename ArrayTypes<LMPHostType>::t_ffloat_1d invdelta;
typename ArrayTypes<LMPHostType>::t_ffloat_2d r,e,de;
};
TableDeviceConst d_table_const;
TableDevice* d_table;
TableHost* h_table;
int **tabindex;
double boltz;
void allocate();
void error_check();
int update_table;
void create_kokkos_tables();
DAT::tdual_float_1d k_dHf,k_energyCorr,k_tempCorrCoeff,k_moleculeCorrCoeff;
typename AT::t_float_1d d_dHf,d_energyCorr,d_tempCorrCoeff,d_moleculeCorrCoeff;
typename AT::t_int_1d mask;
typename AT::t_efloat_1d uCond,uMech,uChem,uCG,uCGnew,rho,dpdTheta,duChem;
typename AT::t_float_2d dvector;
DAT::tdual_int_scalar k_error_flag;
DAT::tdual_int_scalar k_warning_flag;
int pack_reverse_comm(int, int, double *);
void unpack_reverse_comm(int, int *, double *);
int pack_forward_comm(int , int *, double *, int, int *);
void unpack_forward_comm(int , int , double *);
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: FixEOStableRXKokkos requires a fix rx command.
The fix rx command must come before the pair style command in the input file
E: There are no rx species specified
There must be at least one species specified through the fix rx command
E: Invalid eos/table/rx length
The eos/table/rx table must have more than one entry.
E: eos/table/rx values are not increasing
The equation-of-state must an increasing function
E: FixEOStableRX requires atom_style with internal temperature and energies (e.g. dpd)
Self-explanatory.
E: Internal temperature <= zero.
Self-explanatory.
E: Cannot open eos table/rx potential file %s
Self-explanatory.
E: Incorrect format in eos table/rx file
Self-explanatory.
E: Cannot open file %s
Self-explanatory.
E: Did not find keyword in table file
Self-explanatory.
E: Illegal fix eos/table/rx command
Incorrect number of arguments specified for the fix eos/table/rx command.
E: Invalid keyword in fix eos/table/rx parameters
Self-explanatory.
E: The number of columns in fix eos/table/rx does not match the number of species.
Self-explanatory. Check format for fix eos/table/rx file.
E: fix eos/table/rx parameters did not set N
The number of table entries was not set in the eos/table/rx file
W: Secant solver did not converge because table bounds were exceeded
The secant solver failed to converge, resulting in the lower or upper table bound temperature to be returned
E: NaN detected in secant solver.
Self-explanatory.
E: Maxit exceeded in secant solver
The maximum number of interations was exceeded in the secant solver
*/