16 double equiv_2[3], equiv_5[3];
17 long int iter, ncut, j;
18 double cost, pinv, rest, sint,
a,
b,
c,
f[4], hst;
19 double hnorm, secxs[4], secys[4], seczs[4],
f1,
f2, h2,
f3, h4, f4;
20 double g1,
g2, g3,
g4, g5, g6, at, bt,
ct, ph, hp, fx, fy, fz,
tl;
21 double ph2, cba,
rho, est, tet, hxp[3], dxt, dyt, dzt, ang2, rho1;
27 #define y (equiv_2 + 1)
28 #define z (equiv_2 + 2)
29 #define xyzt (equiv_5)
31 #define yt (equiv_5 + 1)
32 #define zt (equiv_5 + 2)
62 for (j = 1; j <= 7; ++j) {vout[j] = vect[j];}
63 pinv = (
charge) * 2.9979251
e-2 / vect[7];
71 if (std::abs(hst) > std::abs(rest)) hst = rest;
91 secxs[0] = (
b *
f[2] -
c *
f[1]) * ph2;
92 secys[0] = (
c *
f[0] -
a *
f[2]) * ph2;
93 seczs[0] = (
a *
f[1] -
b *
f[0]) * ph2;
94 ang2 = secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0];
95 if (ang2 > 9.86960440109)
goto L40;
96 dxt = h2 *
a + h4 * secxs[0];
97 dyt = h2 *
b + h4 * secys[0];
98 dzt = h2 *
c + h4 * seczs[0];
105 est = std::abs(dxt) + std::abs(dyt) + std::abs(dzt);
106 if (est > hst)
goto L30;
118 secxs[1] = (bt *
f[2] -
ct *
f[1]) * ph2;
119 secys[1] = (
ct *
f[0] - at *
f[2]) * ph2;
120 seczs[1] = (at *
f[1] - bt *
f[0]) * ph2;
124 secxs[2] = (bt *
f[2] -
ct *
f[1]) * ph2;
125 secys[2] = (
ct *
f[0] - at *
f[2]) * ph2;
126 seczs[2] = (at *
f[1] - bt *
f[0]) * ph2;
127 dxt = hst * (
a + secxs[2]);
128 dyt = hst * (
b + secys[2]);
129 dzt = hst * (
c + seczs[2]);
133 at =
a + secxs[2] * 2.;
134 bt =
b + secys[2] * 2.;
135 ct =
c + seczs[2] * 2.;
137 est = std::abs(dxt) + std::abs(dyt) + std::abs(dzt);
138 if (est > std::abs(hst) * 2.)
goto L30;
145 *
z += (
c + (seczs[0] + seczs[1] + seczs[2]) /3.) * hst;
146 *
y += (
b + (secys[0] + secys[1] + secys[2]) /3.) * hst;
147 *
x += (
a + (secxs[0] + secxs[1] + secxs[2]) /3.) * hst;
149 secxs[3] = (bt *
f[2] -
ct *
f[1]) * ph2;
150 secys[3] = (
ct *
f[0] - at *
f[2]) * ph2;
151 seczs[3] = (at *
f[1] - bt *
f[0]) * ph2;
152 a += (secxs[0] + secxs[3] + (secxs[1] + secxs[2]) * 2.) /3.;
153 b += (secys[0] + secys[3] + (secys[1] + secys[2]) * 2.) /3.;
154 c += (seczs[0] + seczs[3] + (seczs[1] + seczs[2]) * 2.) /3.;
156 est = std::abs(secxs[0] + secxs[3] - (secxs[1] + secxs[2]))
157 + std::abs(secys[0] + secys[3] - (secys[1] + secys[2]))
158 + std::abs(seczs[0] + seczs[3] - (seczs[1] + seczs[2]));
160 if (est > 1
e-4 && std::abs(hst) > 1
e-4)
goto L30;
166 if (iter > 1992)
goto L40;
171 cba = 1. / sqrt(
a *
a +
b *
b +
c *
c);
179 if (
step < 0.) rest = -rest;
180 if (rest > std::abs(
step) * 1
e-5)
goto L20;
208 hxp[0] =
f2 * vect[6] -
f3 * vect[5];
209 hxp[1] =
f3 * vect[4] -
f1 * vect[6];
210 hxp[2] =
f1 * vect[5] -
f2 * vect[4];
211 hp =
f1 * vect[4] +
f2 * vect[5] +
f3 * vect[6];
219 g3 = (tet - sint) * hp * rho1;
223 vout[1] = vect[1] + (
g1 * vect[4] +
g2 * hxp[0] + g3 *
f1);
224 vout[2] = vect[2] + (
g1 * vect[5] +
g2 * hxp[1] + g3 *
f2);
225 vout[3] = vect[3] + (
g1 * vect[6] +
g2 * hxp[2] + g3 *
f3);
226 vout[4] = vect[4] + (
g4 * vect[4] + g5 * hxp[0] + g6 *
f1);
227 vout[5] = vect[5] + (
g4 * vect[5] + g5 * hxp[1] + g6 *
f2);
228 vout[6] = vect[6] + (
g4 * vect[6] + g5 * hxp[2] + g6 *
f3);
231 vout[1] = vect[1] +
step * vect[4];
232 vout[2] = vect[2] +
step * vect[5];
233 vout[3] = vect[3] +
step * vect[6];