7 #ifndef IMPSAXS_UTILITY_H
8 #define IMPSAXS_UTILITY_H
10 #include <IMP/saxs/saxs_config.h>
16 IMPSAXS_BEGIN_NAMESPACE
18 inline void get_coordinates(
const kernel::Particles& particles,
19 std::vector<algebra::Vector3D>& coordinates) {
21 coordinates.resize(particles.size());
22 for (
unsigned int i = 0; i < particles.size(); i++) {
23 coordinates[i] = core::XYZ(particles[i]).get_coordinates();
27 inline void get_form_factors(
const kernel::Particles& particles,
28 FormFactorTable* ff_table,
Floats& form_factors,
30 form_factors.resize(particles.size());
31 for (
unsigned int i = 0; i < particles.size(); i++) {
32 form_factors[i] = ff_table->get_form_factor(particles[i], ff_type);
39 std::vector<algebra::Vector3D> coordinates(particles.size());
40 get_coordinates(particles, coordinates);
41 for (
unsigned int i = 0; i < coordinates.size(); i++) {
42 for (
unsigned int j = i + 1; j < coordinates.size(); j++) {
45 if (dist2 > max_dist2) max_dist2 = dist2;
48 return std::sqrt(max_dist2);
56 std::vector<algebra::Vector3D> coordinates1, coordinates2;
57 get_coordinates(particles1, coordinates1);
58 get_coordinates(particles2, coordinates2);
60 for (
unsigned int i = 0; i < coordinates1.size(); i++) {
61 for (
unsigned int j = i + 1; j < coordinates2.size(); j++) {
64 if (dist2 > max_dist2) max_dist2 = dist2;
67 return std::sqrt(max_dist2);
73 std::vector<algebra::Vector3D> coordinates(particles.size());
74 get_coordinates(particles, coordinates);
75 for (
unsigned int i = 0; i < particles.size(); i++) {
76 centroid += coordinates[i];
78 centroid /= particles.size();
80 for (
unsigned int i = 0; i < particles.size(); i++) {
83 rg /= particles.size();
Float compute_max_distance(const kernel::Particles &particles1, const kernel::Particles &particles2)
double get_squared_distance(const VectorD< D > &v1, const VectorD< D > &v2)
compute the squared distance between two vectors
Exception definitions and assertions.
Float radius_of_gyration(const kernel::Particles &particles)
compute radius_of_gyration
IMP::base::Vector< Float > Floats
Standard way to pass a bunch of Float values.
double Float
Basic floating-point value (could be float, double...)
FormFactorType
type of the form factors for profile calculations