7 #ifndef IMPSAXS_UTILITY_H
8 #define IMPSAXS_UTILITY_H
10 #include <IMP/saxs/saxs_config.h>
18 IMPSAXS_BEGIN_NAMESPACE
20 inline void get_coordinates(
const kernel::Particles& particles,
21 std::vector<algebra::Vector3D>& coordinates) {
23 coordinates.resize(particles.size());
24 for (
unsigned int i = 0; i < particles.size(); i++) {
25 coordinates[i] = core::XYZ(particles[i]).get_coordinates();
29 inline void get_form_factors(
const kernel::Particles& particles,
30 FormFactorTable* ff_table,
Floats& form_factors,
32 form_factors.resize(particles.size());
33 for (
unsigned int i = 0; i < particles.size(); i++) {
34 form_factors[i] = ff_table->get_form_factor(particles[i], ff_type);
41 std::vector<algebra::Vector3D> coordinates(particles.size());
42 get_coordinates(particles, coordinates);
43 for (
unsigned int i = 0; i < coordinates.size(); i++) {
44 for (
unsigned int j = i + 1; j < coordinates.size(); j++) {
47 if (dist2 > max_dist2) max_dist2 = dist2;
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++) {
66 if (dist2 > max_dist2) max_dist2 = dist2;
69 return std::sqrt(max_dist2);
75 std::vector<algebra::Vector3D> coordinates(particles.size());
76 get_coordinates(particles, coordinates);
77 for (
unsigned int i = 0; i < particles.size(); i++) {
78 centroid += coordinates[i];
80 centroid /= particles.size();
82 for (
unsigned int i = 0; i < particles.size(); i++) {
85 rg /= particles.size();
92 float min_q = 0.0,
float max_q = 0.5,
93 float delta_q = 0.001,
96 float water_layer_c2 = 4.0,
98 bool reciprocal =
false,
99 bool ab_initio =
false,
101 std::string beam_profile_file =
"");
103 IMPSAXS_END_NAMESPACE
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.
FormFactorTable * get_default_form_factor_table()
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
Profile * compute_profile(IMP::kernel::Particles particles, float min_q=0.0, float max_q=0.5, float delta_q=0.001, FormFactorTable *ft=get_default_form_factor_table(), FormFactorType ff_type=HEAVY_ATOMS, float water_layer_c2=4.0, bool fit=true, bool reciprocal=false, bool ab_initio=false, bool vacuum=false, std::string beam_profile_file="")
profile calculation for particles and a given set of options
A class for profile storing and computation.