9 #ifndef IMPATOM_DISTANCE_H
10 #define IMPATOM_DISTANCE_H
12 #include <IMP/atom/atom_config.h>
19 IMPATOM_BEGIN_NAMESPACE
25 const core::XYZs& s1);
30 IMPATOMEXPORT
double get_rmsd(
const core::XYZs& s0,
const core::XYZs& s1);
37 template <
class Vector3DsOrXYZs0,
class Vector3DsOrXYZs1>
38 IMPATOM_DEPRECATED_FUNCTION_DECL(2.2) inline
double get_rmsd(
39 const Vector3DsOrXYZs0& m1, const Vector3DsOrXYZs1& m2,
40 const algebra::Transformation3D& tr_for_second =
42 IMPATOM_DEPRECATED_FUNCTION_DEF(2.2,
"Use it in IMP::algebra");
47 IMPATOMEXPORT
double get_rmsd(
const Selection& s0,
const Selection& s1);
57 IMPATOM_DEPRECATED_FUNCTION_DECL(2.2)
58 IMPATOMEXPORT
double get_rmsd(const Selection& s0, const Selection& s1,
59 const algebra::Transformation3D& tr_for_second);
65 IMPATOM_DEPRECATED_FUNCTION_DECL(2.2)
68 const algebra::Transformation3D& tr_for_second);
74 IMPATOM_DEPRECATED_FUNCTION_DECL(2.2)
76 const core::XYZs& s0, const core::XYZs& s1,
77 const IMP::algebra::Transformation3D& tr_for_second);
87 template <class Vector3DsOrXYZs0, class Vector3DsOrXYZs1>
89 const Vector3DsOrXYZs1& m1) {
90 using algebra::get_vector_geometry;
92 <<
"should be of the same size");
96 for (
unsigned i = 0; i < m0.size() - 1; ++i) {
100 for (
unsigned j = i + 1; j < m0.size(); ++j) {
106 drmsd += (dist0 - dist1) * (dist0 - dist1);
110 return std::sqrt(drmsd / npairs);
123 template <
class Vector3DsOrXYZs0,
class Vector3DsOrXYZs1>
125 const Vector3DsOrXYZs1& m2,
double threshold) {
127 "native_verlap: The input sets of XYZ points "
128 <<
"should be of the same size");
129 unsigned int distances = 0;
130 for (
unsigned int i = 0; i < m1.size(); i++) {
132 get_vector_geometry(m2[i]));
133 if (d <= threshold) distances++;
135 return 100.0 * distances / m1.size();
146 template <
class Vector3DsOrXYZs0,
class Vector3DsOrXYZs1>
147 inline double get_drms(
const Vector3DsOrXYZs0& m1,
const Vector3DsOrXYZs1& m2) {
149 "native_verlap: The input sets of XYZ points "
150 <<
"should be of the same size");
152 unsigned int n = m1.size();
154 double sum_d1ij = 0.0;
155 for (
unsigned int i = 0; i < n; ++i) {
156 for (
unsigned int j = i + 1; j < n; ++j) {
158 get_vector_geometry(m1[j]));
160 get_vector_geometry(m2[j]));
161 drms += (sqd1 - sqd2) * (sqd1 - sqd2);
165 drms /= (4 * sum_d1ij);
177 template <
class Vector3DsOrXYZs0,
class Vector3DsOrXYZs1>
179 const Vector3DsOrXYZs1& m2,
182 "get_rigid_bodies_drms: The input sets of XYZ points "
183 <<
"should be of the same size");
185 int rn = ranges.size();
187 double sum_d1ij = 0.0;
188 for (
int i = 0; i < n; ++i) {
190 for (
int k = 0; k < rn; ++k) {
191 if (i >= ranges[k].first && i <= ranges[k].second) {
196 IMP_USAGE_CHECK(range1 >= 0,
"Point " << i <<
" of m1 does not belong to "
198 for (
int j = i + 1; j < n; ++j) {
200 for (
int k = 0; k < rn; ++k) {
201 if (j >= ranges[k].first && j <= ranges[k].second) {
206 IMP_USAGE_CHECK(range2 >= 0,
"Point " << j <<
" of m2 does not belong to "
210 get_vector_geometry(m1[j]));
212 if (range1 != range2) {
215 get_vector_geometry(m2[j]));
216 drms += (sqd1 - sqd2) * (sqd1 - sqd2);
220 drms /= (4 * sum_d1ij);
294 IMPATOM_END_NAMESPACE
double get_radius_of_gyration(const kernel::ParticlesTemp &ps)
double get_rigid_bodies_drms(const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2, const IMP::IntRanges &ranges)
Import IMP/kernel/base_types.h in the namespace.
double get_drms(const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2)
double get_native_overlap(const Vector3DsOrXYZs0 &m1, const Vector3DsOrXYZs1 &m2, double threshold)
Computes the native overlap between two sets of 3D points.
double get_drmsd(const Vector3DsOrXYZs0 &m0, const Vector3DsOrXYZs1 &m1)
Calculate the root mean square deviation between two sets of 3D points.
std::pair< double, double > FloatPair
A generic pair of floats.
double get_squared_distance(const VectorD< D > &v1, const VectorD< D > &v2)
compute the squared distance between two vectors
double get_rmsd(const core::XYZs &s0, const core::XYZs &s1, const IMP::algebra::Transformation3D &tr_for_second)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Decorator for helping deal with a hierarchy of molecules.
base::Vector< VectorD< 3 > > Vector3Ds
FloatPair get_component_placement_score(const core::XYZs &ref1, const core::XYZs &ref2, const core::XYZs &mdl1, const core::XYZs &mdl2)
Measure the difference between two placements of the same set of points.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
Transformation3D get_identity_transformation_3d()
Return a transformation that does not do anything.
double get_pairwise_rmsd_score(const core::XYZs &ref1, const core::XYZs &ref2, const core::XYZs &mdl1, const core::XYZs &mdl2)
Measure the RMSD between two placements of the same set of points.
FloatPair get_placement_score(const core::XYZs &source, const core::XYZs &target)
Measure the difference between two placements of the same set of points.
A set of useful functionality on IMP::atom::Hierarchy decorators.
double get_rmsd_transforming_first(const algebra::Transformation3D &tr, const Selection &s0, const Selection &s1)