219 for (std::size_t n = 0; n <
ids_.size(); ++n) {
223 const Index width = 3 * n_sites;
224 Eigen::MatrixXd block = Eigen::MatrixXd::Zero(width, width);
226 for (
Index s = 0; s < n_sites; ++s) {
227 block.block<3, 3>(3 * s, 3 * s) = segment[s].getPInv();
231 for (
Index i = 0; i < n_sites; ++i) {
233 for (
Index j = i + 1; j < n_sites; ++j) {
235 const Eigen::Vector3d r_vec = site_i.
getPos() - site_j.
getPos();
236 const double r = r_vec.norm();
241 const Eigen::Matrix3d coupling =
242 t.
l5 * b.
B2 * (r_vec * r_vec.transpose()) -
243 t.
l3 * b.
B1 * Eigen::Matrix3d::Identity();
259 block.block<3, 3>(3 * i, 3 * j) -= coupling;
260 block.block<3, 3>(3 * j, 3 * i) -= coupling.transpose();
265 Eigen::LDLT<Eigen::MatrixXd> ldlt(block);