13#ifndef RDKIT_SHAPEINPUT_GUARD
14#define RDKIT_SHAPEINPUT_GUARD
24#include <boost/dynamic_bitset.hpp>
25#ifdef RDK_USE_BOOST_SERIALIZATION
26#include <boost/archive/text_oarchive.hpp>
27#include <boost/archive/text_iarchive.hpp>
28#include <boost/serialization/vector.hpp>
29#include <boost/serialization/array.hpp>
30#include <boost/serialization/unique_ptr.hpp>
42template <
class Archive,
typename Block,
typename Allocator>
43void serialize(Archive &ar, dynamic_bitset<Block, Allocator> &bs,
44 const unsigned int ) {
45 size_t num_bits = bs.size();
48 std::vector<Block> blocks;
50 if (Archive::is_saving::value) {
51 to_block_range(bs, std::back_inserter(blocks));
56 if (Archive::is_loading::value) {
58 from_block_range(blocks.begin(), blocks.end(), bs);
74constexpr double P = 2.7;
75constexpr double KAPPA = 2.41798793102;
80 const std::vector<unsigned int> &a = std::vector<unsigned int>())
85 std::vector<unsigned int>
102 std::vector<std::vector<CustomFeature>>
105 std::vector<unsigned int>
108 std::vector<std::pair<unsigned int, double>>
137 const ROMol &mol,
int confId = -1,
146#ifndef RDK_USE_BOOST_SERIALIZATION
149 std::stringstream ss(str);
150 boost::archive::text_iarchive ia(ss);
168#ifndef RDK_USE_BOOST_SERIALIZATION
171 std::stringstream ss;
172 boost::archive::text_oarchive oa(ss);
178 const std::string
getSmiles()
const {
return d_smiles; }
189 return d_coords[d_activeShape];
192 const std::vector<double> &
getAlphas()
const {
return d_alphas; }
199 std::vector<RDGeom::Point3D>
getAtomPoints(
bool includeColors =
false)
const;
216 return d_selfOverlapShapeVols[d_activeShape];
222 return d_selfOverlapColorVols[d_activeShape];
228 return d_carbonRadii.get();
258 std::unique_ptr<RWMol>
shapeToMol(
bool includeColors =
false,
259 bool withBonds =
true)
const;
270 const ShapeInput &fitShape,
unsigned int &bestThisShape,
272 double threshold = -1.0,
287#ifdef RDK_USE_BOOST_SERIALIZATION
288 template <
class Archive>
289 void serialize(Archive &ar,
unsigned int);
297 void extractFeatures(
const Conformer &conf,
unsigned int confNum,
301 void calcNormalization();
303 void calculateExtremes();
305 unsigned int d_activeShape;
307 std::vector<std::vector<double>>
310 std::vector<double> d_alphas;
313 std::vector<int> d_types;
315 unsigned int d_numAtoms;
316 unsigned int d_numFeats;
317 std::vector<double> d_selfOverlapShapeVols;
318 std::vector<double> d_selfOverlapColorVols;
321 std::vector<std::array<size_t, 6>> d_extremePointss;
322 std::unique_ptr<boost::dynamic_bitset<>>
325 std::string d_smiles;
330 boost::dynamic_bitset<> d_normalizeds;
333 boost::dynamic_bitset<> d_normalizationOKs;
335 std::vector<std::array<double, 9>> d_canonRots;
336 std::vector<std::array<double, 3>> d_canonTranss;
338 std::vector<std::array<double, 3>> d_eigenValuess;
340 void selectConformations(
const std::vector<int> &picks);
344 void sortShapesByVolumes();
347#ifdef RDK_USE_BOOST_SERIALIZATION
348template <
class Archive>
349void ShapeInput::serialize(Archive &ar,
const unsigned int) {
356 ar & d_selfOverlapShapeVols;
357 ar & d_selfOverlapColorVols;
358 ar & d_extremePointss;
362 ar & d_normalizationOKs;
372 const Conformer &conf, std::vector<CustomFeature> &features,
373 const std::optional<std::vector<unsigned int>> &atomSubset = std::nullopt);
377 const Conformer &conf,
const std::vector<unsigned int> &ats);
380 const double *quat,
const double *trans);
387 const double *inShape,
double *outShape,
size_t numPoints,
392 const double *inShape,
double *outShape,
size_t numPoints,
397 double v1,
double v2,
double c1,
double c2,
#define PRECONDITION(expr, mess)
Defines the editable molecule class RWMol.
#define RDKIT_GAUSSIANSHAPE_EXPORT
RDKIT_GAUSSIANSHAPE_EXPORT double maxScore(double v1, double v2, double c1, double c2, const ShapeOverlayOptions &overlayOpts)
RDKIT_GAUSSIANSHAPE_EXPORT void translateShape(std::vector< double > &shape, const RDGeom::Point3D &translation)
constexpr double CARBON_RAD
RDKIT_GAUSSIANSHAPE_EXPORT void applyTransformToShape(std::vector< double > &shape, const RDGeom::Transform3D &xform)
RDKIT_GAUSSIANSHAPE_EXPORT void findFeatures(const Conformer &conf, std::vector< CustomFeature > &features, const std::optional< std::vector< unsigned int > > &atomSubset=std::nullopt)
RDKIT_GAUSSIANSHAPE_EXPORT RDGeom::Transform3D quatTransToTransform(const double *quat, const double *trans)
RDKIT_GAUSSIANSHAPE_EXPORT RDGeom::Point3D computeFeaturePos(const Conformer &conf, const std::vector< unsigned int > &ats)
constexpr double DUMMY_RAD
void serialize(Archive &ar, dynamic_bitset< Block, Allocator > &bs, const unsigned int)
CustomFeature(const unsigned int t, const RDGeom::Point3D &p, const double r, const std::vector< unsigned int > &a=std::vector< unsigned int >())
std::vector< unsigned int > atoms