//Bayesis updates parameters in the rescale function, but does not take into account depended parameter (impact parameter for example)
//calculate potential parameters update these parameters.
printf (" calculate chi2 : ");
Potential_SOA *lenses = UserCommon->potentials;
// Call the chi2_function specified in the BayeSys3_runBayeSys3(...) function call
// The chi2 function has to return an error value and modify the chi2 passed to it
// negative error values give an error code
//std::cerr << "Potential given to chi function: "<< UserCommon->potentials->position_x[0] << UserCommon->potentials->position_y[0] << UserCommon->potentials->ellipticity[0] << std::endl;
fprintf (stdout, "Currently we have %lf chi2/sec\n", UserCommon->Nchi2 / (((float) timeDifference) / CLOCKS_PER_SEC)); // We have 1000 chi2 since the last time
// we called this function
UserCommon->referenceTime = clock (); // make current time reference time
UserCommon->Nchi2 = 0; // Reset number of chi2 counter
fflush (stdout); // Make sure the text is printed to stdout