#include #include "models.hh" #include "parameters.hh" #include using namespace std; extern "C" { #include "pearlnecklace.h" } PearlNecklaceModel :: PearlNecklaceModel() { scale = Parameter(1.0); radius = Parameter(80.0, true); radius.set_min(0.0); edge_separation = Parameter(350.0, true); edge_separation.set_min(0.0); thick_string = Parameter(2.5, true); thick_string.set_min(0.0); num_pearls = Parameter(3); num_pearls.set_min(0.0); sld_pearl = Parameter(1.0e-06); sld_string = Parameter(1.0e-06); sld_solv = Parameter(6.3e-06); background = Parameter(0.0); } /** * Function to evaluate 1D PearlNecklaceModel function * @param q: q-value * @return: function value */ double PearlNecklaceModel :: operator()(double q) { double dp[9]; // Fill parameter array for IGOR library // Add the background after averaging dp[0] = scale(); dp[1] = radius(); dp[2] = edge_separation(); dp[3] = thick_string(); dp[4] = num_pearls(); dp[5] = sld_pearl(); dp[6] = sld_string(); dp[7] = sld_solv(); dp[8] = 0.0; double pi = 4.0*atan(1.0); // No polydispersion supported in this model. // Get the dispersion points for the radius vector weights_radius; radius.get_weights(weights_radius); vector weights_edge_separation; edge_separation.get_weights(weights_edge_separation); // Perform the computation, with all weight points double sum = 0.0; double norm = 0.0; double vol = 0.0; double string_vol = 0.0; double pearl_vol = 0.0; double tot_vol = 0.0; // Loop over core weight points for(size_t i=0; i weights_radius; radius.get_weights(weights_radius); vector weights_edge_separation; edge_separation.get_weights(weights_edge_separation); // Perform the computation, with all weight points double string_vol = 0.0; double pearl_vol = 0.0; double tot_vol = 0.0; // Loop over core weight points for(size_t i=0; i