134 rtensor(0, 1, 0, 1) - 0.25 * (rtensor(0, 0, 0, 0) + rtensor(1, 1, 1, 1) -
135 2. * rtensor(0, 0, 1, 1));
136 double B_12 = rtensor(0, 0, 0, 1) - rtensor(1, 1, 0, 1);
138 double cos4alpha = -A_12 / (std::sqrt(A_12 * A_12 + B_12 * B_12));
141 double sin4alpha = B_12 / (std::sqrt(A_12 * A_12 + B_12 * B_12));
145 double sqroot = std::sqrt(1.0 - 0.5 * (1.0 - cos4alpha));
146 double x_squared_plus = 0.5 * (1.0 + sqroot);
147 double x_squared_minus = 0.5 * (1.0 - sqroot);
149 double x1 = sqrt(x_squared_plus);
150 double y1 = sqrt(1.0 - x_squared_plus);
152 double x2 = sqrt(x_squared_minus);
153 double y2 = sqrt(1.0 - x_squared_minus);
155 double test1 = 4.0 * x1 * y1 * (x1 * x1 - y1 * y1);
156 double test2 = 4.0 * x2 * y2 * (x2 * x2 - y2 * y2);
158 double cos_alpha0 = 0;
159 double sin_alpha0 = 0;
162 if (std::abs(test1 - sin4alpha) < 1
e-4) {
165 }
else if (std::abs(test2 - sin4alpha) < 1
e-4) {
173 <<
"Coupling element directly: "
177 double angle = std::acos(cos_alpha0);
183 <<
"angle MAX (degrees) " << angle * 57.2958 << flush;