The entry of each active pair type of a configuration (null for a pair type whose element pair the population has not seen), by the same walk of the type table the covalent prior uses.
101 {
102 std::vector<const PopulationPairPrior*> entries(
103 static_cast<std::size_t>(conf.n_pt), nullptr);
104 if (pairs_.empty() || conf.n_pt <= 0) return entries;
105 const Eigen::Index n_types = conf.pairtype.rows();
106 std::vector<int> type_to_Z(static_cast<std::size_t>(n_types), -1);
107 const auto& types = conf.type.size() == conf.atomicNrs.size()
108 ? conf.type
109 : conf.atoms_mov.type;
110 const Eigen::Index count =
111 std::min(types.size(), conf.atomicNrs.size());
112 for (Eigen::Index atom = 0; atom < count; ++atom) {
113 const auto type = static_cast<Eigen::Index>(types.data()[atom]);
114 if (type < 0 || type >= n_types) continue;
115 if (type_to_Z[static_cast<std::size_t>(type)] == -1)
116 type_to_Z[static_cast<std::size_t>(type)] =
117 conf.atomicNrs.data()[atom];
118 }
119 for (Eigen::Index ti = 0; ti < n_types; ++ti) {
120 for (Eigen::Index tj = ti; tj < n_types; ++tj) {
121 if (ti >= conf.pairtype.rows() || tj >= conf.pairtype.cols())
122 continue;
123 const auto k = static_cast<Eigen::Index>(conf.pairtype(ti, tj));
124 if (k < 0 || k >= conf.n_pt) continue;
125 const int za = type_to_Z[static_cast<std::size_t>(ti)];
126 const int zb = type_to_Z[static_cast<std::size_t>(tj)];
127 if (za < 0 || zb < 0) continue;
128 if (entries[static_cast<std::size_t>(k)] == nullptr)
129 entries[
static_cast<std::size_t
>(k)] =
find(za, zb);
130 }
131 }
132 return entries;
133 }
const PopulationPairPrior * find(int element_a, int element_b) const noexcept
The entry of an element pair, in either order; null when unseen.