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