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,
31 form_factors.resize(particles.size());
32 for (
unsigned int i=0; i<particles.size(); i++) {
33 form_factors[i] = ff_table->get_form_factor(particles[i], ff_type);
40 std::vector<algebra::Vector3D> coordinates(particles.size());
41 get_coordinates(particles, coordinates);
42 for (
unsigned int i = 0; i < coordinates.size(); i++) {
43 for (
unsigned int j = i + 1; j < coordinates.size(); j++) {
50 return std::sqrt(max_dist2);
58 std::vector<algebra::Vector3D> coordinates1, coordinates2;
59 get_coordinates(particles1, coordinates1);
60 get_coordinates(particles2, coordinates2);
62 for (
unsigned int i = 0; i < coordinates1.size(); i++) {
63 for (
unsigned int j = i + 1; j < coordinates2.size(); j++) {
70 return std::sqrt(max_dist2);
76 std::vector<algebra::Vector3D> coordinates(particles.size());
77 get_coordinates(particles, coordinates);
78 for (
unsigned int i = 0; i < particles.size(); i++) {
79 centroid += coordinates[i];
81 centroid /= particles.size();
83 for (
unsigned int i = 0; i < particles.size(); i++) {
86 rg /= particles.size();
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...)
Float compute_max_distance(const kernel::Particles &particles)
compute max distance
FormFactorType
type of the form factors for profile calculations