~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to lib/cuda/pair_lj_charmm_coul_charmm_cuda_kernel_nc.cu

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
   This software is distributed under the GNU General Public License.
22
22
------------------------------------------------------------------------- */
23
 
__device__ inline F_FLOAT PairLJCharmmCuda_Eval(const F_FLOAT &rsq, const int ij_type, F_FLOAT &factor_lj, int &eflag, ENERGY_FLOAT &evdwl)
 
23
__device__ inline F_CFLOAT PairLJCharmmCuda_Eval(const F_CFLOAT &rsq, const int ij_type, F_CFLOAT &factor_lj, int &eflag, ENERGY_CFLOAT &evdwl)
24
24
{
25
 
  const F_FLOAT r2inv = F_F(1.0) / rsq;
26
 
  const F_FLOAT r6inv = r2inv * r2inv * r2inv;
27
 
  F_FLOAT forcelj = r6inv * (_lj1[ij_type] * r6inv - _lj2[ij_type]);
28
 
  F_FLOAT philj, switch1;
 
25
  const F_CFLOAT r2inv = F_F(1.0) / rsq;
 
26
  const F_CFLOAT r6inv = r2inv * r2inv * r2inv;
 
27
  F_CFLOAT forcelj = r6inv * (_lj1[ij_type] * r6inv - _lj2[ij_type]);
 
28
  F_CFLOAT philj, switch1;
29
29
 
30
30
  if(rsq > _cut_innersq_global) {
31
31
    switch1 = (_cutsq_global - rsq) * (_cutsq_global - rsq) *
32
32
              (_cutsq_global + F_F(2.0) * rsq - F_F(3.0) * _cut_innersq_global) * _denom_lj_inv;
33
 
    const F_FLOAT switch2 = F_F(12.0) * rsq * (_cutsq_global - rsq) *
 
33
    const F_CFLOAT switch2 = F_F(12.0) * rsq * (_cutsq_global - rsq) *
34
34
                            (rsq - _cut_innersq_global) * _denom_lj_inv;
35
35
    philj = r6inv * (_lj3[ij_type] * r6inv - _lj4[ij_type]);
36
36
    forcelj = forcelj * switch1 + philj * switch2;
37
37
  }
38
38
 
39
39
  if(eflag) {
40
 
    ENERGY_FLOAT evdwl_tmp = factor_lj;
 
40
    ENERGY_CFLOAT evdwl_tmp = factor_lj;
41
41
 
42
42
    if(rsq > _cut_innersq_global) {
43
43
      evdwl_tmp *= philj * switch1;
50
50
  return factor_lj * forcelj * r2inv;
51
51
}
52
52
 
53
 
__device__ inline F_FLOAT CoulCharmmCuda_Eval(const F_FLOAT &rsq, F_FLOAT &factor_coul, int &eflag, ENERGY_FLOAT &ecoul, F_FLOAT qij)
 
53
__device__ inline F_CFLOAT CoulCharmmCuda_Eval(const F_CFLOAT &rsq, F_CFLOAT &factor_coul, int &eflag, ENERGY_CFLOAT &ecoul, F_CFLOAT qij)
54
54
{
55
 
  F_FLOAT forcecoul;
56
 
  ENERGY_FLOAT ecoul_tmp = forcecoul = _qqrd2e * qij * _RSQRT_(rsq) * factor_coul;
 
55
  F_CFLOAT forcecoul;
 
56
  ENERGY_CFLOAT ecoul_tmp = forcecoul = _qqrd2e * qij * _RSQRT_(rsq) * factor_coul;
57
57
 
58
58
  if(rsq > _cut_coul_innersq_global) {
59
 
    const F_FLOAT switch1 = (_cut_coulsq_global - rsq) * (_cut_coulsq_global - rsq) *
 
59
    const F_CFLOAT switch1 = (_cut_coulsq_global - rsq) * (_cut_coulsq_global - rsq) *
60
60
                            (_cut_coulsq_global + F_F(2.0) * rsq - F_F(3.0) * _cut_coul_innersq_global) * _denom_coul_inv;
61
61
    ecoul_tmp *= switch1;
62
 
    const F_FLOAT switch2 = F_F(12.0) * rsq * (_cut_coulsq_global - rsq) *
 
62
    const F_CFLOAT switch2 = F_F(12.0) * rsq * (_cut_coulsq_global - rsq) *
63
63
                            (rsq - _cut_coul_innersq_global) * _denom_coul_inv;
64
64
    forcecoul *= switch1 + switch2;
65
65
  }