1 /* ----------------------------------------------------------------------
2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
3
4 Original Version:
5 http://lammps.sandia.gov, Sandia National Laboratories
6 Steve Plimpton, sjplimp@sandia.gov
7
8 See the README file in the top-level LAMMPS directory.
9
10 -----------------------------------------------------------------------
11
12 USER-CUDA Package and associated modifications:
13 https://sourceforge.net/projects/lammpscuda/
14
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
18
19 See the README file in the USER-CUDA directory.
20
21 This software is distributed under the GNU General Public License.
22 ------------------------------------------------------------------------- */
23
CoulCharmmImplicitCuda_Eval(const F_FLOAT & rsq,F_FLOAT & factor_coul,int & eflag,ENERGY_FLOAT & ecoul,F_FLOAT qij)24 __device__ inline F_FLOAT CoulCharmmImplicitCuda_Eval(const F_FLOAT &rsq, F_FLOAT &factor_coul, int &eflag, ENERGY_FLOAT &ecoul, F_FLOAT qij)
25 {
26 F_FLOAT forcecoul;
27 ENERGY_FLOAT ecoul_tmp = forcecoul = _qqrd2e * qij * (F_F(1.0) / rsq) * factor_coul;
28
29 if(rsq > _cut_coul_innersq_global) {
30 const F_FLOAT switch1 = (_cut_coulsq_global - rsq) * (_cut_coulsq_global - rsq) *
31 (_cut_coulsq_global + F_F(2.0) * rsq - F_F(3.0) * _cut_coul_innersq_global) * _denom_coul_inv;
32 ecoul_tmp *= switch1;
33 const F_FLOAT switch2 = F_F(12.0) * rsq * (_cut_coulsq_global - rsq) *
34 (rsq - _cut_coul_innersq_global) * _denom_coul_inv;
35 forcecoul *= (switch1 + switch2);
36 }
37
38 if(eflag) {
39 ecoul += ecoul_tmp * factor_coul;
40 }
41
42 return F_F(2.0) * forcecoul * (F_F(1.0) / rsq);
43 }
44
45