18 #ifndef INCLUDE_MOLASSEMBLER_DISTANCE_GEOMETRY_SPATIAL_MODEL_H
19 #define INCLUDE_MOLASSEMBLER_DISTANCE_GEOMETRY_SPATIAL_MODEL_H
28 #include <unordered_map>
31 namespace Molassembler {
32 namespace DistanceGeometry {
45 struct ModelGraphWriter;
48 template<
unsigned size>
50 std::array<AtomIndex, size>,
53 std::array<AtomIndex, size>
77 Eigen::MatrixXd matrix;
123 const std::vector<AtomIndex>& atoms,
139 static boost::optional<ValueBounds>
coneAngle(
140 const std::vector<AtomIndex>& baseConstituents,
169 const std::vector<AtomIndex>& siteAtomList,
185 double absoluteVariance
245 const std::pair<SiteIndex, SiteIndex>&
sites,
252 const std::pair<SiteIndex, SiteIndex>&
sites,
270 const std::pair<SiteIndex, SiteIndex>&
sites,
271 double looseningMultiplier,
292 double looseningMultiplier
362 std::array<AtomIndex, 2> bondIndices,
377 std::array<AtomIndex, 3> angleIndices,
391 std::array<AtomIndex, 4> dihedralIndices,
413 double looseningMultiplier,
414 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions,
415 bool forceChiralConstraintEmission
435 double looseningMultiplier,
436 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions
441 const std::pair<const AtomStereopermutator&, const AtomStereopermutator&>& atomPermutators,
442 const std::unordered_map<AtomIndex, Utils::Position>& fixedAngstromPositions
505 std::unordered_map<AtomIndex, Stereopermutators::LocalSpatialModel>
localModels_;
518 std::vector<DihedralConstraint> dihedralConstraints_;
543 double looseningFactor
549 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:108
Models a molecule as a graph (connectivity of atoms) and a list of stereopermutators.
Definition: Molecule.h:77
SpatialModel(const Molecule &molecule, const Configuration &configuration)
Model a molecule into internal coordinate bounds stored internally.
Definition: SpatialModel.h:69
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:92
Definition: FeasiblePermutations.h:27
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:73
unsigned size(Shape shape)
Fetch the number of vertices of a shape.
BoundsMapType< 4 > dihedralBounds_
Dihedral value bounds on index quadruplets.
Definition: SpatialModel.h:514
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.
static constexpr ValueBounds angleClampBounds
Defines clamping bounds on angles.
Definition: SpatialModel.h:97
Class performing spatial modeling of molecules.
Definition: SpatialModel.h:40
BoundsMapType< 2 > constraints_
Constraints by fixed positions.
Definition: SpatialModel.h:508
static double smallestCycleDistortionMultiplier(AtomIndex i, const Cycles &cycles)
Idealization strictness loosening multiplier due to small cycles.
Wrapper class to make working with RDL in C++ more pleasant.
Definition: Cycles.h:44
Decide which stereopermutations are feasible.
static ValueBounds siteDistanceFromCenter(const std::vector< AtomIndex > &siteAtomList, AtomIndex placement, const PrivateGraph &graph)
Calculates bounds on the distance of a (possibly haptic) ligand site to a central index...
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:58
static const ValueBounds defaultDihedralBounds
Defines the range (-π,π] using std::nextafter (not constexpr)
Definition: SpatialModel.h:99
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:94
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.
bool modelPartiallyFixedBond(const BondStereopermutator &permutator, const std::pair< const AtomStereopermutator &, const AtomStereopermutator & > &atomPermutators, const std::unordered_map< AtomIndex, Utils::Position > &fixedAngstromPositions)
Sets bond bounds to exact value bounds if unset.
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:517
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
BoundsMapType< 3 > angleBounds_
Angle value bounds on index triples.
Definition: SpatialModel.h:512
std::unordered_map< std::array< AtomIndex, size >, ValueBounds, boost::hash< std::array< AtomIndex, size > > > BoundsMapType
ValueBounds container for various internal coordinates.
Definition: SpatialModel.h:55
static ValueBounds makeBoundsFromCentralValue(double centralValue, double absoluteVariance)
Yields central value plus/minus some absolute variance bounds.
static ChiralConstraint makeChiralConstraint(const AtomStereopermutator::MinimalChiralConstraint &minimalConstraint, const AtomStereopermutator &permutator, const Stereopermutators::LocalSpatialModel &localModel, double looseningMultiplier)
Creates a volume-specific chiral constraint from a list of.
static boost::optional< ValueBounds > coneAngle(const std::vector< AtomIndex > &baseConstituents, const ValueBounds &coneHeightBounds, const PrivateGraph &graph)
Tries to calculate the cone angle for a possibly haptic ligand site.
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
static ValueBounds modelSiteAngleBounds(const AtomStereopermutator &permutator, const Stereopermutators::LocalSpatialModel &localModel, const std::pair< SiteIndex, SiteIndex > &sites, double looseningMultiplier, const PrivateGraph &inner)
Models bounds on the angle between AtomStereopermutator sites.
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:510
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 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:87
Class storing atom-pairwise distance bounds.
void writeGraphviz(const std::string &filename) const
Writes a graphviz representation of a modeled molecule to a file.
std::unordered_map< AtomIndex, Stereopermutators::LocalSpatialModel > localModels_
Local models of atom stereopermutators.
Definition: SpatialModel.h:505
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:67