Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
triangle.h
1#pragma once
2
3namespace tinker {
4__device__
5inline int xy_to_tri(int x, int y)
6{
7 long long lx = x;
8 int base = (lx + 1) * lx / 2;
9 return base + y;
10}
11
12__device__
13inline void tri_to_xy(int f, int& x, int& y)
14{
15 long long lf = 8ll * f + 1;
16 double ff = lf;
17 double fa = (sqrt(ff) - 1) / 2;
18 x = fa;
19 y = f - xy_to_tri(x, 0);
20}
21}
real * x
Number of the trajectory frames.
real * y
Current coordinates used in energy evaluation and neighbor lists.
Definition: testrt.h:9
__device__ int xy_to_tri(int x, int y)
Definition: triangle.h:5
__device__ void tri_to_xy(int f, int &x, int &y)
Definition: triangle.h:13