1
/* ----------------------------------------------------------------------
2
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
5
http://lammps.sandia.gov, Sandia National Laboratories
6
Steve Plimpton, sjplimp@sandia.gov
8
See the README file in the top-level LAMMPS directory.
10
-----------------------------------------------------------------------
12
USER-CUDA Package and associated modifications:
13
https://sourceforge.net/projects/lammpscuda/
15
Christian Trott, christian.trott@tu-ilmenau.de
16
Lars Winterfeld, lars.winterfeld@tu-ilmenau.de
17
Theoretical Physics II, University of Technology Ilmenau, Germany
19
See the README file in the USER-CUDA directory.
21
This software is distributed under the GNU General Public License.
22
------------------------------------------------------------------------- */
24
__device__ inline F_FLOAT PairCGCMMCuda_Eval(const F_FLOAT &rsq, const int ij_type, F_FLOAT &factor_lj, int &eflag, ENERGY_FLOAT &evdwl) //0.11 of 0.4
26
const F_FLOAT r2inv = F_F(1.0) / rsq;
27
const int cg_type = _cg_type[ij_type];
28
const F_FLOAT r4inv = r2inv * r2inv;
29
const F_FLOAT rNinv_first = cg_type != CG_LJ9_6 ? r4inv : _RSQRT_(rsq);
30
const F_FLOAT rNinv_second = cg_type != CG_LJ12_4 ? -r2inv : -F_F(1.0);
31
const F_FLOAT forcelj = r4inv * (_lj1[ij_type] * r4inv * rNinv_first + _lj2[ij_type] * rNinv_second);
33
if(eflag) evdwl += factor_lj * (r4inv * (_lj3[ij_type] * r4inv * rNinv_first + _lj4[ij_type] * rNinv_second) - _offset[ij_type]);
35
return factor_lj * forcelj * r2inv;
38
/*__device__ inline F_FLOAT PairCGCMMCuda_Eval(const F_FLOAT& rsq,const int ij_type,F_FLOAT& factor_lj,int& eflag, ENERGY_FLOAT& evdwl)
40
const int cg_type = tex1Dfetch(_coeff5_gm_tex,ij_type);
41
const F_FLOAT r2inv = F_F(1.0)/rsq;
42
const F_FLOAT r4inv = r2inv*r2inv;
43
const F_FLOAT rNinv_first = cg_type!=CG_LJ9_6?r4inv:_RSQRT_(rsq);
44
const F_FLOAT rNinv_second = cg_type!=CG_LJ12_4?r2inv:F_F(1.0);
45
const F_FLOAT forcelj = r4inv * (tex1Dfetch(_coeff1_gm_tex,ij_type)*r4inv*rNinv_first - tex1Dfetch(_coeff2_gm_tex,ij_type)*rNinv_second);
47
if(eflag) evdwl += factor_lj*(r4inv*(tex1Dfetch(_coeff3_gm_tex,ij_type)*r4inv*rNinv_first-tex1Dfetch(_coeff4_gm_tex,ij_type)*rNinv_second));
48
return factor_lj*forcelj*r2inv;