votca 2024.2-dev
Loading...
Searching...
No Matches
beadstructurealgorithms.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// VOTCA includes
20
21// Local VOTCA includes
23
24using namespace std;
25using namespace votca::tools;
26
27namespace votca {
28namespace csg {
29
30vector<BeadStructure> breakIntoStructures(BeadStructure &beadstructure) {
31 vector<BeadStructure> structures;
32 if (beadstructure.isSingleStructure()) {
33 structures.push_back(beadstructure);
34 } else {
35
36 vector<Graph> sub_graphs =
37 decoupleIsolatedSubGraphs(beadstructure.getGraph());
38 for (Graph &sub_graph : sub_graphs) {
39 vector<Edge> sub_graph_edges = sub_graph.getEdges();
40 vector<Index> sub_graph_vertices = sub_graph.getVertices();
41 structures.push_back(
42 beadstructure.getSubStructure(sub_graph_vertices, sub_graph_edges));
43 }
44 }
45 return structures;
46}
47
48} // namespace csg
49} // namespace votca
Designed to determine if the structure beads passed in.
BeadStructure getSubStructure(const std::vector< Index > &idx, const std::vector< tools::Edge > &edges) const
Given indices and edges that exist are a subset of beadstructure, return the sub-beadstructure.
bool isSingleStructure()
Determine if the bead structure consists of a single connected structure.
STL namespace.
std::vector< BeadStructure > breakIntoStructures(BeadStructure &beadstructure)
std::vector< Graph > decoupleIsolatedSubGraphs(Graph graph)
Break graph into smaller graph instances if the network is made up of isolated sub networks.
base class for all analysis tools
Definition basebead.h:33