8 #ifndef INCLUDE_MOLASSEMBLER_ATOM_ENVIRONMENT_HASH_H
9 #define INCLUDE_MOLASSEMBLER_ATOM_ENVIRONMENT_HASH_H
11 #include "boost/multiprecision/cpp_int.hpp"
12 #include "boost/optional.hpp"
19 namespace Molassembler {
22 class StereopermutatorList;
30 using WideHashType = boost::multiprecision::uint128_t;
31 using HashType = std::uint64_t;
37 static constexpr
unsigned bondTypeBits = 3;
38 static constexpr
unsigned assignmentBits = 3;
42 static constexpr
unsigned hashWidth = 6;
45 bool stereopermutatorOnBond;
46 boost::optional<unsigned> assignmentOptional;
50 bool passStereopermutatorOnBond,
51 boost::optional<unsigned> passAssignmentOptional
54 WideHashType hash()
const;
72 Utils::ElementType elementType,
73 const std::vector<BondInformation>& sortedBonds,
74 const boost::optional<Shapes::Shape>& shapeOptional,
75 const boost::optional<unsigned>& assignedOptional
96 boost::optional<const StereopermutatorList&> stereopermutators,
107 boost::optional<const StereopermutatorList&> stereopermutatorsOption,
132 std::vector<HashType>,
133 std::vector<HashType>,
136 const std::vector<WideHashType>& a,
137 const std::vector<WideHashType>& b
148 std::vector<HashType>,
149 std::vector<HashType>
164 const std::vector<HashType>*
const hashesPtr;
167 using result_type = HashType;
169 inline LookupFunctor(
const std::vector<HashType>& hashes) : hashesPtr(&hashes) {}
171 inline HashType operator() (
const AtomIndex i)
const {
172 return hashesPtr->at(i);
Defines basic types widely shared across the project.
std::tuple< std::vector< HashType >, std::vector< HashType >, HashType > narrow(const std::vector< WideHashType > &a, const std::vector< WideHashType > &b)
Re-enumerates the hashes in two generated hash lists.
std::vector< BondInformation > gatherBonds(const PrivateGraph &inner, const StereopermutatorList &stereopermutators, AtomEnvironmentComponents componentsBitmask, AtomIndex i)
Collects bond information for hash() input.
std::vector< WideHashType > generate(const PrivateGraph &inner, boost::optional< const StereopermutatorList & > stereopermutatorsOption, AtomEnvironmentComponents bitmask)
Generates the hashes for every atom in a molecule's components.
AtomEnvironmentComponents
For bitmasks grouping components of immediate atom environments.
Definition: Types.h:103
A functor for getting an atom's hash from a captured list of hashes.
Definition: AtomEnvironmentHash.h:163
Manages all stereopermutators that are part of a Molecule.
Definition: StereopermutatorList.h:30
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
BondType
Discrete bond type numeration.
Definition: Types.h:26
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.
Defines symmetry names and total count.
bool identityCompare(const PrivateGraph &aGraph, const StereopermutatorList &aStereopermutators, const PrivateGraph &bGraph, const StereopermutatorList &bStereopermutators, AtomEnvironmentComponents componentBitmask)
Compare two molecules with an identity index mapping.
WideHashType atomEnvironment(const PrivateGraph &inner, boost::optional< const StereopermutatorList & > stereopermutators, AtomEnvironmentComponents bitmask, AtomIndex i)
Calculate the hash for a particular atom index.