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 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 Particles& particles,
30 FormFactorTable* ff_table,
31 Vector<double>& form_factors,
33 form_factors.resize(particles.size());
34 for (
unsigned int i = 0; i < particles.size(); i++) {
35 form_factors[i] = ff_table->get_form_factor(particles[i], ff_type);
42 std::vector<algebra::Vector3D> coordinates(particles.size());
43 get_coordinates(particles, coordinates);
44 for (
unsigned int i = 0; i < coordinates.size(); i++) {
45 for (
unsigned int j = i + 1; j < coordinates.size(); j++) {
48 if (dist2 > max_dist2) max_dist2 = dist2;
51 return std::sqrt(max_dist2);
59 std::vector<algebra::Vector3D> coordinates1, coordinates2;
60 get_coordinates(particles1, coordinates1);
61 get_coordinates(particles2, coordinates2);
63 for (
unsigned int i = 0; i < coordinates1.size(); i++) {
64 for (
unsigned int j = i + 1; j < coordinates2.size(); j++) {
67 if (dist2 > max_dist2) max_dist2 = dist2;
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();
93 double min_q = 0.0,
double max_q = 0.5,
94 double delta_q = 0.001,
97 bool hydration_layer =
true,
99 bool reciprocal =
false,
100 bool ab_initio =
false,
102 std::string beam_profile_file =
"");
106 void read_pdb(
Model *m,
const std::string file,
107 std::vector<std::string>& pdb_file_names,
108 std::vector<IMP::Particles>& particles_vec,
109 bool residue_level =
false,
110 bool heavy_atoms_only =
true,
111 int multi_model_pdb = 2,
112 bool explicit_water =
false);
114 IMPSAXS_DEPRECATED_FUNCTION_DECL(2.7)
116 void read_pdb(const std::
string file,
117 std::vector<std::
string>& pdb_file_names,
118 std::vector<IMP::
Particles>& particles_vec,
119 bool residue_level = false,
120 bool heavy_atoms_only = true,
121 int multi_model_pdb = 2,
122 bool explicit_water = false);
126 void read_files(
Model *m, const std::vector<std::
string>& files,
127 std::vector<std::
string>& pdb_file_names,
128 std::vector<std::
string>& dat_files,
129 std::vector<IMP::
Particles>& particles_vec,
131 bool residue_level = false,
132 bool heavy_atoms_only = true,
133 int multi_model_pdb = 2,
134 bool explicit_water = false,
137 IMPSAXS_DEPRECATED_FUNCTION_DECL(2.7)
139 void read_files(const std::vector<std::
string>& files,
140 std::vector<std::
string>& pdb_file_names,
141 std::vector<std::
string>& dat_files,
142 std::vector<IMP::
Particles>& particles_vec,
144 bool residue_level = false,
145 bool heavy_atoms_only = true,
146 int multi_model_pdb = 2,
147 bool explicit_water = false,
151 std::
string trim_extension(const std::
string file_name);
154 IMPSAXS_END_NAMESPACE
IMP::Vector< IMP::Pointer< Profile > > Profiles
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.
Class for storing model, its restraints, constraints, and particles.
Profile * compute_profile(Particles particles, double min_q=0.0, double max_q=0.5, double delta_q=0.001, FormFactorTable *ft=get_default_form_factor_table(), FormFactorType ff_type=HEAVY_ATOMS, bool hydration_layer=true, 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
FormFactorType
type of the form factors for profile calculations
double compute_max_distance(const Particles &particles1, const Particles &particles2)
double radius_of_gyration(const Particles &particles)
compute radius_of_gyration
A class for profile storing and computation.