24 Eigen::MatrixXd pointSet(n, 3);
29 for (
int k = 0; k < 3; k++) {
41 for (
int i = 0; i < n; i++) {
42 pointSet(i, dims[0]) = cos((2.0 *
gen::pi * i) / n);
43 pointSet(i, dims[1]) = sin((2.0 *
gen::pi * i) / n);
45 pointSet(i, axialDim) = 0.0;
61 int nop = ringSize * 2;
62 Eigen::MatrixXd pointSet(nop, 3);
87 for (
int i = 0; i < ringSize; i++) {
89 iBasalTwo = i + ringSize;
91 for (
int k = 0; k < 3; k++) {
94 pointSet(iBasalOne, k) = 0.0;
95 pointSet(iBasalTwo, k) = avgHeight;
98 pointSet(iBasalOne, k) = avgRadius * refPoints(i, k);
99 pointSet(iBasalTwo, k) = avgRadius * refPoints(i, k);
115 double avgRadius = 0.0;
118 int ringSize = basal1.
size();
127 for (
int i = 0; i < ringSize; i++) {
129 centroid1[0] += yCloud->pts[basal1[i]].x;
130 centroid1[1] += yCloud->pts[basal1[i]].y;
131 centroid1[2] += yCloud->pts[basal1[i]].z;
134 centroid2[0] += yCloud->pts[basal2[i]].x;
135 centroid2[1] += yCloud->pts[basal2[i]].y;
136 centroid2[2] += yCloud->pts[basal2[i]].z;
140 for (
int k = 0; k < 3; k++) {
141 centroid1[k] /= ringSize;
142 centroid2[k] /= ringSize;
147 for (
int i = 0; i < ringSize; i++) {
175 double avgHeight = 0.0;
178 int ringSize = basal1.
size();
183 for (
int i = 0; i < ringSize; i++) {
213 int ringSize = basal1.
size();
217 bool isClock, isAntiClock;
220 int currentIatom, currentJatom;
226 for (
int l = 0; l < ringSize; l++) {
231 for (
int m = 0; m < ringSize; m++) {
235 auto it =
std::find(nList[l_k].begin() + 1, nList[l_k].end(), m_k);
238 if (it != nList[l_k].end()) {
253 std::cerr <<
"Something is wrong with your deformed prism.\n";
263 int tempJfor, tempJback;
265 tempJfor = jatom + 1;
266 tempJback = jatom - 1;
268 if (jatom == ringSize - 1) {
270 tempJback = ringSize - 2;
274 tempJback = ringSize - 1;
277 int forwardJ = basal2[tempJfor];
278 int backwardJ = basal2[tempJback];
279 int currentI = basal1[iatom];
286 if (distClock < distAntiClock) {
290 if (distAntiClock < distClock) {
294 if (isClock ==
false && isAntiClock ==
false) {
301 for (
int i = 0; i < ringSize; i++) {
302 currentIatom = iatom + i;
303 if (currentIatom >= ringSize) {
304 currentIatom -= ringSize;
309 currentJatom = jatom + i;
310 if (currentJatom >= ringSize) {
311 currentJatom -= ringSize;
315 currentJatom = jatom - i;
316 if (currentJatom < 0) {
317 currentJatom += ringSize;
322 (*outBasal1).push_back(basal1[currentIatom]);
323 (*outBasal2).push_back(basal2[currentJatom]);
342 int ringSize = basal1.
size();
346 bool isClock, isAntiClock;
349 int currentIatom, currentJatom;
353 double infHugeNumber = 100000;
354 double leastDist = infHugeNumber;
362 for (
int m = 0; m < ringSize; m++) {
369 if (leastDist > dist) {
377 if (leastDist < infHugeNumber) {
383 std::cerr <<
"Something is wrong with your deformed prism.\n";
393 int tempJfor, tempJback;
395 tempJfor = jatom + 1;
396 tempJback = jatom - 1;
398 if (jatom == ringSize - 1) {
400 tempJback = ringSize - 2;
404 tempJback = ringSize - 1;
407 int forwardJ = basal2[tempJfor];
408 int backwardJ = basal2[tempJback];
409 int currentI = basal1[iatom];
416 if (distClock < distAntiClock) {
420 if (distAntiClock < distClock) {
424 if (isClock ==
false && isAntiClock ==
false) {
431 for (
int i = 0; i < ringSize; i++) {
432 currentIatom = iatom + i;
433 if (currentIatom >= ringSize) {
434 currentIatom -= ringSize;
439 currentJatom = jatom + i;
440 if (currentJatom >= ringSize) {
441 currentJatom -= ringSize;
445 currentJatom = jatom - i;
446 if (currentJatom < 0) {
447 currentJatom += ringSize;
452 (*outBasal1).push_back(basal1[currentIatom]);
453 (*outBasal2).push_back(basal2[currentJatom]);
470 int ringSize = basalRing.
size();
471 int nop = basalRing.
size();
472 Eigen::MatrixXd pointSet(nop, dim);
478 if (startingIndex >= ringSize || startingIndex < 0) {
483 for (
int i = 0; i < nop; i++) {
486 currentPosition = startingIndex + i;
488 if (currentPosition >= ringSize) {
489 currentPosition -= ringSize;
494 index = basalRing[currentPosition];
495 pointSet(i, 0) = yCloud->pts[index].x;
496 pointSet(i, 1) = yCloud->pts[index].y;
497 pointSet(i, 2) = yCloud->pts[index].z;
514 int ringSize = basal1.
size();
515 int nop = ringSize * 2;
516 Eigen::MatrixXd pointSet(nop, dim);
520 int iatomIndex, jatomIndex;
526 if (startingIndex >= ringSize || startingIndex < 0) {
531 for (
int i = 0; i < ringSize; i++) {
534 currentPosition = startingIndex + i;
536 if (currentPosition >= ringSize) {
537 currentPosition -= ringSize;
543 basal1[currentPosition];
545 pointSet(iatom, 0) = yCloud->pts[iatomIndex].x;
546 pointSet(iatom, 1) = yCloud->pts[iatomIndex].y;
547 pointSet(iatom, 2) = yCloud->pts[iatomIndex].z;
551 basal2[currentPosition];
552 jatom = i + ringSize;
553 pointSet(jatom, 0) = yCloud->pts[jatomIndex].x;
554 pointSet(jatom, 1) = yCloud->pts[jatomIndex].y;
555 pointSet(jatom, 2) = yCloud->pts[jatomIndex].z;
570 Eigen::MatrixXd pointSet(12, 3);
579 int n = setCloud.
nop;
580 Eigen::MatrixXd pointSet(n, 3);
583 for (
int i = 0; i < n; i++) {
584 pointSet(i, 0) = setCloud.
pts[i].x;
585 pointSet(i, 1) = setCloud.
pts[i].y;
586 pointSet(i, 2) = setCloud.
pts[i].z;
617 int ringSize = basal1.
size();
618 bool neighOne, neighTwo;
623 int nextBasal1Element;
624 int nextBasal2Element;
625 bool isReversedOrder;
628 (*matchedBasal1).resize(ringSize);
629 (*matchedBasal2).resize(ringSize);
634 for (
int i = 0; i < ringSize; i++) {
637 auto it =
std::find(nList[l1].begin() + 1, nList[l1].end(), iatom);
639 if (it != nList[l1].end()) {
640 neighbourFound =
true;
644 nextBasal1Element = basal1[2];
649 auto it1 =
std::find(nList[l2].begin() + 1, nList[l2].end(), iatom);
651 if (it1 != nList[l2].end()) {
652 neighbourFound =
true;
655 nextBasal1Element = basal1[3];
665 if (!neighbourFound) {
676 index = m_kIndex + 2;
678 if (index >= ringSize) {
681 nextBasal2Element = basal2[index];
683 auto it =
std::find(nList[nextBasal1Element].begin() + 1,
684 nList[nextBasal1Element].end(), nextBasal2Element);
686 if (it != nList[nextBasal1Element].end()) {
688 for (
int i = 0; i < ringSize; i++) {
689 index = m_kIndex + i;
691 if (index >= ringSize) {
694 (*matchedBasal2)[i] = basal2[index];
699 index = m_kIndex - 2;
704 nextBasal2Element = basal2[index];
706 auto it =
std::find(nList[nextBasal1Element].begin() + 1,
707 nList[nextBasal1Element].end(), nextBasal2Element);
709 if (it != nList[nextBasal1Element].end()) {
711 for (
int i = 0; i < ringSize; i++) {
712 index = m_kIndex - i;
717 (*matchedBasal2)[i] = basal2[index];
730 (*matchedBasal1) = basal1;
743 Eigen::MatrixXd pointSet(12, 3);
744 int iatomIndex, jatomIndex;
754 if (startingIndex > 5 || startingIndex < 0) {
759 if (startingIndex > 0) {
760 for (
int k = 0; k < 6; k++) {
761 iPnt = k + startingIndex;
777 iatomOne = newBasal1[0];
778 pointSet(0, 0) = yCloud->pts[iatomOne].x;
779 pointSet(0, 1) = yCloud->pts[iatomOne].y;
780 pointSet(0, 2) = yCloud->pts[iatomOne].z;
782 jatomIndex = newBasal2[0];
787 pointSet(6, 0) = yCloud->pts[iatomOne].x + dr[0];
788 pointSet(6, 1) = yCloud->pts[iatomOne].y + dr[1];
789 pointSet(6, 2) = yCloud->pts[iatomOne].z + dr[2];
792 for (
int i = 1; i < 6; i++) {
794 iatomIndex = newBasal1[i];
795 jatomIndex = newBasal2[i];
800 pointSet(i, 0) = yCloud->pts[iatomOne].x + dr[0];
801 pointSet(i, 1) = yCloud->pts[iatomOne].y + dr[1];
802 pointSet(i, 2) = yCloud->pts[iatomOne].z + dr[2];
807 pointSet(i + 6, 0) = yCloud->pts[iatomOne].x + dr[0];
808 pointSet(i + 6, 1) = yCloud->pts[iatomOne].y + dr[1];
809 pointSet(i + 6, 2) = yCloud->pts[iatomOne].z + dr[2];
858 int nextI, prevI, nextJ, prevJ;
859 int jatomIndex, atomIndex;
863 iring = cageList[index]
867 for (
int i = 0; i < ringSize; i++) {
875 for (
int i = 0; i < ringSize; i++) {
880 if (i == ringSize - 1) {
882 prevI = ddcOrder[i - 1];
885 nextI = ddcOrder[i + 1];
888 nextI = ddcOrder[i + 1];
889 prevI = ddcOrder[i - 1];
895 for (
int j = 1; j <= ringSize; j++) {
897 jring = cageList[index].rings[j];
900 auto it =
std::find(rings[jring].begin(), rings[jring].end(), iatom);
902 if (it != rings[jring].end()) {
910 atomIndex = jatomIndex + 1;
912 if (atomIndex >= ringSize) {
913 atomIndex -= ringSize;
915 nextJ = rings[jring][atomIndex];
917 atomIndex = jatomIndex - 1;
919 atomIndex += ringSize;
921 prevJ = rings[jring][atomIndex];
926 if (prevJ != nextI && prevJ != prevI) {
934 atomIndex = jatomIndex - 2;
937 atomIndex += ringSize;
939 apex1 = rings[jring][atomIndex];
948 atomIndex = jatomIndex - 2;
951 atomIndex += ringSize;
953 apex2 = rings[jring][atomIndex];
962 if (nextJ != nextI && nextJ != prevI) {
970 atomIndex = jatomIndex + 2;
972 if (atomIndex >= ringSize) {
973 atomIndex -= ringSize;
975 apex1 = rings[jring][atomIndex];
984 atomIndex = jatomIndex + 2;
986 if (atomIndex >= ringSize) {
987 atomIndex -= ringSize;
989 apex2 = rings[jring][atomIndex];
1004 for (
int i = 0; i < peripheral1.
size(); i++) {
1012 for (
int i = 0; i < peripheral2.
size(); i++) {
1047 Eigen::MatrixXd pointSet(nop, 3);
1048 int peripheralStartingIndex;
1054 int iatomIndex, jatomIndex;
1057 if (startingIndex == 0) {
1058 wrappedDDC = ddcOrder;
1065 for (
int i = 0; i < ringSize; i++) {
1066 currentIndex = startingIndex + i;
1068 if (currentIndex >= ringSize) {
1069 currentIndex -= ringSize;
1072 wrappedDDC[i] = ddcOrder[currentIndex];
1078 if (startingIndex <= 1) {
1079 peripheralStartingIndex = 0;
1080 }
else if (startingIndex > 1 && startingIndex <= 3) {
1081 peripheralStartingIndex = 1;
1083 peripheralStartingIndex = 2;
1087 for (
int i = 6; i < 9; i++) {
1088 currentIndex = i + peripheralStartingIndex;
1090 if (currentIndex <= 9) {
1093 wrappedDDC[i] = ddcOrder[currentIndex];
1097 for (
int i = 10; i < 13; i++) {
1098 currentIndex = i + peripheralStartingIndex;
1100 if (currentIndex <= 13) {
1103 wrappedDDC[i] = ddcOrder[currentIndex];
1107 wrappedDDC[9] = ddcOrder[9];
1108 wrappedDDC[13] = ddcOrder[13];
1113 iatomIndex = wrappedDDC[0];
1114 pointSet(0, 0) = yCloud->pts[iatomIndex].x;
1115 pointSet(0, 1) = yCloud->pts[iatomIndex].y;
1116 pointSet(0, 2) = yCloud->pts[iatomIndex].z;
1118 for (
int i = 1; i < 14; i++) {
1120 jatomIndex = wrappedDDC[i];
1125 pointSet(i, 0) = yCloud->pts[iatomIndex].x + dr[0];
1126 pointSet(i, 1) = yCloud->pts[iatomIndex].y + dr[1];
1127 pointSet(i, 2) = yCloud->pts[iatomIndex].z + dr[2];
std::array< double, 3 > relDist(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, int jatom)
double periodicDist(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, int jatom)
Inline generic function for obtaining the unwrapped periodic distance between two particles,...
double unWrappedDistFromPoint(molSys::PointCloud< molSys::Point< double >, double > *yCloud, int iatom, std::vector< double > singlePoint)
double getAverageWithoutOutliers(std::vector< double > inpVec)
Get the average, after excluding the outliers, using quartiles.
int nop
Current frame number.
@ HCbasal
The ring belongs only to a hexagonal cage (HC). Specifically, the ring is purely a basal ring of an H...
molSys::PointCloud< molSys::Point< double >, double > readXYZ(std::string filename)
Function for reading in atom coordinates from an XYZ file.
Eigen::MatrixXd changeDiaCageOrder(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > ddcOrder, int startingIndex=0)
double getRadiusFromRings(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2)
Eigen::MatrixXd getPointSetCage(ring::strucType type)
Eigen::MatrixXd fillPointSetPrismRing(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basalRing, int startingIndex)
Eigen::MatrixXd getPointSetRefRing(int n, int axialDim)
Eigen::MatrixXd createPrismBlock(molSys::PointCloud< molSys::Point< double >, double > *yCloud, const Eigen::MatrixXd &refPoints, int ringSize, std::vector< int > basal1, std::vector< int > basal2)
std::vector< int > relOrderDDC(int index, std::vector< std::vector< int >> rings, std::vector< cage::Cage > cageList)
Matches the order of the basal rings of an DDC or a potential HC.
int relOrderHC(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2, std::vector< std::vector< int >> nList, std::vector< int > *matchedBasal1, std::vector< int > *matchedBasal2)
Matches the order of the basal rings of an HC or a potential HC.
Eigen::MatrixXd changeHexCageOrder(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2, int startingIndex=0)
int relOrderPrismBlock(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2, std::vector< std::vector< int >> nList, std::vector< int > *outBasal1, std::vector< int > *outBasal2)
double getAvgHeightPrismBlock(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2)
Eigen::MatrixXd fillPointSetPrismBlock(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< int > basal1, std::vector< int > basal2, int startingIndex)
This contains a collection of points; contains information for a particular frame.
This contains per-particle information.