Merge remote-tracking branch 'lammps-ro/master' into lammps-icms
Resolved Conflicts: doc/Manual.html doc/Manual.txt src/KOKKOS/neigh_list_kokkos.h
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="16 Apr 2015 version">
|
||||
<META NAME="docnumber" CONTENT="18 Apr 2015 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -22,7 +22,7 @@
|
||||
|
||||
<CENTER><H3>LAMMPS-ICMS Documentation
|
||||
</H3></CENTER>
|
||||
<CENTER><H4>16 Apr 2015 version
|
||||
<CENTER><H4>18 Apr 2015 version
|
||||
</H4></CENTER>
|
||||
<H4>Version info:
|
||||
</H4>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<HEAD>
|
||||
<TITLE>LAMMPS-ICMS Users Manual</TITLE>
|
||||
<META NAME="docnumber" CONTENT="16 Apr 2015 version">
|
||||
<META NAME="docnumber" CONTENT="18 Apr 2015 version">
|
||||
<META NAME="author" CONTENT="http://lammps.sandia.gov - Sandia National Laboratories">
|
||||
<META NAME="copyright" CONTENT="Copyright (2003) Sandia Corporation. This software and manual is distributed under the GNU General Public License.">
|
||||
</HEAD>
|
||||
@ -18,7 +18,7 @@
|
||||
<H1></H1>
|
||||
|
||||
LAMMPS-ICMS Documentation :c,h3
|
||||
16 Apr 2015 version :c,h4
|
||||
18 Apr 2015 version :c,h4
|
||||
|
||||
Version info: :h4
|
||||
|
||||
|
||||
@ -496,7 +496,7 @@ KOKKOS, o = USER-OMP, t = OPT.
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_comb.html">comb (o)</A></TD><TD ><A HREF = "pair_comb.html">comb3</A></TD><TD ><A HREF = "pair_coul.html">coul/cut (gko)</A></TD><TD ><A HREF = "pair_coul.html">coul/debye (gko)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_coul.html">coul/dsf (gko)</A></TD><TD ><A HREF = "pair_coul.html">coul/long (gko)</A></TD><TD ><A HREF = "pair_coul.html">coul/msm</A></TD><TD ><A HREF = "pair_coul.html">coul/streitz</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_coul.html">coul/wolf (ko)</A></TD><TD ><A HREF = "pair_dpd.html">dpd (o)</A></TD><TD ><A HREF = "pair_dpd.html">dpd/tstat (o)</A></TD><TD ><A HREF = "pair_dsmc.html">dsmc</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_eam.html">eam (cgkot)</A></TD><TD ><A HREF = "pair_eam.html">eam/alloy (cgot)</A></TD><TD ><A HREF = "pair_eam.html">eam/fs (cgot)</A></TD><TD ><A HREF = "pair_eim.html">eim (o)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_eam.html">eam (cgkot)</A></TD><TD ><A HREF = "pair_eam.html">eam/alloy (cgkot)</A></TD><TD ><A HREF = "pair_eam.html">eam/fs (cgkot)</A></TD><TD ><A HREF = "pair_eim.html">eim (o)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_gauss.html">gauss (go)</A></TD><TD ><A HREF = "pair_gayberne.html">gayberne (gio)</A></TD><TD ><A HREF = "pair_gran.html">gran/hertz/history (o)</A></TD><TD ><A HREF = "pair_gran.html">gran/hooke (co)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_gran.html">gran/hooke/history (o)</A></TD><TD ><A HREF = "pair_hbond_dreiding.html">hbond/dreiding/lj (o)</A></TD><TD ><A HREF = "pair_hbond_dreiding.html">hbond/dreiding/morse (o)</A></TD><TD ><A HREF = "pair_kim.html">kim</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_lcbop.html">lcbop</A></TD><TD ><A HREF = "pair_line_lj.html">line/lj (o)</A></TD><TD ><A HREF = "pair_charmm.html">lj/charmm/coul/charmm (cko)</A></TD><TD ><A HREF = "pair_charmm.html">lj/charmm/coul/charmm/implicit (cko)</A></TD></TR>
|
||||
@ -511,8 +511,8 @@ KOKKOS, o = USER-OMP, t = OPT.
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_nm.html">nm/cut (o)</A></TD><TD ><A HREF = "pair_nm.html">nm/cut/coul/cut (o)</A></TD><TD ><A HREF = "pair_nm.html">nm/cut/coul/long (o)</A></TD><TD ><A HREF = "pair_peri.html">peri/eps</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_peri.html">peri/lps (o)</A></TD><TD ><A HREF = "pair_peri.html">peri/pmb (o)</A></TD><TD ><A HREF = "pair_peri.html">peri/ves</A></TD><TD ><A HREF = "pair_reax.html">reax</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_airebo.html">rebo (o)</A></TD><TD ><A HREF = "pair_resquared.html">resquared (go)</A></TD><TD ><A HREF = "pair_snap.html">snap</A></TD><TD ><A HREF = "pair_soft.html">soft (go)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_sw.html">sw (cgo)</A></TD><TD ><A HREF = "pair_table.html">table (gko)</A></TD><TD ><A HREF = "pair_tersoff.html">tersoff (co)</A></TD><TD ><A HREF = "pair_tersoff_mod.html">tersoff/mod (o)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_tersoff_zbl.html">tersoff/zbl (o)</A></TD><TD ><A HREF = "pair_coul.html">tip4p/cut (o)</A></TD><TD ><A HREF = "pair_coul.html">tip4p/long (o)</A></TD><TD ><A HREF = "pair_tri_lj.html">tri/lj (o)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_sw.html">sw (cgkio)</A></TD><TD ><A HREF = "pair_table.html">table (gko)</A></TD><TD ><A HREF = "pair_tersoff.html">tersoff (cko)</A></TD><TD ><A HREF = "pair_tersoff_mod.html">tersoff/mod (ko)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_tersoff_zbl.html">tersoff/zbl (ko)</A></TD><TD ><A HREF = "pair_coul.html">tip4p/cut (o)</A></TD><TD ><A HREF = "pair_coul.html">tip4p/long (o)</A></TD><TD ><A HREF = "pair_tri_lj.html">tri/lj (o)</A></TD></TR>
|
||||
<TR ALIGN="center"><TD ><A HREF = "pair_yukawa.html">yukawa (go)</A></TD><TD ><A HREF = "pair_yukawa_colloid.html">yukawa/colloid (go)</A></TD><TD ><A HREF = "pair_zbl.html">zbl (o)</A>
|
||||
</TD></TR></TABLE></DIV>
|
||||
|
||||
|
||||
@ -770,8 +770,8 @@ KOKKOS, o = USER-OMP, t = OPT.
|
||||
"dpd/tstat (o)"_pair_dpd.html,
|
||||
"dsmc"_pair_dsmc.html,
|
||||
"eam (cgkot)"_pair_eam.html,
|
||||
"eam/alloy (cgot)"_pair_eam.html,
|
||||
"eam/fs (cgot)"_pair_eam.html,
|
||||
"eam/alloy (cgkot)"_pair_eam.html,
|
||||
"eam/fs (cgkot)"_pair_eam.html,
|
||||
"eim (o)"_pair_eim.html,
|
||||
"gauss (go)"_pair_gauss.html,
|
||||
"gayberne (gio)"_pair_gayberne.html,
|
||||
@ -829,11 +829,11 @@ KOKKOS, o = USER-OMP, t = OPT.
|
||||
"resquared (go)"_pair_resquared.html,
|
||||
"snap"_pair_snap.html,
|
||||
"soft (go)"_pair_soft.html,
|
||||
"sw (cgo)"_pair_sw.html,
|
||||
"sw (cgkio)"_pair_sw.html,
|
||||
"table (gko)"_pair_table.html,
|
||||
"tersoff (co)"_pair_tersoff.html,
|
||||
"tersoff/mod (o)"_pair_tersoff_mod.html,
|
||||
"tersoff/zbl (o)"_pair_tersoff_zbl.html,
|
||||
"tersoff (cko)"_pair_tersoff.html,
|
||||
"tersoff/mod (ko)"_pair_tersoff_mod.html,
|
||||
"tersoff/zbl (ko)"_pair_tersoff_zbl.html,
|
||||
"tip4p/cut (o)"_pair_coul.html,
|
||||
"tip4p/long (o)"_pair_coul.html,
|
||||
"tri/lj (o)"_pair_tri_lj.html,
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
</H3>
|
||||
<H3>pair_style eam/alloy/gpu command
|
||||
</H3>
|
||||
<H3>pair_style eam/alloy/kk command
|
||||
</H3>
|
||||
<H3>pair_style eam/alloy/omp command
|
||||
</H3>
|
||||
<H3>pair_style eam/alloy/opt command
|
||||
@ -41,6 +43,8 @@
|
||||
</H3>
|
||||
<H3>pair_style eam/fs/gpu command
|
||||
</H3>
|
||||
<H3>pair_style eam/fs/kk command
|
||||
</H3>
|
||||
<H3>pair_style eam/fs/omp command
|
||||
</H3>
|
||||
<H3>pair_style eam/fs/opt command
|
||||
|
||||
@ -15,6 +15,7 @@ pair_style eam/opt command :h3
|
||||
pair_style eam/alloy command :h3
|
||||
pair_style eam/alloy/cuda command :h3
|
||||
pair_style eam/alloy/gpu command :h3
|
||||
pair_style eam/alloy/kk command :h3
|
||||
pair_style eam/alloy/omp command :h3
|
||||
pair_style eam/alloy/opt command :h3
|
||||
pair_style eam/cd command :h3
|
||||
@ -22,6 +23,7 @@ pair_style eam/cd/omp command :h3
|
||||
pair_style eam/fs command :h3
|
||||
pair_style eam/fs/cuda command :h3
|
||||
pair_style eam/fs/gpu command :h3
|
||||
pair_style eam/fs/kk command :h3
|
||||
pair_style eam/fs/omp command :h3
|
||||
pair_style eam/fs/opt command :h3
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
</H3>
|
||||
<H3>pair_style sw/intel command
|
||||
</H3>
|
||||
<H3>pair_style sw/kk command
|
||||
</H3>
|
||||
<H3>pair_style sw/omp command
|
||||
</H3>
|
||||
<P><B>Syntax:</B>
|
||||
|
||||
@ -10,6 +10,7 @@ pair_style sw command :h3
|
||||
pair_style sw/cuda command :h3
|
||||
pair_style sw/gpu command :h3
|
||||
pair_style sw/intel command :h3
|
||||
pair_style sw/kk command :h3
|
||||
pair_style sw/omp command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
</H3>
|
||||
<H3>pair_style tersoff/cuda
|
||||
</H3>
|
||||
<H3>pair_style tersoff/kk
|
||||
</H3>
|
||||
<H3>pair_style tersoff/omp
|
||||
</H3>
|
||||
<H3>pair_style tersoff/table/omp command
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
pair_style tersoff command :h3
|
||||
pair_style tersoff/table command :h3
|
||||
pair_style tersoff/cuda :h3
|
||||
pair_style tersoff/kk :h3
|
||||
pair_style tersoff/omp :h3
|
||||
pair_style tersoff/table/omp command :h3
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
<H3>pair_style tersoff/mod command
|
||||
</H3>
|
||||
<H3>pair_style tersoff/mod/kk command
|
||||
</H3>
|
||||
<H3>pair_style tersoff/mod/omp command
|
||||
</H3>
|
||||
<P><B>Syntax:</B>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
:line
|
||||
|
||||
pair_style tersoff/mod command :h3
|
||||
pair_style tersoff/mod/kk command :h3
|
||||
pair_style tersoff/mod/omp command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
|
||||
<H3>pair_style tersoff/zbl command
|
||||
</H3>
|
||||
<H3>pair_style tersoff/zbl/kk command
|
||||
</H3>
|
||||
<H3>pair_style tersoff/zbl/omp command
|
||||
</H3>
|
||||
<P><B>Syntax:</B>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
:line
|
||||
|
||||
pair_style tersoff/zbl command :h3
|
||||
pair_style tersoff/zbl/kk command :h3
|
||||
pair_style tersoff/zbl/omp command :h3
|
||||
|
||||
[Syntax:]
|
||||
|
||||
@ -98,6 +98,10 @@ 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_eam_alloy_kokkos.cpp pair_eam_alloy.cpp
|
||||
action pair_eam_alloy_kokkos.h pair_eam_alloy.h
|
||||
action pair_eam_fs_kokkos.cpp pair_eam_fs.cpp
|
||||
action pair_eam_fs_kokkos.h pair_eam_fs.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
|
||||
@ -129,8 +133,16 @@ action pair_lj_gromacs_kokkos.cpp
|
||||
action pair_lj_gromacs_kokkos.h
|
||||
action pair_lj_sdk_kokkos.cpp pair_lj_sdk.cpp
|
||||
action pair_lj_sdk_kokkos.h pair_lj_sdk.h
|
||||
action pair_sw_kokkos.cpp pair_sw.cpp
|
||||
action pair_sw_kokkos.h pair_sw.h
|
||||
action pair_table_kokkos.cpp
|
||||
action pair_table_kokkos.h
|
||||
action pair_tersoff_kokkos.cpp pair_tersoff.cpp
|
||||
action pair_tersoff_kokkos.h pair_tersoff.h
|
||||
action pair_tersoff_mod_kokkos.cpp pair_tersoff_mod.cpp
|
||||
action pair_tersoff_mod_kokkos.h pair_tersoff_mod.h
|
||||
action pair_tersoff_zbl_kokkos.cpp pair_tersoff_zbl.cpp
|
||||
action pair_tersoff_zbl_kokkos.h pair_tersoff_zbl.h
|
||||
action verlet_kokkos.cpp
|
||||
action verlet_kokkos.h
|
||||
|
||||
|
||||
@ -214,6 +214,14 @@ typedef tdual_int_1d::t_dev_um t_int_1d_um;
|
||||
typedef tdual_int_1d::t_dev_const_um t_int_1d_const_um;
|
||||
typedef tdual_int_1d::t_dev_const_randomread t_int_1d_randomread;
|
||||
|
||||
typedef Kokkos::
|
||||
DualView<int*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_int_1d_3;
|
||||
typedef tdual_int_1d_3::t_dev t_int_1d_3;
|
||||
typedef tdual_int_1d_3::t_dev_const t_int_1d_3_const;
|
||||
typedef tdual_int_1d_3::t_dev_um t_int_1d_3_um;
|
||||
typedef tdual_int_1d_3::t_dev_const_um t_int_1d_3_const_um;
|
||||
typedef tdual_int_1d_3::t_dev_const_randomread t_int_1d_3_randomread;
|
||||
|
||||
typedef Kokkos::
|
||||
DualView<int**, Kokkos::LayoutRight, LMPDeviceType> tdual_int_2d;
|
||||
typedef tdual_int_2d::t_dev t_int_2d;
|
||||
@ -440,6 +448,13 @@ typedef tdual_int_1d::t_host_um t_int_1d_um;
|
||||
typedef tdual_int_1d::t_host_const_um t_int_1d_const_um;
|
||||
typedef tdual_int_1d::t_host_const_randomread t_int_1d_randomread;
|
||||
|
||||
typedef Kokkos::DualView<int*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_int_1d_3;
|
||||
typedef tdual_int_1d_3::t_host t_int_1d_3;
|
||||
typedef tdual_int_1d_3::t_host_const t_int_1d_3_const;
|
||||
typedef tdual_int_1d_3::t_host_um t_int_1d_3_um;
|
||||
typedef tdual_int_1d_3::t_host_const_um t_int_1d_3_const_um;
|
||||
typedef tdual_int_1d_3::t_host_const_randomread t_int_1d_3_randomread;
|
||||
|
||||
typedef Kokkos::DualView<int**, Kokkos::LayoutRight, LMPDeviceType> tdual_int_2d;
|
||||
typedef tdual_int_2d::t_host t_int_2d;
|
||||
typedef tdual_int_2d::t_host_const t_int_2d_const;
|
||||
|
||||
@ -19,17 +19,20 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType, int HALF_NEIGH>
|
||||
template<class DeviceType, int HALF_NEIGH, int GHOST>
|
||||
void NeighborKokkos::full_bin_kokkos(NeighListKokkos<DeviceType> *list)
|
||||
{
|
||||
const int nall = includegroup?atom->nfirst:atom->nlocal;
|
||||
const int nlocal = includegroup?atom->nfirst:atom->nlocal;
|
||||
int nall = nlocal;
|
||||
if (GHOST)
|
||||
nall += atom->nghost;
|
||||
list->grow(nall);
|
||||
|
||||
NeighborKokkosExecute<DeviceType>
|
||||
data(*list,
|
||||
k_cutneighsq.view<DeviceType>(),
|
||||
k_bincount.view<DeviceType>(),
|
||||
k_bins.view<DeviceType>(),nall,
|
||||
k_bins.view<DeviceType>(),nlocal,
|
||||
atomKK->k_x.view<DeviceType>(),
|
||||
atomKK->k_type.view<DeviceType>(),
|
||||
atomKK->k_mask.view<DeviceType>(),
|
||||
@ -68,6 +71,8 @@ void NeighborKokkos::full_bin_kokkos(NeighListKokkos<DeviceType> *list)
|
||||
k_ex_mol_bit.sync<DeviceType>();
|
||||
atomKK->sync(Device,X_MASK|TYPE_MASK|MASK_MASK|MOLECULE_MASK|TAG_MASK|SPECIAL_MASK);
|
||||
Kokkos::deep_copy(list->d_stencil,list->h_stencil);
|
||||
if (GHOST)
|
||||
Kokkos::deep_copy(list->d_stencilxyz,list->h_stencilxyz);
|
||||
|
||||
data.special_flag[0] = special_flag[0];
|
||||
data.special_flag[1] = special_flag[1];
|
||||
@ -119,20 +124,25 @@ void NeighborKokkos::full_bin_kokkos(NeighListKokkos<DeviceType> *list)
|
||||
const int factor = 1;
|
||||
#endif
|
||||
|
||||
if(newton_pair) {
|
||||
NeighborKokkosBuildFunctor<DeviceType,HALF_NEIGH,1> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
Kokkos::parallel_for(config, f);
|
||||
#else
|
||||
if (GHOST && !HALF_NEIGH) {
|
||||
NeighborKokkosBuildFunctorFullGhost<DeviceType> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
} else {
|
||||
NeighborKokkosBuildFunctor<DeviceType,HALF_NEIGH,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
if(newton_pair) {
|
||||
NeighborKokkosBuildFunctor<DeviceType,HALF_NEIGH,1> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
Kokkos::parallel_for(config, f);
|
||||
Kokkos::parallel_for(config, f);
|
||||
#else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
} else {
|
||||
NeighborKokkosBuildFunctor<DeviceType,HALF_NEIGH,0> f(data,atoms_per_bin * 5 * sizeof(X_FLOAT) * factor);
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
Kokkos::parallel_for(config, f);
|
||||
#else
|
||||
Kokkos::parallel_for(nall, f);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
DeviceType::fence();
|
||||
deep_copy(data.h_resize, data.resize);
|
||||
@ -146,8 +156,13 @@ if(newton_pair) {
|
||||
}
|
||||
}
|
||||
|
||||
list->inum = nall;
|
||||
list->gnum = 0;
|
||||
if (GHOST) {
|
||||
list->inum = atom->nlocal;
|
||||
list->gnum = nall - atom->nlocal;
|
||||
} else {
|
||||
list->inum = nall;
|
||||
list->gnum = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -524,6 +539,120 @@ void NeighborKokkosExecute<DeviceType>::build_ItemCuda(typename Kokkos::TeamPoli
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class Device>
|
||||
void NeighborKokkosExecute<Device>::
|
||||
build_Item_Full_Ghost(const int &i) const
|
||||
{
|
||||
/* if necessary, goto next page and add pages */
|
||||
int n = 0;
|
||||
int which = 0;
|
||||
int moltemplate;
|
||||
if (molecular == 2) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
// get subview of neighbors of i
|
||||
|
||||
const AtomNeighbors neighbors_i = neigh_list.get_neighbors(i);
|
||||
const X_FLOAT xtmp = x(i, 0);
|
||||
const X_FLOAT ytmp = x(i, 1);
|
||||
const X_FLOAT ztmp = x(i, 2);
|
||||
const int itype = type(i);
|
||||
|
||||
const int nstencil = neigh_list.nstencil;
|
||||
const typename ArrayTypes<Device>::t_int_1d_const_um stencil
|
||||
= neigh_list.d_stencil;
|
||||
const typename ArrayTypes<Device>::t_int_1d_3_const_um stencilxyz
|
||||
= neigh_list.d_stencilxyz;
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// when i is a ghost atom, must check if stencil bin is out of bounds
|
||||
// skip i = j
|
||||
// no molecular test when i = ghost atom
|
||||
|
||||
if (i < nlocal) {
|
||||
const int ibin = coord2bin(xtmp, ytmp, ztmp);
|
||||
for (int k = 0; k < nstencil; k++) {
|
||||
const int jbin = ibin + stencil[k];
|
||||
for(int m = 0; m < c_bincount(jbin); m++) {
|
||||
const int j = c_bins(jbin,m);
|
||||
if (i == j) continue;
|
||||
|
||||
const int jtype = type[j];
|
||||
if(exclude && exclusion(i,j,itype,jtype)) continue;
|
||||
|
||||
const X_FLOAT delx = xtmp - x(j,0);
|
||||
const X_FLOAT dely = ytmp - x(j,1);
|
||||
const X_FLOAT delz = ztmp - x(j,2);
|
||||
const X_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
if (rsq <= cutneighsq(itype,jtype)) {
|
||||
if (molecular) {
|
||||
if (!moltemplate)
|
||||
which = find_special(i,j);
|
||||
/* else if (imol >= 0) */
|
||||
/* which = find_special(onemols[imol]->special[iatom], */
|
||||
/* onemols[imol]->nspecial[iatom], */
|
||||
/* tag[j]-tagprev); */
|
||||
/* else which = 0; */
|
||||
if (which == 0){
|
||||
if(n<neigh_list.maxneighs) neighbors_i(n++) = j;
|
||||
}else if (minimum_image_check(delx,dely,delz)){
|
||||
if(n<neigh_list.maxneighs) neighbors_i(n++) = j;
|
||||
}
|
||||
else if (which > 0) {
|
||||
if(n<neigh_list.maxneighs) neighbors_i(n++) = j ^ (which << SBBITS);
|
||||
}
|
||||
} else {
|
||||
if(n<neigh_list.maxneighs) neighbors_i(n++) = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
int binxyz[3];
|
||||
const int ibin = coord2bin(xtmp, ytmp, ztmp, binxyz);
|
||||
const int xbin = binxyz[0];
|
||||
const int ybin = binxyz[1];
|
||||
const int zbin = binxyz[2];
|
||||
for (int k = 0; k < nstencil; k++) {
|
||||
const X_FLOAT xbin2 = xbin + stencilxyz(k,0);
|
||||
const X_FLOAT ybin2 = ybin + stencilxyz(k,1);
|
||||
const X_FLOAT zbin2 = zbin + stencilxyz(k,2);
|
||||
if (xbin2 < 0 || xbin2 >= mbinx ||
|
||||
ybin2 < 0 || ybin2 >= mbiny ||
|
||||
zbin2 < 0 || zbin2 >= mbinz) continue;
|
||||
const int jbin = ibin + stencil[k];
|
||||
for(int m = 0; m < c_bincount(jbin); m++) {
|
||||
const int j = c_bins(jbin,m);
|
||||
if (i == j) continue;
|
||||
|
||||
const int jtype = type[j];
|
||||
if(exclude && exclusion(i,j,itype,jtype)) continue;
|
||||
|
||||
const X_FLOAT delx = xtmp - x(j,0);
|
||||
const X_FLOAT dely = ytmp - x(j,1);
|
||||
const X_FLOAT delz = ztmp - x(j,2);
|
||||
const X_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
if (rsq <= cutneighsq(itype,jtype)) {
|
||||
if(n<neigh_list.maxneighs) neighbors_i(n++) = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
neigh_list.d_numneigh(i) = n;
|
||||
|
||||
if(n >= neigh_list.maxneighs) {
|
||||
resize() = 1;
|
||||
|
||||
if(n >= new_maxneighs()) new_maxneighs() = n;
|
||||
}
|
||||
neigh_list.d_ilist(i) = i;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
void NeighborKokkos::full_bin_cluster_kokkos(NeighListKokkos<DeviceType> *list)
|
||||
{
|
||||
|
||||
@ -81,8 +81,8 @@ void NeighListKokkos<Device>::stencil_allocate(int smax, int style)
|
||||
memory->create_kokkos(d_stencil,h_stencil,stencil,maxstencil,
|
||||
"neighlist:stencil");
|
||||
if (ghostflag) {
|
||||
memory->destroy(stencilxyz);
|
||||
memory->create(stencilxyz,maxstencil,3,"neighlist:stencilxyz");
|
||||
memory->create_kokkos(d_stencilxyz,h_stencilxyz,stencilxyz,maxstencil,
|
||||
3,"neighlist:stencilxyz");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class AtomNeighborsConst
|
||||
const int num_neighs;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
AtomNeighborsConst(int* const & firstneigh, const int & _num_neighs,
|
||||
AtomNeighborsConst(int* const & firstneigh, const int & _num_neighs,
|
||||
const int & stride):
|
||||
_firstneigh(firstneigh), num_neighs(_num_neighs), _stride(stride) {};
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
@ -75,6 +75,8 @@ public:
|
||||
typename ArrayTypes<Device>::t_int_1d d_numneigh; // # of J neighs for each I
|
||||
typename ArrayTypes<Device>::t_int_1d d_stencil; // # of J neighs for each I
|
||||
typename ArrayTypes<LMPHostType>::t_int_1d h_stencil; // # of J neighs per I
|
||||
typename ArrayTypes<Device>::t_int_1d_3 d_stencilxyz;
|
||||
typename ArrayTypes<LMPHostType>::t_int_1d_3 h_stencilxyz;
|
||||
|
||||
NeighListKokkos(class LAMMPS *lmp):
|
||||
NeighList(lmp) {_stride = 1; maxneighs = 16;};
|
||||
|
||||
@ -269,18 +269,32 @@ void NeighborKokkos::choose_build(int index, NeighRequest *rq)
|
||||
{
|
||||
if (rq->kokkos_host != 0) {
|
||||
PairPtrHost pb = NULL;
|
||||
if (rq->full) pb = &NeighborKokkos::full_bin_kokkos<LMPHostType,0>;
|
||||
else if (rq->half) pb = &NeighborKokkos::full_bin_kokkos<LMPHostType,1>;
|
||||
pair_build_host[index] = pb;
|
||||
if (rq->ghost) {
|
||||
if (rq->full) pb = &NeighborKokkos::full_bin_kokkos<LMPHostType,0,1>;
|
||||
else if (rq->half) error->one(FLERR,"Cannot (yet) request ghost atoms with Kokkos half neighbor list");
|
||||
pair_build_host[index] = pb;
|
||||
} else {
|
||||
if (rq->full) pb = &NeighborKokkos::full_bin_kokkos<LMPHostType,0,0>;
|
||||
else if (rq->half) pb = &NeighborKokkos::full_bin_kokkos<LMPHostType,1,0>;
|
||||
pair_build_host[index] = pb;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (rq->kokkos_device != 0) {
|
||||
PairPtrDevice pb = NULL;
|
||||
if (rq->full) {
|
||||
if (rq->full_cluster) pb = &NeighborKokkos::full_bin_cluster_kokkos<LMPDeviceType>;
|
||||
else pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,0>;
|
||||
if (rq->ghost) {
|
||||
if (rq->full) {
|
||||
if (rq->full_cluster) pb = &NeighborKokkos::full_bin_cluster_kokkos<LMPDeviceType>;
|
||||
else pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,0,1>;
|
||||
}
|
||||
else if (rq->half) pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,1,1>;
|
||||
} else {
|
||||
if (rq->full) {
|
||||
if (rq->full_cluster) pb = &NeighborKokkos::full_bin_cluster_kokkos<LMPDeviceType>;
|
||||
else pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,0,0>;
|
||||
}
|
||||
else if (rq->half) pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,1,0>;
|
||||
}
|
||||
else if (rq->half) pb = &NeighborKokkos::full_bin_kokkos<LMPDeviceType,1>;
|
||||
pair_build_device[index] = pb;
|
||||
return;
|
||||
}
|
||||
@ -441,10 +455,14 @@ void NeighborKokkos::build_kokkos(int topoflag)
|
||||
|
||||
if (anyghostlist && atom->nlocal+atom->nghost > maxatom) {
|
||||
maxatom = atom->nmax;
|
||||
for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom);
|
||||
for (i = 0; i < nglist; i++)
|
||||
if (lists[glist[i]]) lists[glist[i]]->grow(maxatom);
|
||||
else init_list_grow_kokkos(glist[i]);
|
||||
} else if (atom->nlocal > maxatom) {
|
||||
maxatom = atom->nmax;
|
||||
for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom);
|
||||
for (i = 0; i < nglist; i++)
|
||||
if (lists[glist[i]]) lists[glist[i]]->grow(maxatom);
|
||||
else init_list_grow_kokkos(glist[i]);
|
||||
}
|
||||
|
||||
// extend atom bin list if necessary
|
||||
|
||||
@ -158,6 +158,9 @@ class NeighborKokkosExecute
|
||||
KOKKOS_FUNCTION
|
||||
void build_Item(const int &i) const;
|
||||
|
||||
KOKKOS_FUNCTION
|
||||
void build_Item_Full_Ghost(const int &i) const;
|
||||
|
||||
template<int ClusterSize>
|
||||
KOKKOS_FUNCTION
|
||||
void build_cluster_Item(const int &i) const;
|
||||
@ -203,6 +206,42 @@ class NeighborKokkosExecute
|
||||
return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo);
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
int coord2bin(const X_FLOAT & x,const X_FLOAT & y,const X_FLOAT & z, int* i) const
|
||||
{
|
||||
int ix,iy,iz;
|
||||
|
||||
if (x >= bboxhi[0])
|
||||
ix = static_cast<int> ((x-bboxhi[0])*bininvx) + nbinx;
|
||||
else if (x >= bboxlo[0]) {
|
||||
ix = static_cast<int> ((x-bboxlo[0])*bininvx);
|
||||
ix = MIN(ix,nbinx-1);
|
||||
} else
|
||||
ix = static_cast<int> ((x-bboxlo[0])*bininvx) - 1;
|
||||
|
||||
if (y >= bboxhi[1])
|
||||
iy = static_cast<int> ((y-bboxhi[1])*bininvy) + nbiny;
|
||||
else if (y >= bboxlo[1]) {
|
||||
iy = static_cast<int> ((y-bboxlo[1])*bininvy);
|
||||
iy = MIN(iy,nbiny-1);
|
||||
} else
|
||||
iy = static_cast<int> ((y-bboxlo[1])*bininvy) - 1;
|
||||
|
||||
if (z >= bboxhi[2])
|
||||
iz = static_cast<int> ((z-bboxhi[2])*bininvz) + nbinz;
|
||||
else if (z >= bboxlo[2]) {
|
||||
iz = static_cast<int> ((z-bboxlo[2])*bininvz);
|
||||
iz = MIN(iz,nbinz-1);
|
||||
} else
|
||||
iz = static_cast<int> ((z-bboxlo[2])*bininvz) - 1;
|
||||
|
||||
i[0] = ix - mbinxlo;
|
||||
i[1] = iy - mbinylo;
|
||||
i[2] = iz - mbinzlo;
|
||||
|
||||
return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo);
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
int exclusion(const int &i,const int &j, const int &itype,const int &jtype) const;
|
||||
|
||||
@ -258,6 +297,23 @@ struct NeighborKokkosBuildFunctor {
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class Device>
|
||||
struct NeighborKokkosBuildFunctorFullGhost {
|
||||
typedef Device device_type;
|
||||
|
||||
const NeighborKokkosExecute<Device> c;
|
||||
const size_t sharedsize;
|
||||
|
||||
NeighborKokkosBuildFunctorFullGhost(const NeighborKokkosExecute<Device> &_c,
|
||||
const size_t _sharedsize):c(_c),
|
||||
sharedsize(_sharedsize) {};
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator() (const int & i) const {
|
||||
c.build_Item_Full_Ghost(i);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Device,int ClusterSize>
|
||||
struct NeighborClusterKokkosBuildFunctor {
|
||||
typedef Device device_type;
|
||||
@ -358,7 +414,7 @@ class NeighborKokkos : public Neighbor {
|
||||
(class NeighListKokkos<LMPDeviceType> *);
|
||||
PairPtrDevice *pair_build_device;
|
||||
|
||||
template<class DeviceType,int HALF_NEIGH>
|
||||
template<class DeviceType,int HALF_NEIGH, int GHOST>
|
||||
void full_bin_kokkos(NeighListKokkos<DeviceType> *list);
|
||||
template<class DeviceType>
|
||||
void full_bin_cluster_kokkos(NeighListKokkos<DeviceType> *list);
|
||||
@ -383,4 +439,8 @@ The number of nlocal + nghost atoms on a processor
|
||||
is limited by the size of a 32-bit integer with 2 bits
|
||||
removed for masking 1-2, 1-3, 1-4 neighbors.
|
||||
|
||||
E: Cannot (yet) request ghost atoms with Kokkos half neighbor list
|
||||
|
||||
This feature is not yet supported.
|
||||
|
||||
*/
|
||||
|
||||
1177
src/KOKKOS/pair_eam_alloy_kokkos.cpp
Executable file
1177
src/KOKKOS/pair_eam_alloy_kokkos.cpp
Executable file
File diff suppressed because it is too large
Load Diff
183
src/KOKKOS/pair_eam_alloy_kokkos.h
Executable file
183
src/KOKKOS/pair_eam_alloy_kokkos.h
Executable file
@ -0,0 +1,183 @@
|
||||
/* -*- 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(eam/alloy/kk,PairEAMAlloyKokkos<LMPDeviceType>)
|
||||
PairStyle(eam/alloy/kk/device,PairEAMAlloyKokkos<LMPDeviceType>)
|
||||
PairStyle(eam/alloy/kk/host,PairEAMAlloyKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_EAM_ALLOY_KOKKOS_H
|
||||
#define LMP_PAIR_EAM_ALLOY_KOKKOS_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_eam.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
struct TagPairEAMAlloyPackForwardComm{};
|
||||
struct TagPairEAMAlloyUnpackForwardComm{};
|
||||
struct TagPairEAMAlloyInitialize{};
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
struct TagPairEAMAlloyKernelA{};
|
||||
|
||||
template<int EFLAG>
|
||||
struct TagPairEAMAlloyKernelB{};
|
||||
|
||||
template<int EFLAG>
|
||||
struct TagPairEAMAlloyKernelAB{};
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
struct TagPairEAMAlloyKernelC{};
|
||||
|
||||
// Cannot use virtual inheritance on the GPU
|
||||
|
||||
template<class DeviceType>
|
||||
class PairEAMAlloyKokkos : public PairEAM {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairEAMAlloyKokkos(class LAMMPS *);
|
||||
virtual ~PairEAMAlloyKokkos();
|
||||
virtual void compute(int, int);
|
||||
void init_style();
|
||||
void coeff(int, char **);
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyPackForwardComm, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyUnpackForwardComm, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyInitialize, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelA<NEIGHFLAG,NEWTON_PAIR>, const int&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelB<EFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelB<EFLAG>, const int&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelAB<EFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelAB<EFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelC<NEIGHFLAG,NEWTON_PAIR,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMAlloyKernelC<NEIGHFLAG,NEWTON_PAIR,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&,
|
||||
int, int *);
|
||||
virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&);
|
||||
virtual int pack_forward_comm(int, int *, double *, int, int *);
|
||||
virtual void unpack_forward_comm(int, int, double *);
|
||||
int pack_reverse_comm(int, int, double *);
|
||||
void unpack_reverse_comm(int, int *, double *);
|
||||
|
||||
protected:
|
||||
void cleanup_copy();
|
||||
|
||||
typename AT::t_x_array_randomread x;
|
||||
typename AT::t_f_array f;
|
||||
typename AT::t_int_1d_randomread type;
|
||||
typename AT::t_tagint_1d tag;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
DAT::tdual_ffloat_1d k_rho;
|
||||
DAT::tdual_ffloat_1d k_fp;
|
||||
DAT::t_ffloat_1d d_rho;
|
||||
typename AT::t_ffloat_1d v_rho;
|
||||
DAT::t_ffloat_1d d_fp;
|
||||
HAT::t_ffloat_1d h_rho;
|
||||
HAT::t_ffloat_1d h_fp;
|
||||
|
||||
DAT::t_int_1d_randomread d_type2frho;
|
||||
DAT::t_int_2d_randomread d_type2rhor;
|
||||
DAT::t_int_2d_randomread d_type2z2r;
|
||||
|
||||
typedef Kokkos::DualView<F_FLOAT**[7],Kokkos::LayoutRight,DeviceType> tdual_ffloat_2d_n7;
|
||||
typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread;
|
||||
typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7;
|
||||
|
||||
t_ffloat_2d_n7_randomread d_frho_spline;
|
||||
t_ffloat_2d_n7_randomread d_rhor_spline;
|
||||
t_ffloat_2d_n7_randomread d_z2r_spline;
|
||||
|
||||
virtual void file2array();
|
||||
void file2array_alloy();
|
||||
void array2spline();
|
||||
void interpolate(int, double, double *, t_host_ffloat_2d_n7, int);
|
||||
void read_file(char *);
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
int iswap;
|
||||
int first;
|
||||
typename AT::t_int_2d d_sendlist;
|
||||
typename AT::t_xfloat_1d_um v_buf;
|
||||
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairEAMAlloyKokkos>(PairEAMAlloyKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Cannot use chosen neighbor list style with pair eam/kk/alloy
|
||||
|
||||
That style is not supported by Kokkos.
|
||||
|
||||
*/
|
||||
1186
src/KOKKOS/pair_eam_fs_kokkos.cpp
Executable file
1186
src/KOKKOS/pair_eam_fs_kokkos.cpp
Executable file
File diff suppressed because it is too large
Load Diff
183
src/KOKKOS/pair_eam_fs_kokkos.h
Executable file
183
src/KOKKOS/pair_eam_fs_kokkos.h
Executable file
@ -0,0 +1,183 @@
|
||||
/* -*- 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(eam/fs/kk,PairEAMFSKokkos<LMPDeviceType>)
|
||||
PairStyle(eam/fs/kk/device,PairEAMFSKokkos<LMPDeviceType>)
|
||||
PairStyle(eam/fs/kk/host,PairEAMFSKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_EAM_FS_KOKKOS_H
|
||||
#define LMP_PAIR_EAM_FS_KOKKOS_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_eam.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
struct TagPairEAMFSPackForwardComm{};
|
||||
struct TagPairEAMFSUnpackForwardComm{};
|
||||
struct TagPairEAMFSInitialize{};
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
struct TagPairEAMFSKernelA{};
|
||||
|
||||
template<int EFLAG>
|
||||
struct TagPairEAMFSKernelB{};
|
||||
|
||||
template<int EFLAG>
|
||||
struct TagPairEAMFSKernelAB{};
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
struct TagPairEAMFSKernelC{};
|
||||
|
||||
// Cannot use virtual inheritance on the GPU
|
||||
|
||||
template<class DeviceType>
|
||||
class PairEAMFSKokkos : public PairEAM {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL|HALFTHREAD|HALF};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairEAMFSKokkos(class LAMMPS *);
|
||||
virtual ~PairEAMFSKokkos();
|
||||
virtual void compute(int, int);
|
||||
void init_style();
|
||||
void coeff(int, char **);
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSPackForwardComm, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSUnpackForwardComm, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSInitialize, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelA<NEIGHFLAG,NEWTON_PAIR>, const int&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelB<EFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelB<EFLAG>, const int&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelAB<EFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int EFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelAB<EFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelC<NEIGHFLAG,NEWTON_PAIR,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairEAMFSKernelC<NEIGHFLAG,NEWTON_PAIR,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int NEWTON_PAIR>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&,
|
||||
int, int *);
|
||||
virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&);
|
||||
virtual int pack_forward_comm(int, int *, double *, int, int *);
|
||||
virtual void unpack_forward_comm(int, int, double *);
|
||||
int pack_reverse_comm(int, int, double *);
|
||||
void unpack_reverse_comm(int, int *, double *);
|
||||
|
||||
protected:
|
||||
void cleanup_copy();
|
||||
|
||||
typename AT::t_x_array_randomread x;
|
||||
typename AT::t_f_array f;
|
||||
typename AT::t_int_1d_randomread type;
|
||||
typename AT::t_tagint_1d tag;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
DAT::tdual_ffloat_1d k_rho;
|
||||
DAT::tdual_ffloat_1d k_fp;
|
||||
DAT::t_ffloat_1d d_rho;
|
||||
typename AT::t_ffloat_1d v_rho;
|
||||
DAT::t_ffloat_1d d_fp;
|
||||
HAT::t_ffloat_1d h_rho;
|
||||
HAT::t_ffloat_1d h_fp;
|
||||
|
||||
DAT::t_int_1d_randomread d_type2frho;
|
||||
DAT::t_int_2d_randomread d_type2rhor;
|
||||
DAT::t_int_2d_randomread d_type2z2r;
|
||||
|
||||
typedef Kokkos::DualView<F_FLOAT**[7],Kokkos::LayoutRight,DeviceType> tdual_ffloat_2d_n7;
|
||||
typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread;
|
||||
typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7;
|
||||
|
||||
t_ffloat_2d_n7_randomread d_frho_spline;
|
||||
t_ffloat_2d_n7_randomread d_rhor_spline;
|
||||
t_ffloat_2d_n7_randomread d_z2r_spline;
|
||||
|
||||
virtual void file2array();
|
||||
void file2array_fs();
|
||||
void array2spline();
|
||||
void interpolate(int, double, double *, t_host_ffloat_2d_n7, int);
|
||||
void read_file(char *);
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
int iswap;
|
||||
int first;
|
||||
typename AT::t_int_2d d_sendlist;
|
||||
typename AT::t_xfloat_1d_um v_buf;
|
||||
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairEAMFSKokkos>(PairEAMFSKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Cannot use chosen neighbor list style with pair eam/kk/fs
|
||||
|
||||
That style is not supported by Kokkos.
|
||||
|
||||
*/
|
||||
908
src/KOKKOS/pair_sw_kokkos.cpp
Executable file
908
src/KOKKOS/pair_sw_kokkos.cpp
Executable file
@ -0,0 +1,908 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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: Stan Moore (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "math.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
#include "pair_sw_kokkos.h"
|
||||
#include "kokkos.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "atom_kokkos.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_request.h"
|
||||
#include "force.h"
|
||||
#include "comm.h"
|
||||
#include "memory.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "atom_masks.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
#define MAXLINE 1024
|
||||
#define DELTA 4
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
PairSWKokkos<DeviceType>::PairSWKokkos(LAMMPS *lmp) : PairSW(lmp)
|
||||
{
|
||||
THIRD = 1.0/3.0;
|
||||
|
||||
respa_enable = 0;
|
||||
|
||||
|
||||
atomKK = (AtomKokkos *) atom;
|
||||
execution_space = ExecutionSpaceFromDevice<DeviceType>::space;
|
||||
datamask_read = X_MASK | F_MASK | TAG_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK;
|
||||
datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
check if allocated, since class can be destructed when incomplete
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
PairSWKokkos<DeviceType>::~PairSWKokkos()
|
||||
{
|
||||
if (!copymode) {
|
||||
memory->destroy_kokkos(k_eatom,eatom);
|
||||
memory->destroy_kokkos(k_vatom,vatom);
|
||||
eatom = NULL;
|
||||
vatom = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairSWKokkos<DeviceType>::compute(int eflag_in, int vflag_in)
|
||||
{
|
||||
eflag = eflag_in;
|
||||
vflag = vflag_in;
|
||||
|
||||
if (neighflag == FULL) 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.d_view;
|
||||
}
|
||||
if (vflag_atom) {
|
||||
memory->destroy_kokkos(k_vatom,vatom);
|
||||
memory->create_kokkos(k_vatom,vatom,maxvatom,6,"pair:vatom");
|
||||
d_vatom = k_vatom.d_view;
|
||||
}
|
||||
|
||||
atomKK->sync(execution_space,datamask_read);
|
||||
if (eflag || vflag) atomKK->modified(execution_space,datamask_modify);
|
||||
else atomKK->modified(execution_space,F_MASK);
|
||||
|
||||
x = atomKK->k_x.view<DeviceType>();
|
||||
f = atomKK->k_f.view<DeviceType>();
|
||||
tag = atomKK->k_tag.view<DeviceType>();
|
||||
type = atomKK->k_type.view<DeviceType>();
|
||||
nlocal = atom->nlocal;
|
||||
newton_pair = force->newton_pair;
|
||||
nall = atom->nlocal + atom->nghost;
|
||||
|
||||
const int inum = list->inum;
|
||||
const int ignum = inum + list->gnum;
|
||||
NeighListKokkos<DeviceType>* k_list = static_cast<NeighListKokkos<DeviceType>*>(list);
|
||||
d_ilist = k_list->d_ilist;
|
||||
d_numneigh = k_list->d_numneigh;
|
||||
d_neighbors = k_list->d_neighbors;
|
||||
|
||||
k_list->clean_copy();
|
||||
copymode = 1;
|
||||
|
||||
EV_FLOAT ev;
|
||||
EV_FLOAT ev_all;
|
||||
|
||||
// loop over neighbor list of my atoms
|
||||
|
||||
if (neighflag == HALF) {
|
||||
if (evflag)
|
||||
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairSWComputeHalf<HALF,1> >(0,inum),*this,ev);
|
||||
else
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairSWComputeHalf<HALF,0> >(0,inum),*this);
|
||||
DeviceType::fence();
|
||||
ev_all += ev;
|
||||
} else if (neighflag == HALFTHREAD) {
|
||||
if (evflag)
|
||||
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairSWComputeHalf<HALFTHREAD,1> >(0,inum),*this,ev);
|
||||
else
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairSWComputeHalf<HALFTHREAD,0> >(0,inum),*this);
|
||||
DeviceType::fence();
|
||||
ev_all += ev;
|
||||
} else if (neighflag == FULL) {
|
||||
if (evflag)
|
||||
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullA<FULL,1> >(0,inum),*this,ev);
|
||||
else
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullA<FULL,0> >(0,inum),*this);
|
||||
DeviceType::fence();
|
||||
ev_all += ev;
|
||||
|
||||
if (evflag)
|
||||
Kokkos::parallel_reduce(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullB<FULL,1> >(0,ignum),*this,ev);
|
||||
else
|
||||
Kokkos::parallel_for(Kokkos::RangePolicy<DeviceType, TagPairSWComputeFullB<FULL,0> >(0,ignum),*this);
|
||||
DeviceType::fence();
|
||||
ev_all += ev;
|
||||
}
|
||||
|
||||
if (eflag_global) eng_vdwl += ev_all.evdwl;
|
||||
if (vflag_global) {
|
||||
virial[0] += ev_all.v[0];
|
||||
virial[1] += ev_all.v[1];
|
||||
virial[2] += ev_all.v[2];
|
||||
virial[3] += ev_all.v[3];
|
||||
virial[4] += ev_all.v[4];
|
||||
virial[5] += ev_all.v[5];
|
||||
}
|
||||
|
||||
if (vflag_fdotr) pair_virial_fdotr_compute(this);
|
||||
|
||||
if (eflag_atom) {
|
||||
k_eatom.template modify<DeviceType>();
|
||||
k_eatom.template sync<LMPHostType>();
|
||||
}
|
||||
|
||||
if (vflag_atom) {
|
||||
k_vatom.template modify<DeviceType>();
|
||||
k_vatom.template sync<LMPHostType>();
|
||||
}
|
||||
|
||||
copymode = 0;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeHalf<NEIGHFLAG,EVFLAG>, const int &ii, EV_FLOAT& ev) const {
|
||||
|
||||
// The f array is atomic
|
||||
|
||||
Kokkos::View<F_FLOAT*[3], typename DAT::t_f_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > a_f = f;
|
||||
|
||||
F_FLOAT delr1[3],delr2[3],fj[3],fk[3];
|
||||
F_FLOAT evdwl = 0.0;
|
||||
F_FLOAT fpair = 0.0;
|
||||
|
||||
const int i = d_ilist[ii];
|
||||
const tagint itag = tag[i];
|
||||
const int itype = d_map[type[i]];
|
||||
const X_FLOAT xtmp = x(i,0);
|
||||
const X_FLOAT ytmp = x(i,1);
|
||||
const X_FLOAT ztmp = x(i,2);
|
||||
|
||||
// two-body interactions, skip half of them
|
||||
|
||||
const int jnum = d_numneigh[i];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors(i,jj);
|
||||
j &= NEIGHMASK;
|
||||
const tagint jtag = tag[j];
|
||||
|
||||
if (itag > jtag) {
|
||||
if ((itag+jtag) % 2 == 0) continue;
|
||||
} else if (itag < jtag) {
|
||||
if ((itag+jtag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x(j,2) < ztmp) continue;
|
||||
if (x(j,2) == ztmp && x(j,1) < ytmp) continue;
|
||||
if (x(j,2) == ztmp && x(j,1) == ytmp && x(j,0) < xtmp) continue;
|
||||
}
|
||||
|
||||
const int jtype = d_map[type[j]];
|
||||
|
||||
const X_FLOAT delx = xtmp - x(j,0);
|
||||
const X_FLOAT dely = ytmp - x(j,1);
|
||||
const X_FLOAT delz = ztmp - x(j,2);
|
||||
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
const int ijparam = d_elem2param(itype,jtype,jtype);
|
||||
if (rsq > d_params[ijparam].cutsq) continue;
|
||||
|
||||
twobody(d_params[ijparam],rsq,fpair,eflag,evdwl);
|
||||
|
||||
fxtmpi += delx*fpair;
|
||||
fytmpi += dely*fpair;
|
||||
fztmpi += delz*fpair;
|
||||
a_f(j,0) -= delx*fpair;
|
||||
a_f(j,1) -= dely*fpair;
|
||||
a_f(j,2) -= delz*fpair;
|
||||
|
||||
if (EVFLAG) {
|
||||
if (eflag) ev.evdwl += evdwl;
|
||||
if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,evdwl,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
|
||||
const int jnumm1 = jnum - 1;
|
||||
|
||||
for (int jj = 0; jj < jnumm1; jj++) {
|
||||
int j = d_neighbors(i,jj);
|
||||
j &= NEIGHMASK;
|
||||
const int jtype = d_map[type[j]];
|
||||
const int ijparam = d_elem2param(itype,jtype,jtype);
|
||||
delr1[0] = x(j,0) - xtmp;
|
||||
delr1[1] = x(j,1) - ytmp;
|
||||
delr1[2] = x(j,2) - ztmp;
|
||||
const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
|
||||
if (rsq1 > d_params[ijparam].cutsq) continue;
|
||||
|
||||
F_FLOAT fxtmpj = 0.0;
|
||||
F_FLOAT fytmpj = 0.0;
|
||||
F_FLOAT fztmpj = 0.0;
|
||||
|
||||
for (int kk = jj+1; kk < jnum; kk++) {
|
||||
int k = d_neighbors(i,kk);
|
||||
k &= NEIGHMASK;
|
||||
const int ktype = d_map[type[k]];
|
||||
const int ikparam = d_elem2param(itype,ktype,ktype);
|
||||
const int ijkparam = d_elem2param(itype,jtype,ktype);
|
||||
|
||||
delr2[0] = x(k,0) - xtmp;
|
||||
delr2[1] = x(k,1) - ytmp;
|
||||
delr2[2] = x(k,2) - ztmp;
|
||||
const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2];
|
||||
|
||||
if (rsq2 > d_params[ikparam].cutsq) continue;
|
||||
|
||||
threebody(d_params[ijparam],d_params[ikparam],d_params[ijkparam],
|
||||
rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl);
|
||||
|
||||
fxtmpi -= fj[0] + fk[0];
|
||||
fytmpi -= fj[1] + fk[1];
|
||||
fztmpi -= fj[2] + fk[2];
|
||||
fxtmpj += fj[0];
|
||||
fytmpj += fj[1];
|
||||
fztmpj += fj[2];
|
||||
a_f(k,0) += fk[0];
|
||||
a_f(k,1) += fk[1];
|
||||
a_f(k,2) += fk[2];
|
||||
|
||||
if (EVFLAG) {
|
||||
if (eflag) ev.evdwl += evdwl;
|
||||
if (vflag_either || eflag_atom) this->template ev_tally3<NEIGHFLAG>(ev,i,j,k,evdwl,0.0,fj,fk,delr1,delr2);
|
||||
}
|
||||
}
|
||||
|
||||
a_f(j,0) += fxtmpj;
|
||||
a_f(j,1) += fytmpj;
|
||||
a_f(j,2) += fztmpj;
|
||||
}
|
||||
|
||||
a_f(i,0) += fxtmpi;
|
||||
a_f(i,1) += fytmpi;
|
||||
a_f(i,2) += fztmpi;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeHalf<NEIGHFLAG,EVFLAG>, const int &ii) const {
|
||||
EV_FLOAT ev;
|
||||
this->template operator()<NEIGHFLAG,EVFLAG>(TagPairSWComputeHalf<NEIGHFLAG,EVFLAG>(), ii, ev);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeFullA<NEIGHFLAG,EVFLAG>, const int &ii, EV_FLOAT& ev) const {
|
||||
|
||||
F_FLOAT delr1[3],delr2[3],fj[3],fk[3];
|
||||
F_FLOAT evdwl = 0.0;
|
||||
F_FLOAT fpair = 0.0;
|
||||
|
||||
const int i = d_ilist[ii];
|
||||
|
||||
const tagint itag = tag[i];
|
||||
const int itype = d_map[type[i]];
|
||||
const X_FLOAT xtmp = x(i,0);
|
||||
const X_FLOAT ytmp = x(i,1);
|
||||
const X_FLOAT ztmp = x(i,2);
|
||||
|
||||
// two-body interactions
|
||||
|
||||
const int jnum = d_numneigh[i];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors(i,jj);
|
||||
j &= NEIGHMASK;
|
||||
const tagint jtag = tag[j];
|
||||
|
||||
const int jtype = d_map[type[j]];
|
||||
|
||||
const X_FLOAT delx = xtmp - x(j,0);
|
||||
const X_FLOAT dely = ytmp - x(j,1);
|
||||
const X_FLOAT delz = ztmp - x(j,2);
|
||||
const F_FLOAT rsq = delx*delx + dely*dely + delz*delz;
|
||||
|
||||
const int ijparam = d_elem2param(itype,jtype,jtype);
|
||||
|
||||
if (rsq > d_params[ijparam].cutsq) continue;
|
||||
|
||||
twobody(d_params[ijparam],rsq,fpair,eflag,evdwl);
|
||||
|
||||
fxtmpi += delx*fpair;
|
||||
fytmpi += dely*fpair;
|
||||
fztmpi += delz*fpair;
|
||||
|
||||
if (EVFLAG) {
|
||||
if (eflag) ev.evdwl += 0.5*evdwl;
|
||||
if (vflag_either || eflag_atom) this->template ev_tally<NEIGHFLAG>(ev,i,j,evdwl,fpair,delx,dely,delz);
|
||||
}
|
||||
}
|
||||
|
||||
const int jnumm1 = jnum - 1;
|
||||
|
||||
for (int jj = 0; jj < jnumm1; jj++) {
|
||||
int j = d_neighbors(i,jj);
|
||||
j &= NEIGHMASK;
|
||||
const int jtype = d_map[type[j]];
|
||||
const int ijparam = d_elem2param(itype,jtype,jtype);
|
||||
delr1[0] = x(j,0) - xtmp;
|
||||
delr1[1] = x(j,1) - ytmp;
|
||||
delr1[2] = x(j,2) - ztmp;
|
||||
const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
|
||||
|
||||
if (rsq1 > d_params[ijparam].cutsq) continue;
|
||||
|
||||
for (int kk = jj+1; kk < jnum; kk++) {
|
||||
int k = d_neighbors(i,kk);
|
||||
k &= NEIGHMASK;
|
||||
const int ktype = d_map[type[k]];
|
||||
const int ikparam = d_elem2param(itype,ktype,ktype);
|
||||
const int ijkparam = d_elem2param(itype,jtype,ktype);
|
||||
|
||||
delr2[0] = x(k,0) - xtmp;
|
||||
delr2[1] = x(k,1) - ytmp;
|
||||
delr2[2] = x(k,2) - ztmp;
|
||||
const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2];
|
||||
|
||||
if (rsq2 > d_params[ikparam].cutsq) continue;
|
||||
|
||||
threebody(d_params[ijparam],d_params[ikparam],d_params[ijkparam],
|
||||
rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl);
|
||||
|
||||
fxtmpi -= fj[0] + fk[0];
|
||||
fytmpi -= fj[1] + fk[1];
|
||||
fztmpi -= fj[2] + fk[2];
|
||||
|
||||
if (EVFLAG) {
|
||||
if (eflag) ev.evdwl += evdwl;
|
||||
if (vflag_either || eflag_atom) this->template ev_tally3<NEIGHFLAG>(ev,i,j,k,evdwl,0.0,fj,fk,delr1,delr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f(i,0) += fxtmpi;
|
||||
f(i,1) += fytmpi;
|
||||
f(i,2) += fztmpi;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeFullA<NEIGHFLAG,EVFLAG>, const int &ii) const {
|
||||
EV_FLOAT ev;
|
||||
this->template operator()<NEIGHFLAG,EVFLAG>(TagPairSWComputeFullA<NEIGHFLAG,EVFLAG>(), ii, ev);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeFullB<NEIGHFLAG,EVFLAG>, const int &ii, EV_FLOAT& ev) const {
|
||||
|
||||
F_FLOAT delr1[3],delr2[3],fj[3],fk[3];
|
||||
F_FLOAT evdwl = 0.0;
|
||||
F_FLOAT fpair = 0.0;
|
||||
|
||||
const int i = d_ilist[ii];
|
||||
|
||||
const int itype = d_map[type[i]];
|
||||
const X_FLOAT xtmpi = x(i,0);
|
||||
const X_FLOAT ytmpi = x(i,1);
|
||||
const X_FLOAT ztmpi = x(i,2);
|
||||
|
||||
const int jnum = d_numneigh[i];
|
||||
|
||||
F_FLOAT fxtmpi = 0.0;
|
||||
F_FLOAT fytmpi = 0.0;
|
||||
F_FLOAT fztmpi = 0.0;
|
||||
|
||||
for (int jj = 0; jj < jnum; jj++) {
|
||||
int j = d_neighbors(i,jj);
|
||||
j &= NEIGHMASK;
|
||||
if (j >= nlocal) continue;
|
||||
const int jtype = d_map[type[j]];
|
||||
const int jiparam = d_elem2param(jtype,itype,itype);
|
||||
const X_FLOAT xtmpj = x(j,0);
|
||||
const X_FLOAT ytmpj = x(j,1);
|
||||
const X_FLOAT ztmpj = x(j,2);
|
||||
|
||||
delr1[0] = xtmpi - xtmpj;
|
||||
delr1[1] = ytmpi - ytmpj;
|
||||
delr1[2] = ztmpi - ztmpj;
|
||||
const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2];
|
||||
|
||||
if (rsq1 > d_params[jiparam].cutsq) continue;
|
||||
|
||||
const int j_jnum = d_numneigh[j];
|
||||
|
||||
for (int kk = 0; kk < j_jnum; kk++) {
|
||||
int k = d_neighbors(j,kk);
|
||||
k &= NEIGHMASK;
|
||||
if (k == i) continue;
|
||||
const int ktype = d_map[type[k]];
|
||||
const int jkparam = d_elem2param(jtype,ktype,ktype);
|
||||
const int jikparam = d_elem2param(jtype,itype,ktype);
|
||||
|
||||
delr2[0] = x(k,0) - xtmpj;
|
||||
delr2[1] = x(k,1) - ytmpj;
|
||||
delr2[2] = x(k,2) - ztmpj;
|
||||
const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2];
|
||||
|
||||
if (rsq2 > d_params[jkparam].cutsq) continue;
|
||||
|
||||
if (vflag_atom)
|
||||
threebody(d_params[jiparam],d_params[jkparam],d_params[jikparam],
|
||||
rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl);
|
||||
else
|
||||
threebodyj(d_params[jiparam],d_params[jkparam],d_params[jikparam],
|
||||
rsq1,rsq2,delr1,delr2,fj);
|
||||
|
||||
fxtmpi += fj[0];
|
||||
fytmpi += fj[1];
|
||||
fztmpi += fj[2];
|
||||
|
||||
if (EVFLAG)
|
||||
if (vflag_atom || eflag_atom) ev_tally3_atom(ev,i,evdwl,0.0,fj,fk,delr1,delr2);
|
||||
}
|
||||
}
|
||||
|
||||
f(i,0) += fxtmpi;
|
||||
f(i,1) += fytmpi;
|
||||
f(i,2) += fztmpi;
|
||||
}
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::operator()(TagPairSWComputeFullB<NEIGHFLAG,EVFLAG>, const int &ii) const {
|
||||
EV_FLOAT ev;
|
||||
this->template operator()<NEIGHFLAG,EVFLAG>(TagPairSWComputeFullB<NEIGHFLAG,EVFLAG>(), ii, ev);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set coeffs for one or more type pairs
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairSWKokkos<DeviceType>::coeff(int narg, char **arg)
|
||||
{
|
||||
PairSW::coeff(narg,arg);
|
||||
|
||||
// sync map
|
||||
|
||||
int n = atom->ntypes;
|
||||
|
||||
DAT::tdual_int_1d k_map = DAT::tdual_int_1d("pair:map",n+1);
|
||||
HAT::t_int_1d h_map = k_map.h_view;
|
||||
|
||||
for (int i = 1; i <= n; i++)
|
||||
h_map[i] = map[i];
|
||||
|
||||
k_map.template modify<LMPHostType>();
|
||||
k_map.template sync<DeviceType>();
|
||||
|
||||
d_map = k_map.d_view;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
init specific to this pair style
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairSWKokkos<DeviceType>::init_style()
|
||||
{
|
||||
PairSW::init_style();
|
||||
|
||||
// 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<DeviceType,LMPHostType>::value &&
|
||||
!Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value;
|
||||
neighbor->requests[irequest]->
|
||||
kokkos_device = Kokkos::Impl::is_same<DeviceType,LMPDeviceType>::value;
|
||||
|
||||
// always request a full neighbor list
|
||||
|
||||
if (neighflag == FULL || neighflag == HALF || neighflag == HALFTHREAD) {
|
||||
neighbor->requests[irequest]->full = 1;
|
||||
neighbor->requests[irequest]->half = 0;
|
||||
neighbor->requests[irequest]->full_cluster = 0;
|
||||
if (neighflag == FULL)
|
||||
neighbor->requests[irequest]->ghost = 1;
|
||||
else
|
||||
neighbor->requests[irequest]->ghost = 0;
|
||||
} else {
|
||||
error->all(FLERR,"Cannot use chosen neighbor list style with pair sw/kk");
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
void PairSWKokkos<DeviceType>::setup()
|
||||
{
|
||||
PairSW::setup();
|
||||
|
||||
// sync elem2param and params
|
||||
|
||||
tdual_int_3d k_elem2param = tdual_int_3d("pair:elem2param",nelements,nelements,nelements);
|
||||
t_host_int_3d h_elem2param = k_elem2param.h_view;
|
||||
|
||||
tdual_param_1d k_params = tdual_param_1d("pair:params",nparams);
|
||||
t_host_param_1d h_params = k_params.h_view;
|
||||
|
||||
for (int i = 0; i < nelements; i++)
|
||||
for (int j = 0; j < nelements; j++)
|
||||
for (int k = 0; k < nelements; k++)
|
||||
h_elem2param(i,j,k) = elem2param[i][j][k];
|
||||
|
||||
for (int m = 0; m < nparams; m++)
|
||||
h_params[m] = params[m];
|
||||
|
||||
k_elem2param.template modify<LMPHostType>();
|
||||
k_elem2param.template sync<DeviceType>();
|
||||
k_params.template modify<LMPHostType>();
|
||||
k_params.template sync<DeviceType>();
|
||||
|
||||
d_elem2param = k_elem2param.d_view;
|
||||
d_params = k_params.d_view;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::twobody(const Param& param, const F_FLOAT& rsq, F_FLOAT& fforce,
|
||||
const int& eflag, F_FLOAT& eng) const
|
||||
{
|
||||
F_FLOAT r,rinvsq,rp,rq,rainv,rainvsq,expsrainv;
|
||||
|
||||
r = sqrt(rsq);
|
||||
rinvsq = 1.0/rsq;
|
||||
rp = pow(r,-param.powerp);
|
||||
rq = pow(r,-param.powerq);
|
||||
rainv = 1.0 / (r - param.cut);
|
||||
rainvsq = rainv*rainv*r;
|
||||
expsrainv = exp(param.sigma * rainv);
|
||||
fforce = (param.c1*rp - param.c2*rq +
|
||||
(param.c3*rp -param.c4*rq) * rainvsq) * expsrainv * rinvsq;
|
||||
if (eflag) eng = (param.c5*rp - param.c6*rq) * expsrainv;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::threebody(const Param& paramij, const Param& paramik, const Param& paramijk,
|
||||
const F_FLOAT& rsq1, const F_FLOAT& rsq2,
|
||||
F_FLOAT *delr1, F_FLOAT *delr2,
|
||||
F_FLOAT *fj, F_FLOAT *fk, const int& eflag, F_FLOAT& eng) const
|
||||
{
|
||||
F_FLOAT r1,rinvsq1,rainv1,gsrainv1,gsrainvsq1,expgsrainv1;
|
||||
F_FLOAT r2,rinvsq2,rainv2,gsrainv2,gsrainvsq2,expgsrainv2;
|
||||
F_FLOAT rinv12,cs,delcs,delcssq,facexp,facrad,frad1,frad2;
|
||||
F_FLOAT facang,facang12,csfacang,csfac1,csfac2;
|
||||
|
||||
r1 = sqrt(rsq1);
|
||||
rinvsq1 = 1.0/rsq1;
|
||||
rainv1 = 1.0/(r1 - paramij.cut);
|
||||
gsrainv1 = paramij.sigma_gamma * rainv1;
|
||||
gsrainvsq1 = gsrainv1*rainv1/r1;
|
||||
expgsrainv1 = exp(gsrainv1);
|
||||
|
||||
r2 = sqrt(rsq2);
|
||||
rinvsq2 = 1.0/rsq2;
|
||||
rainv2 = 1.0/(r2 - paramik.cut);
|
||||
gsrainv2 = paramik.sigma_gamma * rainv2;
|
||||
gsrainvsq2 = gsrainv2*rainv2/r2;
|
||||
expgsrainv2 = exp(gsrainv2);
|
||||
|
||||
rinv12 = 1.0/(r1*r2);
|
||||
cs = (delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2]) * rinv12;
|
||||
delcs = cs - paramijk.costheta;
|
||||
delcssq = delcs*delcs;
|
||||
|
||||
facexp = expgsrainv1*expgsrainv2;
|
||||
|
||||
// facrad = sqrt(paramij.lambda_epsilon*paramik.lambda_epsilon) *
|
||||
// facexp*delcssq;
|
||||
|
||||
facrad = paramijk.lambda_epsilon * facexp*delcssq;
|
||||
frad1 = facrad*gsrainvsq1;
|
||||
frad2 = facrad*gsrainvsq2;
|
||||
facang = paramijk.lambda_epsilon2 * facexp*delcs;
|
||||
facang12 = rinv12*facang;
|
||||
csfacang = cs*facang;
|
||||
csfac1 = rinvsq1*csfacang;
|
||||
|
||||
fj[0] = delr1[0]*(frad1+csfac1)-delr2[0]*facang12;
|
||||
fj[1] = delr1[1]*(frad1+csfac1)-delr2[1]*facang12;
|
||||
fj[2] = delr1[2]*(frad1+csfac1)-delr2[2]*facang12;
|
||||
|
||||
csfac2 = rinvsq2*csfacang;
|
||||
|
||||
fk[0] = delr2[0]*(frad2+csfac2)-delr1[0]*facang12;
|
||||
fk[1] = delr2[1]*(frad2+csfac2)-delr1[1]*facang12;
|
||||
fk[2] = delr2[2]*(frad2+csfac2)-delr1[2]*facang12;
|
||||
|
||||
if (eflag) eng = facrad;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::threebodyj(const Param& paramij, const Param& paramik, const Param& paramijk,
|
||||
const F_FLOAT& rsq1, const F_FLOAT& rsq2, F_FLOAT *delr1, F_FLOAT *delr2, F_FLOAT *fj) const
|
||||
{
|
||||
F_FLOAT r1,rinvsq1,rainv1,gsrainv1,gsrainvsq1,expgsrainv1;
|
||||
F_FLOAT r2, rainv2, gsrainv2, expgsrainv2;
|
||||
F_FLOAT rinv12,cs,delcs,delcssq,facexp,facrad,frad1;
|
||||
F_FLOAT facang,facang12,csfacang,csfac1;
|
||||
|
||||
r1 = sqrt(rsq1);
|
||||
rinvsq1 = 1.0/rsq1;
|
||||
rainv1 = 1.0/(r1 - paramij.cut);
|
||||
gsrainv1 = paramij.sigma_gamma * rainv1;
|
||||
gsrainvsq1 = gsrainv1*rainv1/r1;
|
||||
expgsrainv1 = exp(gsrainv1);
|
||||
|
||||
r2 = sqrt(rsq2);
|
||||
rainv2 = 1.0/(r2 - paramik.cut);
|
||||
gsrainv2 = paramik.sigma_gamma * rainv2;
|
||||
expgsrainv2 = exp(gsrainv2);
|
||||
|
||||
rinv12 = 1.0/(r1*r2);
|
||||
cs = (delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2]) * rinv12;
|
||||
delcs = cs - paramijk.costheta;
|
||||
delcssq = delcs*delcs;
|
||||
|
||||
facexp = expgsrainv1*expgsrainv2;
|
||||
|
||||
// facrad = sqrt(paramij.lambda_epsilon*paramik.lambda_epsilon) *
|
||||
// facexp*delcssq;
|
||||
|
||||
facrad = paramijk.lambda_epsilon * facexp*delcssq;
|
||||
frad1 = facrad*gsrainvsq1;
|
||||
facang = paramijk.lambda_epsilon2 * facexp*delcs;
|
||||
facang12 = rinv12*facang;
|
||||
csfacang = cs*facang;
|
||||
csfac1 = rinvsq1*csfacang;
|
||||
|
||||
fj[0] = delr1[0]*(frad1+csfac1)-delr2[0]*facang12;
|
||||
fj[1] = delr1[1]*(frad1+csfac1)-delr2[1]*facang12;
|
||||
fj[2] = delr1[2]*(frad1+csfac1)-delr2[2]*facang12;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const
|
||||
{
|
||||
const int VFLAG = vflag_either;
|
||||
|
||||
// The eatom and vatom arrays are atomic for half/thread neighbor list
|
||||
|
||||
Kokkos::View<E_FLOAT*, typename DAT::t_efloat_1d::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_eatom = k_eatom.view<DeviceType>();
|
||||
Kokkos::View<F_FLOAT*[6], typename DAT::t_virial_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_vatom = k_vatom.view<DeviceType>();
|
||||
|
||||
|
||||
if (eflag_atom) {
|
||||
const E_FLOAT epairhalf = 0.5 * epair;
|
||||
v_eatom[i] += epairhalf;
|
||||
if (NEIGHFLAG != FULL)
|
||||
v_eatom[j] += epairhalf;
|
||||
}
|
||||
|
||||
if (VFLAG) {
|
||||
const E_FLOAT v0 = delx*delx*fpair;
|
||||
const E_FLOAT v1 = dely*dely*fpair;
|
||||
const E_FLOAT v2 = delz*delz*fpair;
|
||||
const E_FLOAT v3 = delx*dely*fpair;
|
||||
const E_FLOAT v4 = delx*delz*fpair;
|
||||
const E_FLOAT v5 = dely*delz*fpair;
|
||||
|
||||
if (vflag_global) {
|
||||
if (NEIGHFLAG != FULL) {
|
||||
ev.v[0] += v0;
|
||||
ev.v[1] += v1;
|
||||
ev.v[2] += v2;
|
||||
ev.v[3] += v3;
|
||||
ev.v[4] += v4;
|
||||
ev.v[5] += v5;
|
||||
} else {
|
||||
ev.v[0] += 0.5*v0;
|
||||
ev.v[1] += 0.5*v1;
|
||||
ev.v[2] += 0.5*v2;
|
||||
ev.v[3] += 0.5*v3;
|
||||
ev.v[4] += 0.5*v4;
|
||||
ev.v[5] += 0.5*v5;
|
||||
}
|
||||
}
|
||||
|
||||
if (vflag_atom) {
|
||||
v_vatom(i,0) += 0.5*v0;
|
||||
v_vatom(i,1) += 0.5*v1;
|
||||
v_vatom(i,2) += 0.5*v2;
|
||||
v_vatom(i,3) += 0.5*v3;
|
||||
v_vatom(i,4) += 0.5*v4;
|
||||
v_vatom(i,5) += 0.5*v5;
|
||||
|
||||
if (NEIGHFLAG != FULL) {
|
||||
v_vatom(j,0) += 0.5*v0;
|
||||
v_vatom(j,1) += 0.5*v1;
|
||||
v_vatom(j,2) += 0.5*v2;
|
||||
v_vatom(j,3) += 0.5*v3;
|
||||
v_vatom(j,4) += 0.5*v4;
|
||||
v_vatom(j,5) += 0.5*v5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
tally eng_vdwl and virial into global and per-atom accumulators
|
||||
called by SW and hbond potentials, newton_pair is always on
|
||||
virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k,
|
||||
const F_FLOAT &evdwl, const F_FLOAT &ecoul,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const
|
||||
{
|
||||
F_FLOAT epairthird,v[6];
|
||||
|
||||
const int VFLAG = vflag_either;
|
||||
|
||||
// The eatom and vatom arrays are atomic for half/thread neighbor list
|
||||
|
||||
Kokkos::View<E_FLOAT*, typename DAT::t_efloat_1d::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_eatom = k_eatom.view<DeviceType>();
|
||||
Kokkos::View<F_FLOAT*[6], typename DAT::t_virial_array::array_layout,DeviceType,Kokkos::MemoryTraits<AtomicF<NEIGHFLAG>::value> > v_vatom = k_vatom.view<DeviceType>();
|
||||
|
||||
if (eflag_atom) {
|
||||
epairthird = THIRD * (evdwl + ecoul);
|
||||
v_eatom[i] += epairthird;
|
||||
if (NEIGHFLAG != FULL) {
|
||||
v_eatom[j] += epairthird;
|
||||
v_eatom[k] += epairthird;
|
||||
}
|
||||
}
|
||||
|
||||
if (VFLAG) {
|
||||
v[0] = drji[0]*fj[0] + drki[0]*fk[0];
|
||||
v[1] = drji[1]*fj[1] + drki[1]*fk[1];
|
||||
v[2] = drji[2]*fj[2] + drki[2]*fk[2];
|
||||
v[3] = drji[0]*fj[1] + drki[0]*fk[1];
|
||||
v[4] = drji[0]*fj[2] + drki[0]*fk[2];
|
||||
v[5] = drji[1]*fj[2] + drki[1]*fk[2];
|
||||
|
||||
if (vflag_global) {
|
||||
ev.v[0] += v[0];
|
||||
ev.v[1] += v[1];
|
||||
ev.v[2] += v[2];
|
||||
ev.v[3] += v[3];
|
||||
ev.v[4] += v[4];
|
||||
ev.v[5] += v[5];
|
||||
}
|
||||
|
||||
if (vflag_atom) {
|
||||
v_vatom(i,0) += THIRD*v[0]; v_vatom(i,1) += THIRD*v[1];
|
||||
v_vatom(i,2) += THIRD*v[2]; v_vatom(i,3) += THIRD*v[3];
|
||||
v_vatom(i,4) += THIRD*v[4]; v_vatom(i,5) += THIRD*v[5];
|
||||
|
||||
if (NEIGHFLAG != FULL) {
|
||||
v_vatom(j,0) += THIRD*v[0]; v_vatom(j,1) += THIRD*v[1];
|
||||
v_vatom(j,2) += THIRD*v[2]; v_vatom(j,3) += THIRD*v[3];
|
||||
v_vatom(j,4) += THIRD*v[4]; v_vatom(j,5) += THIRD*v[5];
|
||||
|
||||
v_vatom(k,0) += THIRD*v[0]; v_vatom(k,1) += THIRD*v[1];
|
||||
v_vatom(k,2) += THIRD*v[2]; v_vatom(k,3) += THIRD*v[3];
|
||||
v_vatom(k,4) += THIRD*v[4]; v_vatom(k,5) += THIRD*v[5];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
tally eng_vdwl and virial into global and per-atom accumulators
|
||||
called by SW and hbond potentials, newton_pair is always on
|
||||
virial = riFi + rjFj + rkFk = (rj-ri) Fj + (rk-ri) Fk = drji*fj + drki*fk
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<class DeviceType>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void PairSWKokkos<DeviceType>::ev_tally3_atom(EV_FLOAT &ev, const int &i,
|
||||
const F_FLOAT &evdwl, const F_FLOAT &ecoul,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const
|
||||
{
|
||||
F_FLOAT epairthird,v[6];
|
||||
|
||||
const int VFLAG = vflag_either;
|
||||
|
||||
if (eflag_atom) {
|
||||
epairthird = THIRD * (evdwl + ecoul);
|
||||
d_eatom[i] += epairthird;
|
||||
}
|
||||
|
||||
if (VFLAG) {
|
||||
v[0] = drji[0]*fj[0] + drki[0]*fk[0];
|
||||
v[1] = drji[1]*fj[1] + drki[1]*fk[1];
|
||||
v[2] = drji[2]*fj[2] + drki[2]*fk[2];
|
||||
v[3] = drji[0]*fj[1] + drki[0]*fk[1];
|
||||
v[4] = drji[0]*fj[2] + drki[0]*fk[2];
|
||||
v[5] = drji[1]*fj[2] + drki[1]*fk[2];
|
||||
|
||||
if (vflag_atom) {
|
||||
d_vatom(i,0) += THIRD*v[0]; d_vatom(i,1) += THIRD*v[1];
|
||||
d_vatom(i,2) += THIRD*v[2]; d_vatom(i,3) += THIRD*v[3];
|
||||
d_vatom(i,4) += THIRD*v[4]; d_vatom(i,5) += THIRD*v[5];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template class PairSWKokkos<LMPDeviceType>;
|
||||
#ifdef KOKKOS_HAVE_CUDA
|
||||
template class PairSWKokkos<LMPHostType>;
|
||||
#endif
|
||||
150
src/KOKKOS/pair_sw_kokkos.h
Executable file
150
src/KOKKOS/pair_sw_kokkos.h
Executable file
@ -0,0 +1,150 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
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(sw/kk,PairSWKokkos<LMPDeviceType>)
|
||||
PairStyle(sw/kk/device,PairSWKokkos<LMPDeviceType>)
|
||||
PairStyle(sw/kk/host,PairSWKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_SW_KOKKOS_H
|
||||
#define LMP_PAIR_SW_KOKKOS_H
|
||||
|
||||
#include "pair_sw.h"
|
||||
#include "pair_kokkos.h"
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairSWComputeHalf{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairSWComputeFullA{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairSWComputeFullB{};
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<class DeviceType>
|
||||
class PairSWKokkos : public PairSW {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairSWKokkos(class LAMMPS *);
|
||||
virtual ~PairSWKokkos();
|
||||
virtual void compute(int, int);
|
||||
virtual void coeff(int, char **);
|
||||
virtual void init_style();
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeHalf<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeHalf<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeFullA<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeFullA<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeFullB<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairSWComputeFullB<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally3(EV_FLOAT &ev, const int &i, const int &j, int &k,
|
||||
const F_FLOAT &evdwl, const F_FLOAT &ecoul,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally3_atom(EV_FLOAT &ev, const int &i,
|
||||
const F_FLOAT &evdwl, const F_FLOAT &ecoul,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drki) const;
|
||||
|
||||
protected:
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread;
|
||||
typedef typename tdual_int_3d::t_host t_host_int_3d;
|
||||
|
||||
t_int_3d_randomread d_elem2param;
|
||||
DAT::t_int_1d_randomread d_map;
|
||||
|
||||
typedef Kokkos::DualView<Param*,DeviceType> tdual_param_1d;
|
||||
typedef typename tdual_param_1d::t_dev t_param_1d;
|
||||
typedef typename tdual_param_1d::t_host t_host_param_1d;
|
||||
|
||||
t_param_1d d_params;
|
||||
|
||||
virtual void setup();
|
||||
void twobody(const Param&, const F_FLOAT&, F_FLOAT&, const int&, F_FLOAT&) const;
|
||||
void threebody(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *,
|
||||
F_FLOAT *, F_FLOAT *, const int&, F_FLOAT&) const;
|
||||
void threebodyj(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *,
|
||||
F_FLOAT *) const;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_x_array_randomread x;
|
||||
typename ArrayTypes<DeviceType>::t_f_array f;
|
||||
typename ArrayTypes<DeviceType>::t_tagint_1d tag;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread type;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
DAT::t_int_1d_randomread d_type2frho;
|
||||
DAT::t_int_2d_randomread d_type2rhor;
|
||||
DAT::t_int_2d_randomread d_type2z2r;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
int inum;
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairSWKokkos>(PairSWKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
1202
src/KOKKOS/pair_tersoff_kokkos.cpp
Executable file
1202
src/KOKKOS/pair_tersoff_kokkos.cpp
Executable file
File diff suppressed because it is too large
Load Diff
220
src/KOKKOS/pair_tersoff_kokkos.h
Executable file
220
src/KOKKOS/pair_tersoff_kokkos.h
Executable file
@ -0,0 +1,220 @@
|
||||
/* -*- 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(tersoff/kk,PairTersoffKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/kk/device,PairTersoffKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/kk/host,PairTersoffKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_TERSOFF_KOKKOS_H
|
||||
#define LMP_PAIR_TERSOFF_KOKKOS_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_tersoff.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffComputeHalf{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffComputeFullA{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffComputeFullB{};
|
||||
|
||||
template<class DeviceType>
|
||||
class PairTersoffKokkos : public PairTersoff {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairTersoffKokkos(class LAMMPS *);
|
||||
virtual ~PairTersoffKokkos();
|
||||
virtual void compute(int, int);
|
||||
void init_style();
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeHalf<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeHalf<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeFullA<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeFullA<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeFullB<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffComputeFullB<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double bondorder(const int &i, const int &j, const int &k,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double vec3_dot(const F_FLOAT x[3], const double y[3]) const {
|
||||
return x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_add(const F_FLOAT x[3], const double y[3], double * const z) const {
|
||||
z[0] = x[0]+y[0]; z[1] = x[1]+y[1]; z[2] = x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scale(const F_FLOAT k, const double x[3], double y[3]) const {
|
||||
y[0] = k*x[0]; y[1] = k*x[1]; y[2] = k*x[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const {
|
||||
z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
int sbmask(const int& j) const;
|
||||
|
||||
struct params_ters{
|
||||
params_ters(){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0;
|
||||
bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;};
|
||||
params_ters(int i){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0;
|
||||
bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;};
|
||||
F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr,
|
||||
bigd, lam1, biga, cutsq, c1, c2, c3, c4;
|
||||
};
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const;
|
||||
|
||||
void allocate();
|
||||
void setup();
|
||||
|
||||
protected:
|
||||
void cleanup_copy();
|
||||
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
typename AT::t_x_array_randomread x;
|
||||
typename AT::t_f_array f;
|
||||
typename AT::t_int_1d_randomread type;
|
||||
typename AT::t_tagint_1d tag;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
typedef Kokkos::DualView<F_FLOAT**[7],Kokkos::LayoutRight,DeviceType> tdual_ffloat_2d_n7;
|
||||
typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread;
|
||||
typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
class AtomKokkos *atomKK;
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairTersoffKokkos>(PairTersoffKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
1208
src/KOKKOS/pair_tersoff_mod_kokkos.cpp
Executable file
1208
src/KOKKOS/pair_tersoff_mod_kokkos.cpp
Executable file
File diff suppressed because it is too large
Load Diff
220
src/KOKKOS/pair_tersoff_mod_kokkos.h
Executable file
220
src/KOKKOS/pair_tersoff_mod_kokkos.h
Executable file
@ -0,0 +1,220 @@
|
||||
/* -*- 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(tersoff/mod/kk,PairTersoffMODKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/mod/kk/device,PairTersoffMODKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/mod/kk/host,PairTersoffMODKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_TERSOFF_MOD_KOKKOS_H
|
||||
#define LMP_PAIR_TERSOFF_MOD_KOKKOS_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_tersoff_mod.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffMODComputeHalf{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffMODComputeFullA{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffMODComputeFullB{};
|
||||
|
||||
template<class DeviceType>
|
||||
class PairTersoffMODKokkos : public PairTersoffMOD {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairTersoffMODKokkos(class LAMMPS *);
|
||||
virtual ~PairTersoffMODKokkos();
|
||||
virtual void compute(int, int);
|
||||
void init_style();
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeHalf<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeHalf<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeFullA<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeFullA<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeFullB<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffMODComputeFullB<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double bondorder(const int &i, const int &j, const int &k,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double vec3_dot(const F_FLOAT x[3], const double y[3]) const {
|
||||
return x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_add(const F_FLOAT x[3], const double y[3], double * const z) const {
|
||||
z[0] = x[0]+y[0]; z[1] = x[1]+y[1]; z[2] = x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scale(const F_FLOAT k, const double x[3], double y[3]) const {
|
||||
y[0] = k*x[0]; y[1] = k*x[1]; y[2] = k*x[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const {
|
||||
z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
int sbmask(const int& j) const;
|
||||
|
||||
struct params_ters{
|
||||
params_ters(){powerm=0;lam3=0;h=0;powern=0;beta=0;lam2=0;bigb=0;bigr=0;bigd=0;
|
||||
lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;};
|
||||
params_ters(int i){powerm=0;lam3=0;h=0;powern=0;beta=0;lam2=0;bigb=0;bigr=0;bigd=0;
|
||||
lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;};
|
||||
F_FLOAT powerm, lam3, h, powern, beta, lam2, bigb, bigr, bigd,
|
||||
lam1, biga, powern_del, cutsq, c1, c2, c3, c4, c5, ca1, ca4;
|
||||
};
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const;
|
||||
|
||||
void allocate();
|
||||
void setup();
|
||||
|
||||
protected:
|
||||
void cleanup_copy();
|
||||
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
typename AT::t_x_array_randomread x;
|
||||
typename AT::t_f_array f;
|
||||
typename AT::t_int_1d_randomread type;
|
||||
typename AT::t_tagint_1d tag;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
typedef Kokkos::DualView<F_FLOAT**[7],Kokkos::LayoutRight,DeviceType> tdual_ffloat_2d_n7;
|
||||
typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread;
|
||||
typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
class AtomKokkos *atomKK;
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairTersoffMODKokkos>(PairTersoffMODKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
1302
src/KOKKOS/pair_tersoff_zbl_kokkos.cpp
Executable file
1302
src/KOKKOS/pair_tersoff_zbl_kokkos.cpp
Executable file
File diff suppressed because it is too large
Load Diff
231
src/KOKKOS/pair_tersoff_zbl_kokkos.h
Executable file
231
src/KOKKOS/pair_tersoff_zbl_kokkos.h
Executable file
@ -0,0 +1,231 @@
|
||||
/* -*- 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(tersoff/zbl/kk,PairTersoffZBLKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/zbl/kk/device,PairTersoffZBLKokkos<LMPDeviceType>)
|
||||
PairStyle(tersoff/zbl/kk/host,PairTersoffZBLKokkos<LMPHostType>)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef LMP_PAIR_TERSOFF_ZBL_KOKKOS_H
|
||||
#define LMP_PAIR_TERSOFF_ZBL_KOKKOS_H
|
||||
|
||||
#include "stdio.h"
|
||||
#include "pair_kokkos.h"
|
||||
#include "pair_tersoff_zbl.h"
|
||||
#include "neigh_list_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffZBLComputeHalf{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffZBLComputeFullA{};
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
struct TagPairTersoffZBLComputeFullB{};
|
||||
|
||||
template<class DeviceType>
|
||||
class PairTersoffZBLKokkos : public PairTersoffZBL {
|
||||
public:
|
||||
enum {EnabledNeighFlags=FULL};
|
||||
enum {COUL_FLAG=0};
|
||||
typedef DeviceType device_type;
|
||||
typedef ArrayTypes<DeviceType> AT;
|
||||
typedef EV_FLOAT value_type;
|
||||
|
||||
PairTersoffZBLKokkos(class LAMMPS *);
|
||||
virtual ~PairTersoffZBLKokkos();
|
||||
virtual void compute(int, int);
|
||||
void init_style();
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeHalf<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeHalf<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeFullA<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeFullA<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeFullB<NEIGHFLAG,EVFLAG>, const int&, EV_FLOAT&) const;
|
||||
|
||||
template<int NEIGHFLAG, int EVFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void operator()(TagPairTersoffZBLComputeFullB<NEIGHFLAG,EVFLAG>, const int&) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double bondorder(const int &i, const int &j, const int &k,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fj, F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor,
|
||||
const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1,
|
||||
const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2,
|
||||
F_FLOAT *fk) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double vec3_dot(const F_FLOAT x[3], const double y[3]) const {
|
||||
return x[0]*y[0] + x[1]*y[1] + x[2]*y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_add(const F_FLOAT x[3], const double y[3], double * const z) const {
|
||||
z[0] = x[0]+y[0]; z[1] = x[1]+y[1]; z[2] = x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scale(const F_FLOAT k, const double x[3], double y[3]) const {
|
||||
y[0] = k*x[0]; y[1] = k*x[1]; y[2] = k*x[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void vec3_scaleadd(const F_FLOAT k, const double x[3], const double y[3], double * const z) const {
|
||||
z[0] = k*x[0]+y[0]; z[1] = k*x[1]+y[1]; z[2] = k*x[2]+y[2];
|
||||
}
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
int sbmask(const int& j) const;
|
||||
|
||||
struct params_ters{
|
||||
params_ters(){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0;
|
||||
bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;};
|
||||
params_ters(int i){powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0;
|
||||
bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;};
|
||||
F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr,
|
||||
bigd, lam1, biga, cutsq, c1, c2, c3, c4, Z_i, Z_j, ZBLcut, ZBLexpscale;
|
||||
};
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void ev_tally(EV_FLOAT &ev, const int &i, const int &j,
|
||||
const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx,
|
||||
const F_FLOAT &dely, const F_FLOAT &delz) const;
|
||||
|
||||
template<int NEIGHFLAG>
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k,
|
||||
F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const;
|
||||
|
||||
void allocate();
|
||||
void setup();
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double fermi_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
KOKKOS_INLINE_FUNCTION
|
||||
double fermi_d_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const;
|
||||
|
||||
protected:
|
||||
void cleanup_copy();
|
||||
|
||||
typedef Kokkos::DualView<int***,DeviceType> tdual_int_3d;
|
||||
Kokkos::DualView<params_ters***,Kokkos::LayoutRight,DeviceType> k_params;
|
||||
typename Kokkos::DualView<params_ters***,
|
||||
Kokkos::LayoutRight,DeviceType>::t_dev_const paramskk;
|
||||
// hardwired to space for 15 atom types
|
||||
//params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1];
|
||||
|
||||
typename AT::t_x_array_randomread x;
|
||||
typename AT::t_f_array f;
|
||||
typename AT::t_int_1d_randomread type;
|
||||
typename AT::t_tagint_1d tag;
|
||||
|
||||
DAT::tdual_efloat_1d k_eatom;
|
||||
DAT::tdual_virial_array k_vatom;
|
||||
DAT::t_efloat_1d d_eatom;
|
||||
DAT::t_virial_array d_vatom;
|
||||
|
||||
typedef Kokkos::DualView<F_FLOAT**[7],Kokkos::LayoutRight,DeviceType> tdual_ffloat_2d_n7;
|
||||
typedef typename tdual_ffloat_2d_n7::t_dev_const_randomread t_ffloat_2d_n7_randomread;
|
||||
typedef typename tdual_ffloat_2d_n7::t_host t_host_ffloat_2d_n7;
|
||||
|
||||
typename ArrayTypes<DeviceType>::t_neighbors_2d d_neighbors;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_ilist;
|
||||
typename ArrayTypes<DeviceType>::t_int_1d_randomread d_numneigh;
|
||||
//NeighListKokkos<DeviceType> k_list;
|
||||
|
||||
class AtomKokkos *atomKK;
|
||||
int neighflag,newton_pair;
|
||||
int nlocal,nall,eflag,vflag;
|
||||
|
||||
// ZBL
|
||||
F_FLOAT global_a_0; // Bohr radius for Coulomb repulsion
|
||||
F_FLOAT global_epsilon_0; // permittivity of vacuum for Coulomb repulsion
|
||||
F_FLOAT global_e; // proton charge (negative of electron charge)
|
||||
|
||||
friend void pair_virial_fdotr_compute<PairTersoffZBLKokkos>(PairTersoffZBLKokkos*);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -58,6 +58,8 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
PairSW::~PairSW()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
if (elements)
|
||||
for (int i = 0; i < nelements; i++) delete [] elements[i];
|
||||
delete [] elements;
|
||||
|
||||
@ -30,11 +30,10 @@ class PairSW : public Pair {
|
||||
virtual ~PairSW();
|
||||
virtual void compute(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
virtual void coeff(int, char **);
|
||||
virtual double init_one(int, int);
|
||||
virtual void init_style();
|
||||
|
||||
protected:
|
||||
struct Param {
|
||||
double epsilon,sigma;
|
||||
double littlea,lambda,gamma,costheta;
|
||||
@ -47,6 +46,7 @@ class PairSW : public Pair {
|
||||
int ielement,jelement,kelement;
|
||||
};
|
||||
|
||||
protected:
|
||||
double cutmax; // max cutoff for all elements
|
||||
int nelements; // # of unique elements
|
||||
char **elements; // names of unique elements
|
||||
@ -58,7 +58,7 @@ class PairSW : public Pair {
|
||||
|
||||
virtual void allocate();
|
||||
void read_file(char *);
|
||||
void setup();
|
||||
virtual void setup();
|
||||
void twobody(Param *, double, double &, int, double &);
|
||||
void threebody(Param *, Param *, Param *, double, double, double *, double *,
|
||||
double *, double *, int, double &);
|
||||
|
||||
@ -59,6 +59,8 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp)
|
||||
|
||||
PairTersoff::~PairTersoff()
|
||||
{
|
||||
if (copymode) return;
|
||||
|
||||
if (elements)
|
||||
for (int i = 0; i < nelements; i++) delete [] elements[i];
|
||||
delete [] elements;
|
||||
|
||||
@ -31,7 +31,7 @@ class PairTersoff : public Pair {
|
||||
virtual void compute(int, int);
|
||||
void settings(int, char **);
|
||||
void coeff(int, char **);
|
||||
void init_style();
|
||||
virtual void init_style();
|
||||
double init_one(int, int);
|
||||
|
||||
protected:
|
||||
@ -60,7 +60,7 @@ class PairTersoff : public Pair {
|
||||
int nparams; // # of stored parameter sets
|
||||
int maxparam; // max # of parameter sets
|
||||
|
||||
void allocate();
|
||||
virtual void allocate();
|
||||
virtual void read_file(char *);
|
||||
virtual void setup();
|
||||
virtual void repulsive(Param *, double, double &, int, double &);
|
||||
|
||||
@ -31,7 +31,7 @@ class PairTersoffMOD : public PairTersoff {
|
||||
|
||||
protected:
|
||||
void read_file(char *);
|
||||
void setup();
|
||||
virtual void setup();
|
||||
double zeta(Param *, double, double, double *, double *);
|
||||
|
||||
double ters_fc(double, Param *);
|
||||
|
||||
@ -1 +1 @@
|
||||
#define LAMMPS_VERSION "16 Apr 2015"
|
||||
#define LAMMPS_VERSION "18 Apr 2015"
|
||||
|
||||
Reference in New Issue
Block a user