36 if (nList.size() == 0) {
38 std::cerr <<
"There are no bonds in the system!\n";
52 for (
int i = 0; i < nList.size(); i++) {
55 for (
int j = 1; j < nList[i].size(); j++) {
57 jatom = nList[iatom][j];
67 iatomID = yCloud->pts[iatom].atomID;
68 jatomID = yCloud->pts[jatom].atomID;
101 int iatomID, jatomID;
104 if (nList.size() == 0) {
106 std::cerr <<
"There are no bonds in the system!\n";
120 for (
int i = 0; i < nList.size(); i++) {
127 for (
int j = 1; j < nList[i].size(); j++) {
129 jatom = nList[iatom][j];
143 iatomID = yCloud->pts[iatom].atomID;
144 jatomID = yCloud->pts[jatom].atomID;
191 int iatomID, jatomID;
192 int iatomIndex, jatomIndex;
198 double distCutoff = 2.42;
199 double angleCutoff = 30;
216 for (
int iatom = 0; iatom < yCloud->nop; iatom++) {
219 hBondNet[iatom].
push_back(yCloud->pts[iatom].atomID);
223 for (
int iatom = 0; iatom < nList.size(); iatom++) {
224 currentBondList.
clear();
225 iatomID = nList[iatom][0];
226 nnumNeighbours = nList[iatom].size() - 1;
230 for (
int j = 1; j <= nnumNeighbours; j++) {
231 jatomID = nList[iatom][j];
234 auto it = idMolIDmap.
find(jatomID);
235 if (it != idMolIDmap.
end()) {
236 jOxyMolID = it->second;
247 auto gotJ = yCloud->idIndexMap.find(jatomID);
248 if (gotJ != yCloud->idIndexMap.end()) {
249 jatomIndex = gotJ->second;
252 std::cerr <<
"Something is wrong with the map.\n";
257 for (
int k = 1; k <= 2; k++) {
258 hAtomIndex = molIDlist[listIndex][k];
268 if (hBondLen >= distCutoff) {
279 ooVec.
push_back(yCloud->pts[iatomIndex].x -
280 yCloud->pts[jatomIndex].x);
281 ooVec.
push_back(yCloud->pts[iatomIndex].y -
282 yCloud->pts[jatomIndex].y);
283 ooVec.
push_back(yCloud->pts[iatomIndex].z -
284 yCloud->pts[jatomIndex].z);
286 ohVec.
push_back(yCloud->pts[iatomIndex].x -
287 hCloud.
pts[hAtomIndex].x);
288 ohVec.
push_back(yCloud->pts[iatomIndex].y -
289 hCloud.
pts[hAtomIndex].y);
290 ohVec.
push_back(yCloud->pts[iatomIndex].z -
291 hCloud.
pts[hAtomIndex].z);
293 for (
int l = 0; l < 3; l++) {
294 ooVec[l] -= yCloud->box[l] * round(ooVec[l] / yCloud->box[l]);
295 ohVec[l] -= yCloud->box[l] * round(ohVec[l] / yCloud->box[l]);
304 if (eigenAngleDeg > angleCutoff) {
357 int iatomID, jatomID;
358 int iatomIndex, jatomIndex;
364 double distCutoff = 2.42;
365 double angleCutoff = 30;
379 for (
int iatom = 0; iatom < yCloud->nop; iatom++) {
382 hBondNet[iatom].
push_back(yCloud->pts[iatom].atomID);
386 for (
int iatom = 0; iatom < nList.size(); iatom++) {
387 currentBondList.
clear();
388 iatomID = nList[iatom][0];
389 nnumNeighbours = nList[iatom].size() - 1;
393 for (
int j = 1; j <= nnumNeighbours; j++) {
394 jatomID = nList[iatom][j];
397 auto it = idMolIDmap.
find(jatomID);
398 if (it != idMolIDmap.
end()) {
399 jOxyMolID = it->second;
410 auto gotJ = yCloud->idIndexMap.find(jatomID);
411 if (gotJ != yCloud->idIndexMap.end()) {
412 jatomIndex = gotJ->second;
415 std::cerr <<
"Something is wrong with the map.\n";
420 for (
int k = 1; k <= 2; k++) {
421 hAtomIndex = molIDlist[listIndex][k];
431 if (hBondLen >= distCutoff) {
442 ooVec.
push_back(yCloud->pts[iatomIndex].x -
443 yCloud->pts[jatomIndex].x);
444 ooVec.
push_back(yCloud->pts[iatomIndex].y -
445 yCloud->pts[jatomIndex].y);
446 ooVec.
push_back(yCloud->pts[iatomIndex].z -
447 yCloud->pts[jatomIndex].z);
449 ohVec.
push_back(yCloud->pts[iatomIndex].x -
450 hCloud->pts[hAtomIndex].x);
451 ohVec.
push_back(yCloud->pts[iatomIndex].y -
452 hCloud->pts[hAtomIndex].y);
453 ohVec.
push_back(yCloud->pts[iatomIndex].z -
454 hCloud->pts[hAtomIndex].z);
456 for (
int l = 0; l < 3; l++) {
457 ooVec[l] -= yCloud->box[l] * round(ooVec[l] / yCloud->box[l]);
458 ohVec[l] -= yCloud->box[l] * round(ohVec[l] / yCloud->box[l]);
467 if (eigenAngleDeg > angleCutoff) {
505 dr[0] = oCloud->pts[oAtomIndex].x - hCloud->pts[hAtomIndex].x;
506 dr[1] = oCloud->pts[oAtomIndex].y - hCloud->pts[hAtomIndex].y;
507 dr[2] = oCloud->pts[oAtomIndex].z - hCloud->pts[hAtomIndex].z;
510 for (
int k = 0; k < 3; k++) {
511 dr[k] -= oCloud->box[k] * round(dr[k] / oCloud->box[k]);
512 r2 += pow(dr[k], 2.0);
534 int ringSize = rings[0].
size();
538 if (rings.size() == 0) {
540 std::cerr <<
"There are no rings in the system!\n";
554 for (
int icage = 0; icage < (*cageList).size(); icage++) {
556 if ((*cageList)[icage].type != type) {
559 *nRings += (*cageList)[icage].rings.
size();
562 for (
int iring = 0; iring < (*cageList)[icage].rings.size(); iring++) {
563 currentRing = (*cageList)[icage].rings[iring];
565 for (
int k = 0; k < rings[currentRing].size() - 1; k++) {
569 currentBond.
push_back(rings[currentRing][k]);
570 currentBond.
push_back(rings[currentRing][k + 1]);
578 currentBond.
push_back(rings[currentRing][ringSize - 1]);
579 currentBond.
push_back(rings[currentRing][0]);
607 bonds.erase(
std::unique(bonds.begin(), bonds.end()), bonds.end());
File for bond-related analyses (hydrogen bonds, bonded atoms for data file write-outs etc....
File for containing generic or common functions.
std::vector< std::vector< int > > populateHbonds(std::string filename, molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< std::vector< int >> nList, int targetFrame, int Htype)
std::vector< std::vector< int > > populateHbondsWithInputClouds(molSys::PointCloud< molSys::Point< double >, double > *yCloud, molSys::PointCloud< molSys::Point< double >, double > *hCloud, std::vector< std::vector< int >> nList)
std::vector< std::vector< int > > trimBonds(std::vector< std::vector< int >> bonds)
Remove duplicate bonds.
std::vector< std::vector< int > > populateBonds(std::vector< std::vector< int >> nList, molSys::PointCloud< molSys::Point< double >, double > *yCloud)
double getHbondDistanceOH(molSys::PointCloud< molSys::Point< double >, double > *oCloud, molSys::PointCloud< molSys::Point< double >, double > *hCloud, int oAtomIndex, int hAtomIndex)
std::vector< std::vector< int > > createBondsFromCages(std::vector< std::vector< int >> rings, std::vector< cage::Cage > *cageList, cage::cageType type, int *nRings)
double eigenVecAngle(std::vector< double > OO, std::vector< double > OH)
Eigen function for getting the angle (in radians) between the O–O and O-H vectors.
double radDeg(double angle)
std::vector< std::vector< int > > hAtomMolList(molSys::PointCloud< molSys::Point< double >, double > *hCloud, molSys::PointCloud< molSys::Point< double >, double > *oCloud)
std::unordered_map< int, int > createIDMolIDmap(molSys::PointCloud< molSys::Point< double >, double > *yCloud)
int searchMolList(std::vector< std::vector< int >> molList, int molIDtoFind)
molSys::PointCloud< molSys::Point< double >, double > clearPointCloud(molSys::PointCloud< molSys::Point< double >, double > *yCloud)
//! Function for clearing vectors in PointCloud after multiple usage
molSys::PointCloud< molSys::Point< double >, double > readLammpsTrjreduced(std::string filename, int targetFrame, molSys::PointCloud< molSys::Point< double >, double > *yCloud, int typeI, bool isSlice=false, std::array< double, 3 > coordLow=std::array< double, 3 >{0, 0, 0}, std::array< double, 3 > coordHigh=std::array< double, 3 >{0, 0, 0})
This contains a collection of points; contains information for a particular frame.
This contains per-particle information.