11#ifndef RD_EMBEDDED_FRAG_H
12#define RD_EMBEDDED_FRAG_H
18#include <boost/smart_ptr.hpp>
31 typedef enum { UNSPECIFIED = 0,
CISTRANS, RING } EAtomType;
125 double d_density{-1.0};
129 bool df_fixed{
false};
189 bool useRingTemplates);
234 unsigned int nbrAid);
293 for (eari = d_eatoms.begin(); eari != d_eatoms.end(); eari++) {
294 eari->second.loc += shift;
300 if (posi == d_eatoms.end()) {
301 PRECONDITION(0,
"Embedded atom does not contain embedded atom specified");
307 int Size()
const {
return d_eatoms.size(); }
321 void openAngles(
const double *dmat,
unsigned int aid1,
unsigned int aid2);
324 bool includeBonds = 1);
331 void permuteBonds(
unsigned int aid,
unsigned int aid1,
unsigned int aid2);
334 unsigned int nSamples = 100,
337 double mimicDmatWt = 0.0,
338 bool permuteDeg4Nodes =
false);
372 double totalDensity();
376 unsigned int ring_count);
379 bool useRingTemplates);
381 void setupAttachmentPoints();
413 unsigned int aid1,
unsigned int aid2,
422 void mergeRing(
const EmbeddedFrag &embRing,
unsigned int nCommon,
435 void reflectIfNecessaryDensity(
EmbeddedFrag &embFrag,
unsigned int aid1,
453 void reflectIfNecessaryCisTrans(
EmbeddedFrag &embFrag,
unsigned int ctCase,
454 unsigned int aid1,
unsigned int aid2);
465 void reflectIfNecessaryThirdPt(
EmbeddedFrag &embFrag,
unsigned int aid1,
466 unsigned int aid2,
unsigned int aid3);
491 void addAtomToAtomWithAng(
unsigned int aid,
unsigned int toAid);
507 void addAtomToAtomWithNoAng(
535 void computeNbrsAndAng(
unsigned int aid,
const RDKit::INT_VECT &doneNbrs);
540 double d_px = 0.0, d_nx = 0.0, d_py = 0.0, d_ny = 0.0;
#define PRECONDITION(expr, mess)
Class that contains the data for an atoms that has already been embedded.
EmbeddedAtom(const EmbeddedAtom &other)=default
int nbr1
the first neighbor of this atom that form the 'angle'
RDKit::INT_VECT neighs
and these are the atom IDs of the neighbors that still need to be embedded
int nbr2
the second neighbor of atom that from the 'angle'
EmbeddedAtom & operator=(const EmbeddedAtom &other)
EmbeddedAtom(unsigned int aid, const RDGeom::Point2D &pos)
void Transform(const RDGeom::Transform2D &trans)
void Reflect(const RDGeom::Point2D &loc1, const RDGeom::Point2D &loc2)
Class containing a fragment of a molecule that has already been embedded.
EmbeddedAtom GetEmbeddedAtom(unsigned int aid) const
void Transform(const RDGeom::Transform2D &trans)
Transform this object to a new coordinates system.
void removeCollisionsBondFlip()
void updateNewNeighs(unsigned int aid)
update the unembedded neighbor atom list for a specified atom
void markDone()
Mark this fragment to be done for final embedding.
EmbeddedFrag(const RDKit::ROMol *mol, const RDKit::VECT_INT_VECT &fusedRings, bool useRingTemplates)
Initializer from a set of fused rings.
void flipAboutBond(unsigned int bondId, bool flipEnd=true)
Flip atoms on one side of a bond - used in removing collisions.
std::vector< PAIR_I_I > findCollisions(const double *dmat, bool includeBonds=1)
int Size() const
the number of atoms in the embedded system
void mergeNoCommon(EmbeddedFrag &embObj, unsigned int toAid, unsigned int nbrAid)
Merge this embedded object with another embedded fragment.
EmbeddedFrag(const RDKit::ROMol *mol, const RDGeom::INT_POINT2D_MAP &coordMap)
Constructor when the coordinates have been specified for a set of atoms.
EmbeddedFrag()
Default constructor.
EmbeddedFrag(const RDKit::Bond *dblBond)
Initializer for a cis/trans system using the double bond.
RDKit::INT_VECT findCommonAtoms(const EmbeddedFrag &efrag2)
Find the common atom ids between this fragment and a second one.
void expandEfrag(RDKit::INT_LIST &nratms, std::list< EmbeddedFrag > &efrags)
int findNumNeigh(const RDGeom::Point2D &pt, double radius)
Find all atoms in this embedded system that are within a specified distant of a point.
void removeCollisionsOpenAngles()
Remove collision by opening angles at the offending atoms.
EmbeddedFrag(unsigned int aid, const RDKit::ROMol *mol)
Initializer from a single atom id.
double mimicDistMatAndDensityCostFunc(const DOUBLE_SMART_PTR *dmat, double mimicDmatWt)
void Translate(const RDGeom::Point2D &shift)
void canonicalizeOrientation()
void addNonRingAtom(unsigned int aid, unsigned int toAid)
Add a new non-ring atom to this object.
void permuteBonds(unsigned int aid, unsigned int aid1, unsigned int aid2)
const RDKit::ROMol * getMol() const
Get the molecule that this embedded fragment belongs to.
void removeCollisionsShortenBonds()
void setupNewNeighs()
helpers functions to
void Reflect(const RDGeom::Point2D &loc1, const RDGeom::Point2D &loc2)
void computeBox()
compute a box that encloses the fragment
void openAngles(const double *dmat, unsigned int aid1, unsigned int aid2)
const INT_EATOM_MAP & GetEmbeddedAtoms() const
void mergeWithCommon(EmbeddedFrag &embObj, RDKit::INT_VECT &commAtms)
Merge this embedded object with another embedded fragment.
void randomSampleFlipsAndPermutations(unsigned int nBondsPerSample=3, unsigned int nSamples=100, int seed=100, const DOUBLE_SMART_PTR *dmat=nullptr, double mimicDmatWt=0.0, bool permuteDeg4Nodes=false)
bool isDone()
If this fragment done for the final embedding.
void mergeFragsWithComm(std::list< EmbeddedFrag > &efrags)
int findNeighbor(unsigned int aid)
Find a neighbor to a non-ring atom among the already embedded atoms.
void computeDistMat(DOUBLE_SMART_PTR &dmat)
class for representing a bond
#define RDKIT_DEPICTOR_EXPORT
boost::shared_array< double > DOUBLE_SMART_PTR
INT_EATOM_MAP::iterator INT_EATOM_MAP_I
RDKIT_DEPICTOR_EXPORT RDGeom::Point2D reflectPoint(const RDGeom::Point2D &point, const RDGeom::Point2D &loc1, const RDGeom::Point2D &loc2)
std::map< unsigned int, EmbeddedAtom > INT_EATOM_MAP
INT_EATOM_MAP::const_iterator INT_EATOM_MAP_CI
std::map< int, Point2D > INT_POINT2D_MAP
std::list< int > INT_LIST
std::vector< int > INT_VECT
std::vector< INT_VECT > VECT_INT_VECT