Tstart,Tstop = desired temperature at start/end of run
@@ -31,18 +35,27 @@
fix 1 all temp/csvr 300.0 300.0 100.0 54324
+fix 1 all temp/csld 100.0 300.0 10.0 123321
+
Description:
-Adjust the temperature with a CSVR thermostat (Bussi), which
-updates the velocities to a linear combination of the current
-velocities with a gaussian distribution at the desired temperature in
-every timestep.
+
Adjust the temperature with a canonical sampling thermostat that uses
+global velocity rescaling with Hamiltonian dynamics (temp/csvr)
+(Bussi1), or Langevin dynamics (temp/csld)
+(Bussi2). In the case of temp/csvr the thermostat is
+similar to the empirical Berendsen thermostat in
+temp/berendsen, but chooses the actual
+scaling factor from a suitably chosen (gaussian) distribution rather
+than having it determined from the time constant directly. In the case
+of temp/csld the velocities are updated to a linear combination of
+the current velocities with a gaussian distribution of velocities at
+the desired temperature. Both termostats are applied every timestep.
The thermostat is applied to only the translational degrees of freedom
for the particles, which is an important consideration for finite-size
particles which have rotational degrees of freedom are being
-thermostatted with this fix. The translational degrees of freedom can
-also have a bias velocity removed from them before thermostatting
+thermostatted with these fixes. The translational degrees of freedom
+can also have a bias velocity removed from them before thermostatting
takes place; see the description below.
The desired temperature at each timestep is a ramped value during the
@@ -64,11 +77,11 @@ keywords for the simulation box parameters and timestep and elapsed
time. Thus it is easy to specify a time-dependent temperature.
IMPORTANT NOTE: Unlike the fix nvt command which
-performs Nose/Hoover thermostatting AND time integration, this fix
-does NOT perform time integration. It only modifies velocities to
-effect thermostatting. Thus you must use a separate time integration
-fix, like fix nve to actually update the positions of
-atoms using the modified velocities. Likewise, this fix should not
+performs Nose/Hoover thermostatting AND time integration, these fixes
+do NOT perform time integration. They only modify velocities to effect
+thermostatting. Thus you must use a separate time integration fix,
+like fix nve to actually update the positions of atoms
+using the modified velocities. Likewise, these fixes should not
normally be used on atoms that also have their temperature controlled
by another fix - e.g. by fix nvt or fix
langevin commands.
@@ -77,7 +90,7 @@ langevin commands.
a discussion of different ways to compute temperature and perform
thermostatting.
-This fix computes a temperature each timestep. To do this, the fix
+
These fixes compute a temperature each timestep. To do this, the fix
creates its own compute of style "temp", as if this command had been
issued:
@@ -97,7 +110,7 @@ custom command using the appropriate compute-ID.
It also means that changing attributes of thermo_temp will have no
effect on this fix.
-Like other fixes that perform thermostatting, this fix can be used
+
Like other fixes that perform thermostatting, these fixes can be used
with compute commands that calculate a temperature
after removing a "bias" from the atom velocities. E.g. removing the
center-of-mass velocity from a group of atoms or only calculating
@@ -116,24 +129,37 @@ thermal degrees of freedom, and the bias is added back in.
Restart, fix_modify, output, run start/stop, minimize info:
-No information about this fix is written to binary restart
+No information about these fixes are written to binary restart
files.
-The fix_modify temp option is supported by this
-fix. You can use it to assign a temperature compute
-you have defined to this fix which will be used in its thermostatting
+
The fix_modify temp option is supported by these
+fixes. You can use it to assign a temperature compute
+you have defined to these fixes which will be used in its thermostatting
procedure, as described above. For consistency, the group used by
-this fix and by the compute should be the same.
+these fixes and by the compute should be the same.
-This fix can ramp its target temperature over multiple runs, using the
-start and stop keywords of the run command. See the
+
These fixes can ramp its target temperature over multiple runs, using
+the start and stop keywords of the run command. See the
run command for details of how to do this.
-This fix is not invoked during energy minimization.
+
These fixes are not invoked during energy minimization.
+
+These fixes compute a global scalar which can be accessed by various
+output commands. The scalar is the
+cummulative energy change due to the fix. The scalar value
+calculated by this fix is "extensive".
Restrictions:
-This fix is not compatible with fix shake.
+
These fixes are not compatible with fix shake.
+
+The fix can be used with dynamic groups as defined by the
+group command. Likewise it can be used with groups to
+which atoms are added or deleted over time, e.g. a deposition
+simulation. However, the conservation properties of the thermostat
+and barostat are defined for systems with a static set of atoms. You
+may observe odd behavior if the atoms in a group vary dramatically
+over time or the atom count becomes very small.
Related commands:
@@ -146,8 +172,11 @@ temp/rescale, fix langevin,
-
+
-(Bussi) Bussi and Parrinello, Phys. Rev. E (2007)
+(Bussi1) Bussi, Donadio and Parrinello, J. Chem. Phys. 126, 014101(2007)
+
+
+
(Bussi2) Bussi and Parrinello, Phys. Rev. E 75, 056707 (2007)
diff --git a/doc/fix_temp_csvr.txt b/doc/fix_temp_csvr.txt
index 024998e0e6..4f77e4f977 100644
--- a/doc/fix_temp_csvr.txt
+++ b/doc/fix_temp_csvr.txt
@@ -30,21 +30,21 @@ fix 1 all temp/csld 100.0 300.0 10.0 123321 :pre
Adjust the temperature with a canonical sampling thermostat that uses
global velocity rescaling with Hamiltonian dynamics ({temp/csvr})
-"(Bussi1)"_#Bussi1, or Langevin dynamics ({temp/csld}) "(Bussi2)"_#Bussi2.
-In the case of {temp/csvr} the thermostat is similar to the empirical
-Berendsen thermostat in "temp/berendsen"_fix_temp_berendsen.html, but
-chooses the actual scaling factor from a suitably chosen (gaussian)
-distribution rather than having it determined from the time constant
-directly. In the second case the velocities are updated to a linear
-combination of the current velocities with a gaussian distribution
-of velocities at the desired temperature. Both termostats are applied
-in every timestep.
+"(Bussi1)"_#Bussi1, or Langevin dynamics ({temp/csld})
+"(Bussi2)"_#Bussi2. In the case of {temp/csvr} the thermostat is
+similar to the empirical Berendsen thermostat in
+"temp/berendsen"_fix_temp_berendsen.html, but chooses the actual
+scaling factor from a suitably chosen (gaussian) distribution rather
+than having it determined from the time constant directly. In the case
+of {temp/csld} the velocities are updated to a linear combination of
+the current velocities with a gaussian distribution of velocities at
+the desired temperature. Both termostats are applied every timestep.
The thermostat is applied to only the translational degrees of freedom
for the particles, which is an important consideration for finite-size
particles which have rotational degrees of freedom are being
-thermostatted with these fixes. The translational degrees of freedom can
-also have a bias velocity removed from them before thermostatting
+thermostatted with these fixes. The translational degrees of freedom
+can also have a bias velocity removed from them before thermostatting
takes place; see the description below.
The desired temperature at each timestep is a ramped value during the
@@ -67,10 +67,10 @@ time. Thus it is easy to specify a time-dependent temperature.
IMPORTANT NOTE: Unlike the "fix nvt"_fix_nh.html command which
performs Nose/Hoover thermostatting AND time integration, these fixes
-do NOT perform time integration. They only modify velocities to
-effect thermostatting. Thus you must use a separate time integration
-fix, like "fix nve"_fix_nve.html to actually update the positions of
-atoms using the modified velocities. Likewise, these fixes should not
+do NOT perform time integration. They only modify velocities to effect
+thermostatting. Thus you must use a separate time integration fix,
+like "fix nve"_fix_nve.html to actually update the positions of atoms
+using the modified velocities. Likewise, these fixes should not
normally be used on atoms that also have their temperature controlled
by another fix - e.g. by "fix nvt"_fix_nh.html or "fix
langevin"_fix_langevin.html commands.
diff --git a/doc/pair_buck.html b/doc/pair_buck.html
index 8671839fef..1e14667251 100644
--- a/doc/pair_buck.html
+++ b/doc/pair_buck.html
@@ -25,6 +25,8 @@
pair_style buck/coul/cut/gpu command
+pair_style buck/coul/cut/kk command
+
pair_style buck/coul/cut/omp command
pair_style buck/coul/long command
@@ -33,6 +35,8 @@
pair_style buck/coul/long/gpu command
+pair_style buck/coul/long/kk command
+
pair_style buck/coul/long/omp command
pair_style buck/coul/msm command
diff --git a/doc/pair_buck.txt b/doc/pair_buck.txt
index bdda6501d8..2409c24ee9 100644
--- a/doc/pair_buck.txt
+++ b/doc/pair_buck.txt
@@ -14,10 +14,12 @@ pair_style buck/omp command :h3
pair_style buck/coul/cut command :h3
pair_style buck/coul/cut/cuda command :h3
pair_style buck/coul/cut/gpu command :h3
+pair_style buck/coul/cut/kk command :h3
pair_style buck/coul/cut/omp command :h3
pair_style buck/coul/long command :h3
pair_style buck/coul/long/cuda command :h3
pair_style buck/coul/long/gpu command :h3
+pair_style buck/coul/long/kk command :h3
pair_style buck/coul/long/omp command :h3
pair_style buck/coul/msm command :h3
pair_style buck/coul/msm/omp command :h3
diff --git a/doc/pair_class2.html b/doc/pair_class2.html
index e461829e5b..58c66b927c 100644
--- a/doc/pair_class2.html
+++ b/doc/pair_class2.html
@@ -15,12 +15,16 @@
pair_style lj/class2/gpu command
+pair_style lj/class2/kk command
+
pair_style lj/class2/omp command
pair_style lj/class2/coul/cut command
pair_style lj/class2/coul/cut/cuda command
+pair_style lj/class2/coul/cut/kk command
+
pair_style lj/class2/coul/cut/omp command
pair_style lj/class2/coul/long command
@@ -29,6 +33,8 @@
pair_style lj/class2/coul/long/gpu command
+pair_style lj/class2/coul/long/kk command
+
pair_style lj/class2/coul/long/omp command
Syntax:
diff --git a/doc/pair_class2.txt b/doc/pair_class2.txt
index 906e25f63e..66ba2b7f30 100644
--- a/doc/pair_class2.txt
+++ b/doc/pair_class2.txt
@@ -9,13 +9,16 @@
pair_style lj/class2 command :h3
pair_style lj/class2/cuda command :h3
pair_style lj/class2/gpu command :h3
+pair_style lj/class2/kk command :h3
pair_style lj/class2/omp command :h3
pair_style lj/class2/coul/cut command :h3
pair_style lj/class2/coul/cut/cuda command :h3
+pair_style lj/class2/coul/cut/kk command :h3
pair_style lj/class2/coul/cut/omp command :h3
pair_style lj/class2/coul/long command :h3
pair_style lj/class2/coul/long/cuda command :h3
pair_style lj/class2/coul/long/gpu command :h3
+pair_style lj/class2/coul/long/kk command :h3
pair_style lj/class2/coul/long/omp command :h3
[Syntax:]
diff --git a/doc/pair_coul.html b/doc/pair_coul.html
index 466dfd33c1..176e331f89 100644
--- a/doc/pair_coul.html
+++ b/doc/pair_coul.html
@@ -21,6 +21,8 @@
pair_style coul/debye/gpu command
+pair_style coul/debye/kk command
+
pair_style coul/debye/omp command
pair_style coul/dsf command
@@ -37,6 +39,8 @@
pair_style coul/long/gpu command
+pair_style coul/long/kk command
+
pair_style coul/msm command
pair_style coul/msm/omp command
diff --git a/doc/pair_coul.txt b/doc/pair_coul.txt
index 46fbf307f0..a6fbda3785 100644
--- a/doc/pair_coul.txt
+++ b/doc/pair_coul.txt
@@ -12,6 +12,7 @@ pair_style coul/cut/kk command :h3
pair_style coul/cut/omp command :h3
pair_style coul/debye command :h3
pair_style coul/debye/gpu command :h3
+pair_style coul/debye/kk command :h3
pair_style coul/debye/omp command :h3
pair_style coul/dsf command :h3
pair_style coul/dsf/gpu command :h3
@@ -20,6 +21,7 @@ pair_style coul/dsf/omp command :h3
pair_style coul/long command :h3
pair_style coul/long/omp command :h3
pair_style coul/long/gpu command :h3
+pair_style coul/long/kk command :h3
pair_style coul/msm command :h3
pair_style coul/msm/omp command :h3
pair_style coul/streitz command :h3
diff --git a/doc/pair_lj.html b/doc/pair_lj.html
index bcdf8e56d1..1a8c57f73a 100644
--- a/doc/pair_lj.html
+++ b/doc/pair_lj.html
@@ -37,12 +37,16 @@
pair_style lj/cut/coul/debye/gpu command
+pair_style lj/cut/coul/debye/kk command
+
pair_style lj/cut/coul/debye/omp command
pair_style lj/cut/coul/dsf command
pair_style lj/cut/coul/dsf/gpu command
+pair_style lj/cut/coul/dsf/kk command
+
pair_style lj/cut/coul/dsf/omp command
pair_style lj/cut/coul/long command
diff --git a/doc/pair_lj.txt b/doc/pair_lj.txt
index a308d81f8c..1a9fea5eef 100644
--- a/doc/pair_lj.txt
+++ b/doc/pair_lj.txt
@@ -20,9 +20,11 @@ pair_style lj/cut/coul/cut/omp command :h3
pair_style lj/cut/coul/debye command :h3
pair_style lj/cut/coul/debye/cuda command :h3
pair_style lj/cut/coul/debye/gpu command :h3
+pair_style lj/cut/coul/debye/kk command :h3
pair_style lj/cut/coul/debye/omp command :h3
pair_style lj/cut/coul/dsf command :h3
pair_style lj/cut/coul/dsf/gpu command :h3
+pair_style lj/cut/coul/dsf/kk command :h3
pair_style lj/cut/coul/dsf/omp command :h3
pair_style lj/cut/coul/long command :h3
pair_style lj/cut/coul/long/cuda command :h3
diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp
index 90f5881ffd..9ae9613a74 100644
--- a/src/CLASS2/pair_lj_class2.cpp
+++ b/src/CLASS2/pair_lj_class2.cpp
@@ -37,18 +37,20 @@ PairLJClass2::PairLJClass2(LAMMPS *lmp) : Pair(lmp)
PairLJClass2::~PairLJClass2()
{
- if (allocated) {
- memory->destroy(setflag);
- memory->destroy(cutsq);
+ if (!copymode) {
+ if (allocated) {
+ memory->destroy(setflag);
+ memory->destroy(cutsq);
- memory->destroy(cut);
- memory->destroy(epsilon);
- memory->destroy(sigma);
- memory->destroy(lj1);
- memory->destroy(lj2);
- memory->destroy(lj3);
- memory->destroy(lj4);
- memory->destroy(offset);
+ memory->destroy(cut);
+ memory->destroy(epsilon);
+ memory->destroy(sigma);
+ memory->destroy(lj1);
+ memory->destroy(lj2);
+ memory->destroy(lj3);
+ memory->destroy(lj4);
+ memory->destroy(offset);
+ }
}
}
diff --git a/src/CLASS2/pair_lj_class2.h b/src/CLASS2/pair_lj_class2.h
index b6b604cbca..4a89ce2a3f 100644
--- a/src/CLASS2/pair_lj_class2.h
+++ b/src/CLASS2/pair_lj_class2.h
@@ -29,9 +29,9 @@ class PairLJClass2 : public Pair {
PairLJClass2(class LAMMPS *);
virtual ~PairLJClass2();
virtual void compute(int, int);
- void settings(int, char **);
+ virtual void settings(int, char **);
void coeff(int, char **);
- double init_one(int, int);
+ virtual double init_one(int, int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
@@ -46,7 +46,7 @@ class PairLJClass2 : public Pair {
double **epsilon,**sigma;
double **lj1,**lj2,**lj3,**lj4,**offset;
- void allocate();
+ virtual void allocate();
};
}
diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp
index 7f851fd239..23f4d36141 100644
--- a/src/CLASS2/pair_lj_class2_coul_cut.cpp
+++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp
@@ -38,21 +38,23 @@ PairLJClass2CoulCut::PairLJClass2CoulCut(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulCut::~PairLJClass2CoulCut()
{
- if (allocated) {
- memory->destroy(setflag);
- memory->destroy(cutsq);
+ if (!copymode) {
+ if (allocated) {
+ memory->destroy(setflag);
+ memory->destroy(cutsq);
- memory->destroy(cut_lj);
- memory->destroy(cut_ljsq);
- memory->destroy(cut_coul);
- memory->destroy(cut_coulsq);
- memory->destroy(epsilon);
- memory->destroy(sigma);
- memory->destroy(lj1);
- memory->destroy(lj2);
- memory->destroy(lj3);
- memory->destroy(lj4);
- memory->destroy(offset);
+ memory->destroy(cut_lj);
+ memory->destroy(cut_ljsq);
+ memory->destroy(cut_coul);
+ memory->destroy(cut_coulsq);
+ memory->destroy(epsilon);
+ memory->destroy(sigma);
+ memory->destroy(lj1);
+ memory->destroy(lj2);
+ memory->destroy(lj3);
+ memory->destroy(lj4);
+ memory->destroy(offset);
+ }
}
}
diff --git a/src/CLASS2/pair_lj_class2_coul_cut.h b/src/CLASS2/pair_lj_class2_coul_cut.h
index cea218f759..9b9c654ec6 100644
--- a/src/CLASS2/pair_lj_class2_coul_cut.h
+++ b/src/CLASS2/pair_lj_class2_coul_cut.h
@@ -29,10 +29,10 @@ class PairLJClass2CoulCut : public Pair {
PairLJClass2CoulCut(class LAMMPS *);
virtual ~PairLJClass2CoulCut();
virtual void compute(int, int);
- void settings(int, char **);
+ virtual void settings(int, char **);
void coeff(int, char **);
- void init_style();
- double init_one(int, int);
+ virtual void init_style();
+ virtual double init_one(int, int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
@@ -48,7 +48,7 @@ class PairLJClass2CoulCut : public Pair {
double **epsilon,**sigma;
double **lj1,**lj2,**lj3,**lj4,**offset;
- void allocate();
+ virtual void allocate();
};
}
diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp
index 2460515b98..7801e1687f 100644
--- a/src/CLASS2/pair_lj_class2_coul_long.cpp
+++ b/src/CLASS2/pair_lj_class2_coul_long.cpp
@@ -50,19 +50,21 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp)
PairLJClass2CoulLong::~PairLJClass2CoulLong()
{
- if (allocated) {
- memory->destroy(setflag);
- memory->destroy(cutsq);
+ if (!copymode) {
+ if (allocated) {
+ memory->destroy(setflag);
+ memory->destroy(cutsq);
- memory->destroy(cut_lj);
- memory->destroy(cut_ljsq);
- memory->destroy(epsilon);
- memory->destroy(sigma);
- memory->destroy(lj1);
- memory->destroy(lj2);
- memory->destroy(lj3);
- memory->destroy(lj4);
- memory->destroy(offset);
+ memory->destroy(cut_lj);
+ memory->destroy(cut_ljsq);
+ memory->destroy(epsilon);
+ memory->destroy(sigma);
+ memory->destroy(lj1);
+ memory->destroy(lj2);
+ memory->destroy(lj3);
+ memory->destroy(lj4);
+ memory->destroy(offset);
+ }
}
}
diff --git a/src/CLASS2/pair_lj_class2_coul_long.h b/src/CLASS2/pair_lj_class2_coul_long.h
index 829c4f23e0..202aaaaa43 100644
--- a/src/CLASS2/pair_lj_class2_coul_long.h
+++ b/src/CLASS2/pair_lj_class2_coul_long.h
@@ -29,10 +29,10 @@ class PairLJClass2CoulLong : public Pair {
PairLJClass2CoulLong(class LAMMPS *);
virtual ~PairLJClass2CoulLong();
virtual void compute(int, int);
- void settings(int, char **);
+ virtual void settings(int, char **);
void coeff(int, char **);
- void init_style();
- double init_one(int, int);
+ virtual void init_style();
+ virtual double init_one(int, int);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
@@ -50,7 +50,7 @@ class PairLJClass2CoulLong : public Pair {
double **lj1,**lj2,**lj3,**lj4,**offset;
double g_ewald;
- void allocate();
+ virtual void allocate();
};
}
diff --git a/src/KOKKOS/Install.sh b/src/KOKKOS/Install.sh
index 91dd935da6..8217609514 100644
--- a/src/KOKKOS/Install.sh
+++ b/src/KOKKOS/Install.sh
@@ -26,7 +26,6 @@ action () {
touch ../accelerator_kokkos.h
touch ../memory.h
-touch ../special.cpp
# list of files with optional dependcies
@@ -81,23 +80,53 @@ action neigh_list_kokkos.cpp
action neigh_list_kokkos.h
action neighbor_kokkos.cpp
action neighbor_kokkos.h
+action pair_buck_coul_cut_kokkos.cpp
+action pair_buck_coul_cut_kokkos.h
+action pair_buck_coul_long_kokkos.cpp pair_buck_coul_long.cpp
+action pair_buck_coul_long_kokkos.h pair_buck_coul_long.h
action pair_buck_kokkos.cpp
action pair_buck_kokkos.h
action pair_coul_cut_kokkos.cpp
action pair_coul_cut_kokkos.h
+action pair_coul_debye_kokkos.cpp
+action pair_coul_debye_kokkos.h
action pair_coul_dsf_kokkos.cpp
action pair_coul_dsf_kokkos.h
+action pair_coul_long_kokkos.cpp pair_coul_long.cpp
+action pair_coul_long_kokkos.h pair_coul_long.h
action pair_coul_wolf_kokkos.cpp
action pair_coul_wolf_kokkos.h
action pair_eam_kokkos.cpp pair_eam.cpp
action pair_eam_kokkos.h pair_eam.h
action pair_kokkos.h
+action pair_lj_charmm_coul_charmm_implicit_kokkos.cpp pair_lj_charmm_coul_charmm_implicit.cpp
+action pair_lj_charmm_coul_charmm_implicit_kokkos.h pair_lj_charmm_coul_charmm_implicit.h
+action pair_lj_charmm_coul_charmm_kokkos.cpp pair_lj_charmm_coul_charmm.cpp
+action pair_lj_charmm_coul_charmm_kokkos.h pair_lj_charmm_coul_charmm.h
+action pair_lj_charmm_coul_long_kokkos.cpp pair_lj_charmm_coul_long.cpp
+action pair_lj_charmm_coul_long_kokkos.h pair_lj_charmm_coul_long.h
+action pair_lj_class2_coul_cut_kokkos.cpp pair_lj_class2_coul_cut.cpp
+action pair_lj_class2_coul_cut_kokkos.h pair_lj_class2_coul_cut.h
+action pair_lj_class2_coul_long_kokkos.cpp pair_lj_class2_coul_long.cpp
+action pair_lj_class2_coul_long_kokkos.h pair_lj_class2_coul_long.h
+action pair_lj_class2_kokkos.cpp pair_lj_class2.cpp
+action pair_lj_class2_kokkos.h pair_lj_class2.h
action pair_lj_cut_coul_cut_kokkos.cpp
action pair_lj_cut_coul_cut_kokkos.h
+action pair_lj_cut_coul_debye_kokkos.cpp
+action pair_lj_cut_coul_debye_kokkos.h
+action pair_lj_cut_coul_dsf_kokkos.cpp
+action pair_lj_cut_coul_dsf_kokkos.h
action pair_lj_cut_coul_long_kokkos.cpp pair_lj_cut_coul_long.cpp
action pair_lj_cut_coul_long_kokkos.h pair_lj_cut_coul_long.h
action pair_lj_cut_kokkos.cpp
action pair_lj_cut_kokkos.h
+action pair_lj_expand_kokkos.cpp
+action pair_lj_expand_kokkos.h
+action pair_lj_gromacs_coul_gromacs_kokkos.cpp
+action pair_lj_gromacs_coul_gromacs_kokkos.h
+action pair_lj_gromacs_kokkos.cpp
+action pair_lj_gromacs_kokkos.h
action pair_table_kokkos.cpp
action pair_table_kokkos.h
action verlet_kokkos.cpp
diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp
new file mode 100644
index 0000000000..7ffdf903f3
--- /dev/null
+++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp
@@ -0,0 +1,373 @@
+/* ----------------------------------------------------------------------
+ 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.
+------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------
+ Contributing author: Ray Shan (SNL)
+------------------------------------------------------------------------- */
+
+#include "math.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+#include "pair_buck_coul_cut_kokkos.h"
+#include "kokkos.h"
+#include "atom_kokkos.h"
+#include "comm.h"
+#include "force.h"
+#include "neighbor.h"
+#include "neigh_list.h"
+#include "neigh_request.h"
+#include "update.h"
+#include "integrate.h"
+#include "respa.h"
+#include "math_const.h"
+#include "memory.h"
+#include "error.h"
+#include "atom_masks.h"
+
+using namespace LAMMPS_NS;
+using namespace MathConst;
+
+#define KOKKOS_CUDA_MAX_THREADS 256
+#define KOKKOS_CUDA_MIN_BLOCKS 8
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairBuckCoulCutKokkos::PairBuckCoulCutKokkos(LAMMPS *lmp):PairBuckCoulCut(lmp)
+{
+ respa_enable = 0;
+
+ atomKK = (AtomKokkos *) atom;
+ execution_space = ExecutionSpaceFromDevice::space;
+ datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK;
+ datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK;
+ cutsq = NULL;
+ cut_ljsq = NULL;
+ cut_coulsq = NULL;
+
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairBuckCoulCutKokkos::~PairBuckCoulCutKokkos()
+{
+
+ if (!copymode) {
+ memory->destroy_kokkos(k_eatom,eatom);
+ memory->destroy_kokkos(k_vatom,vatom);
+ k_cutsq = DAT::tdual_ffloat_2d();
+ k_cut_ljsq = DAT::tdual_ffloat_2d();
+ k_cut_coulsq = DAT::tdual_ffloat_2d();
+ memory->sfree(cutsq);
+ memory->sfree(cut_ljsq);
+ memory->sfree(cut_coulsq);
+ eatom = NULL;
+ vatom = NULL;
+ cutsq = NULL;
+ cut_ljsq = NULL;
+ cut_coulsq = NULL;
+ }
+
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+void PairBuckCoulCutKokkos::compute(int eflag_in, int vflag_in)
+{
+ eflag = eflag_in;
+ vflag = vflag_in;
+
+ if (neighflag == FULL || neighflag == FULLCLUSTER) no_virial_fdotr_compute = 1;
+
+ if (eflag || vflag) ev_setup(eflag,vflag);
+ else evflag = vflag_fdotr = 0;
+
+ // reallocate per-atom arrays if necessary
+
+ if (eflag_atom) {
+ memory->destroy_kokkos(k_eatom,eatom);
+ memory->create_kokkos(k_eatom,eatom,maxeatom,"pair:eatom");
+ d_eatom = k_eatom.view();
+ }
+ if (vflag_atom) {
+ memory->destroy_kokkos(k_vatom,vatom);
+ memory->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom");
+ d_vatom = k_vatom.view();
+ }
+
+ atomKK->sync(execution_space,datamask_read);
+ k_cutsq.template sync();
+ k_cut_ljsq.template sync();
+ k_cut_coulsq.template sync();
+ k_params.template sync();
+ if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
+ else atomKK->modified(execution_space,F_MASK);
+
+ x = atomKK->k_x.view();
+ c_x = atomKK->k_x.view();
+ f = atomKK->k_f.view();
+ q = atomKK->k_q.view();
+ type = atomKK->k_type.view();
+ nlocal = atom->nlocal;
+ nall = atom->nlocal + atom->nghost;
+ qqrd2e = force->qqrd2e;
+ newton_pair = force->newton_pair;
+ special_lj[0] = force->special_lj[0];
+ special_lj[1] = force->special_lj[1];
+ special_lj[2] = force->special_lj[2];
+ special_lj[3] = force->special_lj[3];
+ special_coul[0] = force->special_coul[0];
+ special_coul[1] = force->special_coul[1];
+ special_coul[2] = force->special_coul[2];
+ special_coul[3] = force->special_coul[3];
+
+ // loop over neighbors of my atoms
+
+ copymode = 1;
+
+ EV_FLOAT ev = pair_compute,void >
+ (this,(NeighListKokkos*)list);
+
+ DeviceType::fence();
+
+ if (eflag) {
+ eng_vdwl += ev.evdwl;
+ eng_coul += ev.ecoul;
+ }
+ if (vflag_global) {
+ virial[0] += ev.v[0];
+ virial[1] += ev.v[1];
+ virial[2] += ev.v[2];
+ virial[3] += ev.v[3];
+ virial[4] += ev.v[4];
+ virial[5] += ev.v[5];
+ }
+
+ if (vflag_fdotr) virial_fdotr_compute();
+
+ if (eflag_atom) {
+ k_eatom.template modify();
+ k_eatom.template sync();
+ }
+
+ if (vflag_atom) {
+ k_vatom.template modify();
+ k_vatom.template sync();
+ }
+
+ copymode = 0;
+}
+
+/* ----------------------------------------------------------------------
+ compute Buckingham pair force between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulCutKokkos::
+compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT r6inv = r2inv*r2inv*r2inv;
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT rexp = exp(-r*(STACKPARAMS?m_params[itype][jtype].rhoinv:params(itype,jtype).rhoinv));
+
+ const F_FLOAT forcebuck =
+ (STACKPARAMS?m_params[itype][jtype].buck1:params(itype,jtype).buck1)*r*rexp -
+ (STACKPARAMS?m_params[itype][jtype].buck2:params(itype,jtype).buck2)*r6inv;
+
+ return forcebuck*r2inv;
+}
+
+/* ----------------------------------------------------------------------
+ compute Buckingham pair potential energy between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulCutKokkos::
+compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT r6inv = r2inv*r2inv*r2inv;
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT rexp = exp(-r*(STACKPARAMS?m_params[itype][jtype].rhoinv:params(itype,jtype).rhoinv));
+
+ return (STACKPARAMS?m_params[itype][jtype].a:params(itype,jtype).a)*rexp -
+ (STACKPARAMS?m_params[itype][jtype].c:params(itype,jtype).c)*r6inv -
+ (STACKPARAMS?m_params[itype][jtype].offset:params(itype,jtype).offset);
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair force between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulCutKokkos::
+compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT rinv = sqrt(r2inv);
+ F_FLOAT forcecoul;
+
+ forcecoul = qqrd2e*qtmp*q(j) *rinv;
+
+ return factor_coul*forcecoul*r2inv;
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair potential energy between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulCutKokkos::
+compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT rinv = sqrt(r2inv);
+
+ return factor_coul*qqrd2e*qtmp*q(j)*rinv;
+
+}
+
+/* ----------------------------------------------------------------------
+ allocate all arrays
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulCutKokkos::allocate()
+{
+ PairBuckCoulCut::allocate();
+
+ int n = atom->ntypes;
+ memory->destroy(cutsq);
+ memory->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq");
+ d_cutsq = k_cutsq.template view();
+ memory->destroy(cut_ljsq);
+ memory->create_kokkos(k_cut_ljsq,cut_ljsq,n+1,n+1,"pair:cut_ljsq");
+ d_cut_ljsq = k_cut_ljsq.template view();
+ memory->destroy(cut_coulsq);
+ memory->create_kokkos(k_cut_coulsq,cut_coulsq,n+1,n+1,"pair:cut_coulsq");
+ d_cut_coulsq = k_cut_coulsq.template view();
+ k_params = Kokkos::DualView("PairBuckCoulCut::params",n+1,n+1);
+ params = k_params.d_view;
+}
+
+/* ----------------------------------------------------------------------
+ global settings
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulCutKokkos::settings(int narg, char **arg)
+{
+ if (narg > 2) error->all(FLERR,"Illegal pair_style command");
+
+ PairBuckCoulCut::settings(1,arg);
+}
+
+/* ----------------------------------------------------------------------
+ init specific to this pair style
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulCutKokkos::init_style()
+{
+ PairBuckCoulCut::init_style();
+
+ // error if rRESPA with inner levels
+
+ if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
+ int respa = 0;
+ if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
+ if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
+ if (respa)
+ error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle");
+ }
+
+ // irequest = neigh request made by parent class
+
+ neighflag = lmp->kokkos->neighflag;
+ int irequest = neighbor->nrequest - 1;
+
+ neighbor->requests[irequest]->
+ kokkos_host = Kokkos::Impl::is_same::value &&
+ !Kokkos::Impl::is_same::value;
+ neighbor->requests[irequest]->
+ kokkos_device = Kokkos::Impl::is_same::value;
+
+ if (neighflag == FULL) {
+ neighbor->requests[irequest]->full = 1;
+ neighbor->requests[irequest]->half = 0;
+ neighbor->requests[irequest]->full_cluster = 0;
+ } else if (neighflag == HALF || neighflag == HALFTHREAD) {
+ neighbor->requests[irequest]->full = 0;
+ neighbor->requests[irequest]->half = 1;
+ neighbor->requests[irequest]->full_cluster = 0;
+ } else if (neighflag == N2) {
+ neighbor->requests[irequest]->full_cluster = 0;
+ neighbor->requests[irequest]->full = 0;
+ neighbor->requests[irequest]->half = 0;
+ } else if (neighflag == FULLCLUSTER) {
+ neighbor->requests[irequest]->full = 1;
+ neighbor->requests[irequest]->half = 0;
+ neighbor->requests[irequest]->full_cluster = 1;
+ } else {
+ error->all(FLERR,"Cannot use chosen neighbor list style with buck/coul/cut/kk");
+ }
+}
+
+/* ----------------------------------------------------------------------
+ init for one type pair i,j and corresponding j,i
+------------------------------------------------------------------------- */
+
+template
+double PairBuckCoulCutKokkos::init_one(int i, int j)
+{
+ double cutone = PairBuckCoulCut::init_one(i,j);
+ double cut_ljsqm = cut_ljsq[i][j];
+ double cut_coulsqm = cut_coulsq[i][j];
+
+ k_params.h_view(i,j).a = a[i][j];
+ k_params.h_view(i,j).c = c[i][j];
+ k_params.h_view(i,j).rhoinv = rhoinv[i][j];
+ k_params.h_view(i,j).buck1 = buck1[i][j];
+ k_params.h_view(i,j).buck2 = buck2[i][j];
+ k_params.h_view(i,j).offset = offset[i][j];
+ k_params.h_view(i,j).cut_ljsq = cut_ljsqm;
+ k_params.h_view(i,j).cut_coulsq = cut_coulsqm;
+
+ k_params.h_view(j,i) = k_params.h_view(i,j);
+ if(i();
+ k_cut_ljsq.h_view(i,j) = cut_ljsqm;
+ k_cut_ljsq.template modify();
+ k_cut_coulsq.h_view(i,j) = cut_coulsqm;
+ k_cut_coulsq.template modify();
+ k_params.template modify();
+
+ return cutone;
+}
+
+template class PairBuckCoulCutKokkos;
+#ifdef KOKKOS_HAVE_CUDA
+template class PairBuckCoulCutKokkos;
+#endif
diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.h b/src/KOKKOS/pair_buck_coul_cut_kokkos.h
new file mode 100644
index 0000000000..709098493b
--- /dev/null
+++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.h
@@ -0,0 +1,134 @@
+/* -*- 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 PAIR_CLASS
+
+PairStyle(buck/coul/cut/kk,PairBuckCoulCutKokkos)
+PairStyle(buck/coul/cut/kk/device,PairBuckCoulCutKokkos)
+PairStyle(buck/coul/cut/kk/host,PairBuckCoulCutKokkos)
+
+#else
+
+#ifndef LMP_PAIR_BUCK_COUL_CUT_KOKKOS_H
+#define LMP_PAIR_BUCK_COUL_CUT_KOKKOS_H
+
+#include "pair_kokkos.h"
+#include "pair_buck_coul_cut.h"
+#include "neigh_list_kokkos.h"
+
+namespace LAMMPS_NS {
+
+template
+class PairBuckCoulCutKokkos : public PairBuckCoulCut {
+ public:
+ enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
+ enum {COUL_FLAG=1};
+ typedef DeviceType device_type;
+ PairBuckCoulCutKokkos(class LAMMPS *);
+ ~PairBuckCoulCutKokkos();
+
+ void compute(int, int);
+
+ void settings(int, char **);
+ void init_style();
+ double init_one(int, int);
+
+ struct params_buck_coul{
+ params_buck_coul(){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;};
+ params_buck_coul(int i){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;};
+ F_FLOAT cut_ljsq,cut_coulsq,a,c,rhoinv,buck1,buck2,offset;
+ };
+
+ protected:
+ void cleanup_copy() {}
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_fpair(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const;
+
+ Kokkos::DualView k_params;
+ typename Kokkos::DualView::t_dev_const params;
+ // hardwired to space for 15 atom types
+ params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+
+ F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ F_FLOAT m_cut_ljsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ F_FLOAT m_cut_coulsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ typename ArrayTypes::t_x_array_randomread x;
+ typename ArrayTypes::t_x_array c_x;
+ typename ArrayTypes::t_f_array f;
+ typename ArrayTypes::t_int_1d_randomread type;
+ typename ArrayTypes::t_float_1d_randomread q;
+
+ DAT::tdual_efloat_1d k_eatom;
+ DAT::tdual_virial_array k_vatom;
+ typename ArrayTypes::t_efloat_1d d_eatom;
+ typename ArrayTypes::t_virial_array d_vatom;
+
+ int newton_pair;
+
+ typename ArrayTypes::tdual_ffloat_2d k_cutsq;
+ typename ArrayTypes::t_ffloat_2d d_cutsq;
+ typename ArrayTypes::tdual_ffloat_2d k_cut_ljsq;
+ typename ArrayTypes::t_ffloat_2d d_cut_ljsq;
+ typename ArrayTypes::tdual_ffloat_2d k_cut_coulsq;
+ typename ArrayTypes::t_ffloat_2d d_cut_coulsq;
+
+ class AtomKokkos *atomKK;
+ int neighflag;
+ int nlocal,nall,eflag,vflag;
+
+ double special_lj[4], special_coul[4];
+ double qqrd2e;
+
+ void allocate();
+
+ friend class PairComputeFunctor;
+ friend class PairComputeFunctor;
+ friend class PairComputeFunctor;
+ friend class PairComputeFunctor;
+ friend class PairComputeFunctor;
+ friend class PairComputeFunctor;
+ friend EV_FLOAT pair_compute_neighlist(PairBuckCoulCutKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist(PairBuckCoulCutKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist(PairBuckCoulCutKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute(PairBuckCoulCutKokkos*,
+ NeighListKokkos*);
+
+};
+
+}
+
+#endif
+#endif
+
+/* ERROR/WARNING messages:
+
+*/
diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp
new file mode 100644
index 0000000000..1f733ab3d7
--- /dev/null
+++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp
@@ -0,0 +1,517 @@
+/* ----------------------------------------------------------------------
+ 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.
+------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------
+ Contributing author: Ray Shan (SNL)
+------------------------------------------------------------------------- */
+
+#include "math.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+#include "pair_buck_coul_long_kokkos.h"
+#include "kokkos.h"
+#include "atom_kokkos.h"
+#include "comm.h"
+#include "force.h"
+#include "neighbor.h"
+#include "neigh_list.h"
+#include "neigh_request.h"
+#include "update.h"
+#include "integrate.h"
+#include "respa.h"
+#include "math_const.h"
+#include "memory.h"
+#include "error.h"
+#include "atom_masks.h"
+
+using namespace LAMMPS_NS;
+using namespace MathConst;
+
+#define KOKKOS_CUDA_MAX_THREADS 256
+#define KOKKOS_CUDA_MIN_BLOCKS 8
+
+
+#define EWALD_F 1.12837917
+#define EWALD_P 0.3275911
+#define A1 0.254829592
+#define A2 -0.284496736
+#define A3 1.421413741
+#define A4 -1.453152027
+#define A5 1.061405429
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairBuckCoulLongKokkos::PairBuckCoulLongKokkos(LAMMPS *lmp):PairBuckCoulLong(lmp)
+{
+ respa_enable = 0;
+
+ atomKK = (AtomKokkos *) atom;
+ execution_space = ExecutionSpaceFromDevice::space;
+ datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK;
+ datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK;
+ cutsq = NULL;
+ cut_ljsq = NULL;
+ cut_coulsq = 0.0;
+
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos()
+{
+ if (!copymode) {
+ memory->destroy_kokkos(k_eatom,eatom);
+ memory->destroy_kokkos(k_vatom,vatom);
+ k_cutsq = DAT::tdual_ffloat_2d();
+ k_cut_ljsq = DAT::tdual_ffloat_2d();
+ k_cut_coulsq = DAT::tdual_ffloat_2d();
+ memory->sfree(cutsq);
+ memory->sfree(cut_ljsq);
+ //memory->sfree(cut_coulsq);
+ eatom = NULL;
+ vatom = NULL;
+ cutsq = NULL;
+ cut_ljsq = NULL;
+ //cut_coulsq = NULL;
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+void PairBuckCoulLongKokkos::cleanup_copy() {
+ allocated = 0;
+ cutsq = NULL;
+ cut_ljsq = NULL;
+ eatom = NULL;
+ vatom = NULL;
+ ftable = NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+void PairBuckCoulLongKokkos::compute(int eflag_in, int vflag_in)
+{
+ eflag = eflag_in;
+ vflag = vflag_in;
+
+ if (neighflag == FULL || neighflag == FULLCLUSTER) no_virial_fdotr_compute = 1;
+
+ if (eflag || vflag) ev_setup(eflag,vflag);
+ else evflag = vflag_fdotr = 0;
+
+ atomKK->sync(execution_space,datamask_read);
+ k_cutsq.template sync();
+ k_cut_ljsq.template sync();
+ k_cut_coulsq.template sync();
+ k_params.template sync();
+ if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
+ else atomKK->modified(execution_space,F_MASK);
+
+ x = atomKK->k_x.view();
+ c_x = atomKK->k_x.view();
+ f = atomKK->k_f.view();
+ q = atomKK->k_q.view();
+ type = atomKK->k_type.view();
+ nlocal = atom->nlocal;
+ nall = atom->nlocal + atom->nghost;
+ qqrd2e = force->qqrd2e;
+ newton_pair = force->newton_pair;
+ special_lj[0] = force->special_lj[0];
+ special_lj[1] = force->special_lj[1];
+ special_lj[2] = force->special_lj[2];
+ special_lj[3] = force->special_lj[3];
+ special_coul[0] = force->special_coul[0];
+ special_coul[1] = force->special_coul[1];
+ special_coul[2] = force->special_coul[2];
+ special_coul[3] = force->special_coul[3];
+
+ // loop over neighbors of my atoms
+
+ copymode = 1;
+
+ EV_FLOAT ev;
+ if(ncoultablebits)
+ ev = pair_compute,CoulLongTable<1> >
+ (this,(NeighListKokkos*)list);
+ else
+ ev = pair_compute,CoulLongTable<0> >
+ (this,(NeighListKokkos*)list);
+
+
+ DeviceType::fence();
+
+ if (eflag) {
+ eng_vdwl += ev.evdwl;
+ eng_coul += ev.ecoul;
+ }
+ if (vflag_global) {
+ virial[0] += ev.v[0];
+ virial[1] += ev.v[1];
+ virial[2] += ev.v[2];
+ virial[3] += ev.v[3];
+ virial[4] += ev.v[4];
+ virial[5] += ev.v[5];
+ }
+
+ if (vflag_fdotr) pair_virial_fdotr_compute(this);
+
+ copymode = 0;
+}
+
+/* ----------------------------------------------------------------------
+ compute Buckingham pair force between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulLongKokkos::
+compute_fpair(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT r6inv = r2inv*r2inv*r2inv;
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT rexp = exp(-r*(STACKPARAMS?m_params[itype][jtype].rhoinv:params(itype,jtype).rhoinv));
+
+ const F_FLOAT forcebuck =
+ (STACKPARAMS?m_params[itype][jtype].buck1:params(itype,jtype).buck1)*r*rexp -
+ (STACKPARAMS?m_params[itype][jtype].buck2:params(itype,jtype).buck2)*r6inv;
+
+ return forcebuck*r2inv;
+}
+
+/* ----------------------------------------------------------------------
+ compute Buckingham pair potential energy between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulLongKokkos::
+compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j, const int& itype, const int& jtype) const {
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT r6inv = r2inv*r2inv*r2inv;
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT rexp = exp(-r*(STACKPARAMS?m_params[itype][jtype].rhoinv:params(itype,jtype).rhoinv));
+
+ return (STACKPARAMS?m_params[itype][jtype].a:params(itype,jtype).a)*rexp -
+ (STACKPARAMS?m_params[itype][jtype].c:params(itype,jtype).c)*r6inv -
+ (STACKPARAMS?m_params[itype][jtype].offset:params(itype,jtype).offset);
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair force between atoms i and j
+ ---------------------------------------------------------------------- */
+
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulLongKokkos::
+compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const {
+ if(Specialisation::DoTable && rsq > tabinnersq) {
+ union_int_float_t rsq_lookup;
+ rsq_lookup.f = rsq;
+ const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits;
+ const F_FLOAT fraction = (rsq_lookup.f - d_rtable[itable]) * d_drtable[itable];
+ const F_FLOAT table = d_ftable[itable] + fraction*d_dftable[itable];
+ F_FLOAT forcecoul = qtmp*q[j] * table;
+ if (factor_coul < 1.0) {
+ const F_FLOAT table = d_ctable[itable] + fraction*d_dctable[itable];
+ const F_FLOAT prefactor = qtmp*q[j] * table;
+ forcecoul -= (1.0-factor_coul)*prefactor;
+ }
+ return forcecoul/rsq;
+ } else {
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT grij = g_ewald * r;
+ const F_FLOAT expm2 = exp(-grij*grij);
+ const F_FLOAT t = 1.0 / (1.0 + EWALD_P*grij);
+ const F_FLOAT rinv = 1.0/r;
+ const F_FLOAT erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
+ const F_FLOAT prefactor = qqrd2e * qtmp*q[j]*rinv;
+ F_FLOAT forcecoul = prefactor * (erfc + EWALD_F*grij*expm2);
+ if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor;
+
+ return forcecoul*rinv*rinv;
+ }
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair potential energy between atoms i and j
+ ---------------------------------------------------------------------- */
+
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairBuckCoulLongKokkos::
+compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const {
+ if(Specialisation::DoTable) {
+ union_int_float_t rsq_lookup;
+ rsq_lookup.f = rsq;
+ const int itable = (rsq_lookup.i & ncoulmask) >> ncoulshiftbits;
+ const F_FLOAT fraction = (rsq_lookup.f - d_rtable[itable]) * d_drtable[itable];
+ const F_FLOAT table = d_etable[itable] + fraction*d_detable[itable];
+ F_FLOAT ecoul = qtmp*q[j] * table;
+ if (factor_coul < 1.0) {
+ const F_FLOAT table = d_ctable[itable] + fraction*d_dctable[itable];
+ const F_FLOAT prefactor = qtmp*q[j] * table;
+ ecoul -= (1.0-factor_coul)*prefactor;
+ }
+ return ecoul;
+ } else {
+ const F_FLOAT r = sqrt(rsq);
+ const F_FLOAT grij = g_ewald * r;
+ const F_FLOAT expm2 = exp(-grij*grij);
+ const F_FLOAT t = 1.0 / (1.0 + EWALD_P*grij);
+ const F_FLOAT erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2;
+ const F_FLOAT prefactor = qqrd2e * qtmp*q[j]/r;
+ F_FLOAT ecoul = prefactor * erfc;
+ if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor;
+ return ecoul;
+ }
+}
+
+/* ----------------------------------------------------------------------
+ allocate all arrays
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulLongKokkos::allocate()
+{
+ PairBuckCoulLong::allocate();
+
+ int n = atom->ntypes;
+
+ memory->destroy(cutsq);
+ memory->create_kokkos(k_cutsq,cutsq,n+1,n+1,"pair:cutsq");
+ d_cutsq = k_cutsq.template view();
+
+ memory->destroy(cut_ljsq);
+ memory->create_kokkos(k_cut_ljsq,cut_ljsq,n+1,n+1,"pair:cut_ljsq");
+ d_cut_ljsq = k_cut_ljsq.template view();
+
+ memory->create_kokkos(k_cut_coulsq,n+1,n+1,"pair:cut_coulsq");
+ d_cut_coulsq = k_cut_coulsq.template view();
+
+ k_params = Kokkos::DualView("PairBuckCoulLong::params",n+1,n+1);
+ params = k_params.d_view;
+}
+
+template
+void PairBuckCoulLongKokkos::init_tables(double cut_coul, double *cut_respa)
+{
+ Pair::init_tables(cut_coul,cut_respa);
+
+ typedef typename ArrayTypes::t_ffloat_1d table_type;
+ typedef typename ArrayTypes::t_ffloat_1d host_table_type;
+
+ int ntable = 1;
+ for (int i = 0; i < ncoultablebits; i++) ntable *= 2;
+
+
+ // Copy rtable and drtable
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = rtable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_rtable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = drtable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_drtable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ // Copy ftable and dftable
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = ftable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_ftable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = dftable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_dftable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ // Copy ctable and dctable
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = ctable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_ctable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = dctable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_dctable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ // Copy etable and detable
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = etable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_etable = d_table;
+ }
+
+ {
+ host_table_type h_table("HostTable",ntable);
+ table_type d_table("DeviceTable",ntable);
+
+ for(int i = 0; i < ntable; i++) {
+ h_table(i) = detable[i];
+ }
+ Kokkos::deep_copy(d_table,h_table);
+ d_detable = d_table;
+ }
+}
+
+
+/* ----------------------------------------------------------------------
+ global settings
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulLongKokkos::settings(int narg, char **arg)
+{
+ if (narg > 2) error->all(FLERR,"Illegal pair_style command");
+
+ PairBuckCoulLong::settings(narg,arg);
+}
+
+/* ----------------------------------------------------------------------
+ init specific to this pair style
+------------------------------------------------------------------------- */
+
+template
+void PairBuckCoulLongKokkos::init_style()
+{
+ PairBuckCoulLong::init_style();
+
+ // error if rRESPA with inner levels
+
+ if (update->whichflag == 1 && strstr(update->integrate_style,"respa")) {
+ int respa = 0;
+ if (((Respa *) update->integrate)->level_inner >= 0) respa = 1;
+ if (((Respa *) update->integrate)->level_middle >= 0) respa = 2;
+ if (respa)
+ error->all(FLERR,"Cannot use Kokkos pair style with rRESPA inner/middle");
+ }
+
+ // irequest = neigh request made by parent class
+
+ neighflag = lmp->kokkos->neighflag;
+ int irequest = neighbor->nrequest - 1;
+
+ neighbor->requests[irequest]->
+ kokkos_host = Kokkos::Impl::is_same::value &&
+ !Kokkos::Impl::is_same::value;
+ neighbor->requests[irequest]->
+ kokkos_device = Kokkos::Impl::is_same::value;
+
+ if (neighflag == FULL) {
+ neighbor->requests[irequest]->full = 1;
+ neighbor->requests[irequest]->half = 0;
+ neighbor->requests[irequest]->full_cluster = 0;
+ } else if (neighflag == HALF || neighflag == HALFTHREAD) {
+ neighbor->requests[irequest]->full = 0;
+ neighbor->requests[irequest]->half = 1;
+ neighbor->requests[irequest]->full_cluster = 0;
+ } else {
+ error->all(FLERR,"Cannot use chosen neighbor list style with buck/coul/long/kk");
+ }
+}
+
+/* ----------------------------------------------------------------------
+ init for one type pair i,j and corresponding j,i
+------------------------------------------------------------------------- */
+
+template
+double PairBuckCoulLongKokkos::init_one(int i, int j)
+{
+ double cutone = PairBuckCoulLong::init_one(i,j);
+ double cut_ljsqm = cut_ljsq[i][j];
+ double cut_coulsqm = cut_coulsq;
+
+ k_params.h_view(i,j).a = a[i][j];
+ k_params.h_view(i,j).c = c[i][j];
+ k_params.h_view(i,j).rhoinv = rhoinv[i][j];
+ k_params.h_view(i,j).buck1 = buck1[i][j];
+ k_params.h_view(i,j).buck2 = buck2[i][j];
+ k_params.h_view(i,j).offset = offset[i][j];
+ k_params.h_view(i,j).cut_ljsq = cut_ljsqm;
+ k_params.h_view(i,j).cut_coulsq = cut_coulsqm;
+
+ k_params.h_view(j,i) = k_params.h_view(i,j);
+ if(i();
+ k_cut_ljsq.h_view(i,j) = cut_ljsqm;
+ k_cut_ljsq.template modify();
+ k_cut_coulsq.h_view(i,j) = cut_coulsqm;
+ k_cut_coulsq.template modify();
+ k_params.template modify();
+
+ return cutone;
+
+}
+
+
+template class PairBuckCoulLongKokkos;
+#ifdef KOKKOS_HAVE_CUDA
+template class PairBuckCoulLongKokkos;
+#endif
diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.h b/src/KOKKOS/pair_buck_coul_long_kokkos.h
new file mode 100644
index 0000000000..b4a0c96ff6
--- /dev/null
+++ b/src/KOKKOS/pair_buck_coul_long_kokkos.h
@@ -0,0 +1,150 @@
+/* -*- 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 PAIR_CLASS
+
+PairStyle(buck/coul/long/kk,PairBuckCoulLongKokkos)
+PairStyle(buck/coul/long/kk/device,PairBuckCoulLongKokkos)
+PairStyle(buck/coul/long/kk/host,PairBuckCoulLongKokkos)
+
+#else
+
+#ifndef LMP_PAIR_BUCK_COUL_LONG_KOKKOS_H
+#define LMP_PAIR_BUCK_COUL_LONG_KOKKOS_H
+
+#include "pair_kokkos.h"
+#include "pair_buck_coul_long.h"
+#include "neigh_list_kokkos.h"
+
+namespace LAMMPS_NS {
+
+template
+class PairBuckCoulLongKokkos : public PairBuckCoulLong {
+ public:
+ enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
+ enum {COUL_FLAG=1};
+ typedef DeviceType device_type;
+ PairBuckCoulLongKokkos(class LAMMPS *);
+ ~PairBuckCoulLongKokkos();
+
+ void compute(int, int);
+
+ void settings(int, char **);
+ void init_tables(double cut_coul, double *cut_respa);
+ void init_style();
+ double init_one(int, int);
+
+ struct params_buck_coul{
+ params_buck_coul(){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;};
+ params_buck_coul(int i){cut_ljsq=0;cut_coulsq=0;a=0;c=0;rhoinv=0;buck1=0;buck2=0;offset=0;};
+ F_FLOAT cut_ljsq,cut_coulsq,a,c,rhoinv,buck1,buck2,offset;
+ };
+
+ protected:
+ void cleanup_copy();
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_fpair(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j, const int& itype,
+ const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_evdwl(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype) const;
+
+ template
+ KOKKOS_INLINE_FUNCTION
+ F_FLOAT compute_ecoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const;
+
+ Kokkos::DualView k_params;
+ typename Kokkos::DualView::t_dev_const params;
+ // hardwired to space for 15 atom types
+ params_buck_coul m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+
+ F_FLOAT m_cutsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ F_FLOAT m_cut_ljsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ F_FLOAT m_cut_coulsq[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
+ typename ArrayTypes::t_x_array_randomread x;
+ typename ArrayTypes::t_x_array c_x;
+ typename ArrayTypes::t_f_array f;
+ typename ArrayTypes::t_int_1d_randomread type;
+ typename ArrayTypes::t_float_1d_randomread q;
+
+ DAT::tdual_efloat_1d k_eatom;
+ DAT::tdual_virial_array k_vatom;
+ typename ArrayTypes::t_efloat_1d d_eatom;
+ typename ArrayTypes::t_virial_array d_vatom;
+
+ int newton_pair;
+
+ typename ArrayTypes::tdual_ffloat_2d k_cutsq;
+ typename ArrayTypes::t_ffloat_2d d_cutsq;
+ typename ArrayTypes::tdual_ffloat_2d k_cut_ljsq;
+ typename ArrayTypes::t_ffloat_2d d_cut_ljsq;
+ typename ArrayTypes::tdual_ffloat_2d k_cut_coulsq;
+ typename ArrayTypes::t_ffloat_2d d_cut_coulsq;
+
+ typename ArrayTypes::t_ffloat_1d_randomread
+ d_rtable, d_drtable, d_ftable, d_dftable,
+ d_ctable, d_dctable, d_etable, d_detable;
+ class AtomKokkos *atomKK;
+ int neighflag;
+ int nlocal,nall,eflag,vflag;
+
+ double special_lj[4], special_coul[4];
+ double qqrd2e;
+
+ void allocate();
+
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute >(PairBuckCoulLongKokkos*,
+ NeighListKokkos*);
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend class PairComputeFunctor >;
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist >(PairBuckCoulLongKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute >(PairBuckCoulLongKokkos*,
+ NeighListKokkos*);
+ friend void pair_virial_fdotr_compute(PairBuckCoulLongKokkos*);
+
+};
+
+}
+
+#endif
+#endif
+
+/* ERROR/WARNING messages:
+
+*/
diff --git a/src/KOKKOS/pair_coul_cut_kokkos.h b/src/KOKKOS/pair_coul_cut_kokkos.h
index 03202c4099..29b16d94b8 100644
--- a/src/KOKKOS/pair_coul_cut_kokkos.h
+++ b/src/KOKKOS/pair_coul_cut_kokkos.h
@@ -31,7 +31,7 @@ namespace LAMMPS_NS {
template
class PairCoulCutKokkos : public PairCoulCut {
public:
- enum {EnabledNeighFlags=FULL&HALFTHREAD&HALF};
+ enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
enum {COUL_FLAG=1};
typedef DeviceType device_type;
PairCoulCutKokkos(class LAMMPS *);
@@ -114,13 +114,12 @@ class PairCoulCutKokkos : public PairCoulCut {
friend class PairComputeFunctor;
friend class PairComputeFunctor;
friend class PairComputeFunctor;
- friend class PairComputeFunctor;
- friend class PairComputeFunctor;
friend class PairComputeFunctor;
friend class PairComputeFunctor;
friend class PairComputeFunctor;
- friend class PairComputeFunctor;
- friend class PairComputeFunctor;
+ friend EV_FLOAT pair_compute_neighlist(PairCoulCutKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist(PairCoulCutKokkos*,NeighListKokkos*);
+ friend EV_FLOAT pair_compute_neighlist(PairCoulCutKokkos*,NeighListKokkos*);
friend EV_FLOAT pair_compute(PairCoulCutKokkos*,
NeighListKokkos*);
friend void pair_virial_fdotr_compute(PairCoulCutKokkos*);
diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp
new file mode 100644
index 0000000000..50fb7f8162
--- /dev/null
+++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp
@@ -0,0 +1,313 @@
+/* ----------------------------------------------------------------------
+ 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.
+------------------------------------------------------------------------- */
+
+/* ----------------------------------------------------------------------
+ Contributing author: Ray Shan (SNL)
+------------------------------------------------------------------------- */
+
+#include "math.h"
+#include "stdio.h"
+#include "stdlib.h"
+#include "string.h"
+#include "pair_coul_debye_kokkos.h"
+#include "kokkos.h"
+#include "atom_kokkos.h"
+#include "comm.h"
+#include "force.h"
+#include "neighbor.h"
+#include "neigh_list.h"
+#include "neigh_request.h"
+#include "update.h"
+#include "integrate.h"
+#include "respa.h"
+#include "math_const.h"
+#include "memory.h"
+#include "error.h"
+#include "atom_masks.h"
+
+using namespace LAMMPS_NS;
+using namespace MathConst;
+
+#define KOKKOS_CUDA_MAX_THREADS 256
+#define KOKKOS_CUDA_MIN_BLOCKS 8
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairCoulDebyeKokkos::PairCoulDebyeKokkos(LAMMPS *lmp):PairCoulDebye(lmp)
+{
+ respa_enable = 0;
+
+ atomKK = (AtomKokkos *) atom;
+ execution_space = ExecutionSpaceFromDevice::space;
+ datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK;
+ datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK;
+ cutsq = NULL;
+
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+PairCoulDebyeKokkos::~PairCoulDebyeKokkos()
+{
+ if (!copymode) {
+ memory->destroy_kokkos(k_cutsq, cutsq);
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+void PairCoulDebyeKokkos::cleanup_copy() {
+ // WHY needed: this prevents parent copy from deallocating any arrays
+ allocated = 0;
+ cutsq = NULL;
+ eatom = NULL;
+ vatom = NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+template
+void PairCoulDebyeKokkos::compute(int eflag_in, int vflag_in)
+{
+ eflag = eflag_in;
+ vflag = vflag_in;
+
+ if (neighflag == FULL || neighflag == FULLCLUSTER) no_virial_fdotr_compute = 1;
+
+ if (eflag || vflag) ev_setup(eflag,vflag);
+ else evflag = vflag_fdotr = 0;
+
+ atomKK->sync(execution_space,datamask_read);
+ k_cutsq.template sync();
+ k_cut_ljsq.template sync();
+ k_cut_coulsq.template sync();
+ k_params.template sync();
+ if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
+ else atomKK->modified(execution_space,F_MASK);
+
+ x = atomKK->k_x.view();
+ c_x = atomKK->k_x.view();
+ f = atomKK->k_f.view();
+ q = atomKK->k_q.view();
+ type = atomKK->k_type.view();
+ nlocal = atom->nlocal;
+ nall = atom->nlocal + atom->nghost;
+ special_lj[0] = force->special_lj[0];
+ special_lj[1] = force->special_lj[1];
+ special_lj[2] = force->special_lj[2];
+ special_lj[3] = force->special_lj[3];
+ special_coul[0] = force->special_coul[0];
+ special_coul[1] = force->special_coul[1];
+ special_coul[2] = force->special_coul[2];
+ special_coul[3] = force->special_coul[3];
+ qqrd2e = force->qqrd2e;
+ newton_pair = force->newton_pair;
+
+ // loop over neighbors of my atoms
+
+ copymode = 1;
+
+ EV_FLOAT ev = pair_compute,void >
+ (this,(NeighListKokkos*)list);
+
+ DeviceType::fence();
+
+ if (eflag) {
+ eng_vdwl += ev.evdwl;
+ eng_coul += ev.ecoul;
+ }
+ if (vflag_global) {
+ virial[0] += ev.v[0];
+ virial[1] += ev.v[1];
+ virial[2] += ev.v[2];
+ virial[3] += ev.v[3];
+ virial[4] += ev.v[4];
+ virial[5] += ev.v[5];
+ }
+
+ if (vflag_fdotr) virial_fdotr_compute();
+
+ copymode = 0;
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair force between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template
+KOKKOS_INLINE_FUNCTION
+F_FLOAT PairCoulDebyeKokkos::
+compute_fcoul(const F_FLOAT& rsq, const int& i, const int&j,
+ const int& itype, const int& jtype, const F_FLOAT& factor_coul, const F_FLOAT& qtmp) const {
+
+ const F_FLOAT r2inv = 1.0/rsq;
+ const F_FLOAT rinv = sqrt(r2inv);
+ const F_FLOAT r = 1.0/rinv;
+ const F_FLOAT screening = exp(-kappa*r);
+ F_FLOAT forcecoul;
+
+ forcecoul = qqrd2e * qtmp * q(j) * screening * (kappa + rinv) *
+ (STACKPARAMS?m_params[itype][jtype].scale:params(itype,jtype).scale);
+
+ return factor_coul*forcecoul*r2inv;
+
+}
+
+/* ----------------------------------------------------------------------
+ compute coulomb pair potential energy between atoms i and j
+ ---------------------------------------------------------------------- */
+template
+template