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
126 const std::vector<std::vector<int>> &neighHbondList);
127
131Graph populateGraphFromIndices(const std::vector<std::vector<int>> &nList);
132
137 const std::vector<std::vector<int>> &nList);
138
140Graph countAllRingsFromIndex(const std::vector<std::vector<int>> &neighHbondList,
141 int maxDepth);
142
144void removeNonSPrings(Graph &fullGraph);
145
147[[nodiscard]] int findRings(Graph &fullGraph, int v, std::vector<int> &visited, int maxDepth,
148 int depth, int root = -1);
149
151[[nodiscard]] int shortestPath(Graph &fullGraph, int v, int goal, std::vector<int> &path,
152 std::vector<int> &visited, int maxDepth, int depth = 1);
153
155Graph clearGraph(Graph &currentGraph);
156
157
170public:
171 explicit RingUpdater(int maxDepth);
174 RingUpdater &operator=(RingUpdater &&) noexcept;
175 RingUpdater(const RingUpdater &) = delete;
176 RingUpdater &operator=(const RingUpdater &) = delete;
177
180 const std::vector<std::vector<int>> &
181 update(const std::vector<std::vector<int>> &nList);
182
185 [[nodiscard]] int lastRecomputedSources() const;
186
188 [[nodiscard]] int lastBallsRefreshed() const;
189
190private:
191 struct Impl;
192 std::unique_ptr<Impl> impl_;
193};
194
195} // namespace primitive
196
197#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