22#include <unordered_map>
27#include <boost/smart_ptr.hpp>
37 :
public std::runtime_error {
63 typedef std::array<RDGeom::Point3D, 3>
Bracket;
72 return aIdx == other.
aIdx && lvIdx == other.
lvIdx &&
id == other.
id;
83 return bondIdx == other.
bondIdx;
103 dp_mol = std::exchange(other.dp_mol,
nullptr);
104 d_atoms = std::move(other.d_atoms);
105 d_patoms = std::move(other.d_patoms);
106 d_bonds = std::move(other.d_bonds);
107 d_brackets = std::move(other.d_brackets);
108 d_cstates = std::move(other.d_cstates);
109 d_saps = std::move(other.d_saps);
113 if (
this == &other) {
116 RDProps::operator=(std::move(other));
117 dp_mol = std::exchange(other.dp_mol,
nullptr);
118 d_atoms = std::move(other.d_atoms);
119 d_patoms = std::move(other.d_patoms);
120 d_bonds = std::move(other.d_bonds);
121 d_brackets = std::move(other.d_brackets);
122 d_cstates = std::move(other.d_cstates);
123 d_saps = std::move(other.d_saps);
170 const std::vector<unsigned int> &
getAtoms()
const {
return d_atoms; }
172 const std::vector<unsigned int> &
getBonds()
const {
return d_bonds; }
178 const std::vector<Bracket> &
getBrackets()
const {
return d_brackets; }
179 const std::vector<CState> &
getCStates()
const {
return d_cstates; }
222 return dp_mol == other.dp_mol && d_atoms == other.d_atoms &&
223 d_patoms == other.d_patoms && d_bonds == other.d_bonds &&
224 d_saps == other.d_saps;
228 ROMol *dp_mol =
nullptr;
230 bool d_isValid =
true;
232 std::vector<unsigned int> d_atoms;
233 std::vector<unsigned int> d_patoms;
234 std::vector<unsigned int> d_bonds;
236 std::vector<Bracket> d_brackets;
237 std::vector<CState> d_cstates;
238 std::vector<AttachPoint> d_saps;
241namespace SubstanceGroupChecks {
245 "SRU",
"MON",
"COP",
"CRO",
"GRA",
"MOD",
"MER",
"ANY",
249 "SUP",
"MUL",
"DAT",
"GEN"};
287 RWMol &mol,
unsigned int idx);
294 RWMol &mol,
unsigned int idx);
#define PRECONDITION(expr, mess)
RDKIT_GRAPHMOL_EXPORT std::ostream & operator<<(std::ostream &target, const RDKit::SubstanceGroup &sg)
allows SubstanceGroup objects to be dumped to streams
RWMol is a molecule class that is intended to be edited.
used to indicate errors from incorrect sgroup access
SubstanceGroupException(const std::string &msg)
construct with an error message
SubstanceGroupException(const char *msg)
construct with an error message
The class for representing SubstanceGroups.
const std::vector< unsigned int > & getBonds() const
void addBondWithIdx(unsigned int idx)
void setOwningMol(ROMol *mol)
SubstanceGroup & operator=(const SubstanceGroup &other)=default
void setParentAtoms(std::vector< unsigned int > patoms)
void addAttachPoint(unsigned int aIdx, int lvIdx, const std::string &idStr)
void setBonds(std::vector< unsigned int > bonds)
~SubstanceGroup()=default
Destructor.
void setIsValid(bool isValid)
set whether or not this group is valid; invalid groups must be ignored.
const std::vector< unsigned int > & getAtoms() const
void addParentAtomWithBookmark(int mark)
void setAtoms(std::vector< unsigned int > atoms)
bool adjustToRemovedBond(unsigned int bondIdx)
void addCState(unsigned int bondIdx, const RDGeom::Point3D &vector)
ROMol & getOwningMol() const
Get the molecule that owns this instance.
const std::vector< Bracket > & getBrackets() const
SubstanceGroup()=delete
No default constructor.
bool adjustToRemovedAtom(unsigned int atomIdx)
bool operator==(const SubstanceGroup &other) const
BondType
Bond type (see V3000 spec)
SubstanceGroup(const SubstanceGroup &other)=default
SubstanceGroup(SubstanceGroup &&other) noexcept
void addBondWithBookmark(int mark)
const std::vector< unsigned int > & getParentAtoms() const
void addAtomWithBookmark(int mark)
bool includesAtom(unsigned int atomIdx) const
std::vector< Bracket > & getBrackets()
void removeParentAtomWithIdx(unsigned int idx)
SubstanceGroup(ROMol *owning_mol, const std::string &type)
void addParentAtomWithIdx(unsigned int idx)
void addAtomWithIdx(unsigned int idx)
const std::vector< CState > & getCStates() const
std::array< RDGeom::Point3D, 3 > Bracket
void addBracket(const Bracket &bracket)
const std::vector< AttachPoint > & getAttachPoints() const
std::vector< CState > & getCStates()
bool hasOwningMol() const
returns whether or not this belongs to a molecule
bool includesBond(unsigned int bondIdx) const
void removeAtomWithIdx(unsigned int idx)
std::vector< AttachPoint > & getAttachPoints()
void removeBondWithIdx(unsigned int idx)
BondType getBondType(unsigned int bondIdx) const
SubstanceGroup & operator=(SubstanceGroup &&other) noexcept
unsigned int getIndexInMol() const
#define RDKIT_GRAPHMOL_EXPORT
RDKIT_GRAPHMOL_EXPORT bool isValidType(const std::string &type)
RDKIT_GRAPHMOL_EXPORT bool isValidSubType(const std::string &type)
const std::vector< std::string > sGroupConnectTypes
RDKIT_GRAPHMOL_EXPORT bool isSubstanceGroupIdFree(const ROMol &mol, unsigned int id)
RDKIT_GRAPHMOL_EXPORT bool isValidConnectType(const std::string &type)
const std::vector< std::string > sGroupSubtypes
const std::vector< std::string > sGroupTypes
RDKIT_GRAPHMOL_EXPORT std::vector< SubstanceGroup > & getSubstanceGroups(ROMol &mol)
bool rdvalue_is(const RDValue_cast_t)
RDKIT_GRAPHMOL_EXPORT unsigned int addSubstanceGroup(ROMol &mol, SubstanceGroup sgroup)
RDKIT_GRAPHMOL_EXPORT void removeSubstanceGroupsReferencingBond(RWMol &mol, unsigned int idx)
Removes SubstanceGroups which reference a particular bond index.
RDKIT_GRAPHMOL_EXPORT void removeSubstanceGroupsReferencingAtom(RWMol &mol, unsigned int idx)
Removes SubstanceGroups which reference a particular atom index.
bool operator==(const AttachPoint &other) const
bool operator==(const CState &other) const