1
/* -*- c++ -*- ----------------------------------------------------------
2
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
3
http://lammps.sandia.gov, Sandia National Laboratories
4
Steve Plimpton, sjplimp@sandia.gov
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.
11
See the README file in the top-level LAMMPS directory.
12
------------------------------------------------------------------------- */
16
FixStyle(langevin/kk,FixLangevinKokkos<LMPDeviceType>)
17
FixStyle(langevin/kk/device,FixLangevinKokkos<LMPDeviceType>)
18
FixStyle(langevin/kk/host,FixLangevinKokkos<LMPHostType>)
22
#ifndef LMP_FIX_LANGEVIN_KOKKOS_H
23
#define LMP_FIX_LANGEVIN_KOKKOS_H
25
#include "fix_langevin.h"
26
#include "kokkos_type.h"
27
#include "Kokkos_Random.hpp"
28
#include "comm_kokkos.h"
34
KOKKOS_INLINE_FUNCTION
38
KOKKOS_INLINE_FUNCTION
39
s_FSUM& operator+=(const s_FSUM &rhs){
46
KOKKOS_INLINE_FUNCTION
47
volatile s_FSUM& operator+=(const volatile s_FSUM &rhs) volatile {
56
template<class DeviceType>
57
class FixLangevinKokkos;
59
template<class DeviceType,int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY,
60
int Tp_BIAS, int Tp_RMASS, int Tp_ZERO>
61
class FixLangevinKokkosPostForceFunctor;
63
template<class DeviceType> class FixLangevinKokkosZeroForceFunctor;
65
template<class DeviceType> class FixLangevinKokkosTallyEnergyFunctor;
67
template<class DeviceType>
68
class FixLangevinKokkos : public FixLangevin {
70
FixLangevinKokkos(class LAMMPS *, int, char **);
77
void grow_arrays(int);
78
void copy_arrays(int i, int j, int delflag);
79
double compute_scalar();
82
template<int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY,
83
int Tp_BIAS, int Tp_RMASS, int Tp_ZERO>
84
KOKKOS_INLINE_FUNCTION
85
FSUM post_force_item(int) const;
87
KOKKOS_INLINE_FUNCTION
88
void zero_force_item(int) const;
90
KOKKOS_INLINE_FUNCTION
91
double compute_energy_item(int) const;
94
class CommKokkos *commKK;
95
class AtomKokkos *atomKK;
97
typename ArrayTypes<DeviceType>::tdual_double_2d k_franprev;
98
typename ArrayTypes<DeviceType>::t_double_2d d_franprev;
99
HAT::t_double_2d h_franprev;
101
typename ArrayTypes<DeviceType>::tdual_double_2d k_flangevin;
102
typename ArrayTypes<DeviceType>::t_double_2d d_flangevin;
103
HAT::t_double_2d h_flangevin;
105
typename ArrayTypes<DeviceType>::tdual_double_1d k_tforce;
106
typename ArrayTypes<DeviceType>::t_double_1d d_tforce;
107
HAT::t_double_1d h_tforce;
109
typename ArrayTypes<DeviceType>::t_v_array v;
110
typename ArrayTypes<DeviceType>::t_f_array f;
111
typename ArrayTypes<DeviceType>::t_int_1d type;
112
typename ArrayTypes<DeviceType>::t_int_1d mask;
114
typename ArrayTypes<DeviceType>::tdual_double_1d k_gfactor1, k_gfactor2, k_ratio;
115
typename ArrayTypes<DeviceType>::t_double_1d d_gfactor1, d_gfactor2, d_ratio;
116
HAT::t_double_1d h_gfactor1, h_gfactor2, h_ratio;
118
typedef Kokkos::DualView<double[3], DeviceType>
120
tdual_double_1d_3n k_fsumall;
121
typename tdual_double_1d_3n::t_dev d_fsumall;
122
typename tdual_double_1d_3n::t_host h_fsumall;
124
double boltz,dt,mvv2e,ftm2v,fran_prop_const;
126
void compute_target();
128
Kokkos::Random_XorShift64_Pool<DeviceType> rand_pool;
129
typedef typename Kokkos::Random_XorShift64_Pool<DeviceType>::generator_type rand_type;
133
template <class DeviceType,int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY,
134
int Tp_BIAS, int Tp_RMASS, int Tp_ZERO>
135
struct FixLangevinKokkosPostForceFunctor {
137
typedef DeviceType device_type;
138
typedef FSUM value_type;
139
FixLangevinKokkos<DeviceType> c;
141
FixLangevinKokkosPostForceFunctor(FixLangevinKokkos<DeviceType>* c_ptr):
143
~FixLangevinKokkosPostForceFunctor(){c.cleanup_copy();}
145
KOKKOS_INLINE_FUNCTION
146
void operator()(const int i) const {
147
c.template post_force_item<Tp_TSTYLEATOM,Tp_GJF, Tp_TALLY,
148
Tp_BIAS,Tp_RMASS,Tp_ZERO>(i);
151
KOKKOS_INLINE_FUNCTION
152
void operator()(const int i, value_type &fsum) const {
154
fsum += c.template post_force_item<Tp_TSTYLEATOM,Tp_GJF, Tp_TALLY,
155
Tp_BIAS,Tp_RMASS,Tp_ZERO>(i);
158
KOKKOS_INLINE_FUNCTION
159
static void init(volatile value_type &update) {
164
KOKKOS_INLINE_FUNCTION
165
static void join(volatile value_type &update,
166
const volatile value_type &source) {
167
update.fx += source.fx;
168
update.fy += source.fy;
169
update.fz += source.fz;
174
template <class DeviceType>
175
struct FixLangevinKokkosZeroForceFunctor {
176
typedef DeviceType device_type ;
177
FixLangevinKokkos<DeviceType> c;
179
FixLangevinKokkosZeroForceFunctor(FixLangevinKokkos<DeviceType>* c_ptr):
180
c(*c_ptr) {c.cleanup_copy();}
182
KOKKOS_INLINE_FUNCTION
183
void operator()(const int i) const {
184
c.zero_force_item(i);
188
template<class DeviceType>
189
struct FixLangevinKokkosTallyEnergyFunctor {
190
typedef DeviceType device_type ;
191
FixLangevinKokkos<DeviceType> c;
192
typedef double value_type;
193
FixLangevinKokkosTallyEnergyFunctor(FixLangevinKokkos<DeviceType>* c_ptr):
194
c(*c_ptr) {c.cleanup_copy();}
196
KOKKOS_INLINE_FUNCTION
197
void operator()(const int i, value_type &energy) const {
198
energy += c.compute_energy_item(i);
200
KOKKOS_INLINE_FUNCTION
201
static void init(volatile value_type &update) {
204
KOKKOS_INLINE_FUNCTION
205
static void join(volatile value_type &update,
206
const volatile value_type &source) {
215
/* ERROR/WARNING messages:
217
E: Illegal ... command
219
Self-explanatory. Check the input script syntax and compare to the
220
documentation for the command. You can use -echo screen as a
221
command-line option when running LAMMPS to see the offending line.
223
E: Fix langevin period must be > 0.0
225
The time window for temperature relaxation must be > 0
227
E: Fix langevin omega requires atom style sphere
231
E: Fix langevin angmom requires atom style ellipsoid
235
E: Variable name for fix langevin does not exist
239
E: Variable for fix langevin is invalid style
241
It must be an equal-style variable.
243
E: Fix langevin omega requires extended particles
245
One of the particles has radius 0.0.
247
E: Fix langevin angmom requires extended particles
249
This fix option cannot be used with point paritlces.
251
E: Cannot zero Langevin force of 0 atoms
253
The group has zero atoms, so you cannot request its force
256
E: Fix langevin variable returned negative temperature
260
E: Could not find fix_modify temperature ID
262
The compute ID for computing temperature does not exist.
264
E: Fix_modify temperature ID does not compute temperature
266
The compute ID assigned to the fix must compute temperature.
268
W: Group for fix_modify temp != fix group
270
The fix_modify command is specifying a temperature computation that
271
computes a temperature on a different group of atoms than the fix
272
itself operates on. This is probably not what you want to do.