9 #ifndef IMPISD_EM_UTILITIES_H
10 #define IMPISD_EM_UTILITIES_H
19 #include <boost/random/uniform_real_distribution.hpp>
20 #include <boost/random/variate_generator.hpp>
22 IMPISD_BEGIN_NAMESPACE
24 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
25 inline Float score_gaussian_overlap(Model *m,
27 Eigen::Vector3d * deriv){
30 Eigen::Matrix3d inverse = Eigen::Matrix3d::Zero();
31 Float mass12 = atom::Mass(m, std::get<0>(pp)).get_mass() *
32 atom::Mass(m, std::get<1>(pp)).get_mass();
33 core::Gaussian g1(m, std::get<0>(pp));
34 core::Gaussian g2(m, std::get<1>(pp));
35 Eigen::Matrix3d covar = g1.get_global_covariance() +
36 g2.get_global_covariance();
37 Eigen::Vector3d v = Eigen::Vector3d(g2.get_coordinates().get_data())
38 - Eigen::Vector3d(g1.get_coordinates().get_data());
39 covar.computeInverseAndDetWithCheck(inverse,determinant,invertible);
40 Eigen::Vector3d tmp = inverse*v;
42 Float score = mass12 * 0.06349363593424097 / (std::sqrt(determinant)) *
43 std::exp(-0.5*v.transpose()*tmp);
49 inline FloatsList sample_points_from_density(
const em::DensityMap * dmap_orig,
55 const em::DensityHeader * dhead = dmap->get_header();
56 Float dmax=dhead->dmax;
61 boost::random::uniform_real_distribution<> uni_dist(0,1);
62 boost::variate_generator<
63 IMP::RandomNumberGenerator&,
64 boost::random::uniform_real_distribution<> >
66 for (
int i=0;i<npoints;i++){
68 Float den=(dmap->get_value(vs))/dmax;
Decorator to hold Gaussian3D.
BoundingBoxD< 3 > BoundingBox3D
Typedef for Python.
IMP::Vector< Float > Floats
Standard way to pass a bunch of Float values.
DensityMap * get_threshold_map(const DensityMap *orig_map, float threshold)
Return a map with 0 for all voxels below the threshold.
Class for handling density maps.
IMP::Vector< Floats > FloatsList
Standard way to pass a bunch of Floats values.
Functions to generate vectors.
VectorD< D > get_random_vector_in(const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density.
double Float
Basic floating-point value (could be float, double...)
Random number generators used by IMP.
RandomNumberGenerator random_number_generator
A shared non-GPU random number generator.