Molassembler  3.0.1
Molecule graph and conformer library
Editing.h File Reference

Editing of molecules past low-level member functions. More...

#include "Molassembler/Molecule.h"
#include "Molassembler/RankingInformation.h"
#include <tuple>
Include dependency graph for Editing.h:

Go to the source code of this file.

Data Structures

struct  Scine::Molassembler::Editing::Cleaved
 

Namespaces

 Scine::Molassembler
 Central library namespace.
 

Typedefs

using Scine::Molassembler::Editing::AtomSitePair = std::pair< AtomIndex, SiteIndex >
 Descriptor for an entire haptic site connected to an atom.
 

Functions

Cleaved Scine::Molassembler::Editing::cleave (const Molecule &a, BondIndex bridge)
 Splits a molecule along a bridge edge. More...
 
Cleaved Scine::Molassembler::Editing::cleave (const Molecule &a, AtomSitePair hapticSite)
 Splits a molecule at a haptic site. More...
 
Molecule Scine::Molassembler::Editing::insert (Molecule log, const Molecule &wedge, BondIndex logBond, AtomIndex firstWedgeAtom, AtomIndex secondWedgeAtom)
 Inserts a molecule into a bond of another molecule. More...
 
Molecule Scine::Molassembler::Editing::superpose (Molecule top, const Molecule &bottom, AtomIndex topAtom, AtomIndex bottomAtom)
 Fuses two molecules, adding all adjacencies and continuations of one Molecule's atoms to another. More...
 
Molecule Scine::Molassembler::Editing::substitute (const Molecule &left, const Molecule &right, BondIndex leftBond, BondIndex rightBond)
 Connect two molecules by substituting away the smaller side of a pair of bonds of separate molecules. More...
 
Molecule Scine::Molassembler::Editing::substitute (const Molecule &left, const Molecule &right, BondIndex leftBond, BondIndex rightBond, AtomIndex leftSubstituteIndex, AtomIndex rightSubstituteIndex)
 Connect two molecules by substituting away the defined side of a pair of bonds of separate molecules. More...
 
Molecule Scine::Molassembler::Editing::connect (Molecule a, const Molecule &b, AtomIndex aConnectAtom, AtomIndex bConnectAtom, BondType bondType)
 Connect molecules by creating a new bond between two atoms from separate molecules. More...
 
Molecule Scine::Molassembler::Editing::addLigand (Molecule a, const Molecule &ligand, AtomIndex complexatingAtom, const std::vector< AtomIndex > &ligandBindingAtoms)
 Connects two molecules by connecting multiple atoms from one to a single atom of the other via single bonds. More...
 

Detailed Description

Editing of molecules past low-level member functions.

Function Documentation

◆ addLigand()

Molecule Scine::Molassembler::Editing::addLigand ( Molecule  a,
const Molecule &  ligand,
AtomIndex  complexatingAtom,
const std::vector< AtomIndex > &  ligandBindingAtoms 
)

Connects two molecules by connecting multiple atoms from one to a single atom of the other via single bonds.

Complexity \(\Theta(N)\)

Parameters
aThe molecule the ligand is being connected to
ligandThe ligand molecule being bound to complexatingAtom
complexatingAtomThe atom in a that ligand is being bound to
ligandBindingAtomsThe atoms of ligand that should be connected to a
Returns
A joined molecule

◆ cleave() [1/2]

Cleaved Scine::Molassembler::Editing::cleave ( const Molecule &  a,
AtomSitePair  hapticSite 
)

Splits a molecule at a haptic site.

Parameters
hapticSiteThe haptic site to cleave the molecule at. Does not check if the site is conceptually a bridge of the graph. If it is not, splitting is not undefined.
Note
The first molecule always contains the atom to which the haptic site belonged.

Complexity \(\Theta(N)\)

Exceptions
std::invalid_argumentIf there is no stereopermutator on the specified atom.

◆ cleave() [2/2]

Cleaved Scine::Molassembler::Editing::cleave ( const Molecule &  a,
BondIndex  bridge 
)

Splits a molecule along a bridge edge.

Complexity \(\Theta(N)\)

Exceptions
std::logic_errorIf bridge is not a bridge edge, i.e. the graph is not disconnected by cleaving the indicated bonds. This can be tested for using
a.graph().canRemove(bridge) == false)
.
Returns
A pair of molecules, ordered corresponding to the bond's atoms' position in the supplied bond index (i.e. .first contains the atom at bridge.first)

◆ connect()

Molecule Scine::Molassembler::Editing::connect ( Molecule  a,
const Molecule &  b,
AtomIndex  aConnectAtom,
AtomIndex  bConnectAtom,
BondType  bondType 
)

Connect molecules by creating a new bond between two atoms from separate molecules.

Complexity \(\Theta(N)\)

Parameters
aThe first molecule to connect
bThe second molecule to connect
aConnectAtomThe atom index to connect to in a
bConnectAtomThe atom index to connect to in b
bondTypeThe type of the new bond
Note
This function is symmetric on exchanging the tuples (a, aConnectAtom), (b, bConnectAtom), i.e. the order of the molecule and atom index arguments does not matter as long as the atom indices are properly associated to their respective molecule.
Returns
A single molecule connected by the specified bond type at the indicated atoms

◆ insert()

Molecule Scine::Molassembler::Editing::insert ( Molecule  log,
const Molecule &  wedge,
BondIndex  logBond,
AtomIndex  firstWedgeAtom,
AtomIndex  secondWedgeAtom 
)

Inserts a molecule into a bond of another molecule.

Complexity \(\Theta(N)\)

Parameters
logThe molecule being inserted into
wedgeThe molecule being inserted
logBondThe bond in log into which wedge is being inserted into
firstWedgeAtomThe atom of wedge to bond to the first atom in logBond
secondWedgeAtomThe atom of wedge to bond to the second atom in logBond
Note
The bond type of the bond inserted into is reused in the new bonds to firstWedgeAtom and secondWedgeAtom.
Returns
A molecule inserted into the bond of another molecule

◆ substitute() [1/2]

Molecule Scine::Molassembler::Editing::substitute ( const Molecule &  left,
const Molecule &  right,
BondIndex  leftBond,
BondIndex  rightBond 
)

Connect two molecules by substituting away the smaller side of a pair of bonds of separate molecules.

Complexity \(\Theta(N)\)

Parameters
leftThe first molecule
rightThe second molecule
leftBondleft's bond from which to substitute the lighter part away
rightBondright's bond from which to substitute the lighter part away
Note
The smaller side is chosen by number of atoms first, then molecular weight if the number of atoms is equal. Should both sides be equal in both, which side is picked is undefined.

◆ substitute() [2/2]

Molecule Scine::Molassembler::Editing::substitute ( const Molecule &  left,
const Molecule &  right,
BondIndex  leftBond,
BondIndex  rightBond,
AtomIndex  leftSubstituteIndex,
AtomIndex  rightSubstituteIndex 
)

Connect two molecules by substituting away the defined side of a pair of bonds of separate molecules.

Complexity \(\Theta(N)\)

Parameters
leftThe first molecule
rightThe second molecule
leftBondleft's bond from which to substitute the lighter part away
rightBondright's bond from which to substitute the lighter part away
leftSubstituteIndexThe atom index of left to substitute away
rightSubstituteIndexThe atom index of right to substitute away
Note
The substituting indices must be contained in the respective bonds

◆ superpose()

Molecule Scine::Molassembler::Editing::superpose ( Molecule  top,
const Molecule &  bottom,
AtomIndex  topAtom,
AtomIndex  bottomAtom 
)

Fuses two molecules, adding all adjacencies and continuations of one Molecule's atoms to another.

Adds all adjacent atoms and continuations of bottomAtom in bottom to topAtom in top. topAtom's element type is unchanged as it is the 'top' of the superimposition / overlay.

Complexity \(\Theta(N)\)

Parameters
topThe molecule that is at the top of the superposition.
bottomThe molecule that is set at the bottom of the superposition.
topAtomAn atom index of top that is placed 'atop' bottom's bottomAtom
bottomAtomAn atom index of bottom that is placed 'beneath' top's topAtom
Returns
A single molecule fused at the specified atoms