Index: sansmodels/src/c_models/c_models.cpp
===================================================================
--- sansmodels/src/c_models/c_models.cpp	(revision 7289627c1e08098ecdc843692314e929bbccca9b)
+++ sansmodels/src/c_models/c_models.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
@@ -58,4 +58,7 @@
 void addCRPAModel(PyObject *module);
 void addCFractalModel(PyObject *module);
+void addCMassSurfaceFractal(PyObject *module);
+void addCSurfaceFractalModel(PyObject *module);
+void addCMassFractalModel(PyObject *module);
 void addCPoly_GaussCoil(PyObject *module);
 
@@ -296,3 +299,6 @@
   addCRPAModel(m);
   addCFractalModel(m);
-}
+  addCMassSurfaceFractal(m);
+  addCMassFractalModel(m);
+  addCSurfaceFractalModel(m);
+}
Index: sansmodels/src/c_models/libfunc.c
===================================================================
--- sansmodels/src/c_models/libfunc.c	(revision 101065a9bd217be61773f8eba38d0c461efee3fd)
+++ sansmodels/src/c_models/libfunc.c	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
@@ -63,2 +63,18 @@
 	return sin(x)/x;
 }
+
+double gamln(double xx) {
+
+    double x,y,tmp,ser;
+    static double cof[6]={76.18009172947146,-86.50532032941677,
+    24.01409824083091,-1.231739572450155,
+    0.1208650973866179e-2,-0.5395239384953e-5};
+    int j;
+
+    y=x=xx;
+    tmp=x+5.5;
+    tmp -= (x+0.5)*log(tmp);
+    ser=1.000000000190015;
+    for (j=0;j<=5;j++) ser += cof[j]/++y;
+    return -tmp+log(2.5066282746310005*ser/x);
+}
Index: sansmodels/src/c_models/massfractal.cpp
===================================================================
--- sansmodels/src/c_models/massfractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
+++ sansmodels/src/c_models/massfractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
@@ -0,0 +1,126 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ */
+
+#include <math.h>
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+#include "massfractal.h"
+extern "C" {
+#include "libmultifunc/libfunc.h"
+}
+
+static double mass_fractal_kernel(double dp[], double q) {
+  //fit parameters
+  double scale = dp[0];
+  double radius = dp[1];
+  double mass_dim = dp[2];
+  double co_length = dp[3];
+  double background = dp[4];
+  //others
+  double pq = 0.0;
+  double sq = 0.0;
+  double mmo = 0.0;
+  //result
+  double result = 0.0;
+  if( (q*radius) == 0.0){
+		pq = 1.0;
+  }
+  else{
+	//calculate P(q) for the spherical subunits; not normalized
+	pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2);
+  }
+  mmo = mass_dim-1.0;
+  //calculate S(q)
+  sq = exp(gamln(mmo))*sin((mmo)*atan(q*co_length));
+  sq *= pow(co_length, mmo);
+  sq /= pow((1.0 + (q*co_length)*(q*co_length)),(mmo/2.0));
+
+
+  sq /= q;
+  //combine and return
+  result = pq * sq;
+  result *= scale;
+  result += background;
+
+  return(result);
+}
+
+MassFractalModel :: MassFractalModel() {
+  scale      = Parameter(1.0);
+  radius = Parameter(10.0);
+  mass_dim = Parameter(1.9);
+  co_length = Parameter(100.0);
+  background = Parameter(0.0);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * @param q: q-value
+ * @return: function value
+ */
+double MassFractalModel :: operator()(double q) {
+  double dp[5];
+
+  // Add the background after averaging
+  dp[0] = scale();
+  dp[1] = radius();
+  dp[2] = mass_dim();
+  dp[3] = co_length();
+  dp[4] = 0.0;
+
+  // Perform the computation
+  double sum = 0.0;
+
+  sum = mass_fractal_kernel(dp, fabs(q));
+  return sum + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double MassFractalModel :: operator()(double qx, double qy) {
+  double q = sqrt(qx*qx + qy*qy);
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the FractalModel
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double MassFractalModel :: evaluate_rphi(double q, double phi) {
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to calculate effective radius
+ * @return: effective radius value
+ */
+double MassFractalModel :: calculate_ER() {
+  //NOT implemented yet!!! 'cause None shape Model
+  return 0.0;
+}
Index: sansmodels/src/c_models/masssurfacefractal.cpp
===================================================================
--- sansmodels/src/c_models/masssurfacefractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
+++ sansmodels/src/c_models/masssurfacefractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
@@ -0,0 +1,157 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ */
+
+#include <math.h>
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+#include "masssurfacefractal.h"
+
+
+
+static double mass_surface_fractal_kernel(double dp[], double q) {
+  //fit parameters
+  double scale = dp[0];
+  double mass_dim = dp[1];
+  double surface_dim = dp[2];
+  double cluster_rg = dp[3];
+  double primary_rg = dp[4];
+  double background = dp[5];
+
+  //others
+  double tot_dim = 0.0;
+  double rc_norm = 0.0;
+  double rp_norm = 0.0;
+  double x_val1 = 0.0;
+  double x_val2 = 0.0;
+  double form_factor = 0.0;
+  double inv_form = 0.0;
+
+  // This model is valid only for 0<dm<=6 and 0<ds<=6
+  // Not valid values => reject as 0.0
+  if (mass_dim < 1e-16){
+	  return 0.0;
+  }
+  if (mass_dim > 6.0){
+	  return 0.0;
+  }
+  if (surface_dim < 1e-16){
+	  return 0.0;
+  }
+  if (surface_dim > 6.0){
+	  return 0.0;
+  }
+  tot_dim = 6.0 - surface_dim - mass_dim;
+  //singulars
+  if (tot_dim < 0.0){
+	  return 0.0;
+  }
+  
+  //computation
+  mass_dim /= 2.0;
+  tot_dim /= 2.0;
+  rc_norm = cluster_rg * cluster_rg / (3.0 * mass_dim);
+  if (tot_dim < 1.0e-16){
+	  tot_dim = 1.0e-16;
+  }
+  rp_norm = primary_rg * primary_rg / (3.0 * tot_dim);
+
+  //x for P
+  x_val1 = 1.0 +  q * q * rc_norm;
+  x_val2 = 1.0 +  q * q * rp_norm;
+
+  inv_form = pow(x_val1, mass_dim) * pow(x_val2, tot_dim);
+
+  //another singular
+  if (inv_form == 0.0) return 0.0;
+
+  form_factor = 1.0;
+  form_factor /= inv_form;
+
+  //scale and background
+  form_factor *= scale;
+  form_factor += background;
+  return (form_factor);
+}
+
+MassSurfaceFractal :: MassSurfaceFractal() {
+  scale      = Parameter(1.0);
+  mass_dim = Parameter(1.8);
+  surface_dim = Parameter(2.3);
+  cluster_rg = Parameter(86.7);
+  primary_rg = Parameter(4000.0);
+  background = Parameter(0.0);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * @param q: q-value
+ * @return: function value
+ */
+double MassSurfaceFractal :: operator()(double q) {
+  double dp[6];
+
+  // Fill parameter array for IGOR library
+  // Add the background after averaging
+  dp[0] = scale();
+  dp[1] = mass_dim();
+  dp[2] = surface_dim();
+  dp[3] = cluster_rg();
+  dp[4] = primary_rg();
+  dp[5] = 0.0;
+
+  //computation: no polydispersion
+  double sum = 0.0;
+  sum = mass_surface_fractal_kernel(dp, q);
+
+  return sum + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double MassSurfaceFractal :: operator()(double qx, double qy) {
+  double q = sqrt(qx*qx + qy*qy);
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the FractalModel
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double MassSurfaceFractal :: evaluate_rphi(double q, double phi) {
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to calculate effective radius
+ * @return: effective radius value
+ */
+double MassSurfaceFractal :: calculate_ER() {
+  //NOT implemented yet!!! 'cause None shape Model
+  return 0.0;
+}
Index: sansmodels/src/c_models/surfacefractal.cpp
===================================================================
--- sansmodels/src/c_models/surfacefractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
+++ sansmodels/src/c_models/surfacefractal.cpp	(revision 08648c055ed9beec9949b4b6563871b9101ac8a9)
@@ -0,0 +1,125 @@
+/**
+	This software was developed by the University of Tennessee as part of the
+	Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
+	project funded by the US National Science Foundation.
+
+	If you use DANSE applications to do scientific research that leads to
+	publication, we ask that you acknowledge the use of the software with the
+	following sentence:
+
+	"This work benefited from DANSE software developed under NSF award DMR-0520547."
+
+	copyright 2008, University of Tennessee
+ */
+
+/**
+ * Scattering model classes
+ * The classes use the IGOR library found in
+ *   sansmodels/src/libigor
+ *
+ */
+
+#include <math.h>
+#include "parameters.hh"
+#include <stdio.h>
+using namespace std;
+#include "surfacefractal.h"
+extern "C" {
+#include "libmultifunc/libfunc.h"
+}
+
+static double surface_fractal_kernel(double dp[], double q) {
+  //fit parameters
+  double scale = dp[0];
+  double radius = dp[1];
+  double surface_dim = dp[2];
+  double co_length = dp[3];
+  double background = dp[4];
+  //others
+  double pq = 0.0;
+  double sq = 0.0;
+  double mmo = 0.0;
+  //result
+  double result = 0.0;
+  if( (q*radius) == 0.0){
+		pq = 1.0;
+  }
+  else{
+	//calculate P(q) for the spherical subunits; not normalized
+	pq = pow((3.0*(sin(q*radius) - q*radius*cos(q*radius))/pow((q*radius),3)),2);
+  }
+  mmo = 5.0 - surface_dim;
+
+  //calculate S(q)
+  sq = exp(gamln(mmo))*sin(-(mmo)*atan(q*co_length));
+  sq *= pow(co_length, mmo);
+  sq /= pow((1.0 + (q*co_length)*(q*co_length)),(mmo/2.0));
+  sq /= q;
+  //combine and return
+  result = pq * sq;
+  result *= scale;
+  result += background;
+
+  return(result);
+}
+
+SurfaceFractalModel :: SurfaceFractalModel() {
+  scale      = Parameter(1.0);
+  radius = Parameter(10.0);
+  surface_dim = Parameter(2.0);
+  co_length = Parameter(500.0);
+  background = Parameter(0.0);
+}
+
+/**
+ * Function to evaluate 1D scattering function
+ * @param q: q-value
+ * @return: function value
+ */
+double SurfaceFractalModel :: operator()(double q) {
+  double dp[5];
+
+  // Add the background after averaging
+  dp[0] = scale();
+  dp[1] = radius();
+  dp[2] = surface_dim();
+  dp[3] = co_length();
+  dp[4] = 0.0;
+
+  // Perform the computation
+  double sum = 0.0;
+
+  sum = surface_fractal_kernel(dp, fabs(q));
+  return sum + background();
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param q_x: value of Q along x
+ * @param q_y: value of Q along y
+ * @return: function value
+ */
+double SurfaceFractalModel :: operator()(double qx, double qy) {
+  double q = sqrt(qx*qx + qy*qy);
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to evaluate 2D scattering function
+ * @param pars: parameters of the SurfaceFractalModel
+ * @param q: q-value
+ * @param phi: angle phi
+ * @return: function value
+ */
+double SurfaceFractalModel :: evaluate_rphi(double q, double phi) {
+  return (*this).operator()(q);
+}
+
+/**
+ * Function to calculate effective radius
+ * @return: effective radius value
+ */
+double SurfaceFractalModel :: calculate_ER() {
+  //NOT implemented yet!!! 'cause None shape Model
+  return 0.0;
+}
