Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
Macros | Functions | Variables

Macros

#define INT_COPYSIGN   intCopysignShift
 Defines the implementation of int copysign(int,int); function. More...
 

Functions

template<int N, class T >
void tinker::symlusolve (const T *aUpRowMajor, T *b)
 This subroutine uses the LU decomposition method to solve the linear system Ax = b, returning x in b. A is an n by n real symmetric matrix with its upper triangle (including the diagonal) stored by rows. More...
 
template<class T , class T2 >
tinker::maxOf (T a, T2 b)
 
template<class T , class T2 , class... Ts>
tinker::maxOf (T a, T2 b, Ts... cs)
 
template<class T , class T2 >
tinker::minOf (T a, T2 b)
 
template<class T , class T2 , class... Ts>
tinker::minOf (T a, T2 b, Ts... cs)
 
double tinker::OUProcess (double t, double x0, double gamma, double a, double b, double R)
 Returns the value of an Ornstein-Uhlenbeck process after time t. More...
 
constexpr bool tinker::isPow2 (size_t val)
 Return true if and only if val is a power of 2. More...
 
constexpr int tinker::pow2 (int val)
 Integer base 2 power. More...
 
constexpr long long tinker::pow2ll (int val)
 Long long integer base 2 power. More...
 
constexpr int tinker::floorLog2_constexpr (size_t val)
 The base-2 logarithm of val. More...
 
constexpr size_t tinker::pow2Le (size_t val)
 A power of 2 that is less than or equal to val. More...
 
constexpr size_t tinker::pow2Ge (size_t val)
 A power of 2 that is greater than or equal to val. More...
 
int tinker::floorLog2 (int val)
 Non-constexpr floorLog2(int). More...
 
int tinker::floorLog2 (long long val)
 Non-constexpr floorLog2(long long). More...
 
int tinker::ceilLog2 (int val)
 Non-constexpr log base 2 ceiling. More...
 
int tinker::ceilLog2 (long long val)
 Non-constexpr log base 2 ceiling. More...
 
template<class T >
tinker::random ()
 Returns a random number on [0,1] from a uniform distribution. More...
 
template<class T >
tinker::normal ()
 Returns a random number from a normal Gaussian distribution with a mean of zero and a standard deviation of one. More...
 
template<class T >
tinker::normal (T u, T s)
 Returns a random number from a normal Gaussian distribution with a mean of u and a standard deviation of s. More...
 
template<class T >
tinker::chiSquared (int k)
 Returns a random number as if the square of k independent standard normal N(0,1) random variables were aggregated. More...
 
void tinker::randomData (RcOp)
 
template<class T >
tinker::sinhc (T x)
 \( \sinh(x)/x \) More...
 
template<int DO_DTAPER>
__device__ void tinker::switchTaper5 (real rik, real cut, real off, real &__restrict__ taper, real &__restrict__ dtaper)
 Smooth function F: [cut,off]->[1,0]. More...
 
template<class T >
void tinker::matmul3 (T R[3][3], T A[3][3], T B[3][3])
 Matrix multiplication of two 3 by 3 matrices. \( R = A B \). Matrices are stored in the row-major order (C-style). More...
 
template<class T >
void tinker::matmul3 (T R[3][3], T A[3][3])
 Matrix multiplication of two 3 by 3 matrices. \( R = A R \). Matrices are stored in the row-major order (C-style). More...
 
template<class T >
void tinker::trimatExp (T ans[3][3], T m[3][3], T t)
 \( \exp(mt) \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style). More...
 
template<class T >
void tinker::trimatExpm1c (T ans[3][3], T m[3][3], T t)
 \( (\exp(mt)-I)/(mt) \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style). More...
 
template<class T >
void tinker::trimatTExpm1c (T ans[3][3], T m[3][3], T t)
 \( t \frac{\exp(mt)-I}{mt} \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style). More...
 
void tinker::zeroOnHost (int &v)
 Zeros variable on host. More...
 
void tinker::zeroOnHost (float &v)
 Zeros variable on host. More...
 
void tinker::zeroOnHost (double &v)
 Zeros variable on host. More...
 
void tinker::zeroOnHost (unsigned long long &v)
 Zeros variable on host. More...
 
template<class T >
void tinker::zeroOnHost (T *&ptr)
 Zeros variable on host. More...
 
template<class T , size_t N>
void tinker::zeroOnHost (T(&v)[N])
 Zeros variables on host. More...
 
template<class T , class... Ts>
void tinker::zeroOnHost (T &v, Ts &... vs)
 Zeros variables on host. More...
 
template<class T >
void tinker::zeroOnDevice3Async (int nelem, T *a1, T *a2, T *a3)
 Zeros variables on device. More...
 
template<class T , int N>
void tinker::zeroOnDevice3Async (int nelem, T(*a1)[N], T(*a2)[N], T(*a3)[N])
 Zeros variables on device. More...
 
template<class T >
void tinker::zeroOnDevice9Async (int nelem, T *a1, T *a2, T *a3, T *a4, T *a5, T *a6, T *a7, T *a8, T *a9)
 Zeros variables on device. More...
 
__device__ int tinker::intCopysignShift (int a, int b)
 If b < 0, returns -abs(a), otherwise, returns abs(a). Similar to the 32-bit integer version of Fortran SIGN(A,B). More...
 
__device__ int tinker::intCopysignIf (int a, int b)
 If b < 0, returns -abs(a), otherwise, returns abs(a). More...
 
__device__ int tinker::ffsnShift (int c1, int n)
 Find the position of the n-th least significant bit set in a 32-bit integer. Returns a value from 0 to 32. More...
 
__device__ int tinker::ffsnLoop (int c1, int n)
 An alternative implementation of ffsn using loop. More...
 

Variables

constexpr real tinker::pi = M_PI
 \( \pi \) More...
 
constexpr real tinker::sqrtpi = 1.77245385090551602730
 \( \sqrt{\pi} \) More...
 
constexpr real tinker::radian = 57.2957795130823208768
 \( 180/\pi \) More...
 
constexpr real tinker::_1radian = 0.01745329251994329576924
 \( \pi/180 \) More...
 
using tinker::real2 = float2
 
using tinker::real3 = float3
 
using tinker::real4 = float4
 
__device__ real3 tinker::operator- (real3 a)
 
__device__ real3 tinker::operator+ (real3 a, real3 b)
 
__device__ real3 tinker::operator- (real3 a, real3 b)
 
__device__ real3 tinker::operator* (real a, real3 b)
 
__device__ real3 tinker::operator* (real3 b, real a)
 
__device__ void tinker::operator+= (real3 &a, real3 b)
 
__device__ void tinker::operator-= (real3 &a, real3 b)
 
__device__ void tinker::operator*= (real3 &a, real b)
 
__device__ real tinker::dot3 (real3 a, real3 b)
 
__device__ real tinker::dot3 (real3 a, real bx, real by, real bz)
 
__device__ real tinker::dot3 (real ax, real ay, real az, real3 b)
 
__device__ real tinker::dot3 (real ax, real ay, real az, real bx, real by, real bz)
 
__device__ real3 tinker::matvec (real xx, real xy, real xz, real yy, real yz, real zz, real3 v)
 
__device__ real3 tinker::cross (real ax, real ay, real az, real bx, real by, real bz)
 
__device__ real3 tinker::cross (real ax, real ay, real az, real3 b)
 
__device__ real3 tinker::cross (real3 a, real bx, real by, real bz)
 
__device__ real3 tinker::cross (real3 a, real3 b)
 
template<class T >
__device__ void tinker::fsinhc1 (T d, T &__restrict__ f1d)
 
template<class T >
__device__ void tinker::fsinhc2 (T d, T &__restrict__ f1d, T &__restrict__ f2d)
 
template<class T >
__device__ void tinker::fsinhc3 (T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d)
 
template<class T >
__device__ void tinker::fsinhc4 (T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d, T &__restrict__ f4d)
 
template<class T >
__device__ void tinker::fsinhc5 (T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d, T &__restrict__ f4d, T &__restrict__ f5d)
 
template<class T >
__device__ void tinker::fsinhc6 (T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d, T &__restrict__ f4d, T &__restrict__ f5d, T &__restrict__ f6d)
 
template<class T >
__device__ void tinker::fsinhc7 (T d, T &__restrict__ f1d, T &__restrict__ f2d, T &__restrict__ f3d, T &__restrict__ f4d, T &__restrict__ f5d, T &__restrict__ f6d, T &__restrict__ f7d)
 

Detailed Description

Macro Definition Documentation

◆ INT_COPYSIGN

#define INT_COPYSIGN   intCopysignShift

Defines the implementation of int copysign(int,int); function.

Typedef Documentation

◆ real2

using tinker::real2 = typedef float2

◆ real3

using tinker::real3 = typedef float3

◆ real4

using tinker::real4 = typedef float4

Function Documentation

◆ ceilLog2() [1/2]

int tinker::ceilLog2 ( int  val)
inline

Non-constexpr log base 2 ceiling.

◆ ceilLog2() [2/2]

int tinker::ceilLog2 ( long long  val)
inline

Non-constexpr log base 2 ceiling.

◆ chiSquared()

template<class T >
T tinker::chiSquared ( int  k)

Returns a random number as if the square of k independent standard normal N(0,1) random variables were aggregated.

Note
There is a bug in some (not so) early g++ random/chiSquared_distribution implementations [ref 1 and ref 2], thus gamma distribution is used here via the following equations:

\[ p_{\chi^2}(x|n) = \frac{x^{n/2-1} exp(-x/2)}{2^{n/2} \Gamma(n/2)} \]

\[ p_\Gamma(x|a,b) = \frac{x^{a-1} exp(-x/b)}{b^a \Gamma(a)} \]

\[ p_{\chi^2}(n) = p_\Gamma(n/2,2) \]

◆ cross() [1/4]

__device__ real3 tinker::cross ( real  ax,
real  ay,
real  az,
real  bx,
real  by,
real  bz 
)
inline

◆ cross() [2/4]

__device__ real3 tinker::cross ( real  ax,
real  ay,
real  az,
real3  b 
)
inline

◆ cross() [3/4]

__device__ real3 tinker::cross ( real3  a,
real  bx,
real  by,
real  bz 
)
inline

◆ cross() [4/4]

__device__ real3 tinker::cross ( real3  a,
real3  b 
)
inline

◆ dot3() [1/4]

__device__ real tinker::dot3 ( real  ax,
real  ay,
real  az,
real  bx,
real  by,
real  bz 
)
inline

◆ dot3() [2/4]

__device__ real tinker::dot3 ( real  ax,
real  ay,
real  az,
real3  b 
)
inline

◆ dot3() [3/4]

__device__ real tinker::dot3 ( real3  a,
real  bx,
real  by,
real  bz 
)
inline

◆ dot3() [4/4]

__device__ real tinker::dot3 ( real3  a,
real3  b 
)
inline

◆ ffsnLoop()

__device__ int tinker::ffsnLoop ( int  c1,
int  n 
)
inline

An alternative implementation of ffsn using loop.

◆ ffsnShift()

__device__ int tinker::ffsnShift ( int  c1,
int  n 
)
inline

Find the position of the n-th least significant bit set in a 32-bit integer. Returns a value from 0 to 32.

  • If c1 equals 0, always returns 0.
  • If n equals 0, always returns 0.
  • If n is greater than POPC, which is the number of bits that are set to 1 in c1, returns an undefined value.
Parameters
c1A 32-bit integer.
nRanges from 1 to 32.

◆ floorLog2() [1/2]

int tinker::floorLog2 ( int  val)
inline

Non-constexpr floorLog2(int).

◆ floorLog2() [2/2]

int tinker::floorLog2 ( long long  val)
inline

Non-constexpr floorLog2(long long).

◆ floorLog2_constexpr()

constexpr int tinker::floorLog2_constexpr ( size_t  val)
constexpr

The base-2 logarithm of val.

Parameters
valMust be greater than 0.
Note
Returns 0 if val is 0.

◆ fsinhc1()

template<class T >
__device__ void tinker::fsinhc1 ( d,
T &__restrict__  f1d 
)
inline

◆ fsinhc2()

template<class T >
__device__ void tinker::fsinhc2 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d 
)
inline

◆ fsinhc3()

template<class T >
__device__ void tinker::fsinhc3 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d,
T &__restrict__  f3d 
)
inline

◆ fsinhc4()

template<class T >
__device__ void tinker::fsinhc4 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d,
T &__restrict__  f3d,
T &__restrict__  f4d 
)
inline

◆ fsinhc5()

template<class T >
__device__ void tinker::fsinhc5 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d,
T &__restrict__  f3d,
T &__restrict__  f4d,
T &__restrict__  f5d 
)
inline

◆ fsinhc6()

template<class T >
__device__ void tinker::fsinhc6 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d,
T &__restrict__  f3d,
T &__restrict__  f4d,
T &__restrict__  f5d,
T &__restrict__  f6d 
)
inline

◆ fsinhc7()

template<class T >
__device__ void tinker::fsinhc7 ( d,
T &__restrict__  f1d,
T &__restrict__  f2d,
T &__restrict__  f3d,
T &__restrict__  f4d,
T &__restrict__  f5d,
T &__restrict__  f6d,
T &__restrict__  f7d 
)
inline

◆ intCopysignIf()

__device__ int tinker::intCopysignIf ( int  a,
int  b 
)
inline

If b < 0, returns -abs(a), otherwise, returns abs(a).

◆ intCopysignShift()

__device__ int tinker::intCopysignShift ( int  a,
int  b 
)
inline

If b < 0, returns -abs(a), otherwise, returns abs(a). Similar to the 32-bit integer version of Fortran SIGN(A,B).

Note
Standard C and CUDA libraries only have float and double versions.

◆ isPow2()

constexpr bool tinker::isPow2 ( size_t  val)
constexpr

Return true if and only if val is a power of 2.

◆ matmul3() [1/2]

template<class T >
void tinker::matmul3 ( R[3][3],
A[3][3] 
)

Matrix multiplication of two 3 by 3 matrices. \( R = A R \). Matrices are stored in the row-major order (C-style).

Parameters
[in,out]RMatrix to be multiplied on the left.
[in]AMatrix on the left.

◆ matmul3() [2/2]

template<class T >
void tinker::matmul3 ( R[3][3],
A[3][3],
B[3][3] 
)

Matrix multiplication of two 3 by 3 matrices. \( R = A B \). Matrices are stored in the row-major order (C-style).

Parameters
[out]RMatrix for the result.
[in]AMatrix on the left.
[in]BMatrix on the right.

◆ matvec()

__device__ real3 tinker::matvec ( real  xx,
real  xy,
real  xz,
real  yy,
real  yz,
real  zz,
real3  v 
)
inline

◆ maxOf() [1/2]

template<class T , class T2 >
T tinker::maxOf ( a,
T2  b 
)

◆ maxOf() [2/2]

template<class T , class T2 , class... Ts>
T tinker::maxOf ( a,
T2  b,
Ts...  cs 
)
Returns
The maximum value from a variadic list of numbers.

◆ minOf() [1/2]

template<class T , class T2 >
T tinker::minOf ( a,
T2  b 
)

◆ minOf() [2/2]

template<class T , class T2 , class... Ts>
T tinker::minOf ( a,
T2  b,
Ts...  cs 
)
Returns
The minimum value from a variadic list of numbers.

◆ normal() [1/2]

template<class T >
T tinker::normal ( )

Returns a random number from a normal Gaussian distribution with a mean of zero and a standard deviation of one.

◆ normal() [2/2]

template<class T >
T tinker::normal ( u,
s 
)

Returns a random number from a normal Gaussian distribution with a mean of u and a standard deviation of s.

◆ operator*() [1/2]

__device__ real3 tinker::operator* ( real  a,
real3  b 
)
inline

◆ operator*() [2/2]

__device__ real3 tinker::operator* ( real3  b,
real  a 
)
inline

◆ operator*=()

__device__ void tinker::operator*= ( real3 a,
real  b 
)
inline

◆ operator+()

__device__ real3 tinker::operator+ ( real3  a,
real3  b 
)
inline

◆ operator+=()

__device__ void tinker::operator+= ( real3 a,
real3  b 
)
inline

◆ operator-() [1/2]

__device__ real3 tinker::operator- ( real3  a)
inline

◆ operator-() [2/2]

__device__ real3 tinker::operator- ( real3  a,
real3  b 
)
inline

◆ operator-=()

__device__ void tinker::operator-= ( real3 a,
real3  b 
)
inline

◆ OUProcess()

double tinker::OUProcess ( double  t,
double  x0,
double  gamma,
double  a,
double  b,
double  R 
)
inline

Returns the value of an Ornstein-Uhlenbeck process after time t.

The Ornstein-Uhlenbeck process is described by \( \frac{dx}{dt} = a - \gamma x + b \frac{dW}{dt} \), and \( x_t = x_0 \exp(-\gamma t) + at \frac{1 - \exp(-\gamma t)}{\gamma t} + b R \sqrt{t} \sqrt{\frac{1 - \exp(-2\gamma t)}{2\gamma t}} \).

Parameters
tLength of a time interval.
x0Initial value.
gammaFriction coefficient.
aParameter a.
bParameter b.
RRandom number of a standard normal distribution.

◆ pow2()

constexpr int tinker::pow2 ( int  val)
constexpr

Integer base 2 power.

◆ pow2Ge()

constexpr size_t tinker::pow2Ge ( size_t  val)
constexpr

A power of 2 that is greater than or equal to val.

◆ pow2Le()

constexpr size_t tinker::pow2Le ( size_t  val)
constexpr

A power of 2 that is less than or equal to val.

Parameters
valMust be greater than 0.

◆ pow2ll()

constexpr long long tinker::pow2ll ( int  val)
constexpr

Long long integer base 2 power.

◆ random()

template<class T >
T tinker::random ( )

Returns a random number on [0,1] from a uniform distribution.

◆ randomData()

void tinker::randomData ( RcOp  )

◆ sinhc()

template<class T >
T tinker::sinhc ( x)

\( \sinh(x)/x \)

◆ switchTaper5()

template<int DO_DTAPER>
__device__ void tinker::switchTaper5 ( real  rik,
real  cut,
real  off,
real &__restrict__  taper,
real &__restrict__  dtaper 
)

Smooth function F: [cut,off]->[1,0].

Derived from the 5th order smoothstep function (-S2(x) + 1):

\[ S_2: [0,1]\rightarrow[0,1] \]

\[ S_2(x) = 6 x^5 - 15 x^4 + 10 x^3 \]

Parameters
[in]rikDistance.
[in]cutDistance at which switching of the potential begins.
[out]offDistance at which the potential energy goes to zero.
[out]taperF value.
[out]dtaperdF/dx value.
Template Parameters
DO_DTAPERIf false, dtaper will not be calculated and its original value will not be altered.

◆ symlusolve()

template<int N, class T >
void tinker::symlusolve ( const T *  aUpRowMajor,
T *  b 
)

This subroutine uses the LU decomposition method to solve the linear system Ax = b, returning x in b. A is an n by n real symmetric matrix with its upper triangle (including the diagonal) stored by rows.

Literature reference:

◆ trimatExp()

template<class T >
void tinker::trimatExp ( ans[3][3],
m[3][3],
t 
)

\( \exp(mt) \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style).

Parameters
[out]ans3 by 3 matrix for the result.
[in]m3 by 3 upper triangular matrix.
[in]tScalar to scale the matrix m.
Note
If the input matrix is not an upper triangular matrix, the result is undefined.

◆ trimatExpm1c()

template<class T >
void tinker::trimatExpm1c ( ans[3][3],
m[3][3],
t 
)

\( (\exp(mt)-I)/(mt) \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style).

Parameters
[out]ans3 by 3 matrix for the result.
[in]m3 by 3 upper triangular matrix.
[in]tScalar to scale the matrix m.
Note
If the input matrix is not an upper triangular matrix, the result is undefined.

◆ trimatTExpm1c()

template<class T >
void tinker::trimatTExpm1c ( ans[3][3],
m[3][3],
t 
)

\( t \frac{\exp(mt)-I}{mt} \). Matrix m is 3 by 3 upper triangular. Matrices are stored in the row-major order (C-style).

Parameters
[out]ans3 by 3 matrix for the result.
[in]m3 by 3 upper triangular matrix.
[in]tScalar to scale the matrix m.
Note
If the input matrix is not an upper triangular matrix, the result is undefined.

◆ zeroOnDevice3Async() [1/2]

template<class T >
void tinker::zeroOnDevice3Async ( int  nelem,
T *  a1,
T *  a2,
T *  a3 
)

Zeros variables on device.

◆ zeroOnDevice3Async() [2/2]

template<class T , int N>
void tinker::zeroOnDevice3Async ( int  nelem,
T(*)  a1[N],
T(*)  a2[N],
T(*)  a3[N] 
)

Zeros variables on device.

◆ zeroOnDevice9Async()

template<class T >
void tinker::zeroOnDevice9Async ( int  nelem,
T *  a1,
T *  a2,
T *  a3,
T *  a4,
T *  a5,
T *  a6,
T *  a7,
T *  a8,
T *  a9 
)

Zeros variables on device.

◆ zeroOnHost() [1/7]

void tinker::zeroOnHost ( double &  v)
inline

Zeros variable on host.

◆ zeroOnHost() [2/7]

void tinker::zeroOnHost ( float &  v)
inline

Zeros variable on host.

◆ zeroOnHost() [3/7]

void tinker::zeroOnHost ( int &  v)
inline

Zeros variable on host.

◆ zeroOnHost() [4/7]

template<class T , class... Ts>
void tinker::zeroOnHost ( T &  v,
Ts &...  vs 
)

Zeros variables on host.

◆ zeroOnHost() [5/7]

template<class T >
void tinker::zeroOnHost ( T *&  ptr)

Zeros variable on host.

◆ zeroOnHost() [6/7]

template<class T , size_t N>
void tinker::zeroOnHost ( T(&)  v[N])

Zeros variables on host.

◆ zeroOnHost() [7/7]

void tinker::zeroOnHost ( unsigned long long &  v)
inline

Zeros variable on host.

Variable Documentation

◆ _1radian

constexpr real tinker::_1radian = 0.01745329251994329576924
constexpr

\( \pi/180 \)

◆ pi

constexpr real tinker::pi = M_PI
constexpr

\( \pi \)

◆ radian

constexpr real tinker::radian = 57.2957795130823208768
constexpr

\( 180/\pi \)

◆ sqrtpi

constexpr real tinker::sqrtpi = 1.77245385090551602730
constexpr

\( \sqrt{\pi} \)