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;
189 Eigen::Tensor<double, 4> r_tensor(2, 2, 2, 2);
198 std::vector<QMState> states;
199 states.push_back(state1);
200 states.push_back(state2);
203 for (
Index J = 0; J < 2; J++) {
204 for (
Index K = 0; K < 2; K++) {
205 Eigen::MatrixXd D_JK = tdmat.
Matrix(states[J], states[K]);
206 if (J == 0 && K == 0) {
207 D_JK +=
orbitals1_.DensityMatrixGroundState();
209 if (J == 1 && K == 1) {
210 D_JK +=
orbitals2_.DensityMatrixGroundState();
213 for (
Index M = 0; M < 2; M++) {
214 Eigen::MatrixXd D_LM = tdmat.
Matrix(states[
L], states[M]);
215 if (
L == 0 && M == 0) {
216 D_LM +=
orbitals1_.DensityMatrixGroundState();
218 if (
L == 1 && M == 1) {
219 D_LM +=
orbitals2_.DensityMatrixGroundState();