topo_two_dim.cpp
Go to the documentation of this file.
1 #include <topo_two_dim.hpp>
2 
3 // -----------------------------------------------------------------------------------------------------
4 // MONOLAYER ALGORITHMS
5 // -----------------------------------------------------------------------------------------------------
6 
40  molSys::PointCloud<molSys::Point<double>, double> *yCloud, int maxDepth,
41  double sheetArea, int firstFrame) {
42  //
44  ringsOneType; // Vector of vectors of rings of a single size
45  int nRings; // Number of rings of the current type
46  std::vector<int> nRingList; // Vector of the values of the number of prisms
47  // for a particular frame
48  std::vector<double> coverageAreaXY; // Coverage area percent on the XY plane
49  // for a particular n and frame
50  std::vector<double> coverageAreaXZ; // Coverage area percent on the XZ plane
51  // for a particular n and frame
52  std::vector<double> coverageAreaYZ; // Coverage area percent on the YZ plane
53  // for a particular n and frame
54  std::vector<double> singleAreas; // Coverage area on the XY, XZ and YZ planes
55  // for a single ring
57  atomTypes; // contains int values for each prism type considered
58  // -------------------------------------------------------------------------------
59  // Init
60  nRingList.resize(
61  maxDepth -
62  2); // Has a value for every value of ringSize from 3, upto maxDepth
63  coverageAreaXY.resize(maxDepth - 2);
64  coverageAreaXZ.resize(maxDepth - 2);
65  coverageAreaYZ.resize(maxDepth - 2);
66  // The atomTypes vector is the same size as the pointCloud atoms
67  atomTypes.resize(yCloud->nop, 1); // The dummy or unclassified value is 1
68  // -------------------------------------------------------------------------------
69  // Run this loop for rings of sizes upto maxDepth
70  // The smallest possible ring is of size 3
71  for (int ringSize = 3; ringSize <= maxDepth; ringSize++) {
72  // Clear ringsOneType
73  ring::clearRingList(ringsOneType);
74  // Get rings of the current ring size
75  ringsOneType = ring::getSingleRingSize(rings, ringSize);
76  //
77  // Continue if there are zero rings of ringSize
78  if (ringsOneType.size() == 0) {
79  nRingList[ringSize - 3] = 0; // Update the number of prisms
80  // Update the coverage area%
81  coverageAreaXY[ringSize - 3] = 0.0;
82  coverageAreaXZ[ringSize - 3] = 0.0;
83  coverageAreaYZ[ringSize - 3] = 0.0;
84  continue;
85  } // skip if there are no rings
86  //
87  // -------------
88  // Number of rings with n nodes
89  nRings = ringsOneType.size();
90  // -------------
91  // Now that you have rings of a certain size:
92  nRingList[ringSize - 3] = nRings; // Update the number of n-membered rings
93  // Update the coverage area% for the n-membered ring phase.
94  singleAreas = topoparam::calcCoverageArea(yCloud, ringsOneType, sheetArea);
95  // XY plane
96  coverageAreaXY[ringSize - 3] = singleAreas[0];
97  // XZ plane
98  coverageAreaXZ[ringSize - 3] = singleAreas[1];
99  // YZ plane
100  coverageAreaYZ[ringSize - 3] = singleAreas[2];
101  // -------------
102  } // end of loop through every possible ringSize
103 
104  // Get the atom types for all the ring types
105  ring::assignPolygonType(rings, &atomTypes, nRingList);
106 
107  // Write out the ring information
108  sout::writeRingNum(path, yCloud->currentFrame, nRingList, coverageAreaXY,
109  coverageAreaXZ, coverageAreaYZ, maxDepth, firstFrame);
110  // Write out the lammps data file for the particular frame
111  sout::writeLAMMPSdataAllRings(yCloud, nList, atomTypes, maxDepth, path);
112 
113  return 0;
114 }
int clearRingList(std::vector< std::vector< int >> &rings)
Erases memory for a vector of vectors for a list of rings.
Definition: ring.cpp:22
int polygonRingAnalysis(std::string path, std::vector< std::vector< int >> rings, std::vector< std::vector< int >> nList, molSys::PointCloud< molSys::Point< double >, double > *yCloud, int maxDepth, double sheetArea, int firstFrame)
int assignPolygonType(std::vector< std::vector< int >> rings, std::vector< int > *atomTypes, std::vector< int > nRings)
Definition: ring.cpp:40
std::vector< std::vector< int > > getSingleRingSize(std::vector< std::vector< int >> rings, int ringSize)
Returns a vector of vectors of rings of a single size.
Definition: ring.cpp:200
int writeRingNum(std::string path, int currentFrame, std::vector< int > nRings, std::vector< double > coverageAreaXY, std::vector< double > coverageAreaXZ, std::vector< double > coverageAreaYZ, int maxDepth, int firstFrame)
int writeLAMMPSdataAllRings(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< std::vector< int >> nList, std::vector< int > atomTypes, int maxDepth, std::string path, bool isMonolayer=true)
Write a data file for rings of every type for a monolayer.
std::vector< double > calcCoverageArea(molSys::PointCloud< molSys::Point< double >, double > *yCloud, std::vector< std::vector< int >> rings, double sheetArea)
T resize(T... args)
T size(T... args)
This contains a collection of points; contains information for a particular frame.
Definition: mol_sys.hpp:170
This contains per-particle information.
Definition: mol_sys.hpp:149