115 {
117 std::vector<int> nFCC(nAtoms, 0);
118 std::vector<int> nHCP(nAtoms, 0);
119 std::vector<std::vector<int>> neighborLists(nAtoms);
120
121 for (long i = 0; i < nAtoms - 1; i++) {
122 for (long j = i + 1; j < nAtoms; j++) {
123 double diffR = matter->
distance(i, j);
124 if (diffR < neighborCutoff) {
125 neighborLists[i].push_back(static_cast<int>(j));
126 neighborLists[j].push_back(static_cast<int>(i));
127 }
128 }
129 }
130
131 for (long a2 = 0; a2 < nAtoms; a2++) {
132 const auto &nbs2 = neighborLists[a2];
133 for (size_t n2 = 0; n2 < nbs2.size(); n2++) {
134 int a1 = nbs2[n2];
135 if (a1 < a2) {
136 std::vector<int> common;
137 const auto &nbs1 = neighborLists[a1];
138 for (size_t n1 = 0; n1 < nbs1.size(); n1++) {
139 int a3 = nbs1[n1];
140 for (size_t m2 = 0; m2 < nbs2.size(); m2++) {
141 if (a3 == nbs2[m2])
142 common.push_back(a3);
143 }
144 }
145 if (common.size() == 4) {
146 int nBonds = 0;
147 int bondsSum = 0;
148 for (int j2 = 1; j2 < 4; j2++) {
149 const auto &nbs = neighborLists[common[j2]];
150 for (int j1 = 0; j1 < j2; j1++) {
151 for (size_t n = 0; n < nbs.size(); n++) {
152 if (common[j1] == nbs[n]) {
153 nBonds++;
154 bondsSum += j1 + j2;
155 break;
156 }
157 }
158 }
159 }
160 if (nBonds == 2) {
161 if (bondsSum == 6) {
162 nFCC[a1]++;
163 nFCC[a2]++;
164 } else {
165 nHCP[a1]++;
166 nHCP[a2]++;
167 }
168 }
169 }
170 }
171 }
172 }
173
174 for (long i = 0; i < nAtoms; i++) {
175 if (neighborLists[i].size() == 12) {
176 if (nFCC[i] == 12)
178 else if (nFCC[i] == 6 && nHCP[i] == 6)
180 else
182 } else {
184 }
185 }
186}
double distance(long index1, long index2) const
long int numberOfAtoms() const
void cna(long *cna, const Matter *matter, double neighborCutoff)