NuriKit v0.1.0b2
Loading...
Searching...
No Matches
rings.h
Go to the documentation of this file.
1//
2// Project NuriKit - Copyright 2023 SNU Compbio Lab.
3// SPDX-License-Identifier: Apache-2.0
4//
5#ifndef NURI_ALGO_RINGS_H_
6#define NURI_ALGO_RINGS_H_
7
9#include <memory>
10#include <utility>
11#include <vector>
13
14#include "nuri/core/molecule.h"
15
16namespace nuri {
17using Rings = std::vector<std::vector<int>>;
18
36extern std::pair<Rings, bool> find_all_rings(const Molecule &mol,
37 int max_size = -1);
38
56extern std::pair<Rings, bool> find_all_rings(const Substructure &sub,
57 int max_size = -1);
58
76extern std::pair<Rings, bool> find_all_rings(const ConstSubstructure &sub,
77 int max_size = -1);
78
79namespace internal {
80 template <class MoleculeLike>
81 struct FindRingsCommonData;
82} // namespace internal
83
114template <class MoleculeLike>
116public:
123 explicit RingSetsFinder(const MoleculeLike &mol, int max_size = -1);
124
128 RingSetsFinder &operator=(RingSetsFinder &&) noexcept;
129
130 ~RingSetsFinder() noexcept;
131
138
147
148private:
149 const MoleculeLike *mol_;
150 std::unique_ptr<internal::FindRingsCommonData<MoleculeLike>> data_;
151};
152
153template <class MoleculeLike>
154RingSetsFinder(const MoleculeLike &, int) -> RingSetsFinder<MoleculeLike>;
155
156extern template class RingSetsFinder<Molecule>;
157extern template class RingSetsFinder<Substructure>;
158extern template class RingSetsFinder<ConstSubstructure>;
159
174inline Rings find_relevant_rings(const Molecule &mol, int max_size = -1) {
175 return RingSetsFinder(mol, max_size).find_relevant_rings();
176}
177
192inline Rings find_relevant_rings(const Substructure &sub, int max_size = -1) {
193 return RingSetsFinder(sub, max_size).find_relevant_rings();
194}
195
211 int max_size = -1) {
212 return RingSetsFinder(sub, max_size).find_relevant_rings();
213}
214
231inline Rings find_sssr(const Molecule &mol, int max_size = -1) {
232 return RingSetsFinder(mol, max_size).find_sssr();
233}
234
251inline Rings find_sssr(const Substructure &sub, int max_size = -1) {
252 return RingSetsFinder(sub, max_size).find_sssr();
253}
254
271inline Rings find_sssr(const ConstSubstructure &sub, int max_size = -1) {
272 return RingSetsFinder(sub, max_size).find_sssr();
273}
274} // namespace nuri
275
276#endif /* NURI_ALGO_RINGS_H_ */
Read-only molecule class.
Definition molecule.h:943
Wrapper class of the common routines of find_sssr() and find_relevant_rings().
Definition rings.h:115
RingSetsFinder(const MoleculeLike &mol, int max_size=-1)
Construct a new Rings Finder object.
RingSetsFinder & operator=(const RingSetsFinder &)=delete
Rings find_relevant_rings() const
Find the relevant rings of the molecule.
Rings find_sssr() const
Find the SSSR of the molecule.
RingSetsFinder(const RingSetsFinder &)=delete
RingSetsFinder(RingSetsFinder &&) noexcept
Definition crdgen.h:16
std::pair< Rings, bool > find_all_rings(const Molecule &mol, int max_size=-1)
Find all elementary cycles in the molecular graph.
std::vector< std::vector< int > > Rings
Definition rings.h:17
Rings find_relevant_rings(const Molecule &mol, int max_size=-1)
Find union of the all SSSRs in the molecular graph.
Definition rings.h:174
internal::Substructure< false > Substructure
Definition molecule.h:928
internal::Substructure< true > ConstSubstructure
Definition molecule.h:929