18 #ifndef INCLUDE_MOLASSEMBLER_DISTANCE_GEOMETRY_SPATIAL_MODEL_H
19 #define INCLUDE_MOLASSEMBLER_DISTANCE_GEOMETRY_SPATIAL_MODEL_H
27 #include <unordered_map>
30 namespace Molassembler {
31 namespace DistanceGeometry {
44 struct ModelGraphWriter;
47 template<
unsigned size>
49 std::array<AtomIndex, size>,
52 std::array<AtomIndex, size>
76 Eigen::MatrixXd matrix;
122 const std::vector<AtomIndex>& atoms,
138 static boost::optional<ValueBounds>
coneAngle(
139 const std::vector<AtomIndex>& baseConstituents,
168 const std::vector<AtomIndex>& siteAtomList,
184 double absoluteVariance
244 const std::pair<SiteIndex, SiteIndex>&
sites,
251 const std::pair<SiteIndex, SiteIndex>&
sites,
268 const std::pair<SiteIndex, SiteIndex>&
sites,
269 const double looseningMultiplier,
289 const double looseningMultiplier
359 std::array<AtomIndex, 2> bondIndices,
374 std::array<AtomIndex, 3> angleIndices,
388 std::array<AtomIndex, 4> dihedralIndices,
410 double looseningMultiplier,
411 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions,
412 bool forceChiralConstraintEmission
432 double looseningMultiplier,
433 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions
438 const std::pair<const AtomStereopermutator&, const AtomStereopermutator&>& atomStereopermutators,
439 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions
512 std::vector<DihedralConstraint> dihedralConstraints_;
537 double looseningFactor
543 double looseningFactor
std::array< boost::optional< SiteIndex >, 4 > MinimalChiralConstraint
Site index sequence defining a chiral constraint. If a site index is None, then it denotes the positi...
Definition: AtomStereopermutator.h:95
Models a molecule as a graph (connectivity of atoms) and a list of stereopermutators.
Definition: Molecule.h:73
SpatialModel(const Molecule &molecule, const Configuration &configuration)
Model a molecule into internal coordinate bounds stored internally.
Definition: SpatialModel.h:68
static std::vector< BondIndex > cycleConsistingOfExactly(const std::vector< AtomIndex > &atoms, const PrivateGraph &graph)
Tries to find a cycle that consists of a particular set of atoms.
static constexpr double angleRelativeVariance
Relative angle variance.
Definition: SpatialModel.h:91
static double siteCentralAngle(AtomIndex placement, const Shapes::Shape &shape, const RankingInformation &ranking, const AtomStereopermutator::ShapeMap &shapeVertexMap, const std::pair< SiteIndex, SiteIndex > &sites, const PrivateGraph &inner)
Determines the central value of the angle between AtomStereopermutator sites.
Drives a PRNG.
Definition: Prng.h:24
A configuration object for distance geometry runs with sane defaults.
Definition: Conformers.h:75
BoundsMapType< 4 > dihedralBounds_
Dihedral value bounds on index quadruplets.
Definition: SpatialModel.h:508
static ValueBounds siteDistanceFromCenter(const std::vector< AtomIndex > &siteAtomList, AtomIndex placement, const Graph &graph)
Calculates bounds on the distance of a (possibly haptic) ligand site to a central index...
ShapeResult shape(const PositionCollection &normalizedPositions, Shape shape)
Forwarding function to calculate the continuous shape measure.
void addAtomStereopermutatorInformation(const AtomStereopermutator &permutator, const PrivateGraph &graph, double looseningMultiplier, const std::unordered_map< AtomIndex, Utils::Position > &fixedAngstromPositions, bool forceChiralConstraintEmission)
Adds angle information to the internal coordinate bounds and collects chiral constraints.
Represents the connectivity of atoms of a molecule.
Definition: Graph.h:57
static constexpr ValueBounds angleClampBounds
Defines clamping bounds on angles.
Definition: SpatialModel.h:96
Class performing spatial modeling of molecules.
Definition: SpatialModel.h:39
BoundsMapType< 2 > constraints_
Constraints by fixed positions.
Definition: SpatialModel.h:502
Wrapper class to make working with RDL in C++ more pleasant.
Definition: Cycles.h:44
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
std::unordered_map< AtomIndex, Utils::Position > FixedPositionsMapType
Type used to store fixed positions in angstrom.
Definition: SpatialModel.h:57
static const ValueBounds defaultDihedralBounds
Defines the range (-π,π] using std::nextafter (not constexpr)
Definition: SpatialModel.h:98
static void checkFixedPositionsPreconditions(const Molecule &molecule, const Configuration &configuration)
Ensures that the preconditions for fixed positions in Distance Geometry detailed in the Configuration...
Handle arrangements of substituents at corners of an atom-centered shape.
std::string dumpGraphviz() const
Generates a string graphviz representation of the modeled molecule.
void setDihedralBoundsIfEmpty(std::array< AtomIndex, 4 > dihedralIndices, ValueBounds bounds)
Adds the dihedral bounds to the model if unset.
Molecule class interface.
static constexpr double dihedralAbsoluteVariance
Absolute dihedral angle variance in radians.
Definition: SpatialModel.h:93
Handles specific relative arrangements of two atom stereopermutators joined by a bond.
Definition: BondStereopermutator.h:46
void modelSpirocenters_(const FixedPositionsMapType &fixedAngstromPositions)
Adds spirocenter modelling to the data set.
static double modelDistance(AtomIndex i, AtomIndex j, const PrivateGraph &graph)
Models the equilibrium distance between two bonded atoms.
std::vector< DihedralConstraint > getDihedralConstraints() const
Yields all collected dihedral constraints.
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
std::vector< std::vector< AtomIndex >> sites(const PrivateGraph &graph, AtomIndex placement, const std::vector< AtomIndex > &excludeAdjacents={})
Differentiate adjacent vertices of a central index into sites.
std::vector< ChiralConstraint > chiralConstraints_
Chiral constraints.
Definition: SpatialModel.h:511
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:24
static ValueBounds modelSiteAngleBounds(const AtomStereopermutator &permutator, const std::pair< SiteIndex, SiteIndex > &sites, const double looseningMultiplier, const PrivateGraph &inner)
Models bounds on the angle between AtomStereopermutator sites.
static double smallestCycleDistortionMultiplier(const AtomIndex i, const Cycles &cycles)
Idealization strictness loosening multiplier due to small cycles.
BoundsMapType< 3 > angleBounds_
Angle value bounds on index triples.
Definition: SpatialModel.h:506
std::unordered_map< std::array< AtomIndex, size >, ValueBounds, boost::hash< std::array< AtomIndex, size > > > BoundsMapType
ValueBounds container for various internal coordinates.
Definition: SpatialModel.h:54
static ValueBounds makeBoundsFromCentralValue(double centralValue, double absoluteVariance)
Yields central value plus/minus some absolute variance bounds.
static ValueBounds clamp(ValueBounds bounds, const ValueBounds &clampBounds)
Analogous to C++17's clamp, reduces ValueBounds to the maximal extent specified by some clamping boun...
BoundsMatrix makePairwiseBounds() const
Generate unsmoothed atom-pairwise distance bounds matrix.
void addDefaultDihedrals_()
Adds [0, π] default dihedrals to the model (of connected sequences)
std::vector< ChiralConstraint > getChiralConstraints() const
Yields all collected chiral constraints.
Type used to refer to particular bonds. Orders first < second.
Definition: Types.h:54
unsigned size(const Shape shape)
Fetch the number of vertices of a shape.
Interface class for the molecular graph.
void setAngleBoundsIfEmpty(std::array< AtomIndex, 3 > angleIndices, ValueBounds bounds)
Adds angle bounds to the model if unset.
BoundsMapType< 2 > bondBounds_
Bond distance value bounds on index pairs.
Definition: SpatialModel.h:504
Data class for bounded values.
Definition: ValueBounds.h:23
WideHashType hash(AtomEnvironmentComponents bitmask, Utils::ElementType elementType, const std::vector< BondInformation > &sortedBonds, const boost::optional< Shapes::Shape > &shapeOptional, const boost::optional< unsigned > &assignedOptional)
Convolutes the atom's element type and bonds into an unsigned integer.
Shape
Enumeration of all contained symmetry names.
Definition: Shapes.h:28
void modelBondDistances_(const FixedPositionsMapType &fixedAngstromPositions, double looseningFactor)
Add bond distances to the underlying model.
void modelFlatCycles_(const FixedPositionsMapType &fixedAngstromPositions, double looseningFactor)
Add precise information to the model for cycles that are flat.
void instantiateMissingAtomStereopermutators_(Random::Engine &engine)
static ChiralConstraint makeChiralConstraint(const AtomStereopermutator::MinimalChiralConstraint &minimalConstraint, const AtomStereopermutator &permutator, const double looseningMultiplier)
Creates a volume-specific chiral constraint from a list of.
static double spiroCrossAngle(double alpha, double beta)
Calculates the cross angle between opposite cycle atoms in a spirocenter.
Data struct representing a chiral constraint.
Definition: DistanceGeometry.h:32
void addDefaultAngles_()
Adds [0, π] default angle bounds for all bonded atom triples.
Owning class storing all stereopermutators in a molecule.
static constexpr double bondRelativeVariance
Relative bond distance variance 0.0x mean x% variance. Must fulfill 0 < x << 1.
Definition: SpatialModel.h:86
Class storing atom-pairwise distance bounds.
void writeGraphviz(const std::string &filename) const
Writes a graphviz representation of a modeled molecule to a file.
bool modelPartiallyFixedBond(const BondStereopermutator &permutator, const std::pair< const AtomStereopermutator &, const AtomStereopermutator & > &atomStereopermutators, const std::unordered_map< AtomIndex, Utils::Position > &fixedAngstromPositions)
Sets bond bounds to exact value bounds if unset.
void addBondStereopermutatorInformation(const BondStereopermutator &permutator, const AtomStereopermutator &stereopermutatorA, const AtomStereopermutator &stereopermutatorB, double looseningMultiplier, const std::unordered_map< AtomIndex, Utils::Position > &fixedAngstromPositions)
Adds dihedral information to the internal coordinate bounds and collects dihedral constraints...
void setBondBoundsIfEmpty(std::array< AtomIndex, 2 > bondIndices, ValueBounds bounds)
Sets bond bounds to exact value bounds if unset.
Eigen::MatrixXd BoundsMatrix
Type used to represent atom-pairwise distance bounds constructed from bounds on internal coordinates...
Definition: SpatialModel.h:66
static boost::optional< ValueBounds > coneAngle(const std::vector< AtomIndex > &baseConstituents, const ValueBounds &coneHeightBounds, const Graph &graph)
Tries to calculate the cone angle for a possibly haptic ligand site.