Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
damp_hippodisp.h
1#pragma once
2#include "math/sinhc.h"
3
4namespace tinker {
5#pragma ac routine seq
6template <int DO_G>
8inline void damp_hippodisp(real* restrict dmpij, real r, real rr1, real ai,
9 real aj)
10{
11 real a = ai * r, b = aj * r;
12 real c = (b + a) / 2, d = (b - a) / 2;
13 real expmc = REAL_EXP(-c);
14
15 real t = (ai + aj) * r;
16 real x = a / t, y = 1 - x;
17 real c3 = c * c * c, d2 = d * d;
18
19 real f1d, f2d, f3d;
20 if CONSTEXPR (DO_G)
21 fsinhc3(d, f1d, f2d, f3d);
22 else
23 fsinhc2(d, f1d, f2d);
24
25 real ec = expmc / 32, ea = REAL_EXP(-a) / 256, eb = REAL_EXP(-b) / 256;
26
27 // [0]
28 real k01, k02, l00x, l01x, l02x, l03x, l00y, l01y, l02y, l03y;
29 k01 = c * (c * (c * (c + 8) + 18) + 18);
30 k02 = c3 * (c * (c + 2) + 2);
31 l00x = 32 * (x * (x * (2 * x - 3) - 3) + 6);
32 l00y = 32 * (y * (y * (2 * y - 3) - 3) + 6);
33 l01x = 4 * (8 * x * (x * (x * (2 * x - 3) - 3) + 6) - 9);
34 l01y = 4 * (8 * y * (y * (y * (2 * y - 3) - 3) + 6) - 9);
35 l02x = 2 * x * (8 * x * (x * (x * (2 * x - 3) - 3) + 6) - 9) - 9;
36 l02y = 2 * y * (8 * y * (y * (y * (2 * y - 3) - 3) + 6) - 9) - 9;
37 l03x = (-y) * (4 * (-y) * x * (4 * (-y) * x - 1) + 1);
38 l03y = (-x) * (4 * (-x) * y * (4 * (-x) * y - 1) + 1);
39 l01x *= t, l01y *= t;
40 l02x *= t * t, l02y *= t * t;
41 l03x *= t * t * t, l03y *= t * t * t;
42 dmpij[0] = 1
43 - ((k01 * f1d + k02 * f2d) * ec + (l00x + l01x + l02x + l03x) * ea
44 + (l00y + l01y + l02y + l03y) * eb);
45
46 // [1]
47 if CONSTEXPR (DO_G) {
48 real k11, k12, k13, l10x, l11x, l12x, l13x, l10y, l11y, l12y, l13y;
49 k11 = c * (c * (c * (c * (c + 4) - 6) - 18) - 18);
50 k12 = c3 * (c * ((c - 3) * c - 6) - 6) - k01 * d2;
51 k13 = -k02 * d2;
52 l10x = a * l00x;
53 l11x = (a - 1) * l01x;
54 l12x = (a - 2) * l02x;
55 l13x = (a - 3) * l03x;
56 l10y = b * l00y;
57 l11y = (b - 1) * l01y;
58 l12y = (b - 2) * l02y;
59 l13y = (b - 3) * l03y;
60 dmpij[1] = ((k11 * f1d + k12 * f2d + k13 * f3d) * ec
61 + (l10x + l11x + l12x + l13x) * ea
62 + (l10y + l11y + l12y + l13y) * eb)
63 * rr1;
64 }
65}
66}
#define SEQ_CUDA
Definition: acc/seqdef.h:12
EnergyBuffer ea
EnergyBuffer eb
#define restrict
Definition: macro.h:51
#define CONSTEXPR
Definition: macro.h:61
real * x
Number of the trajectory frames.
real * y
Current coordinates used in energy evaluation and neighbor lists.
__device__ void fsinhc2(T d, T &__restrict__ f1d, T &__restrict__ f2d)
Definition: sinhc.h:285
__device__ void fsinhc3(T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d)
Definition: sinhc.h:294
float real
Definition: precision.h:80
Definition: testrt.h:9
EnergyBuffer ec
__device__ void damp_hippodisp(real *__restrict__ dmpij, real r, real rr1, real ai, real aj)
Definition: damp_hippodisp.h:8