37 static const double pi=M_PI;
38 static const double pih=M_PI_2;
39 static const double tpi=2.0*pi;
41 static const double bohr = 0.52917706;
46 delta(
double u[],
const double a[],
const double b[])
56 dot(
double v[3],
double w[3])
58 return v[0]*w[0] + v[1]*w[1] + v[2]*w[2];
65 dist(
const double a[],
const double b[])
67 double ab[3]; delta(ab, a, b);
68 return sqrt(dot(ab,ab));
77 double tmp = 1.0 - x*x;
78 if (tmp < 0.0) tmp = 0.0;
86 scalar(
const double a[],
const double b[])
89 double x1 = a[1]*b[1];
99 norm(
double u[],
const double a[],
const double b[])
102 double x = 1.0/sqrt(scalar(u,u));
103 u[0] *= x; u[1] *= x; u[2] *= x;
110 normal(
const double a[],
const double b[],
double w[])
112 w[0] = a[1]*b[2]-a[2]*b[1];
113 w[1] = a[2]*b[0]-a[0]*b[2];
114 w[2] = a[0]*b[1]-a[1]*b[0];
115 double x = 1.0/sqrt(scalar(w,w));
116 w[0] *= x; w[1] *= x; w[2] *= x;