7 #ifndef IMPSAXS_UTILITY_H
8 #define IMPSAXS_UTILITY_H
10 #include <IMP/saxs/saxs_config.h>
15 IMPSAXS_BEGIN_NAMESPACE
17 inline void get_coordinates(
const Particles& particles,
18 std::vector<algebra::Vector3D>& coordinates) {
20 coordinates.resize(particles.size());
21 for (
unsigned int i=0; i<particles.size(); i++) {
22 coordinates[i] = core::XYZ(particles[i]).get_coordinates();
26 inline void get_form_factors(
const Particles& particles,
27 FormFactorTable* ff_table,
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++) {
48 return sqrt(max_dist2);
54 const Particles& particles2) {
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++) {
67 return 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();