RDKit: Flippers.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Flippers.h
Go to the documentation of this file.
1//
2// Copyright (C) David Cosgrove 2025.
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10
11#ifndef FLIPPERS_H
12#define FLIPPERS_H
13
14#include <RDGeneral/export.h>
15#include <GraphMol/Atom.h>
16#include <GraphMol/Bond.h>
17#include <GraphMol/Chirality.h>
18#include <GraphMol/StereoGroup.h>
19
20namespace RDKit {
21namespace EnumerateStereoisomers {
22 namespace details {
23// The classes are called Flipper because that's what they were
24// called in the Python, but in fact they set a particular
25// stereochemistry at a centre according to whether a bool is
26// true or not. Setters would be a more accurate name.
27 struct RDKIT_ENUMERATESTEREOISOMERS_EXPORT Flipper {
28 public:
29 Flipper() = default;
30 Flipper(const Flipper &other) = delete;
31 Flipper(Flipper &&other) = delete;
32 Flipper &operator=(const Flipper &other) = delete;
33 Flipper &operator=(Flipper &&other) = delete;
34 virtual ~Flipper() = default;
35
36 // Sets the stereo at the centre, one way if flag is true,
37 // the other way if it is false.
38 virtual void flip(bool flag) = 0;
39};
40
41 struct RDKIT_ENUMERATESTEREOISOMERS_EXPORT AtomFlipper : public Flipper {
42 public:
43 AtomFlipper() = delete;
44 AtomFlipper(RWMol &mol, const Chirality::StereoInfo &si);
45 AtomFlipper(const AtomFlipper &other) = delete;
46 AtomFlipper(AtomFlipper &&other) = delete;
47 AtomFlipper &operator=(const AtomFlipper &other) = delete;
48 AtomFlipper &operator=(AtomFlipper &&other) = delete;
49 ~AtomFlipper() override = default;
50
51 void flip(bool flag) override;
52
53 Atom *dp_atom{nullptr};
54};
55
56 struct RDKIT_ENUMERATESTEREOISOMERS_EXPORT BondFlipper : public Flipper {
57 public:
58 BondFlipper() = delete;
59 // This c'tor may leave dp_bond as a nullptr if the bond
60 // is not appropriate.
61 BondFlipper(RWMol &mol, const Chirality::StereoInfo &si);
62 BondFlipper(const BondFlipper &other) = delete;
63 BondFlipper(BondFlipper &&other) = delete;
64 BondFlipper &operator=(const BondFlipper &other) = delete;
65 BondFlipper &operator=(BondFlipper &&other) = delete;
66 ~BondFlipper() override = default;
67
68 void flip(bool flag) override;
69
70 Bond *dp_bond{nullptr};
71};
72
73 struct RDKIT_ENUMERATESTEREOISOMERS_EXPORT StereoGroupFlipper : public Flipper {
74 public:
75 StereoGroupFlipper() = delete;
76 StereoGroupFlipper(const StereoGroup &sg);
77 StereoGroupFlipper(const StereoGroupFlipper &other) = delete;
78 StereoGroupFlipper(StereoGroupFlipper &&other) = delete;
79 StereoGroupFlipper &operator=(const StereoGroupFlipper &other) = delete;
80 StereoGroupFlipper &operator=(StereoGroupFlipper &&other) = delete;
81 ~StereoGroupFlipper() override = default;
82
83 void flip(bool flag) override;
84
85 std::vector<std::pair<Atom *, Atom::ChiralType>> d_original_parities;
86};
87
88 struct RDKIT_ENUMERATESTEREOISOMERS_EXPORT AtropisomerFlipper : public Flipper {
89 public:
90 AtropisomerFlipper() = delete;
91 AtropisomerFlipper(RWMol &mol, const Chirality::StereoInfo &si);
92 AtropisomerFlipper(const AtropisomerFlipper &other) = delete;
93 AtropisomerFlipper(AtropisomerFlipper &&other) = delete;
94 AtropisomerFlipper &operator=(const AtropisomerFlipper &other) = delete;
95 AtropisomerFlipper &operator=(AtropisomerFlipper &&other) = delete;
96 ~AtropisomerFlipper() override = default;
97
98 void flip(bool flag) override;
99
100 Bond *dp_bond{nullptr};
101 std::vector<unsigned int> d_ctrlAtoms;
102};
103
104} // namespace details
105} // namespace EnumerateStereoisomers
106} // namespace RDKit
107
108#endif // FLIPPERS_H
Atom.h
Defines the Atom class and associated typedefs.
Bond.h
Chirality.h
StereoGroup.h
Defines the class StereoGroup which stores relationships between the absolute configurations of atoms...
RDKit::Atom
The class for representing atoms.
Definition Atom.h:74
RDKit::Bond
class for representing a bond
Definition Bond.h:46
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
RDKit::StereoGroup
Definition StereoGroup.h:43
export.h
RDKIT_ENUMERATESTEREOISOMERS_EXPORT
#define RDKIT_ENUMERATESTEREOISOMERS_EXPORT
Definition export.h:161
RDKit::EnumerateStereoisomers::details
Definition Flippers.h:22
RDKit::EnumerateStereoisomers
Definition EnumerateStereoisomers.h:30
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::Chirality::StereoInfo
Definition Chirality.h:117
RDKit::EnumerateStereoisomers::details::AtomFlipper::AtomFlipper
AtomFlipper(AtomFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::AtomFlipper::operator=
AtomFlipper & operator=(const AtomFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::AtomFlipper::operator=
AtomFlipper & operator=(AtomFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::AtomFlipper::~AtomFlipper
~AtomFlipper() override=default
RDKit::EnumerateStereoisomers::details::AtomFlipper::dp_atom
Atom * dp_atom
Definition Flippers.h:53
RDKit::EnumerateStereoisomers::details::AtomFlipper::AtomFlipper
AtomFlipper(const AtomFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::AtomFlipper::flip
void flip(bool flag) override
RDKit::EnumerateStereoisomers::details::AtomFlipper::AtomFlipper
AtomFlipper(RWMol &mol, const Chirality::StereoInfo &si)
RDKit::EnumerateStereoisomers::details::AtomFlipper::AtomFlipper
AtomFlipper()=delete
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::flip
void flip(bool flag) override
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::AtropisomerFlipper
AtropisomerFlipper(RWMol &mol, const Chirality::StereoInfo &si)
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::~AtropisomerFlipper
~AtropisomerFlipper() override=default
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::AtropisomerFlipper
AtropisomerFlipper(const AtropisomerFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::d_ctrlAtoms
std::vector< unsigned int > d_ctrlAtoms
Definition Flippers.h:101
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::dp_bond
Bond * dp_bond
Definition Flippers.h:100
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::AtropisomerFlipper
AtropisomerFlipper(AtropisomerFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::AtropisomerFlipper
AtropisomerFlipper()=delete
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::operator=
AtropisomerFlipper & operator=(AtropisomerFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::AtropisomerFlipper::operator=
AtropisomerFlipper & operator=(const AtropisomerFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::~BondFlipper
~BondFlipper() override=default
RDKit::EnumerateStereoisomers::details::BondFlipper::BondFlipper
BondFlipper()=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::flip
void flip(bool flag) override
RDKit::EnumerateStereoisomers::details::BondFlipper::BondFlipper
BondFlipper(BondFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::dp_bond
Bond * dp_bond
Definition Flippers.h:70
RDKit::EnumerateStereoisomers::details::BondFlipper::operator=
BondFlipper & operator=(BondFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::operator=
BondFlipper & operator=(const BondFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::BondFlipper
BondFlipper(const BondFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::BondFlipper::BondFlipper
BondFlipper(RWMol &mol, const Chirality::StereoInfo &si)
RDKit::EnumerateStereoisomers::details::Flipper::Flipper
Flipper()=default
RDKit::EnumerateStereoisomers::details::Flipper::operator=
Flipper & operator=(const Flipper &other)=delete
RDKit::EnumerateStereoisomers::details::Flipper::Flipper
Flipper(Flipper &&other)=delete
RDKit::EnumerateStereoisomers::details::Flipper::Flipper
Flipper(const Flipper &other)=delete
RDKit::EnumerateStereoisomers::details::Flipper::~Flipper
virtual ~Flipper()=default
RDKit::EnumerateStereoisomers::details::Flipper::flip
virtual void flip(bool flag)=0
RDKit::EnumerateStereoisomers::details::Flipper::operator=
Flipper & operator=(Flipper &&other)=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::StereoGroupFlipper
StereoGroupFlipper(const StereoGroup &sg)
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::d_original_parities
std::vector< std::pair< Atom *, Atom::ChiralType > > d_original_parities
Definition Flippers.h:85
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::operator=
StereoGroupFlipper & operator=(StereoGroupFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::operator=
StereoGroupFlipper & operator=(const StereoGroupFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::~StereoGroupFlipper
~StereoGroupFlipper() override=default
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::StereoGroupFlipper
StereoGroupFlipper()=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::StereoGroupFlipper
StereoGroupFlipper(StereoGroupFlipper &&other)=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::StereoGroupFlipper
StereoGroupFlipper(const StereoGroupFlipper &other)=delete
RDKit::EnumerateStereoisomers::details::StereoGroupFlipper::flip
void flip(bool flag) override