Loading...
Searching...
No Matches
franzblau.hpp
Go to the documentation of this file.
1//-----------------------------------------------------------------------------------
2// d-SEAMS - Deferred Structural Elucidation Analysis for Molecular Simulations
3//
4// Copyright (c) 2018--present d-SEAMS core team
5//
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the MIT License as published by
8// the Open Source Initiative.
9//
10// A copy of the MIT License is included in the LICENSE file of this repository.
11// You should have received a copy of the MIT License along with this program.
12// If not, see <https://opensource.org/licenses/MIT>.
13//-----------------------------------------------------------------------------------
14
15#ifndef SEAMS_FRANZBLAU_H_
16#define SEAMS_FRANZBLAU_H_
17
18#include <algorithm>
19#include <array>
20#include <fstream>
21#include <iostream>
22#include <iterator>
23#include <cmath>
24#include <memory>
25#include <sstream>
26#include <string>
27#include <vector>
28
29#include <cage.hpp>
30#include <mol_sys.hpp>
31#include <seams_input.hpp>
32#include <seams_output.hpp>
33
38
43
75
76namespace primitive {
77
89struct Vertex {
91 std::vector<int> neighListIndex;
93 bool inGraph =
94 true;
95};
96
107struct Graph {
108 std::vector<Vertex> pts;
110 std::vector<std::vector<int>>
112};
113
118std::vector<std::vector<int>> ringNetwork(const std::vector<std::vector<int>> &nList,
119 int maxDepth);
120
123std::vector<std::vector<int>> ringNetwork(const std::vector<std::vector<int>> &nList,
124 int maxDepth,
125 const std::vector<char> &sources);
126
132 const std::vector<std::vector<int>> &neighHbondList);
133
137Graph populateGraphFromIndices(const std::vector<std::vector<int>> &nList);
138
143 const std::vector<std::vector<int>> &nList);
144
146Graph countAllRingsFromIndex(const std::vector<std::vector<int>> &neighHbondList,
147 int maxDepth);
148
150void removeNonSPrings(Graph &fullGraph);
151
153[[nodiscard]] int findRings(Graph &fullGraph, int v, std::vector<int> &visited, int maxDepth,
154 int depth, int root = -1);
155
157[[nodiscard]] int shortestPath(Graph &fullGraph, int v, int goal, std::vector<int> &path,
158 std::vector<int> &visited, int maxDepth, int depth = 1);
159
161Graph clearGraph(Graph &currentGraph);
162
163
176public:
177 explicit RingUpdater(int maxDepth);
180 RingUpdater &operator=(RingUpdater &&) noexcept;
181 RingUpdater(const RingUpdater &) = delete;
182 RingUpdater &operator=(const RingUpdater &) = delete;
183
186 const std::vector<std::vector<int>> &
187 update(const std::vector<std::vector<int>> &nList);
188
191 [[nodiscard]] int lastRecomputedSources() const;
192
194 [[nodiscard]] int lastBallsRefreshed() const;
195
196private:
197 struct Impl;
198 std::unique_ptr<Impl> impl_;
199};
200
201} // namespace primitive
202
203#endif // SEAMS_FRANZBLAU_H_
File for cage types for topological network criteria.
int lastRecomputedSources() const
Graph populateGraphFromNListID(molSys::PointCloud< molSys::Point< double >, double > &yCloud, const std::vector< std::vector< int > > &neighHbondList)
int findRings(Graph &fullGraph, int v, std::vector< int > &visited, int maxDepth, int depth, int root=-1)
Main function that searches for all rings.
void restoreEdgesFromIndices(Graph &fullGraph, const std::vector< std::vector< int > > &nList)
Graph populateGraphFromIndices(const std::vector< std::vector< int > > &nList)
void removeNonSPrings(Graph &fullGraph)
Removes the non-SP rings, using the Franzblau shortest path criterion.
RingUpdater(RingUpdater &&) noexcept
int shortestPath(Graph &fullGraph, int v, int goal, std::vector< int > &path, std::vector< int > &visited, int maxDepth, int depth=1)
Calculates the shortest path.
RingUpdater(int maxDepth)
std::vector< std::vector< int > > ringNetwork(const std::vector< std::vector< int > > &nList, int maxDepth)
const std::vector< std::vector< int > > & update(const std::vector< std::vector< int > > &nList)
std::vector< int > neighListIndex
This is the index according to pointCloud.
Definition franzblau.hpp:91
std::vector< std::vector< int > > rings
Graph countAllRingsFromIndex(const std::vector< std::vector< int > > &neighHbondList, int maxDepth)
Creates a vector of vectors of all possible rings.
int lastBallsRefreshed() const
Vertices whose bounded balls were rebuilt on the last update.
Graph clearGraph(Graph &currentGraph)
Function for clearing vectors in Graph after multiple usage.
std::vector< Vertex > pts
The main molecular system handler.
Functions for generating primitive rings.
Definition franzblau.hpp:76
File for functions that read in files).
This contains a collection of points; contains information for a particular frame.
Definition mol_sys.hpp:173
This contains per-particle information.
Definition mol_sys.hpp:152
This is a per-frame object, containing all the vertices for the particular frame, along with the vect...
This is a collection of elements, for each point, required for graph traversal.
Definition franzblau.hpp:89