Helper type for directed conformer generation. More...
#include <DirectedConformerGenerator.h>
Data Structures | |
struct | EnumerationSettings |
Settings for enumeration. More... | |
class | Impl |
struct | Relabeler |
Relabeler for decision lists with minimized structures. More... | |
Public Member Functions | |
Constructors | |
DirectedConformerGenerator (Molecule molecule, BondStereopermutator::Alignment alignment=BondStereopermutator::Alignment::Staggered, const BondList &bondsToConsider={}) | |
Constructor. More... | |
Special member functions | |
DirectedConformerGenerator (DirectedConformerGenerator &&other) noexcept | |
DirectedConformerGenerator & | operator= (DirectedConformerGenerator &&other) noexcept |
DirectedConformerGenerator (const DirectedConformerGenerator &other)=delete | |
DirectedConformerGenerator & | operator= (const DirectedConformerGenerator &other)=delete |
~DirectedConformerGenerator () | |
Modification | |
DecisionList | generateNewDecisionList (Random::Engine &engine=randomnessEngine()) |
Generate a new list of discrete dihedral arrangement choices. More... | |
bool | insert (const DecisionList &decisionList) |
Adds a decision list to the underlying set-like data structure. More... | |
bool | contains (const DecisionList &decisionList) const |
Checks whether a DecisionList is part of the underlying set. More... | |
Information | |
BondStereopermutator::Alignment | alignment () const |
Get alignment with which this generator was instantiated with. | |
const BondList & | bondList () const |
Accessor for list of relevant bonds. More... | |
unsigned | decisionListSetSize () const |
Number of conformer decision lists stored in the underlying set-like data structure. More... | |
unsigned | idealEnsembleSize () const |
Number of conformers needed for full ensemble. More... | |
Result< Utils::PositionCollection > | generateRandomConformation (const DecisionList &decisionList, const DistanceGeometry::Configuration &configuration=DistanceGeometry::Configuration{}, BondStereopermutator::FittingMode fitting=BondStereopermutator::FittingMode::Nearest) const |
Try to generate a conformer for a particular decision list. More... | |
Result< Utils::PositionCollection > | generateConformation (const DecisionList &decisionList, unsigned seed, const DistanceGeometry::Configuration &configuration=DistanceGeometry::Configuration{}, BondStereopermutator::FittingMode fitting=BondStereopermutator::FittingMode::Nearest) const |
Try to generate a conformer for a particular decision list. More... | |
Molecule | conformationMolecule (const DecisionList &decisionList) const |
Yields a molecule reference for a particular decision list. More... | |
DecisionList | getDecisionList (const Utils::AtomCollection &atomCollection, BondStereopermutator::FittingMode mode=BondStereopermutator::FittingMode::Nearest) const |
Infer a decision list for relevant bonds from an atom collection. More... | |
DecisionList | getDecisionList (const Utils::PositionCollection &positions, BondStereopermutator::FittingMode mode=BondStereopermutator::FittingMode::Thresholded) const |
Infer a decision list for relevant bonds from positional information only. More... | |
void | enumerate (std::function< void(const DecisionList &, Utils::PositionCollection)> callback, unsigned seed, const EnumerationSettings &settings={}) |
Enumerate all conformers of the captured molecule. More... | |
void | enumerateRandom (std::function< void(const DecisionList &, Utils::PositionCollection)> callback, const EnumerationSettings &settings={}) |
Enumerate all conformers of the captured molecule. More... | |
Relabeler | relabeler () const |
Generates a relabeler for the molecule and considered bonds. | |
std::vector< int > | binMidpointIntegers (const DecisionList &decision) const |
std::vector< std::pair< int, int > > | binBounds (const DecisionList &decision) const |
Relabels a DecisionList into the bounds of its bin. | |
Static Public Member Functions | |
Static functions | |
static boost::variant < IgnoreReason, BondStereopermutator > | considerBond (const BondIndex &bondIndex, const Molecule &molecule, BondStereopermutator::Alignment alignment=BondStereopermutator::Alignment::Staggered) |
Decide whether to consider a bond's dihedral values for directed conformer generation or not. More... | |
static unsigned | distance (const DecisionList &a, const DecisionList &b, const DecisionList &bounds) |
Calculates a distance metric between two decision lists for dihedral permutations. More... | |
Private Attributes | |
std::unique_ptr< Impl > | pImpl_ |
Public types | |
enum | IgnoreReason { IgnoreReason::AtomStereopermutatorPreconditionsUnmet, IgnoreReason::HasAssignedBondStereopermutator, IgnoreReason::HasTerminalConstitutingAtom, IgnoreReason::InCycle, IgnoreReason::IsEtaBond, IgnoreReason::RotationIsIsotropic } |
Type used to represent the list of bonds relevant to directed conformer generation. More... | |
using | BondList = std::vector< BondIndex > |
Type used to represent the list of bonds relevant to directed conformer generation. | |
using | DecisionList = std::vector< std::uint8_t > |
Type used to represent assignments at bonds. More... | |
static constexpr std::uint8_t | unknownDecision = std::numeric_limits<std::uint8_t>::max() |
Value set in decision lists if no decision could be recovered. | |
Helper type for directed conformer generation.
Generates new combinations of BondStereopermutator assignments and provides helper functions for the generation of conformers using these combinations and the reverse, finding the combinations from conformers.
It is important that you lower your expectations for the modeling of dihedral energy minima, however. Considering that Molassembler neither requires you to supply a correct graph, never detects or kekulizes aromatic systems nor asks you to supply an overall charge for a molecule, it should be understandable that the manner in which Molassembler decides where dihedral energy minima are is somewhat underpowered. The manner in which shape vertices are aligned in stereopermutation enumeration isn't even strictly based on a physical principle. We suggest the following to make the most of what the library can do for you:
Client code for generating conformers could look something like this. Make sure to differentiate cases in which the list of considered bonds by bondList() is empty, since many member functions behave differently in those circumstances.
using Scine::Molassembler::DirectedConformerGenerator::DecisionList = std::vector<std::uint8_t> |
Type used to represent assignments at bonds.
Type used to represent the list of bonds relevant to directed conformer generation.
|
explicit |
Constructor.
molecule | Molecule for which to generate conformers |
alignment | Alignment with which to generate BondStereopermutator on considered bonds |
bondsToConsider | A list of suggestions of which bonds to consider. Bonds for which considerBond() yields an IgnoreReason will still be ignored. If the list is empty, all bonds of a molecule will be tested against considerBond(). |
Complexity \(\Theta(B)\) where \(B\) is the number of bonds in the molecule. If there is a particularly large shape in the molecule, this can dominate with \(\Theta(S!)\).
Scales linearly with the number of bonds in molecule
or bondsToConsider's
size.
std::vector<int> Scine::Molassembler::DirectedConformerGenerator::binMidpointIntegers | ( | const DecisionList & | decision | ) | const |
Relabels a DecisionList into bin midpoint integers Returns the dihedra angles. The angle is defined as the first angle of the stereopermutation at the given bond (note that this is inconsistent with its definition in Relabeler::add).
const BondList& Scine::Molassembler::DirectedConformerGenerator::bondList | ( | ) | const |
Accessor for list of relevant bonds.
Complexity \(\Theta(1)\)
Molecule Scine::Molassembler::DirectedConformerGenerator::conformationMolecule | ( | const DecisionList & | decisionList | ) | const |
Yields a molecule reference for a particular decision list.
Complexity \(\Theta(N)\) bond stereopermutator assignments
|
static |
Decide whether to consider a bond's dihedral values for directed conformer generation or not.
bondIndex | The bond to consider |
molecule | The molecule in which bond exists |
smallestCycleMap | A map of atom indices to the smallest cycle they are in |
alignment | Alignment to generate BondStereopermutator instances with. |
Complexity \(O(S!)\) where \(S\) is the size of the larger shape constituting bondIndex
bool Scine::Molassembler::DirectedConformerGenerator::contains | ( | const DecisionList & | decisionList | ) | const |
Checks whether a DecisionList is part of the underlying set.
std::logic_error | If the result of bondList() is empty, i.e. there are no bonds to consider for directed conformer generation. |
Complexity \(\Theta(N)\)
unsigned Scine::Molassembler::DirectedConformerGenerator::decisionListSetSize | ( | ) | const |
Number of conformer decision lists stored in the underlying set-like data structure.
Complexity \(\Theta(1)\)
|
static |
Calculates a distance metric between two decision lists for dihedral permutations.
The distance metric is:
\(d = \sum_i \min\left(a_i - b_i \textrm{ mod } U_i, b_i - a_i \textrm{ mod } U_i\right)\)
where \(a_i\) is the choice in a
at position \(i\) and likewise for b
, and \(U_i\) is the upper exclusive bound on the choice values at position \(i\).
This is akin to the shortest distance between the choices when arranged in a modular number circle.
a | The first distance metric |
b | The second distance metric |
bounds | Upper exclusive bound on values at each position |
Complexity \(\Theta(N)\)
a
and b
. void Scine::Molassembler::DirectedConformerGenerator::enumerate | ( | std::function< void(const DecisionList &, Utils::PositionCollection)> | callback, |
unsigned | seed, | ||
const EnumerationSettings & | settings = {} |
||
) |
Enumerate all conformers of the captured molecule.
Clears the stored set of decision lists, then enumerates all conformers of the molecule in parallel.
callback | Function called with decision list and conformer positions for each successfully generated. It is guaranteed that the callback function is never called simultaneously even in parallel execution. |
seed | Randomness initiator for decision list and conformer generation |
settings | Further parameters for enumeration algorithms |
void Scine::Molassembler::DirectedConformerGenerator::enumerateRandom | ( | std::function< void(const DecisionList &, Utils::PositionCollection)> | callback, |
const EnumerationSettings & | settings = {} |
||
) |
Enumerate all conformers of the captured molecule.
Clears the stored set of decision lists, then enumerates all conformers of the molecule in parallel.
callback | Function called with decision list and conformer positions for each successfully generated pair. It is guaranteed that the callback function is never called simultaneously even in parallel execution. |
seed | Randomness initiator for decision list and conformer generation |
settings | Further parameters for enumeration algorithms |
Result<Utils::PositionCollection> Scine::Molassembler::DirectedConformerGenerator::generateConformation | ( | const DecisionList & | decisionList, |
unsigned | seed, | ||
const DistanceGeometry::Configuration & | configuration = DistanceGeometry::Configuration{} , |
||
BondStereopermutator::FittingMode | fitting = BondStereopermutator::FittingMode::Nearest |
||
) | const |
Try to generate a conformer for a particular decision list.
This is very similar to the free generateConformation function in terms of what configuration
will accept.
std::invalid_argument | If the passed decisionList does not match the length of the result of bondList(). |
DecisionList Scine::Molassembler::DirectedConformerGenerator::generateNewDecisionList | ( | Random::Engine & | engine = randomnessEngine() | ) |
Generate a new list of discrete dihedral arrangement choices.
Guarantees that the generated list is not yet part of the underlying set.
Complexity \(\Theta(N)\)
std::logic_error | If the underlying set is full, i.e. all decision lists for conformers have been generated or if there are no bonds to consider. |
engine
is chosen. Result<Utils::PositionCollection> Scine::Molassembler::DirectedConformerGenerator::generateRandomConformation | ( | const DecisionList & | decisionList, |
const DistanceGeometry::Configuration & | configuration = DistanceGeometry::Configuration{} , |
||
BondStereopermutator::FittingMode | fitting = BondStereopermutator::FittingMode::Nearest |
||
) | const |
Try to generate a conformer for a particular decision list.
This is very similar to the free generateRandomConformation function in terms of what configuration
will accept.
std::invalid_argument | If the passed decisionList does not match the length of the result of bondList(). |
DecisionList Scine::Molassembler::DirectedConformerGenerator::getDecisionList | ( | const Utils::AtomCollection & | atomCollection, |
BondStereopermutator::FittingMode | mode = BondStereopermutator::FittingMode::Nearest |
||
) | const |
Infer a decision list for relevant bonds from an atom collection.
For all bonds considered relevant (i.e. all bonds in bondList()), fits supplied positions to possible stereopermutations and returns the result. Entries have the value DirectedConformer::unknownDecision
if no permutation could be recovered. The usual BondStereopermutator fitting tolerances apply.
positions
has not constutitionally rearranged (although a little check for matching element types does exist here. This is not a full safeguard against index permutations.)Complexity \(\Theta(N)\) bond stereopermutator fits
std::logic_error | If the element type sequence of the atom collection does not match the underlying molecule |
DecisionList Scine::Molassembler::DirectedConformerGenerator::getDecisionList | ( | const Utils::PositionCollection & | positions, |
BondStereopermutator::FittingMode | mode = BondStereopermutator::FittingMode::Thresholded |
||
) | const |
Infer a decision list for relevant bonds from positional information only.
For all bonds considered relevant (i.e. all bonds in bondList()), fits supplied positions to possible stereopermutations and returns the result. Entries have the value DirectedConformer::unknownDecision
if no permutation could be recovered. The usual BondStereopermutator fitting tolerances apply.
positions
has not constutitionally rearrangedComplexity \(\Theta(N)\) bond stereopermutator fits
unsigned Scine::Molassembler::DirectedConformerGenerator::idealEnsembleSize | ( | ) | const |
Number of conformers needed for full ensemble.
Complexity \(\Theta(1)\)
bool Scine::Molassembler::DirectedConformerGenerator::insert | ( | const DecisionList & | decisionList | ) |
Adds a decision list to the underlying set-like data structure.
Complexity \(\Theta(N)\)
std::logic_error | If the result of bondList() is empty, i.e. there are no bonds to consider for directed conformer generation. |
true
if decisionList
wasn't already part of the set