Index: src/sas/models/c_extension/c_models/DiamCyl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/DiamCyl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,114 +1,0 @@
-/**
-	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 "DiamCyl.h"
-
-extern "C" {
-	#include "libStructureFactor.h"
-}
-
-DiamCylFunc :: DiamCylFunc() {
-	radius      = Parameter(20.0, true);
-	radius.set_min(0.0);
-	length      = Parameter(400, true);
-	length.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double DiamCylFunc :: operator()(double q) {
-	double dp[2];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = radius();
-	dp[1] = length();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp[1] = weights_len[j].value;
-
-			sum += weights_rad[i].weight
-						* weights_len[j].weight *DiamCyl(dp[1], dp[0]);
-			norm += weights_rad[i].weight
-				* weights_len[j].weight;
-		}
-	}
-	return sum/norm ;
-}
-
-/**
- * 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 DiamCylFunc :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double DiamCylFunc :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double DiamCylFunc :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-double DiamCylFunc :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/DiamEllip.cpp
===================================================================
--- src/sas/models/c_extension/c_models/DiamEllip.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/**
-	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 "DiamEllip.h"
-
-extern "C" {
-	#include "libStructureFactor.h"
-}
-
-DiamEllipFunc :: DiamEllipFunc() {
-	radius_a      = Parameter(20.0, true);
-	radius_a.set_min(0.0);
-	radius_b      = Parameter(400, true);
-	radius_b.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double DiamEllipFunc :: operator()(double q) {
-	double dp[2];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = radius_a();
-	dp[1] = radius_b();
-
-	// Get the dispersion points for the radius a
-	vector<WeightPoint> weights_rad_a;
-	radius_a.get_weights(weights_rad_a);
-
-	// Get the dispersion points for the radius b
-	vector<WeightPoint> weights_rad_b;
-	radius_b.get_weights(weights_rad_b);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_a.size(); i++) {
-		dp[0] = weights_rad_a[i].value;
-		// Loop over length weight points
-		for(size_t j=0; j<weights_rad_b.size(); j++) {
-			dp[1] = weights_rad_b[j].value;
-
-			sum += weights_rad_a[i].weight*weights_rad_b[j].weight
-				* DiamEllip(dp[0], dp[1]);
-			norm += weights_rad_a[i].weight*weights_rad_b[j].weight;
-		}
-	}
-	return sum/norm ;
-}
-
-/**
- * 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 DiamEllipFunc :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double DiamEllipFunc :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double DiamEllipFunc :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-double DiamEllipFunc :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/FractalQtoN.cpp
===================================================================
--- src/sas/models/c_extension/c_models/FractalQtoN.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,146 +1,0 @@
-
-/*
-	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
-
-    See Schmidt, J Appl Cryst, 24, (1991), 414-435, Eqn (19)
-    See Hurd, Schaefer & Martin, 35, (1987), 2361-2364
-
-    Ported to C++ from Fortran by Robert Whitley (2012)
-*/
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include "FractalQtoN.h"
-using namespace std;
-
-FractalO_Z::FractalO_Z()
-{
-    scale = Parameter(10000.0, true);
-    m_fractal = Parameter(1.8);
-    cluster_rg = Parameter(3250.0);
-    s_fractal = Parameter(2.5);
-    primary_rg = Parameter(82.0);
-    background = Parameter(0.01);
-}
-
-double FractalO_Z :: operator()(double q)
-{
-    double dp[3];
-    dp[0] = m_fractal();
-    dp[1] = s_fractal();
-    
-    
-    if (dp[0] <= 0)
-    {
-        //std::cout << "\n\nThe mass fractal dimension must be > 0!";
-        //std::cout << "\nWill set to 3.";
-        dp[0] = 3.0;
-    }
-    else 
-    {
-        if (dp[0] > 6)
-        {
-            //std::cout << "\n\nThe mass fractal dimension must be <= 6!";
-            //std::cout << "\nWill be set to 3."; 
-            dp[0] = 3.0;
-        }
-    }
-    
-    if (dp[1] <= 0)
-    {
-        //std::cout << "\n\nThe surface dimension must be > 0!";
-        //std::cout << "\nWill be set to 2.";
-        dp[1] = 2.0;
-    }
-    else
-    {
-        if (dp[1] > 6)
-        {
-            //std::cout << "\n\nThe surface dimension must be <= 6!";
-            //std::cout << "\nWill be set to 2.";
-            dp[1] = 2.0;
-        }
-    }
-    
-    double a(dp[0]/2.0);
-    double b((cluster_rg() * cluster_rg())/(3.0*a) );
-    
-    // If C goes negative, it will crash with undefined exponentiation.
-    // So (Ds + Dm) <= 6
-    // c = ((ds-6.0)/-2.0)-a
-    if ((dp[1] > (6.0-dp[0])) && (primary_rg() > 0.0))
-    {
-        dp[1] = 6.0 - dp[0];
-        //std::cout << "\n\nThe surface fractal dimension must be <= (6-Dm)!\n";
-        //std::cout << setprecision(5) << fixed << dp[1];
-    }
-    
-    // c = (ds -6.0 + dm)/-2.0;
-    double c = (6.0 - dp[1] - dp[0])/2.0;
-    double d(0.0);
-    
-    // If c = 0 then it will crash with a floating divide by zero.
-    if (c == 0)
-    {
-        d = 1.0e+37;
-    }
-    else
-    {
-        d = (primary_rg() * primary_rg()) / (3.0 * c);
-    }
-
-    double eVar = q*q*b;
-    double fVar = q*q*d;
-    double g = pow((1.0+eVar),a);
-    double h = pow((1.0+fVar),c);
-    double i = g*h;
-    double result((scale()/i) + background() );
-    return result;
-}
-
-
-/**
- * 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 FractalO_Z :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FractalO_Z :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FractalO_Z :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double FractalO_Z :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/GelFit.cpp
===================================================================
--- src/sas/models/c_extension/c_models/GelFit.cpp	(revision 1d115ef0ea20114c0109dad8c815846e6281604a)
+++ 	(revision )
@@ -1,109 +1,0 @@
-
-/*
-	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
-    
-    SHIBAYAMA-GEISSLER TWO-LENGTH SCALE SCATTERING FUNCTION FOR GELS
-
-    See Sibayama, Tanaka & Han, J Chem Phys, (1992), 97(9), 6829-6841
-    or  Mallam, Horkay, Hecht, Rennie & Geissler, Macromol, (1991), 24, 543
-
-    Ported to C++ from Fortran by Robert Whitley (2012)
-*/
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "GelFit.h"
-
-GelFitModel::GelFitModel()
-{
-    lScale = Parameter(3.5);
-    gScale = Parameter(1.7);
-    zeta = Parameter(16.0);
-    radius = Parameter(104.0,true);
-    radius.set_min(2.0);
-    FractalExp = Parameter(2.0,true);
-    background = Parameter(0.01);
-}
-
-double GelFitModel::operator()(double q) 
-{
-    double dp[3];
-    dp[0] = zeta();
-    dp[1] = radius();
-    dp[2] = FractalExp();
-    
-    if (dp[2] <= 0)
-    {
-        //cout << "\n\nThe Scaling Exponent must be > 0";
-        //cout << "\nWill set to 2.0";
-        dp[2] = 2.0;
-    }
-
-    // Lorentzian Term
-    ////////////////////////double a(x[i]*x[i]*zeta*zeta);
-    double a(q*q*dp[0]*dp[0]);
-    double b(1.0 + (((dp[2] + 1.0)/3.0)*a) );
-    double c(pow(b, (dp[2]/2.0) ) );
-    
-    // Exponential Term
-    ////////////////////////double d(x[i]*x[i]*rg*rg);
-    double d(q*q*dp[1]*dp[1]);
-    double e(-1.0*(d/3.0) );
-    double f(exp(e));
-        
-        // Scattering Law
-    double result((lScale()/c) + (gScale()*f) + background());
-    return result;
-}
-
-
-/**
- * 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 GelFitModel::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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double GelFitModel::evaluate_rphi(double q, double phi) 
-{
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double GelFitModel::calculate_ER() 
-{
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double GelFitModel::calculate_VR() 
-{
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/Hardsphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/Hardsphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,105 +1,0 @@
-/**
-	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 "Hardsphere.h"
-
-extern "C" {
-#include "libStructureFactor.h"
-}
-
-HardsphereStructure :: HardsphereStructure() {
-  effect_radius      = Parameter(50.0, true);
-  effect_radius.set_min(0.0);
-  volfraction = Parameter(0.20, true);
-  volfraction.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HardsphereStructure :: operator()(double q) {
-  double dp[2];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = effect_radius();
-  dp[1] = volfraction();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  effect_radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[0] = weights_rad[i].value;
-
-    sum += weights_rad[i].weight
-        * HardSphereStruct(dp, q);
-    norm += weights_rad[i].weight;
-  }
-  return sum/norm ;
-}
-
-/**
- * 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 HardsphereStructure :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HardsphereStructure :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HardsphereStructure :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double HardsphereStructure :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/HayterMSA.cpp
===================================================================
--- src/sas/models/c_extension/c_models/HayterMSA.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,115 +1,0 @@
-/**
-	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
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "HayterMSA.h"
-
-extern "C" {
-#include "libStructureFactor.h"
-}
-
-HayterMSAStructure :: HayterMSAStructure() {
-  effect_radius      = Parameter(20.75, true);
-  effect_radius.set_min(0.0);
-  charge      = Parameter(19.0, true);
-  volfraction = Parameter(0.0192, true);
-  volfraction.set_min(0.0);
-  temperature = Parameter(318.16, true);
-  temperature.set_min(0.0);
-  saltconc   = Parameter(0.0);
-  dielectconst  = Parameter(71.08);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HayterMSAStructure :: operator()(double q) {
-  double dp[6];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = 2.0*effect_radius();
-  dp[1] = fabs(charge());
-  dp[2] = volfraction();
-  dp[3] = temperature();
-  dp[4] = saltconc();
-  dp[5] = dielectconst();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  effect_radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[0] = 2.0*weights_rad[i].value;
-
-    sum += weights_rad[i].weight
-        * HayterPenfoldMSA(dp, q);
-    norm += weights_rad[i].weight;
-  }
-  return sum/norm ;
-}
-
-/**
- * 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 HayterMSAStructure :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HayterMSAStructure :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HayterMSAStructure :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double HayterMSAStructure :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/RectangularHollowPrism.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularHollowPrism.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/**
-    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
- *
- *    TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularHollowPrism.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double thickness;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularHollowPrismParameters;
-
-
-RectangularHollowPrismModel :: RectangularHollowPrismModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    thickness = Parameter(1.0, true);
-    thickness.set_min(0.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularHollowPrismModel :: operator()(double q) {
-
-    double dp[8];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = thickness();
-    dp[5] = sldPipe();
-    dp[6] = sldSolv();
-    dp[7] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // Get the dispersion points for the thickness
-    vector<WeightPoint> weights_thickness;
-    thickness.get_weights(weights_thickness);
-
-    // Perform the computation, with all weight points
-    double sum = 0.0;
-    double norm = 0.0;
-    double vol = 0.0;
-
-    // Loop over short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-                // Loop over thicknesses
-                for (int l=0; l < (int)weights_thickness.size(); l++) {
-
-                    dp[4] = weights_thickness[l].value;
-
-        	        // Un-normalize  by volume = abc - (a-2*t)*(b-2*t)*(c-2*t)
-
-		            double a = dp[1];
-		            double b = dp[1] * dp[2];
-		            double c = dp[1] * dp[3];
-		            double t = dp[4];
-		            double vol_i = a*b*c - (a-2*t)*(b-2*t)*(c-2*t);
-
-        	        sum += weights_short_side[i].weight *
-        	               weights_b2a_ratio[j].weight *
-        	               weights_c2a_ratio[k].weight *
-			               weights_thickness[l].weight *
-        	               RectangularHollowPrism(dp, q) *
-        	               vol_i;
-
-        	        //Find average volume (ABC)
-
-        	        vol += weights_short_side[i].weight *
-        	               weights_b2a_ratio[j].weight *
-        	               weights_c2a_ratio[k].weight *
-			               weights_thickness[l].weight *
-        	               vol_i;
-
-        	        norm += weights_short_side[i].weight *
-                	        weights_b2a_ratio[j].weight *
-                	        weights_c2a_ratio[k].weight *
-			                weights_thickness[l].weight;
-                }
-            }
-	    }
-    }
-
-    if (vol != 0.0 && norm != 0.0) {
-        //Re-normalize by avg volume
-        sum = sum/(vol/norm);}
-
-    return sum/norm + 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 RectangularHollowPrismModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularHollowPrismModel :: evaluate_rphi(double q, double phi) {
-    double qx = q*cos(phi);
-    double qy = q*sin(phi);
-    return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RectangularHollowPrismModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularHollowPrismModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/RectangularHollowPrismInfThinWalls.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularHollowPrismInfThinWalls.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,181 +1,0 @@
-/**
-    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
- *
- *    TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularHollowPrismInfThinWalls.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularHollowPrismInfThinWallsParameters;
-
-
-RectangularHollowPrismInfThinWallsModel :: RectangularHollowPrismInfThinWallsModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularHollowPrismInfThinWallsModel :: operator()(double q) {
-
-    double dp[7];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = sldPipe();
-    dp[5] = sldSolv();
-    dp[6] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // Perform the computation, with all weight points
-    double sum = 0.0;
-    double norm = 0.0;
-    double vol = 0.0;
-
-    // Loop over short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-        	    // Un-normalize  by volume = 2*a*b + 2*a*c + 2*b*c
-
-	            double a = dp[1];
-	            double b = dp[1] * dp[2];
-	            double c = dp[1] * dp[3];
-                double vol_i = (2.0*a*b) + (2.0*a*c) + (2.0*b*c);
-
-        	    sum += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           RectangularHollowPrismInfThinWalls(dp, q) *
-                       vol_i;
-
-        	    //Find average volume (ABC)
-
-        	    vol += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-                       vol_i;
-
-        	    norm += weights_short_side[i].weight *
-                	    weights_b2a_ratio[j].weight *
-                	    weights_c2a_ratio[k].weight;
-            }
-        }                    
-    }
-
-    if (vol != 0.0 && norm != 0.0) {
-        //Re-normalize by avg volume
-        sum = sum/(vol/norm);}
-
-    return sum/norm + 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 RectangularHollowPrismInfThinWallsModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularHollowPrismInfThinWallsModel :: evaluate_rphi(double q, double phi) {
-    double qx = q*cos(phi);
-    double qy = q*sin(phi);
-    return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RectangularHollowPrismInfThinWallsModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularHollowPrismInfThinWallsModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/RectangularPrism.cpp
===================================================================
--- src/sas/models/c_extension/c_models/RectangularPrism.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/**
-    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
- *
- *    TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <iostream>
-using namespace std;
-
-extern "C" {
-    #include "libCylinder.h"
-    #include "libStructureFactor.h"
-    #include "libmultifunc/libfunc.h"
-}
-#include "RectangularPrism.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_side;
-    double b2a_ratio;
-    double c2a_ratio;
-    double sldPipe;
-    double sldSolv;
-    double background;
-} RectangularPrismParameters;
-
-
-RectangularPrismModel :: RectangularPrismModel() {
-    scale      = Parameter(1.0);
-    short_side = Parameter(35.0, true);
-    short_side.set_min(1.0);
-    b2a_ratio   = Parameter(1.0, true);
-    b2a_ratio.set_min(1.0);
-    c2a_ratio   = Parameter(1.0, true);
-    c2a_ratio.set_min(1.0);
-    sldPipe   = Parameter(6.3e-6);
-    sldSolv   = Parameter(1.0e-6);
-    background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double RectangularPrismModel :: operator()(double q) {
-
-    double dp[7];
-
-    // Fill parameter array for IGOR library
-    // Add the background after averaging
-    dp[0] = scale();
-    dp[1] = short_side();
-    dp[2] = b2a_ratio();
-    dp[3] = c2a_ratio();
-    dp[4] = sldPipe();
-    dp[5] = sldSolv();
-    dp[6] = 0.0;
-
-    // Get the dispersion points for a
-    vector<WeightPoint> weights_short_side;
-    short_side.get_weights(weights_short_side);
-
-    // Get the dispersion points for b/a ratio
-    vector<WeightPoint> weights_b2a_ratio;
-    b2a_ratio.get_weights(weights_b2a_ratio);
-
-    // Get the dispersion points for c/a ratio
-    vector<WeightPoint> weights_c2a_ratio;
-    c2a_ratio.get_weights(weights_c2a_ratio);
-
-    // Perform the computation, with all weight points
-    double sum = 0.0;
-    double norm = 0.0;
-    double vol = 0.0;
-
-    // Loop over short_side weight points
-    for (int i=0; i < (int)weights_short_side.size(); i++) {
-
-        dp[1] = weights_short_side[i].value;
-
-        // Loop over b/a ratios
-        for (int j=0; j < (int)weights_b2a_ratio.size(); j++) {
-
-            dp[2] = weights_b2a_ratio[j].value;
-
-            // Loop over c/a ratios
-            for (int k=0; k < (int)weights_c2a_ratio.size(); k++) {
-
-                dp[3] = weights_c2a_ratio[k].value;
-
-        	    // Un-normalize  by volume = a * (a * b/a) * (a * c/a)
-                double vol_i = dp[1] * dp[1] * dp[2] * dp[1] * dp[3];
-
-        	    sum += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           RectangularPrism(dp, q) *
-        	           vol_i;
-
-        	    //Find average volume (ABC)
-
-        	    vol += weights_short_side[i].weight *
-        	           weights_b2a_ratio[j].weight *
-        	           weights_c2a_ratio[k].weight *
-        	           vol_i;
-
-        	    norm += weights_short_side[i].weight *
-                	    weights_b2a_ratio[j].weight *
-                	    weights_c2a_ratio[k].weight;
-            }
-        }                    
-    }
-
-    if (vol != 0.0 && norm != 0.0) {
-        //Re-normalize by avg volume
-        sum = sum/(vol/norm);}
-
-    return sum/norm + 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 RectangularPrismModel :: operator()(double qx, double qy) {
-    return 1.0;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RectangularPrismModel :: evaluate_rphi(double q, double phi) {
-    double qx = q*cos(phi);
-    double qy = q*sin(phi);
-    return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RectangularPrismModel :: calculate_ER() {
-    return 1.0;
-
-}
-double RectangularPrismModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/SquareWell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/SquareWell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/**
-	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 "SquareWell.h"
-
-extern "C" {
-#include "libStructureFactor.h"
-}
-
-SquareWellStructure :: SquareWellStructure() {
-  effect_radius      = Parameter(50.0, true);
-  effect_radius.set_min(0.0);
-  volfraction = Parameter(0.04, true);
-  volfraction.set_min(0.0);
-  welldepth   = Parameter(1.50);
-  wellwidth  = Parameter(1.20);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SquareWellStructure :: operator()(double q) {
-  double dp[4];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = effect_radius();
-  dp[1] = volfraction();
-  dp[2] = welldepth();
-  dp[3] = wellwidth();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  effect_radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[0] = weights_rad[i].value;
-
-    sum += weights_rad[i].weight
-        * SquareWellStruct(dp, q);
-    norm += weights_rad[i].weight;
-  }
-  return sum/norm ;
-}
-
-/**
- * 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 SquareWellStructure :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SquareWellStructure :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SquareWellStructure :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double SquareWellStructure :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/StickyHS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/StickyHS.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,112 +1,0 @@
-/**
-	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
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "StickyHS.h"
-
-extern "C" {
-	#include "libStructureFactor.h"
-}
-
-StickyHSStructure :: StickyHSStructure() {
-	effect_radius      = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	volfraction = Parameter(0.10, true);
-	volfraction.set_min(0.0);
-	perturb = Parameter(0.05, true);
-	perturb.set_min(0.0);
-	stickiness = Parameter(0.20, true);;
-	stickiness.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double StickyHSStructure :: operator()(double q) {
-	double dp[4];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = effect_radius();
-	dp[1] = volfraction();
-	dp[2] = perturb();
-	dp[3] = stickiness();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	effect_radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[0] = weights_rad[i].value;
-
-		sum += weights_rad[i].weight
-				* StickyHS_Struct(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm ;
-}
-
-/**
- * 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 StickyHSStructure :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double StickyHSStructure :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double StickyHSStructure :: calculate_ER() {
-//NOT implemented yet!!!
-  return 0.0;
-}
-double StickyHSStructure :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/TwoYukawa.cpp
===================================================================
--- src/sas/models/c_extension/c_models/TwoYukawa.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/**
-	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>
-//#include <iostream>
-using namespace std;
-#include "TwoYukawa.h"
-
-extern "C" {
-#include "2Y_TwoYukawa.h"
-}
-
-TwoYukawaModel :: TwoYukawaModel() {
-	// Model parameters
-	volfraction = Parameter(0.2, true);
-	effect_radius = Parameter(50.0, true);
-	effect_radius.set_min(0.0);
-	scale_K1 = Parameter(6.0);
-	decayConst_Z1 = Parameter(10.0);
-	scale_K2 = Parameter(-1.0);
-	decayConst_Z2 = Parameter(2.0); 
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double TwoYukawaModel :: operator()(double q) 
-{
-  double dp[6];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = volfraction();
-  dp[1] = effect_radius();
-  dp[2] = scale_K1();
-  dp[3] = decayConst_Z1();
-  dp[4] = scale_K2();
-  dp[5] = decayConst_Z2();
-  
-  double ZERO = 1.0e-24;
-  if (fabs(dp[2]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[3]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[4]) < 0.001){
-  	return ZERO;
-  	}
-  if (fabs(dp[5]) < 0.001){
-  	return ZERO;
-  	}
-  	
-  double a, b, c1, c2, d1, d2;
-  int check = 1;
-  double x_in = q * dp[1] *2.0;
-  int ok = 0;
-  
-  ok = TY_SolveEquations(dp[3], dp[5], dp[2], dp[4], dp[0], &a, &b, &c1, &c2, &d1, &d2, 0);
-  if (ok > 0 ){
-	//check = TY_CheckSolution(dp[3], dp[5], dp[2], dp[4], dp[0], &a, &b, &c1, &c2, &d1, &d2);
-    if (check > 0){
-    	return SqTwoYukawa(x_in, dp[3], dp[5], dp[2], dp[4], dp[0], a, b, c1, c2, d1, d2);
-    }
-    else{
-    	return ZERO;
-    }
-  }
-  else{
-     return ZERO;
-  }
-}
-
-/**
- * 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 TwoYukawaModel :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double TwoYukawaModel :: evaluate_rphi(double q, double phi)
-{
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double TwoYukawaModel :: calculate_ER()
-{
-  return effect_radius();
-}
-double TwoYukawaModel :: calculate_VR()
-{
-  return 1.0;
-}
-
Index: src/sas/models/c_extension/c_models/barbell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/barbell.cpp	(revision db46d13d6ad925ea6da0c9aa178a62e3dc325cdb)
+++ 	(revision )
@@ -1,413 +1,0 @@
-/**
-	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;
-
-extern "C" {
-	#include "libCylinder.h"
-  #include "GaussWeights.h"
-	#include "barbell.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double rad_bar;
-    double len_bar;
-    double rad_bell;
-    double sld_barbell;
-    double sld_solv;
-    double background;
-    double theta;
-    double phi;
-} BarBellParameters;
-
-BarBellModel :: BarBellModel() {
-	scale      = Parameter(1.0);
-	rad_bar		= Parameter(20.0);
-	rad_bar.set_min(0.0);
-	len_bar     = Parameter(400.0, true);
-	len_bar.set_min(0.0);
-	rad_bell = Parameter(40.0);
-	rad_bell.set_min(0.0);
-	sld_barbell   = Parameter(1.0e-6);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-}
-
-double barbell2d_kernel(double dp[], double q, double alpha) {
-  int j;
-  double Pi;
-  double scale,contr,bkg,sldc,slds;
-  double len,rad,hDist,endRad;
-  int nordj=76;
-  double zi=alpha,yyy,answer;     //running tally of integration
-  double summj,vaj,vbj,zij;     //for the inner integration
-  double arg1,arg2,inner,be;
-
-
-  scale = dp[0];
-  rad = dp[1];
-  len = dp[2];
-  endRad = dp[3];
-  sldc = dp[4];
-  slds = dp[5];
-  bkg = dp[6];
-
-  hDist = sqrt(fabs(endRad*endRad-rad*rad));    //by definition for this model
-
-  contr = sldc-slds;
-
-  Pi = 4.0*atan(1.0);
-  vaj = -1.0*hDist/endRad;
-  vbj = 1.0;    //endpoints of inner integral
-
-  summj=0.0;
-
-  for(j=0;j<nordj;j++) {
-    //20 gauss points for the inner integral
-    zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;    //the "t" dummy
-    yyy = Gauss76Wt[j] * Dumb_kernel(dp,q,zij,zi);    //uses the same Kernel as the Dumbbell, here L>0
-    summj += yyy;
-  }
-  //now calculate the value of the inner integral
-  inner = (vbj-vaj)/2.0*summj;
-  inner *= 4.0*Pi*endRad*endRad*endRad;
-
-  //now calculate outer integrand
-  arg1 = q*len/2.0*cos(zi);
-  arg2 = q*rad*sin(zi);
-  yyy = inner;
-
-  if(arg2 == 0) {
-    be = 0.5;
-  } else {
-    be = NR_BessJ1(arg2)/arg2;
-  }
-
-  if(arg1 == 0.0) {   //limiting value of sinc(0) is 1; sinc is not defined in math.h
-    yyy += Pi*rad*rad*len*2.0*be;
-  } else {
-    yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-  }
-  yyy *= yyy;   //sin(zi);
-  answer = yyy;
-
-
-  answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);   //divide by volume
-  answer *= 1.0e8;    //convert to cm^-1
-  answer *= contr*contr;
-  answer *= scale;
-  answer += bkg;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, cos_val;
-  double answer;
-  double dp[7];
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-
-  dp[0] = pars->scale;
-  dp[1] = pars->rad_bar;
-  dp[2] = pars->len_bar;
-  dp[3] = pars->rad_bell;
-  dp[4] = pars->sld_barbell;
-  dp[5] = pars->sld_solv;
-  dp[6] = pars->background;
-
-
-  //double Pi = 4.0*atan(1.0);
-    // Cylinder orientation
-    cyl_x = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-
-    // q vector
-    //q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-      printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-      return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-  alpha = acos( cos_val );
-
-  answer = barbell2d_kernel(dp, q, alpha);
-
-
-  return answer;
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-static double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy){
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return barbell_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BarBellModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rad_bar();
-	dp[2] = len_bar();
-	dp[3] = rad_bell();
-	dp[4] = sld_barbell();
-	dp[5] = sld_solv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_bar;
-	rad_bar.get_weights(weights_rad_bar);
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_bar;
-	len_bar.get_weights(weights_len_bar);
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_bell;
-	rad_bell.get_weights(weights_rad_bell);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double pi,hDist,result;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_bar.size(); i++) {
-		dp[1] = weights_rad_bar[i].value;
-		for(size_t j=0; j<weights_len_bar.size(); j++) {
-			dp[2] = weights_len_bar[j].value;
-			for(size_t k=0; k<weights_rad_bell.size(); k++) {
-				dp[3] = weights_rad_bell[k].value;
-
-				//Un-normalize SphereForm by volume
-				hDist = sqrt(fabs(dp[3]*dp[3]-dp[1]*dp[1]));
-				vol_i = pi*dp[1]*dp[1]*dp[2]+2.0*pi*(2.0*dp[3]*dp[3]*dp[3]/3.0
-								+dp[3]*dp[3]*hDist-hDist*hDist*hDist/3.0);
-				result =  Barbell(dp, q) * vol_i;
-				// This FIXES a singualrity the kernel in libigor.
-				if ( result == INFINITY || result == NAN){
-					result = 0.0;
-				}
-				sum += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight
-					* result;
-				//Find average volume
-				vol += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight
-					* vol_i;
-
-				norm += weights_rad_bar[i].weight*weights_len_bar[j].weight*weights_rad_bell[k].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + 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 BarBellModel :: operator()(double qx, double qy) {
-  BarBellParameters dp;
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp.scale = scale();
-	dp.rad_bar = rad_bar();
-	dp.len_bar = len_bar();
-	dp.rad_bell = rad_bell();
-	dp.sld_barbell = sld_barbell();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-	dp.theta = theta();
-	dp.phi = phi();
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_bar;
-	rad_bar.get_weights(weights_rad_bar);
-
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_bar;
-	len_bar.get_weights(weights_len_bar);
-
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_bell;
-	rad_bell.get_weights(weights_rad_bell);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi,hDist;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_bar.size(); i++) {
-		dp.rad_bar = weights_rad_bar[i].value;
-		for(size_t j=0; j<weights_len_bar.size(); j++) {
-			dp.len_bar = weights_len_bar[j].value;
-			for(size_t k=0; k<weights_rad_bell.size(); k++) {
-				dp.rad_bell = weights_rad_bell[k].value;
-				// Average over theta distribution
-				for(size_t l=0; l< weights_theta.size(); l++) {
-					dp.theta = weights_theta[l].value;
-					// Average over phi distribution
-					for(size_t m=0; m< weights_phi.size(); m++) {
-						dp.phi = weights_phi[m].value;
-						//Un-normalize Form by volume
-						hDist = -sqrt(fabs(dp.rad_bell*dp.rad_bell-dp.rad_bar*dp.rad_bar));
-						vol_i = pi*dp.rad_bar*dp.rad_bar*dp.len_bar+2.0*pi/3.0*((dp.rad_bell-hDist)*(dp.rad_bell-hDist)*
-										(2*dp.rad_bell+hDist));
-						double _ptvalue = weights_rad_bar[i].weight
-											* weights_len_bar[j].weight
-											* weights_rad_bell[k].weight
-											* weights_theta[l].weight
-											* weights_phi[m].weight
-											* vol_i
-											* barbell_analytical_2DXY(&dp, qx, qy);
-											//* output;
-											//* pow(weights_rad[i].value,3.0);
-
-						// Consider when there is infinte or nan.
-						if ( _ptvalue == INFINITY || _ptvalue == NAN){
-							_ptvalue = 0.0;
-						}
-						if (weights_theta.size()>1) {
-							_ptvalue *= fabs(cos(weights_theta[l].value*pi/180.0));
-						}
-						sum += _ptvalue;
-						// This model dose not need the volume of spheres correction!!!
-						//Find average volume
-						vol += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight
-								* vol_i;
-						//Find norm for volume
-						norm_vol += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight;
-
-						norm += weights_rad_bar[i].weight
-								* weights_len_bar[j].weight
-								* weights_rad_bell[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight;
-					}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BarBellModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BarBellModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
-/**
- * Function to calculate volf_ratio for shell/tot
- * @return: volf_ratio value
- */
-double BarBellModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/bcc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/bcc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,342 +1,0 @@
-/**
-	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 "bcc.h"
-
-extern "C" {
-	#include "libSphere.h"
-}
-
-// Convenience structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-
-} BCParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double bc_analytical_2D_scaled(BCParameters *pars, double q, double q_x, double q_y) {
-  double b3_x, b3_y, b1_x, b1_y, b2_x, b2_y; //b3_z,
-  double q_z;
-  double cos_val_b3, cos_val_b2, cos_val_b1;
-  double a1_dot_q, a2_dot_q,a3_dot_q;
-  double answer;
-  double Pi = 4.0*atan(1.0);
-  double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2;
-
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-  double psi = pars->psi * pi/180.0;
-
-  double dp[5];
-  dp[0] = 1.0;
-  dp[1] = pars->radius;
-  dp[2] = pars->sldSph;
-  dp[3] = pars->sldSolv;
-  dp[4] = 0.0;
-
-  aa = pars->dnn;
-  Da = pars->d_factor*aa;
-  qDa_2 = pow(q*Da,2.0);
-
-  //the occupied volume of the lattice
-  latticeScale = 2.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa/sqrt(3.0/4.0),3.0);
-  // q vector
-  q_z = 0.0; // for SANS; assuming qz is negligible
-  /// Angles here are respect to detector coordinate
-  ///  instead of against q coordinate(PRB 36(46), 3(6), 1754(3854))
-    // b3 axis orientation
-    b3_x = cos(theta) * cos(phi);
-    b3_y = sin(theta);
-    //b3_z = -cos(theta) * sin(phi);
-    cos_val_b3 =  b3_x*q_x + b3_y*q_y;// + b3_z*q_z;
-
-    //alpha = acos(cos_val_b3);
-    // b1 axis orientation
-    b1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-    b1_y = sin(psi)*cos(theta);
-    cos_val_b1 = b1_x*q_x + b1_y*q_y;
-    // b2 axis orientation
-    b2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  	b2_y = cos(theta)*cos(psi);
-    cos_val_b2 = b2_x*q_x + b2_y*q_y;
-    
-    // The following test should always pass
-    if (fabs(cos_val_b3)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b3 = 1.0;
-    }
-    if (fabs(cos_val_b2)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b2 = 1.0;
-    }
-    if (fabs(cos_val_b1)>1.0) {
-      //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-      cos_val_b1 = 1.0;
-    }
-    // Compute the angle btw vector q and the a3 axis
-    a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1-cos_val_b3);
-
-    // a1 axis
-    a1_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b2-cos_val_b1);
-
-    // a2 axis
-    a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1-cos_val_b2);
-
-
-    // Get Fkq and Fkq_2
-    Fkq = exp(-0.5*pow(Da/aa,2.0)*(a1_dot_q*a1_dot_q+a2_dot_q*a2_dot_q+a3_dot_q*a3_dot_q));
-    Fkq_2 = Fkq*Fkq;
-    // Call Zq=Z1*Z2*Z3
-    Zq = (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a1_dot_q)+Fkq_2);
-    Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2);
-    Zq *= (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2);
-
-  // Use SphereForm directly from libigor
-  answer = SphereForm(dp,q)*Zq;
-
-  //consider scales
-  answer *= latticeScale * pars->scale;
-
-  // This FIXES a singualrity the kernel in libigor.
-  if ( answer == INFINITY || answer == NAN){
-    answer = 0.0;
-  }
-
-  // add background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static double bc_analytical_2DXY(BCParameters *pars, double qx, double qy){
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return bc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-BCCrystalModel :: BCCrystalModel() {
-	scale      = Parameter(1.0);
-	dnn		= Parameter(220.0);
-	d_factor = Parameter(0.06);
-	radius     = Parameter(40.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(3.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-	psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BCCrystalModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = dnn();
-	dp[2] = d_factor();
-	dp[3] = radius();
-	dp[4] = sldSph();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double result;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[3] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		result = BCC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-		// This FIXES a singualrity in the kernel in libigor.
-		if ( result == INFINITY || result == NAN){
-			result = 0.0;
-		}
-		sum += weights_rad[i].weight
-			* result;
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + 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 BCCrystalModel :: operator()(double qx, double qy) {
-	BCParameters dp;
-	dp.scale      = scale();
-	dp.dnn   = dnn();
-	dp.d_factor   = d_factor();
-	dp.radius  = radius();
-	dp.sldSph   = sldSph();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-	dp.psi    = psi();
-	double pi = 4.0*atan(1.0);
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_psi;
-	psi.get_weights(weights_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-		// Average over theta distribution
-		for(size_t j=0; j< weights_theta.size(); j++) {
-			dp.theta = weights_theta[j].value;
-			// Average over phi distribution
-			for(size_t k=0; k< weights_phi.size(); k++) {
-				dp.phi = weights_phi[k].value;
-				// Average over phi distribution
-				for(size_t l=0; l< weights_psi.size(); l++) {
-					dp.psi = weights_psi[l].value;
-					//Un-normalize SphereForm by volume
-					double _ptvalue = weights_rad[i].weight
-										* weights_theta[j].weight
-										* weights_phi[k].weight
-										* weights_psi[l].weight
-										* bc_analytical_2DXY(&dp, qx, qy);
-										//* pow(weights_rad[i].value,3.0);
-					// Consider when there is infinity or nan.
-					// Actual value for this singular point are typically zero.
-					if ( _ptvalue == INFINITY || _ptvalue == NAN){
-						_ptvalue = 0.0;
-					}
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(cos(weights_theta[j].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					// This model dose not need the volume of spheres correction!!!
-					norm += weights_rad[i].weight
-							* weights_theta[j].weight
-							* weights_phi[k].weight
-							* weights_psi[l].weight;
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BCCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BCCrystalModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BCCrystalModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
-double BCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/binaryHS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/binaryHS.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/**
-	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 "binaryHS.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-BinaryHSModel :: BinaryHSModel() {
-
-  l_radius     = Parameter(160.0, true);
-  l_radius.set_min(0.0);
-  s_radius    = Parameter(25.0, true);
-  s_radius.set_min(0.0);
-  vol_frac_ls  = Parameter(0.2);
-  vol_frac_ss  = Parameter(0.1);
-  ls_sld      = Parameter(3.5e-6);
-  ss_sld     = Parameter(5e-7);
-  solvent_sld   = Parameter(6.36e-6);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BinaryHSModel :: operator()(double q) {
-  double dp[8];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = l_radius();
-  dp[1] = s_radius();
-  dp[2] = vol_frac_ls();
-  dp[3] = vol_frac_ss();
-  dp[4] = ls_sld();
-  dp[5] = ss_sld();
-  dp[6] = solvent_sld();
-  dp[7] = 0.0;
-
-
-  // Get the dispersion points for the large radius
-  vector<WeightPoint> weights_l_radius;
-  l_radius.get_weights(weights_l_radius);
-
-  // Get the dispersion points for the small radius
-  vector<WeightPoint> weights_s_radius;
-  s_radius.get_weights(weights_s_radius);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over larger radius weight points
-  for(int i=0; i< (int)weights_l_radius.size(); i++) {
-    dp[0] = weights_l_radius[i].value;
-
-    // Loop over small radius weight points
-    for(int j=0; j< (int)weights_s_radius.size(); j++) {
-      dp[1] = weights_s_radius[j].value;
-
-
-      sum += weights_l_radius[i].weight *weights_s_radius[j].weight * BinaryHS(dp, q);
-      norm += weights_l_radius[i].weight *weights_s_radius[j].weight;
-    }
-  }
-  return sum/norm + 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 BinaryHSModel :: 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 vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BinaryHSModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BinaryHSModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double BinaryHSModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/binaryHS_PSF11.cpp
===================================================================
--- src/sas/models/c_extension/c_models/binaryHS_PSF11.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,148 +1,0 @@
-/**
-	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;
-
-extern "C" {
-	#include "libSphere.h"
-}
-
-class BinaryHSPSF11Model{
-public:
-  // Model parameters
-  Parameter l_radius;
-  Parameter s_radius;
-  Parameter vol_frac_ls;
-  Parameter vol_frac_ss;
-  Parameter ls_sld;
-  Parameter ss_sld;
-  Parameter solvent_sld;
-  Parameter background;
-
-  //Constructor
-  BinaryHSPSF11Model();
-
-  //Operators to get I(Q)
-  double operator()(double q);
-  double operator()(double qx , double qy);
-  double calculate_ER();
-  double calculate_VR();
-  double evaluate_rphi(double q, double phi);
-};
-
-BinaryHSPSF11Model :: BinaryHSPSF11Model() {
-
-	l_radius     = Parameter(160.0, true);
-	l_radius.set_min(0.0);
-	s_radius    = Parameter(25.0, true);
-	s_radius.set_min(0.0);
-	vol_frac_ls  = Parameter(0.2);
-	vol_frac_ss  = Parameter(0.1);
-	ls_sld      = Parameter(3.5e-6);
-	ss_sld     = Parameter(5e-7);
-	solvent_sld   = Parameter(6.36e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double BinaryHSPSF11Model :: operator()(double q) {
-	double dp[8];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = l_radius();
-	dp[1] = s_radius();
-	dp[2] = vol_frac_ls();
-	dp[3] = vol_frac_ss();
-	dp[4] = ls_sld();
-	dp[5] = ss_sld();
-	dp[6] = solvent_sld();
-	dp[7] = 0.0;
-
-
-	// Get the dispersion points for the large radius
-	vector<WeightPoint> weights_l_radius;
-	l_radius.get_weights(weights_l_radius);
-
-	// Get the dispersion points for the small radius
-	vector<WeightPoint> weights_s_radius;
-	s_radius.get_weights(weights_s_radius);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over larger radius weight points
-	for(int i=0; i< (int)weights_l_radius.size(); i++) {
-		dp[0] = weights_l_radius[i].value;
-
-		// Loop over small radius weight points
-		for(int j=0; j< (int)weights_s_radius.size(); j++) {
-			dp[1] = weights_s_radius[j].value;
-
-
-			sum += weights_l_radius[i].weight *weights_s_radius[j].weight * BinaryHS_PSF11(dp, q);
-			norm += weights_l_radius[i].weight *weights_s_radius[j].weight;
-		}
-	}
-	return sum/norm + 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 BinaryHSPSF11Model :: 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 vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double BinaryHSPSF11Model :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double BinaryHSPSF11Model :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-double BinaryHSPSF11Model :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/c_models.cpp.template
===================================================================
--- src/sas/models/c_extension/c_models/c_models.cpp.template	(revision fd5ac0db8089df5bd882587f157d4bf317cfcf67)
+++ 	(revision )
@@ -1,198 +1,0 @@
-/** c_models
- *
- * Module containing all SAS model extensions
- *
- * @author   M.Doucet / UTK
- */
-#include <Python.h>
-#include <parameters.hh>
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sas
-#include "arrayobject.h"
-
-// [TAG_1]
-
-
-
-extern "C" {
-  void addDisperser(PyObject *module);
-}
-
-/**
- * Delete a dispersion model object
- */
-void del_dispersion_model(void *ptr){
-  DispersionModel * disp = static_cast<DispersionModel *>(ptr);
-  delete disp;
-  return;
-}
-
-/**
- * Create a dispersion model as a python object
- */
-PyObject * new_dispersion_model(PyObject *, PyObject *args) {
-  DispersionModel *disp = new DispersionModel();
-  return PyCObject_FromVoidPtr(disp, del_dispersion_model);
-}
-
-
-/**
- * Delete a lognormal dispersion model object
- */
-void del_lognormal_dispersion(void *ptr){
-  LogNormalDispersion * disp = static_cast<LogNormalDispersion *>(ptr);
-  delete disp;
-  return;
-}
-
-/**
- * Create a lognormal dispersion model as a python object
- */
-PyObject * new_lognormal_dispersion(PyObject *, PyObject *args) {
-  LogNormalDispersion *disp = new LogNormalDispersion();
-  return PyCObject_FromVoidPtr(disp, del_lognormal_dispersion);
-}
-
-/**
- * Delete a gaussian dispersion model object
- */
-void del_gaussian_dispersion(void *ptr){
-  GaussianDispersion * disp = static_cast<GaussianDispersion *>(ptr);
-  delete disp;
-  return;
-}
-
-/**
- * Create a gaussian dispersion model as a python object
- */
-PyObject * new_gaussian_dispersion(PyObject *, PyObject *args) {
-  GaussianDispersion *disp = new GaussianDispersion();
-  return PyCObject_FromVoidPtr(disp, del_gaussian_dispersion);
-}
-
-
-/**
- * Delete a rectangle dispersion model object
- */
-void del_rectangle_dispersion(void *ptr){
-  RectangleDispersion * disp = static_cast<RectangleDispersion *>(ptr);
-  delete disp;
-  return;
-}
-
-/**
- * Create a rectangle dispersion model as a python object
- */
-PyObject * new_rectangle_dispersion(PyObject *, PyObject *args) {
-  RectangleDispersion *disp = new RectangleDispersion();
-  return PyCObject_FromVoidPtr(disp, del_rectangle_dispersion);
-}
-
-
-/**
- * Delete a schulz dispersion model object
- */
-void del_schulz_dispersion(void *ptr){
-  SchulzDispersion * disp = static_cast<SchulzDispersion *>(ptr);
-  delete disp;
-  return;
-}
-/**
- * Create a schulz dispersion model as a python object
- */
-PyObject * new_schulz_dispersion(PyObject *, PyObject *args) {
-  SchulzDispersion *disp = new SchulzDispersion();
-  return PyCObject_FromVoidPtr(disp, del_schulz_dispersion);
-}
-
-
-/**
- * Delete an array dispersion model object
- */
-void del_array_dispersion(void *ptr){
-  ArrayDispersion * disp = static_cast<ArrayDispersion *>(ptr);
-  delete disp;
-  return;
-}
-
-/**
- * Create an array dispersion model as a python object
- */
-PyObject * new_array_dispersion(PyObject *, PyObject *args) {
-  ArrayDispersion *disp = new ArrayDispersion();
-  return PyCObject_FromVoidPtr(disp, del_array_dispersion);
-}
-
-#define INVECTOR(obj,buf,len)										\
-    do { \
-      int err = PyObject_AsReadBuffer(obj, (const void **)(&buf), &len); \
-      if (err < 0) return NULL; \
-      len /= sizeof(*buf); \
-    } while (0)
-
-/**
- * Sets weights from a numpy array
- */
-PyObject * set_weights(PyObject *, PyObject *args) {
-  PyObject *val_obj;
-  PyObject *wei_obj;
-  PyObject *disp;
-  Py_ssize_t nval;
-  Py_ssize_t nwei;
-  double *values;
-  double *weights;
-  //int i;
-
-  if (!PyArg_ParseTuple(args, "OOO", &disp, &val_obj, &wei_obj)) return NULL;
-  INVECTOR(val_obj, values, nval);
-  INVECTOR(wei_obj, weights, nwei);
-
-  // Sanity check
-  if(nval!=nwei) return NULL;
-
-  // Set the array pointers
-  void *temp = PyCObject_AsVoidPtr(disp);
-  DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
-  dispersion->set_weights(nval, values, weights);
-
-  return Py_BuildValue("i",1);
-}
-
-
-
-/**
- * Define empty module
- */
-static PyMethodDef module_methods[] = {
-    {"new_dispersion_model", (PyCFunction)new_dispersion_model     , METH_VARARGS,
-        "Create a new DispersionModel object"},
-        {"new_gaussian_model",   (PyCFunction)new_gaussian_dispersion, METH_VARARGS,
-            "Create a new GaussianDispersion object"},
-            {"new_rectangle_model",   (PyCFunction)new_rectangle_dispersion, METH_VARARGS,
-                "Create a new RectangleDispersion object"},
-                {"new_lognormal_model",   (PyCFunction)new_lognormal_dispersion, METH_VARARGS,
-                    "Create a new LogNormalDispersion object"},
-                    {"new_schulz_model",   (PyCFunction)new_schulz_dispersion, METH_VARARGS,
-                        "Create a new SchulzDispersion object"},
-                        {"new_array_model",      (PyCFunction)new_array_dispersion  , METH_VARARGS,
-                            "Create a new ArrayDispersion object"},
-                            {"set_dispersion_weights",(PyCFunction)set_weights  , METH_VARARGS,
-                                "Create the dispersion weight arrays for an Array Dispersion object"},
-                                {NULL}
-};
-
-
-#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
-#define PyMODINIT_FUNC void
-#endif
-PyMODINIT_FUNC
-initc_models(void)
-{
-  PyObject* m;
-
-  m = Py_InitModule3("c_models", module_methods,
-      "C extension module for SAS scattering models.");
-  import_array();
-
-  // [TAG_2]
-
-}
Index: src/sas/models/c_extension/c_models/capcyl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/capcyl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,406 +1,0 @@
-/**
-	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;
-
-extern "C" {
-  #include "GaussWeights.h"
-	#include "libCylinder.h"
-}
-#include "capcyl.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double rad_cyl;
-    double len_cyl;
-    double rad_cap;
-    double sld_capcyl;
-    double sld_solv;
-    double background;
-    double theta;
-    double phi;
-} CapCylParameters;
-
-CappedCylinderModel :: CappedCylinderModel() {
-	scale      = Parameter(1.0);
-	rad_cyl		= Parameter(20.0);
-	rad_cyl.set_min(0.0);
-	len_cyl     = Parameter(400.0, true);
-	len_cyl.set_min(0.0);
-	rad_cap = Parameter(40.0);
-	rad_cap.set_min(0.0);
-	sld_capcyl  = Parameter(1.0e-6);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-	theta  = Parameter(0.0, true);
-	phi    = Parameter(0.0, true);
-}
-
-static double capcyl2d_kernel(double dp[], double q, double alpha) {
-  int j;
-  double Pi;
-  double scale,contr,bkg,sldc,slds;
-  double len,rad,hDist,endRad;
-  int nordj=76;
-  double zi=alpha,yyy,answer;     //running tally of integration
-  double summj,vaj,vbj,zij;     //for the inner integration
-  double arg1,arg2,inner,be;
-
-
-  scale = dp[0];
-  rad = dp[1];
-  len = dp[2];
-  endRad = dp[3];
-  sldc = dp[4];
-  slds = dp[5];
-  bkg = dp[6];
-
-  hDist = -1.0*sqrt(fabs(endRad*endRad-rad*rad));   //by definition for this model
-
-  contr = sldc-slds;
-
-  Pi = 4.0*atan(1.0);
-  vaj = -1.0*hDist/endRad;
-  vbj = 1.0;    //endpoints of inner integral
-
-  summj=0.0;
-
-  for(j=0;j<nordj;j++) {
-    //20 gauss points for the inner integral
-    zij = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;    //the "t" dummy
-    yyy = Gauss76Wt[j] * ConvLens_kernel(dp,q,zij,zi);    //uses the same Kernel as the Dumbbell, here L>0
-    summj += yyy;
-  }
-  //now calculate the value of the inner integral
-  inner = (vbj-vaj)/2.0*summj;
-  inner *= 4.0*Pi*endRad*endRad*endRad;
-
-  //now calculate outer integrand
-  arg1 = q*len/2.0*cos(zi);
-  arg2 = q*rad*sin(zi);
-  yyy = inner;
-
-  if(arg2 == 0) {
-    be = 0.5;
-  } else {
-    be = NR_BessJ1(arg2)/arg2;
-  }
-
-  if(arg1 == 0.0) {   //limiting value of sinc(0) is 1; sinc is not defined in math.h
-    yyy += Pi*rad*rad*len*2.0*be;
-  } else {
-    yyy += Pi*rad*rad*len*sin(arg1)/arg1*2.0*be;
-  }
-  yyy *= yyy;   //sin(zi);
-  answer = yyy;
-
-
-  answer /= Pi*rad*rad*len + 2.0*Pi*(2.0*endRad*endRad*endRad/3.0+endRad*endRad*hDist-hDist*hDist*hDist/3.0);   //divide by volume
-  answer *= 1.0e8;    //convert to cm^-1
-  answer *= contr*contr;
-  answer *= scale;
-  answer += bkg;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double capcyl_analytical_2D_scaled(CapCylParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, cos_val;
-  double answer;
-  double dp[7];
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->theta * pi/180.0;
-  double phi = pars->phi * pi/180.0;
-
-  dp[0] = pars->scale;
-  dp[1] = pars->rad_cyl;
-  dp[2] = pars->len_cyl;
-  dp[3] = pars->rad_cap;
-  dp[4] = pars->sld_capcyl;
-  dp[5] = pars->sld_solv;
-  dp[6] = pars->background;
-
-
-  //double Pi = 4.0*atan(1.0);
-    // Cylinder orientation
-    cyl_x = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-
-    // q vector
-    //q_z = 0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-      printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-      return 0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-  alpha = acos( cos_val );
-
-  answer = capcyl2d_kernel(dp, q, alpha);
-
-
-  return answer;
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the BarBell
- * @param q: q-value
- * @return: function value
- */
-static double capcyl_analytical_2DXY(CapCylParameters *pars, double qx, double qy){
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return capcyl_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CappedCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rad_cyl();
-	dp[2] = len_cyl();
-	dp[3] = rad_cap();
-	dp[4] = sld_capcyl();
-	dp[5] = sld_solv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the rad_cyl
-	vector<WeightPoint> weights_rad_cyl;
-	rad_cyl.get_weights(weights_rad_cyl);
-	// Get the dispersion points for the len_cyl
-	vector<WeightPoint> weights_len_cyl;
-	len_cyl.get_weights(weights_len_cyl);
-	// Get the dispersion points for the rad_cap
-	vector<WeightPoint> weights_rad_cap;
-	rad_cap.get_weights(weights_rad_cap);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-	double pi,hDist,result;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
-		dp[1] = weights_rad_cyl[i].value;
-		for(size_t j=0; j<weights_len_cyl.size(); j++) {
-			dp[2] = weights_len_cyl[j].value;
-			for(size_t k=0; k<weights_rad_cap.size(); k++) {
-				dp[3] = weights_rad_cap[k].value;
-
-				//Un-normalize SphereForm by volume
-				hDist = sqrt(fabs(dp[3]*dp[3]-dp[1]*dp[1]));
-				vol_i = pi*dp[1]*dp[1]*dp[2]+2.0*pi/3.0*((dp[3]-hDist)*(dp[3]-hDist)*
-								(2.0*dp[3]+hDist));
-				result =  CappedCylinder(dp, q) * vol_i;
-				// This FIXES a singualrity the kernel in libigor.
-				if ( result == INFINITY || result == NAN){
-					result = 0.0;
-				}
-				sum += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
-					* result;
-				//Find average volume
-				vol += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight
-					* vol_i;
-
-				norm += weights_rad_cyl[i].weight*weights_len_cyl[j].weight*weights_rad_cap[k].weight;
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + 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 CappedCylinderModel :: operator()(double qx, double qy) {
-	CapCylParameters dp;
-
-	dp.scale = scale();
-	dp.rad_cyl = rad_cyl();
-	dp.len_cyl = len_cyl();
-	dp.rad_cap = rad_cap();
-	dp.sld_capcyl = sld_capcyl();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-	dp.theta  = theta();
-	dp.phi    = phi();
-
-	// Get the dispersion points for the rad_bar
-	vector<WeightPoint> weights_rad_cyl;
-	rad_cyl.get_weights(weights_rad_cyl);
-
-	// Get the dispersion points for the len_bar
-	vector<WeightPoint> weights_len_cyl;
-	len_cyl.get_weights(weights_len_cyl);
-
-	// Get the dispersion points for the rad_bell
-	vector<WeightPoint> weights_rad_cap;
-	rad_cap.get_weights(weights_rad_cap);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	phi.get_weights(weights_phi);
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi,hDist;
-	double vol_i = 0.0;
-	pi = 4.0*atan(1.0);
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
-		dp.rad_cyl = weights_rad_cyl[i].value;
-		for(size_t j=0; j<weights_len_cyl.size(); j++) {
-			dp.len_cyl = weights_len_cyl[j].value;
-			for(size_t k=0; k<weights_rad_cap.size(); k++) {
-				dp.rad_cap = weights_rad_cap[k].value;
-				// Average over theta distribution
-				for(size_t l=0; l< weights_theta.size(); l++) {
-					dp.theta = weights_theta[l].value;
-					// Average over phi distribution
-					for(size_t m=0; m< weights_phi.size(); m++) {
-						dp.phi = weights_phi[m].value;
-						//Un-normalize Form by volume
-						hDist = sqrt(fabs(dp.rad_cap*dp.rad_cap-dp.rad_cyl*dp.rad_cyl));
-						vol_i = pi*dp.rad_cyl*dp.rad_cyl*dp.len_cyl+2.0*pi/3.0*((dp.rad_cap-hDist)*(dp.rad_cap-hDist)*
-										(2*dp.rad_cap+hDist));
-
-						double _ptvalue = weights_rad_cyl[i].weight
-											* weights_len_cyl[j].weight
-											* weights_rad_cap[k].weight
-											* weights_theta[l].weight
-											* weights_phi[m].weight
-											* vol_i
-											* capcyl_analytical_2DXY(&dp, qx, qy);
-											//* pow(weights_rad[i].value,3.0);
-						// Consider when there is infinte or nan.
-						if ( _ptvalue == INFINITY || _ptvalue == NAN){
-							_ptvalue = 0.0;
-						}
-						if (weights_theta.size()>1) {
-							_ptvalue *= fabs(cos(weights_theta[l].value*pi/180.0));
-						}
-						sum += _ptvalue;
-						// This model dose not need the volume of spheres correction!!!
-						//Find average volume
-						vol += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight
-								* vol_i;
-						//Find norm for volume
-						norm_vol += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight;
-
-						norm += weights_rad_cyl[i].weight
-								* weights_len_cyl[j].weight
-								* weights_rad_cap[k].weight
-								* weights_theta[l].weight
-								* weights_phi[m].weight;
-					}
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CappedCylinderModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CappedCylinderModel :: calculate_ER() {
-	//NOT implemented yet!!!
-	return 0.0;
-}
-double CappedCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/corefourshell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/corefourshell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,552 +1,0 @@
-/**
-	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 "corefourshell.h"
-
-extern "C" {
-	#include "libSphere.h"
-	#include "libmultifunc/libfunc.h"
-}
-
-typedef struct {
-  double scale;
-  double rad_core0;
-  double sld_core0;
-  double thick_shell1;
-  double sld_shell1;
-  double thick_shell2;
-  double sld_shell2;
-  double thick_shell3;
-  double sld_shell3;
-  double thick_shell4;
-  double sld_shell4;
-  double sld_solv;
-  double background;
-  double M0_sld_shell1;
-  double M_theta_shell1;
-  double M_phi_shell1;
-  double M0_sld_shell2;
-  double M_theta_shell2;
-  double M_phi_shell2;
-  double M0_sld_shell3;
-  double M_theta_shell3;
-  double M_phi_shell3;
-  double M0_sld_shell4;
-  double M_theta_shell4;
-  double M_phi_shell4;
-  double M0_sld_core0;
-  double M_theta_core0;
-  double M_phi_core0;
-  double M0_sld_solv;
-  double M_theta_solv;
-  double M_phi_solv;
-  double Up_frac_i;
-  double Up_frac_f;
-  double Up_theta;
-} CoreFourShellParameters;
-
-CoreFourShellModel :: CoreFourShellModel() {
-	scale      = Parameter(1.0);
-	rad_core0     = Parameter(60.0, true);
-	rad_core0.set_min(0.0);
-	sld_core0   = Parameter(6.4e-6);
-	thick_shell1     = Parameter(10.0, true);
-	thick_shell1.set_min(0.0);
-	sld_shell1   = Parameter(1.0e-6);
-	thick_shell2     = Parameter(10.0, true);
-	thick_shell2.set_min(0.0);
-	sld_shell2   = Parameter(2.0e-6);
-	thick_shell3     = Parameter(10.0, true);
-	thick_shell3.set_min(0.0);
-	sld_shell3   = Parameter(3.0e-6);
-	thick_shell4     = Parameter(10.0, true);
-	thick_shell4.set_min(0.0);
-	sld_shell4   = Parameter(4.0e-6);
-	sld_solv   = Parameter(6.4e-6);
-	background = Parameter(0.001);
-	M0_sld_shell1 = Parameter(0.0e-6);
-	M_theta_shell1 = Parameter(0.0);
-	M_phi_shell1 = Parameter(0.0);
-	M0_sld_shell2 = Parameter(0.0e-6);
-	M_theta_shell2 = Parameter(0.0);
-	M_phi_shell2 = Parameter(0.0);
-	M0_sld_shell3 = Parameter(0.0e-6);
-	M_theta_shell3 = Parameter(0.0);
-	M_phi_shell3 = Parameter(0.0);
-	M0_sld_shell4 = Parameter(0.0e-6);
-	M_theta_shell4 = Parameter(0.0);
-	M_phi_shell4 = Parameter(0.0);
-	M0_sld_core0 = Parameter(0.0e-6);
-	M_theta_core0 = Parameter(0.0);
-	M_phi_core0 = Parameter(0.0);
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0);
-	Up_frac_i = Parameter(0.5);
-	Up_frac_f = Parameter(0.5);
-	Up_theta = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreFourShellModel :: operator()(double q) {
-	double dp[13];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-
-	dp[0] = scale();
-	dp[1] = rad_core0();
-	dp[2] = sld_core0();
-	dp[3] = thick_shell1();
-	dp[4] = sld_shell1();
-	dp[5] = thick_shell2();
-	dp[6] = sld_shell2();
-	dp[7] = thick_shell3();
-	dp[8] = sld_shell3();
-	dp[9] = thick_shell4();
-	dp[10] = sld_shell4();
-	dp[11] = sld_solv();
-	dp[12] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp[3] = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp[5] = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp[7] = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp[9] = weights_s4[m].value;
-						//Un-normalize FourShell by volume
-						sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* FourShell(dp, q) * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-						//Find average volume
-						vol += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-
-						norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight;
-					}
-				}
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + 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
- */
-
-static double corefourshell_analytical_2D_scaled(CoreFourShellParameters *pars, double q, double q_x, double q_y) {
-	double dp[13];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-
-	dp[0] = pars->scale;
-	dp[1] = pars->rad_core0;
-	dp[2] = 0.0; //sld_core0;
-	dp[3] = pars->thick_shell1;
-	dp[4] = 0.0; //sld_shell1;
-	dp[5] = pars->thick_shell2;
-	dp[6] = 0.0; //sld_shell2;
-	dp[7] = pars->thick_shell3;
-	dp[8] = 0.0; //sld_shell3;
-	dp[9] = pars->thick_shell4;
-	dp[10] = 0.0; //sld_shell4;
-	dp[11] = 0.0; //sld_solv;
-	dp[12] = 0.0;
-
-    double sld_core0 = pars->sld_core0;
-    double sld_shell1 = pars->sld_shell1;
-	double sld_shell2 = pars->sld_shell2;
-	double sld_shell3 = pars->sld_shell3;
-	double sld_shell4 = pars->sld_shell4;
-	double sld_solv = pars->sld_solv;
-	double answer = 0.0;
-	double m_max0 = pars->M0_sld_core0;
-	double m_max_shell1 = pars->M0_sld_shell1;
-	double m_max_shell2 = pars->M0_sld_shell2;
-	double m_max_shell3 = pars->M0_sld_shell3;
-	double m_max_shell4 = pars->M0_sld_shell4;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max0 < 1.0e-32 && m_max_solv < 1.0e-32 && m_max_shell1 < 1.0e-32 && m_max_shell2 <
-						1.0e-32 && m_max_shell3 < 1.0e-32 && m_max_shell4 < 1.0e-32){
-		dp[2] = sld_core0;
-		dp[4] = sld_shell1;
-		dp[6] = sld_shell2;
-		dp[8] = sld_shell3;
-		dp[10] = sld_shell4;
-		dp[11] = sld_solv;
-		answer = FourShell(dp, q);
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi0 = pars->M_phi_core0;
-		double m_theta0 = pars->M_theta_core0;
-		double m_phi_shell1 = pars->M_phi_shell1;
-		double m_theta_shell1 = pars->M_theta_shell1;
-		double m_phi_shell2 = pars->M_phi_shell2;
-		double m_theta_shell2 = pars->M_theta_shell2;
-		double m_phi_shell3 = pars->M_phi_shell3;
-		double m_theta_shell3 = pars->M_theta_shell3;
-		double m_phi_shell4 = pars->M_phi_shell4;
-		double m_theta_shell4 = pars->M_theta_shell4;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld_core0;
-		polar_sld p_sld_shell1;
-		polar_sld p_sld_shell2;
-		polar_sld p_sld_shell3;
-		polar_sld p_sld_shell4;
-		polar_sld p_sld_solv;
-		//Find (b+m) slds
-		p_sld_core0 = cal_msld(1, qx, qy, sld_core0, m_max0, m_theta0, m_phi0,
-								in_spin, out_spin, s_theta);
-		p_sld_shell1 = cal_msld(1, qx, qy, sld_shell1, m_max_shell1, m_theta_shell1, m_phi_shell1,
-								in_spin, out_spin, s_theta);
-		p_sld_shell2 = cal_msld(1, qx, qy, sld_shell2, m_max_shell2, m_theta_shell2, m_phi_shell2,
-								in_spin, out_spin, s_theta);
-		p_sld_shell3 = cal_msld(1, qx, qy, sld_shell3, m_max_shell3, m_theta_shell3, m_phi_shell3,
-								in_spin, out_spin, s_theta);
-		p_sld_shell4 = cal_msld(1, qx, qy, sld_shell4, m_max_shell4, m_theta_shell4, m_phi_shell4,
-								in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv,
-						 		in_spin, out_spin, s_theta);
-		//up_up
-		if (in_spin > 0.0 && out_spin > 0.0){
-			dp[2] = p_sld_core0.uu;
-			dp[4] = p_sld_shell1.uu;
-			dp[6] = p_sld_shell2.uu;
-			dp[8] = p_sld_shell3.uu;
-			dp[10] = p_sld_shell4.uu;
-			dp[11] = p_sld_solv.uu;
-			answer += FourShell(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[2] = p_sld_core0.dd;
-			dp[4] = p_sld_shell1.dd;
-			dp[6] = p_sld_shell2.dd;
-			dp[8] = p_sld_shell3.dd;
-			dp[10] = p_sld_shell4.dd;
-			dp[11] = p_sld_solv.dd;
-			answer += FourShell(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[2] = p_sld_core0.re_ud;
-			dp[4] = p_sld_shell1.re_ud;
-			dp[6] = p_sld_shell2.re_ud;
-			dp[8] = p_sld_shell3.re_ud;
-			dp[10] = p_sld_shell4.re_ud;
-			dp[11] = p_sld_solv.re_ud;
-			answer += FourShell(dp, q);
-			dp[2] = p_sld_core0.im_ud;
-			dp[4] = p_sld_shell1.im_ud;
-			dp[6] = p_sld_shell2.im_ud;
-			dp[8] = p_sld_shell3.im_ud;
-			dp[10] = p_sld_shell4.im_ud;
-			dp[11] = p_sld_solv.im_ud;
-			answer += FourShell(dp, q);
-			}
-		//down_up
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[2] = p_sld_core0.re_du;
-			dp[4] = p_sld_shell1.re_du;
-			dp[6] = p_sld_shell2.re_du;
-			dp[8] = p_sld_shell3.re_du;
-			dp[10] = p_sld_shell4.re_du;
-			dp[11] = p_sld_solv.re_du;
-			answer += FourShell(dp, q);
-			dp[2] = p_sld_core0.im_du;
-			dp[4] = p_sld_shell1.im_du;
-			dp[6] = p_sld_shell2.im_du;
-			dp[8] = p_sld_shell3.im_du;
-			dp[10] = p_sld_shell4.im_du;
-			dp[11] = p_sld_solv.im_du;
-			answer += FourShell(dp, q);
-			}
-	}
-	// Already normalized
-	// add in the background
-	answer += pars->background;
-	return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double corefourshell_analytical_2DXY(CoreFourShellParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return corefourshell_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-double CoreFourShellModel :: operator()(double qx, double qy) {
-	CoreFourShellParameters dp;
-	dp.scale = scale();
-	dp.rad_core0 = rad_core0();
-	dp.sld_core0 = sld_core0();
-	dp.thick_shell1 = thick_shell1();
-	dp.sld_shell1 = sld_shell1();
-	dp.thick_shell2 = thick_shell2();
-	dp.sld_shell2 = sld_shell2();
-	dp.thick_shell3 = thick_shell3();
-	dp.sld_shell3 = sld_shell3();
-	dp.thick_shell4 = thick_shell4();
-	dp.sld_shell4 = sld_shell4();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-	dp.M0_sld_shell1 = M0_sld_shell1();
-	dp.M_theta_shell1 = M_theta_shell1();
-	dp.M_phi_shell1 = M_phi_shell1();
-	dp.M0_sld_shell2 = M0_sld_shell2();
-	dp.M_theta_shell2 = M_theta_shell2();
-	dp.M_phi_shell2 = M_phi_shell2();
-	dp.M0_sld_shell3 = M0_sld_shell3();
-	dp.M_theta_shell3 = M_theta_shell3();
-	dp.M_phi_shell3 = M_phi_shell3();
-	dp.M0_sld_shell4 = M0_sld_shell4();
-	dp.M_theta_shell4 = M_theta_shell4();
-	dp.M_phi_shell4 = M_phi_shell4();
-	dp.M0_sld_core0 = M0_sld_core0();
-	dp.M_theta_core0 = M_theta_core0();
-	dp.M_phi_core0 = M_phi_core0();
-	dp.M0_sld_solv = M0_sld_solv();
-	dp.M_theta_solv = M_theta_solv();
-	dp.M_phi_solv = M_phi_solv();
-	dp.Up_frac_i = Up_frac_i();
-	dp.Up_frac_f = Up_frac_f();
-	dp.Up_theta = Up_theta();
-    
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.rad_core0 = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp.thick_shell1 = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp.thick_shell2 = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp.thick_shell3 = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp.thick_shell4 = weights_s4[m].value;
-						//Un-normalize FourShell by volume
-						sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* corefourshell_analytical_2DXY(&dp, qx, qy) * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-						//Find average volume
-						vol += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value),3);
-
-						norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight;
-					}
-				}
-			}
-		}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreFourShellModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreFourShellModel :: calculate_ER() {
-	CoreFourShellParameters dp;
-
-	dp.scale = scale();
-	dp.rad_core0 = rad_core0();
-	dp.sld_core0 = sld_core0();
-	dp.thick_shell1 = thick_shell1();
-	dp.sld_shell1 = sld_shell1();
-	dp.thick_shell2 = thick_shell2();
-	dp.sld_shell2 = sld_shell2();
-	dp.thick_shell3 = thick_shell3();
-	dp.sld_shell3 = sld_shell3();
-	dp.thick_shell4 = thick_shell4();
-	dp.sld_shell4 = sld_shell4();
-	dp.sld_solv = sld_solv();
-	dp.background = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rad_core0.get_weights(weights_rad);
-
-	// Get the dispersion points for the thick 1
-	vector<WeightPoint> weights_s1;
-	thick_shell1.get_weights(weights_s1);
-
-	// Get the dispersion points for the thick 2
-	vector<WeightPoint> weights_s2;
-	thick_shell2.get_weights(weights_s2);
-
-	// Get the dispersion points for the thick 3
-	vector<WeightPoint> weights_s3;
-	thick_shell3.get_weights(weights_s3);
-
-	// Get the dispersion points for the thick 4
-	vector<WeightPoint> weights_s4;
-	thick_shell4.get_weights(weights_s4);
-
-	double rad_out = 0.0;
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.rad_core0 = weights_rad[i].value;
-		// Loop over radius weight points
-		for(size_t j=0; j<weights_s1.size(); j++) {
-			dp.thick_shell1 = weights_s1[j].value;
-			// Loop over radius weight points
-			for(size_t k=0; k<weights_s2.size(); k++) {
-				dp.thick_shell2 = weights_s2[k].value;
-				// Loop over radius weight points
-				for(size_t l=0; l<weights_s3.size(); l++) {
-					dp.thick_shell3 = weights_s3[l].value;
-					// Loop over radius weight points
-					for(size_t m=0; m<weights_s4.size(); m++) {
-						dp.thick_shell4 = weights_s4[m].value;
-						//Un-normalize FourShell by volume
-						sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-							* (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4);
-						norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight;
-					}
-				}
-			}
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4;}
-
-	return rad_out;
-}
-double CoreFourShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/coresecondmoment.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coresecondmoment.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/**
- * Scattering model classes
- *
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "coresecondmoment.h"
-
-static double core_secondmoment_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double density_poly = dp[1];
-  double sld_poly = dp[2];
-  double radius_core = dp[3];
-  double volf_cores = dp[4];
-  double ads_amount = dp[5];
-  double second_moment = dp[6];
-  double sld_solv = dp[7];
-  double background = dp[8];
-  // Not valid for very small r
-  if (radius_core < 0.001){
-	  return 0.0;
-  }
-  //others
-  double form_factor = 0.0;
-  double x_val = 0.0;
-  //Pi
-  double pi = 4.0 * atan(1.0);
-  //relative sld
-  double contrast = sld_poly - sld_solv;
-  //x for exp
-  x_val = q*second_moment;
-  x_val *= x_val;
-  //computation
-  form_factor = contrast * ads_amount;
-  form_factor /= (q * density_poly);
-  form_factor *= form_factor;
-  form_factor *= (6.0 * pi * volf_cores * 1.0e+10);
-  form_factor /= radius_core;
-  form_factor *= exp(-x_val);
-
-  // scale and background
-  form_factor *= scale;
-  form_factor += background;
-  return (form_factor);
-}
-
-Core2ndMomentModel :: Core2ndMomentModel() {
-	scale = Parameter(1.0);
-	density_poly = Parameter(0.7);
-	sld_poly = Parameter(1.5e-6);
-	radius_core = Parameter(500.0, true);
-	radius_core.set_min(0.0);
-	volf_cores = Parameter(0.14);
-	ads_amount = Parameter(1.9);
-	second_moment = Parameter(23.0);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double Core2ndMomentModel :: operator()(double q) {
-	double dp[9];
-
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = density_poly();
-	dp[2] = sld_poly();
-	dp[3] = radius_core();
-	dp[4] = volf_cores();
-	dp[5] = ads_amount();
-	dp[6] = second_moment();
-	dp[7] = sld_solv();
-	dp[8] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius_core.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[3] = weights_rad[i].value;
-		//weighted sum
-		sum += weights_rad[i].weight
-			* core_secondmoment_kernel(dp, q);
-		norm += weights_rad[i].weight;
-	}
-	return sum/norm + 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 Core2ndMomentModel :: 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 sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Core2ndMomentModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Core2ndMomentModel :: calculate_ER() {
-	return 0.0;
-}
-double Core2ndMomentModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/coreshellbicelle.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellbicelle.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,433 +1,0 @@
-/**
-	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 "core_shell_bicelle.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double rim_thick;
-  double face_thick;
-  double length;
-  double core_sld;
-  double rim_sld;
-  double face_sld;
-  double solvent_sld;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} CoreShellBicelleParameters;
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell Bicelle
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double core_shell_bicelle_analytical_2D_scaled(CoreShellBicelleParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-  // Cylinder orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("core_shell_bicelle_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val);
-    return 0;
-  }
-
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel
-  answer = BicelleKernel(q, pars->radius, pars->rim_thick, pars->face_thick,
-      pars->core_sld,pars->face_sld,pars->rim_sld,
-      pars->solvent_sld, pars->length/2.0, alpha) / fabs(sin(alpha));
-
-  //normalize by cylinder volume
-  vol=pi*(pars->radius+pars->rim_thick)
-          *(pars->radius+pars->rim_thick)
-          *(pars->length+2.0*pars->face_thick);
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-static double core_shell_bicelle_analytical_2DXY(CoreShellBicelleParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return core_shell_bicelle_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-CoreShellBicelleModel :: CoreShellBicelleModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(20.0, true);
-  radius.set_min(0.0);
-  face_thick  = Parameter(10.0, true);
-  face_thick.set_min(0.0);
-  rim_thick  = Parameter(10.0, true);
-  rim_thick.set_min(0.0);
-  length     = Parameter(400.0, true);
-  length.set_min(0.0);
-  core_sld   = Parameter(1.e-6);
-  face_sld  = Parameter(4.e-6);
-  rim_sld  = Parameter(4.e-6);
-  solvent_sld= Parameter(1.e-6);
-  background = Parameter(0.0);
-  axis_theta = Parameter(90.0, true);
-  axis_phi   = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellBicelleModel :: operator()(double q) {
-  double dp[10];
-
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = rim_thick();
-  dp[3] = face_thick();
-  dp[4] = length();
-  dp[5] = core_sld();
-  dp[6] = face_sld();
-  dp[7] = rim_sld();
-  dp[8] = solvent_sld();
-  dp[9] = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[1] = weights_rad[i].value;
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp[4] = weights_len[j].value;
-
-      // Loop over thickness weight points
-      for(size_t k=0; k<weights_rthick.size(); k++) {
-        dp[2] = weights_rthick[k].value;
-        for(size_t l=0; l<weights_fthick.size(); l++) {
-            dp[3] = weights_fthick[l].value;
-			//Un-normalize by volume
-			sum += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight
-				* BicelleIntegration(q, dp[1],dp[2], dp[3],
-						dp[5],dp[6],dp[7],dp[8], dp[4]);
-			//* pow(weights_rad[i].value+weights_rthick[k].value,2)
-			//*(weights_len[j].value+2.0*weights_fthick[k].value);
-			//Find average volume
-			vol += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight
-				* pi * pow(weights_rad[i].value+weights_rthick[k].value,2)
-			*(weights_len[j].value+2.0*weights_fthick[l].value);
-			norm += weights_rad[i].weight
-				* weights_len[j].weight
-				* weights_rthick[k].weight
-				* weights_fthick[l].weight;
-        }
-      }
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  //convert to [cm-1]
-  sum *= 1.0e8;
-  sum *= dp[0];
-  return sum/norm + 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 CoreShellBicelleModel :: operator()(double qx, double qy) {
-  CoreShellBicelleParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.radius     = radius();
-  dp.rim_thick  = rim_thick();
-  dp.face_thick  = face_thick();
-  dp.length     = length();
-  dp.core_sld   = core_sld();
-  dp.rim_sld  = rim_sld();
-  dp.face_sld  = face_sld();
-  dp.solvent_sld= solvent_sld();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi   = axis_phi();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.radius = weights_rad[i].value;
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp.length = weights_len[j].value;
-
-      // Loop over thickness weight points
-      for(size_t m=0; m<weights_rthick.size(); m++) {
-        dp.rim_thick = weights_rthick[m].value;
-
-        // Loop over thickness weight points
-        for(size_t n=0; n<weights_fthick.size(); n++) {
-          dp.face_thick = weights_fthick[n].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-			  dp.axis_theta = weights_theta[k].value;
-
-			  // Average over phi distribution
-			  for(size_t l=0; l<weights_phi.size(); l++) {
-				dp.axis_phi = weights_phi[l].value;
-				//Un-normalize by volume
-				double _ptvalue = weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight
-					* weights_theta[k].weight
-					* weights_phi[l].weight
-					* core_shell_bicelle_analytical_2DXY(&dp, qx, qy)
-				* pow(weights_rad[i].value+weights_rthick[m].value,2)
-				*(weights_len[j].value+2.0*weights_fthick[n].value);
-
-				if (weights_theta.size()>1) {
-				  _ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-				}
-				sum += _ptvalue;
-
-				//Find average volume
-				vol += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight
-					* pow(weights_rad[i].value+weights_rthick[m].value,2)
-				*(weights_len[j].value+2.0*weights_fthick[n].value);
-				//Find norm for volume
-				norm_vol += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight;
-
-				norm += weights_rad[i].weight
-					* weights_len[j].weight
-					* weights_rthick[m].weight
-					* weights_fthick[n].weight
-					* weights_theta[k].weight
-					* weights_phi[l].weight;
-
-			  }
-			}
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellBicelleModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellBicelleModel :: calculate_ER() {
-  CoreShellBicelleParameters dp;
-
-  dp.radius     = radius();
-  dp.rim_thick  = rim_thick();
-  dp.face_thick  = face_thick();
-  dp.length     = length();
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_rthick;
-  rim_thick.get_weights(weights_rthick);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_fthick;
-  face_thick.get_weights(weights_fthick);
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_length.size(); i++) {
-    dp.length = weights_length[i].value;
-    for(int j=0; j< (int)weights_rthick.size(); j++) {
-      dp.rim_thick = weights_rthick[j].value;
-      for(int l=0; l< (int)weights_fthick.size(); l++) {
-          dp.face_thick = weights_fthick[l].value;
-		  for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl( )" is DIAMETER.
-			sum +=weights_length[i].weight * weights_rthick[j].weight * weights_fthick[l].weight
-				* weights_radius[k].weight*DiamCyl(dp.length+2.0*dp.face_thick,dp.radius+dp.rim_thick)/2.0;
-			norm += weights_length[i].weight* weights_rthick[j].weight * weights_fthick[l].weight* weights_radius[k].weight;
-		  }
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl()" is DIAMETER.
-    rad_out = DiamCyl(dp.length+2.0*dp.face_thick,dp.radius+dp.rim_thick)/2.0;}
-
-  return rad_out;
-}
-double CoreShellBicelleModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/coreshellcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,393 +1,0 @@
-/**
-	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 "core_shell_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double length;
-  double core_sld;
-  double shell_sld;
-  double solvent_sld;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} CoreShellCylinderParameters;
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double core_shell_cylinder_analytical_2D_scaled(CoreShellCylinderParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-  // Cylinder orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val);
-    cos_val = 1.0;
-  }
-
-  alpha = acos( cos_val );
-  if (alpha == 0.0){
-  	alpha = 1.0e-26;
-  }
-  // Call the IGOR library function to get the kernel
-  answer = CoreShellCylKernel(q, pars->radius, pars->thickness,
-      pars->core_sld,pars->shell_sld,
-      pars->solvent_sld, pars->length/2.0, alpha) / fabs(sin(alpha));
-
-  //normalize by cylinder volume
-  vol=pi*(pars->radius+pars->thickness)
-          *(pars->radius+pars->thickness)
-          *(pars->length+2.0*pars->thickness);
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the core-shell cylinder
- * @param q: q-value
- * @return: function value
- */
-static double core_shell_cylinder_analytical_2DXY(CoreShellCylinderParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return core_shell_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-CoreShellCylinderModel :: CoreShellCylinderModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(20.0, true);
-  radius.set_min(0.0);
-  thickness  = Parameter(10.0, true);
-  thickness.set_min(0.0);
-  length     = Parameter(400.0, true);
-  length.set_min(0.0);
-  core_sld   = Parameter(1.e-6);
-  shell_sld  = Parameter(4.e-6);
-  solvent_sld= Parameter(1.e-6);
-  background = Parameter(0.0);
-  axis_theta = Parameter(90.0, true);
-  axis_phi   = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellCylinderModel :: operator()(double q) {
-  double dp[8];
-
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = thickness();
-  dp[3] = length();
-  dp[4] = core_sld();
-  dp[5] = shell_sld();
-  dp[6] = solvent_sld();
-  dp[7] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_thick;
-  thickness.get_weights(weights_thick);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[1] = weights_rad[i].value;
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp[3] = weights_len[j].value;
-
-      // Loop over thickness weight points
-      for(size_t k=0; k<weights_thick.size(); k++) {
-        dp[2] = weights_thick[k].value;
-        //Un-normalize by volume
-        sum += weights_rad[i].weight
-            * weights_len[j].weight
-            * weights_thick[k].weight
-            * CoreShellCylinder(dp, q)
-        * pow(weights_rad[i].value+weights_thick[k].value,2)
-        *(weights_len[j].value+2.0*weights_thick[k].value);
-        //Find average volume
-        vol += weights_rad[i].weight
-            * weights_len[j].weight
-            * weights_thick[k].weight
-            * pow(weights_rad[i].value+weights_thick[k].value,2)
-        *(weights_len[j].value+2.0*weights_thick[k].value);
-        norm += weights_rad[i].weight
-            * weights_len[j].weight
-            * weights_thick[k].weight;
-      }
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 CoreShellCylinderModel :: operator()(double qx, double qy) {
-  CoreShellCylinderParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-  dp.length     = length();
-  dp.core_sld   = core_sld();
-  dp.shell_sld  = shell_sld();
-  dp.solvent_sld= solvent_sld();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi   = axis_phi();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_thick;
-  thickness.get_weights(weights_thick);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.radius = weights_rad[i].value;
-
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp.length = weights_len[j].value;
-
-      // Loop over thickness weight points
-      for(size_t m=0; m<weights_thick.size(); m++) {
-        dp.thickness = weights_thick[m].value;
-
-        // Average over theta distribution
-        for(size_t k=0; k<weights_theta.size(); k++) {
-          dp.axis_theta = weights_theta[k].value;
-
-          // Average over phi distribution
-          for(size_t l=0; l<weights_phi.size(); l++) {
-            dp.axis_phi = weights_phi[l].value;
-            //Un-normalize by volume
-            double _ptvalue = weights_rad[i].weight
-                * weights_len[j].weight
-                * weights_thick[m].weight
-                * weights_theta[k].weight
-                * weights_phi[l].weight
-                * core_shell_cylinder_analytical_2DXY(&dp, qx, qy)
-            * pow(weights_rad[i].value+weights_thick[m].value,2)
-            *(weights_len[j].value+2.0*weights_thick[m].value);
-
-            if (weights_theta.size()>1) {
-              _ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-            }
-            sum += _ptvalue;
-
-            //Find average volume
-            vol += weights_rad[i].weight
-                * weights_len[j].weight
-                * weights_thick[m].weight
-                * pow(weights_rad[i].value+weights_thick[m].value,2)
-            *(weights_len[j].value+2.0*weights_thick[m].value);
-            //Find norm for volume
-            norm_vol += weights_rad[i].weight
-                * weights_len[j].weight
-                * weights_thick[m].weight;
-
-            norm += weights_rad[i].weight
-                * weights_len[j].weight
-                * weights_thick[m].weight
-                * weights_theta[k].weight
-                * weights_phi[l].weight;
-
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellCylinderModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellCylinderModel :: calculate_ER() {
-  CoreShellCylinderParameters dp;
-
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-  dp.length     = length();
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_length.size(); i++) {
-    dp.length = weights_length[i].value;
-    for(int j=0; j< (int)weights_thickness.size(); j++) {
-      dp.thickness = weights_thickness[j].value;
-      for(int k=0; k< (int)weights_radius.size(); k++) {
-        dp.radius = weights_radius[k].value;
-        //Note: output of "DiamCyl( )" is DIAMETER.
-        sum +=weights_length[i].weight * weights_thickness[j].weight
-            * weights_radius[k].weight*DiamCyl(dp.length+2.0*dp.thickness,dp.radius+dp.thickness)/2.0;
-        norm += weights_length[i].weight* weights_thickness[j].weight* weights_radius[k].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl()" is DIAMETER.
-    rad_out = DiamCyl(dp.length+2.0*dp.thickness,dp.radius+dp.thickness)/2.0;}
-
-  return rad_out;
-}
-double CoreShellCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/coreshellsphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/coreshellsphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,386 +1,0 @@
-/**
-	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 "core_shell.h"
-
-extern "C" {
-#include "libSphere.h"
-#include "libmultifunc/libfunc.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double core_sld;
-  double shell_sld;
-  double solvent_sld;
-  double background;
-  double M0_sld_shell;
-  double M_theta_shell;
-  double M_phi_shell;
-  double M0_sld_core;
-  double M_theta_core;
-  double M_phi_core;
-  double M0_sld_solv;
-  double M_theta_solv;
-  double M_phi_solv;
-  double Up_frac_i;
-  double Up_frac_f;
-  double Up_theta;
-} CoreShellParameters;
-
-CoreShellModel :: CoreShellModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(60.0, true);
-  radius.set_min(0.0);
-  thickness  = Parameter(10.0, true);
-  thickness.set_min(0.0);
-  core_sld   = Parameter(1.e-6);
-  shell_sld  = Parameter(2.e-6);
-  solvent_sld = Parameter(3.e-6);
-  background = Parameter(0.0);
-  M0_sld_shell = Parameter(0.0e-6);
-  M_theta_shell = Parameter(0.0);
-  M_phi_shell = Parameter(0.0);
-  M0_sld_core = Parameter(0.0e-6);
-  M_theta_core = Parameter(0.0);
-  M_phi_core = Parameter(0.0);
-  M0_sld_solv = Parameter(0.0e-6);
-  M_theta_solv = Parameter(0.0);
-  M_phi_solv = Parameter(0.0);
-  Up_frac_i = Parameter(0.5);
-  Up_frac_f = Parameter(0.5);
-  Up_theta = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = thickness();
-  dp[3] = core_sld();
-  dp[4] = shell_sld();
-  dp[5] = solvent_sld();
-  dp[6] = 0.0;
-
-  //im
-  ///dp[7] = 0.0;
-  ///dp[8] = 0.0;
-  ///dp[9] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_thick;
-  thickness.get_weights(weights_thick);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[1] = weights_rad[i].value;
-
-    // Loop over thickness weight points
-    for(size_t j=0; j<weights_thick.size(); j++) {
-      dp[2] = weights_thick[j].value;
-      //Un-normalize SphereForm by volume
-      sum += weights_rad[i].weight
-          * weights_thick[j].weight * CoreShellForm(dp, q)* pow(weights_rad[i].value+weights_thick[j].value,3);
-
-      //Find average volume
-      vol += weights_rad[i].weight * weights_thick[j].weight
-          * pow(weights_rad[i].value+weights_thick[j].value,3);
-      norm += weights_rad[i].weight
-          * weights_thick[j].weight;
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + background();
-}
-
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-
-static double coreshell_analytical_2D_scaled(CoreShellParameters *pars, double q, double q_x, double q_y) {
-	double dp[7];
-	//convert angle degree to radian
-	dp[0] = pars->scale;
-	dp[1] = pars->radius;
-	dp[2] = pars->thickness;
-	dp[3] = 0.0;
-	dp[4] = 0.0;
-	dp[5] = 0.0;
-	dp[6] = 0.0;
-	//im
-	///dp[7] = 0.0;
-	///dp[8] = 0.0;
-	///dp[9] = 0.0;
-
-    double sld_core = pars->core_sld;
-    double sld_shell = pars->shell_sld;
-	double sld_solv = pars->solvent_sld;
-	double answer = 0.0;
-	double m_max = pars->M0_sld_core;
-	double m_max_shell = pars->M0_sld_shell;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32 && m_max_shell < 1.0e-32){
-		dp[3] = sld_core;
-		dp[4] = sld_shell;
-		dp[5] = sld_solv;
-		answer = CoreShellForm(dp, q);
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_core;
-		double m_theta = pars->M_theta_core;
-		double m_phi_shell = pars->M_phi_shell;
-		double m_theta_shell = pars->M_theta_shell;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld_core;
-		polar_sld p_sld_shell;
-		polar_sld p_sld_solv;
-		//Find (b+m) slds
-		p_sld_core = cal_msld(1, qx, qy, sld_core, m_max, m_theta, m_phi,
-								in_spin, out_spin, s_theta);
-		p_sld_shell = cal_msld(1, qx, qy, sld_shell, m_max_shell, m_theta_shell, m_phi_shell,
-								in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv,
-						 		in_spin, out_spin, s_theta);
-		//up_up
-		if (in_spin > 0.0 && out_spin > 0.0){
-			dp[3] = p_sld_core.uu;
-			dp[4] = p_sld_shell.uu;
-			dp[5] = p_sld_solv.uu;
-			answer += CoreShellForm(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[3] = p_sld_core.dd;
-			dp[4] = p_sld_shell.dd;
-			dp[5] = p_sld_solv.dd;
-			answer += CoreShellForm(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[3] = p_sld_core.re_ud;
-			dp[4] = p_sld_shell.re_ud;
-			dp[5] = p_sld_solv.re_ud;
-			answer += CoreShellForm(dp, q);
-			dp[3] = p_sld_core.im_ud;
-			dp[4] = p_sld_shell.im_ud;
-			dp[5] = p_sld_solv.im_ud;
-			answer += CoreShellForm(dp, q);
-			}
-		//down_up
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[3] = p_sld_core.re_du;
-			dp[4] = p_sld_shell.re_du;
-			dp[5] = p_sld_solv.re_du;
-			answer += CoreShellForm(dp, q);
-			dp[3] = p_sld_core.im_du;
-			dp[4] = p_sld_shell.im_du;
-			dp[5] = p_sld_solv.im_du;
-			answer += CoreShellForm(dp, q);
-			}
-	}
-	// Already normalized
-	// add in the background
-	answer += pars->background;
-	return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double coreshell_analytical_2DXY(CoreShellParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return coreshell_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * 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 CoreShellModel :: operator()(double qx, double qy) {
-	CoreShellParameters dp;
-    dp.scale = scale();
-    dp.radius = radius();
-    dp.thickness = thickness();
-    dp.core_sld = core_sld();
-    dp.shell_sld = shell_sld();
-    dp.solvent_sld = solvent_sld();
-    dp.background = 0.0;
-    dp.M0_sld_shell = M0_sld_shell();
-    dp.M_theta_shell = M_theta_shell();
-    dp.M_phi_shell = M_phi_shell();
-    dp.M0_sld_core = M0_sld_core();
-    dp.M_theta_core = M_theta_core();
-    dp.M_phi_core = M_phi_core();
-    dp.M0_sld_solv = M0_sld_solv();
-    dp.M_theta_solv = M_theta_solv();
-    dp.M_phi_solv = M_phi_solv();
-    dp.Up_frac_i = Up_frac_i();
-    dp.Up_frac_f = Up_frac_f();
-    dp.Up_theta = Up_theta();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-	dp.radius = weights_rad[i].value;
-
-	// Loop over thickness weight points
-	for(size_t j=0; j<weights_thick.size(); j++) {
-	  dp.thickness = weights_thick[j].value;
-	  //Un-normalize SphereForm by volume
-	  sum += weights_rad[i].weight
-		  * weights_thick[j].weight * coreshell_analytical_2DXY(&dp, qx, qy) *
-		  	pow(weights_rad[i].value+weights_thick[j].value,3);
-
-	  //Find average volume
-	  vol += weights_rad[i].weight * weights_thick[j].weight
-		  * pow(weights_rad[i].value+weights_thick[j].value,3);
-	  norm += weights_rad[i].weight
-		  * weights_thick[j].weight;
-	}
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellModel :: calculate_ER() {
-  CoreShellParameters dp;
-
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int j=0; j< (int)weights_thickness.size(); j++) {
-    dp.thickness = weights_thickness[j].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      sum += weights_thickness[j].weight
-          * weights_radius[k].weight*(dp.radius+dp.thickness);
-      norm += weights_thickness[j].weight* weights_radius[k].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = (dp.radius+dp.thickness);}
-
-  return rad_out;
-}
-double CoreShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/csparallelepiped.cpp
===================================================================
--- src/sas/models/c_extension/c_models/csparallelepiped.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,561 +1,0 @@
-/**
-	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 2010, 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;
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-#include "csparallelepiped.h"
-
-// Convenience parameter structure
-typedef struct {
-  double scale;
-  double shortA;
-  double midB;
-  double longC;
-  double rimA;
-  double rimB;
-  double rimC;
-  double sld_rimA;
-  double sld_rimB;
-  double sld_rimC;
-  double sld_pcore;
-  double sld_solv;
-  double background;
-  double parallel_theta;
-  double parallel_phi;
-  double parallel_psi;
-} CSParallelepipedParameters;
-
-static double cspkernel(double dp[],double q, double ala, double alb, double alc){
-  // mu passed in is really mu*sqrt(1-sig^2)
-  double argA,argB,argC,argtA,argtB,argtC,tmp1,tmp2,tmp3,tmpt1,tmpt2,tmpt3;     //local variables
-
-  double aa,bb,cc, ta,tb,tc;
-  double Vin,Vot,V1,V2,V3;
-  double rhoA,rhoB,rhoC, rhoP, rhosolv;
-  double dr0, drA,drB, drC;
-  double retVal;
-
-  aa = dp[1];
-  bb = dp[2];
-  cc = dp[3];
-  ta = dp[4];
-  tb = dp[5];
-  tc = dp[6];
-  rhoA=dp[7];
-  rhoB=dp[8];
-  rhoC=dp[9];
-  rhoP=dp[10];
-  rhosolv=dp[11];
-  dr0=rhoP-rhosolv;
-  drA=rhoA-rhosolv;
-  drB=rhoB-rhosolv;
-  drC=rhoC-rhosolv;
-  Vin=(aa*bb*cc);
-  Vot=(aa*bb*cc+2.0*ta*bb*cc+2.0*aa*tb*cc+2.0*aa*bb*tc);
-  V1=(2.0*ta*bb*cc);   //  incorrect V1 (aa*bb*cc+2*ta*bb*cc)
-  V2=(2.0*aa*tb*cc);  // incorrect V2(aa*bb*cc+2*aa*tb*cc)
-  V3=(2.0*aa*bb*tc);
-  //aa = aa/bb;
-  ta=(aa+2.0*ta);///bb;
-  tb=(aa+2.0*tb);///bb;
-  tc=(aa+2.0*tc);
-  //handle arg=0 separately, as sin(t)/t -> 1 as t->0
-  argA = q*aa*ala/2.0;
-  argB = q*bb*alb/2.0;
-  argC = q*cc*alc/2.0;
-  argtA = q*ta*ala/2.0;
-  argtB = q*tb*alb/2.0;
-  argtC = q*tc*alc/2.0;
-
-  if(argA==0.0) {
-    tmp1 = 1.0;
-  } else {
-    tmp1 = sin(argA)/argA;
-  }
-  if (argB==0.0) {
-    tmp2 = 1.0;
-  } else {
-    tmp2 = sin(argB)/argB;
-  }
-
-  if (argC==0.0) {
-    tmp3 = 1.0;
-  } else {
-    tmp3 = sin(argC)/argC;
-  }
-  if(argtA==0.0) {
-    tmpt1 = 1.0;
-  } else {
-    tmpt1 = sin(argtA)/argtA;
-  }
-  if (argtB==0.0) {
-    tmpt2 = 1.0;
-  } else {
-    tmpt2 = sin(argtB)/argtB;
-  }
-  if (argtC==0.0) {
-    tmpt3 = 1.0;
-  } else {
-    tmpt3 = sin(argtC)*sin(argtC)/argtC/argtC;
-  }
-  // This expression is different from NIST/IGOR package (I strongly believe the IGOR is wrong!!!). 10/15/2010.
-  retVal =( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3)*
-      ( dr0*tmp1*tmp2*tmp3*Vin + drA*(tmpt1-tmp1)*tmp2*tmp3*V1+ drB*tmp1*(tmpt2-tmp2)*tmp3*V2 + drC*tmp1*tmp2*(tmpt3-tmp3)*V3);   //  correct FF : square of sum of phase factors
-  //retVal *= (tmp3*tmp3);
-  retVal /= Vot;
-
-  return (retVal);
-
-}//Function cspkernel()
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y) {
-  double dp[13];
-  double cparallel_x, cparallel_y, bparallel_x, bparallel_y, parallel_x, parallel_y;
-  //double q_z;
-  double cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;
-
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->parallel_theta * pi/180.0;
-  double phi = pars->parallel_phi * pi/180.0;
-  double psi = pars->parallel_psi* pi/180.0;
-
-  // Fill paramater array
-  dp[0] = 1.0;
-  dp[1] = pars->shortA;
-  dp[2] = pars->midB;
-  dp[3] = pars->longC;
-  dp[4] = pars->rimA;
-  dp[5] = pars->rimB;
-  dp[6] = pars->rimC;
-  dp[7] = pars->sld_rimA;
-  dp[8] = pars->sld_rimB;
-  dp[9] = pars->sld_rimC;
-  dp[10] = pars->sld_pcore;
-  dp[11] = pars->sld_solv;
-  dp[12] = 0.0;
-
-
-  edgeA = pars->shortA;
-  edgeB = pars->midB;
-  edgeC = pars->longC;
-
-
-  // parallelepiped c axis orientation
-  cparallel_x = cos(theta) * cos(phi);
-  cparallel_y = sin(theta);
-  //cparallel_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0.0;
-
-  // Compute the angle btw vector q and the
-  // axis of the parallelepiped
-  cos_val_c = cparallel_x*q_x + cparallel_y*q_y;// + cparallel_z*q_z;
-  //alpha = acos(cos_val_c);
-
-  // parallelepiped a axis orientation
-  parallel_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  parallel_y = sin(psi)*cos(theta);
-
-  cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-
-
-  // parallelepiped b axis orientation
-  bparallel_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  bparallel_y = cos(theta)*cos(psi);
-  // axis of the parallelepiped
-  cos_val_b = bparallel_x*q_x + bparallel_y*q_y;
-
-  // The following test should always pass
-  if (fabs(cos_val_c)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_c = 1.0;
-  }
-  if (fabs(cos_val_a)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a = 1.0;
-  }
-  if (fabs(cos_val_b)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_b = 1.0;
-  }
-  // Call the IGOR library function to get the kernel
-  answer = cspkernel( dp, q, cos_val_a, cos_val_b, cos_val_c);
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the CSparallelepiped
- * @param q: q-value
- * @return: function value
- */
-static double csparallelepiped_analytical_2DXY(CSParallelepipedParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return csparallelepiped_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-
-
-CSParallelepipedModel :: CSParallelepipedModel() {
-  scale      = Parameter(1.0);
-  shortA     = Parameter(35.0, true);
-  shortA.set_min(1.0);
-  midB     = Parameter(75.0, true);
-  midB.set_min(1.0);
-  longC    = Parameter(400.0, true);
-  longC.set_min(1.0);
-  rimA     = Parameter(10.0, true);
-  rimB     = Parameter(10.0, true);
-  rimC     = Parameter(10.0, true);
-  sld_rimA     = Parameter(2.0e-6, true);
-  sld_rimB     = Parameter(4.0e-6, true);
-  sld_rimC    = Parameter(2.0e-6, true);
-  sld_pcore   = Parameter(1.0e-6);
-  sld_solv   = Parameter(6.0e-6);
-  background = Parameter(0.06);
-  parallel_theta  = Parameter(0.0, true);
-  parallel_phi    = Parameter(0.0, true);
-  parallel_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CSParallelepipedModel :: operator()(double q) {
-  double dp[13];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = shortA();
-  dp[2] = midB();
-  dp[3] = longC();
-  dp[4] = rimA();
-  dp[5] = rimB();
-  dp[6] = rimC();
-  dp[7] = sld_rimA();
-  dp[8] = sld_rimB();
-  dp[9] = sld_rimC();
-  dp[10] = sld_pcore();
-  dp[11] = sld_solv();
-  dp[12] = 0.0;
-
-  // Get the dispersion points for the short_edgeA
-  vector<WeightPoint> weights_shortA;
-  shortA.get_weights(weights_shortA);
-
-  // Get the dispersion points for the longer_edgeB
-  vector<WeightPoint> weights_midB;
-  midB.get_weights(weights_midB);
-
-  // Get the dispersion points for the longuest_edgeC
-  vector<WeightPoint> weights_longC;
-  longC.get_weights(weights_longC);
-
-
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over short_edgeA weight points
-  for(int i=0; i< (int)weights_shortA.size(); i++) {
-    dp[1] = weights_shortA[i].value;
-
-    // Loop over longer_edgeB weight points
-    for(int j=0; j< (int)weights_midB.size(); j++) {
-      dp[2] = weights_midB[j].value;
-
-      // Loop over longuest_edgeC weight points
-      for(int k=0; k< (int)weights_longC.size(); k++) {
-        dp[3] = weights_longC[k].value;
-        //Un-normalize  by volume
-        sum += weights_shortA[i].weight * weights_midB[j].weight
-            * weights_longC[k].weight * CSParallelepiped(dp, q)
-        * weights_shortA[i].value*weights_midB[j].value
-        * weights_longC[k].value;
-        //Find average volume
-        vol += weights_shortA[i].weight * weights_midB[j].weight
-            * weights_longC[k].weight
-            * weights_shortA[i].value * weights_midB[j].value
-            * weights_longC[k].value;
-
-        norm += weights_shortA[i].weight
-            * weights_midB[j].weight * weights_longC[k].weight;
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 CSParallelepipedModel :: operator()(double qx, double qy) {
-  CSParallelepipedParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.shortA   = shortA();
-  dp.midB   = midB();
-  dp.longC  = longC();
-  dp.rimA   = rimA();
-  dp.rimB   = rimB();
-  dp.rimC  = rimC();
-  dp.sld_rimA   = sld_rimA();
-  dp.sld_rimB   = sld_rimB();
-  dp.sld_rimC  = sld_rimC();
-  dp.sld_pcore   = sld_pcore();
-  dp.sld_solv   = sld_solv();
-  dp.background = 0.0;
-  //dp.background = background();
-  dp.parallel_theta  = parallel_theta();
-  dp.parallel_phi    = parallel_phi();
-  dp.parallel_psi    = parallel_psi();
-
-
-
-  // Get the dispersion points for the short_edgeA
-  vector<WeightPoint> weights_shortA;
-  shortA.get_weights(weights_shortA);
-
-  // Get the dispersion points for the longer_edgeB
-  vector<WeightPoint> weights_midB;
-  midB.get_weights(weights_midB);
-
-  // Get the dispersion points for the longuest_edgeC
-  vector<WeightPoint> weights_longC;
-  longC.get_weights(weights_longC);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_parallel_theta;
-  parallel_theta.get_weights(weights_parallel_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_parallel_phi;
-  parallel_phi.get_weights(weights_parallel_phi);
-
-  // Get angular averaging for psi
-  vector<WeightPoint> weights_parallel_psi;
-  parallel_psi.get_weights(weights_parallel_psi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-
-  // Loop over radius weight points
-  for(int i=0; i< (int)weights_shortA.size(); i++) {
-    dp.shortA = weights_shortA[i].value;
-
-    // Loop over longer_edgeB weight points
-    for(int j=0; j< (int)weights_midB.size(); j++) {
-      dp.midB = weights_midB[j].value;
-
-      // Average over longuest_edgeC distribution
-      for(int k=0; k< (int)weights_longC.size(); k++) {
-        dp.longC = weights_longC[k].value;
-
-        // Average over theta distribution
-        for(int l=0; l< (int)weights_parallel_theta.size(); l++) {
-          dp.parallel_theta = weights_parallel_theta[l].value;
-
-          // Average over phi distribution
-          for(int m=0; m< (int)weights_parallel_phi.size(); m++) {
-            dp.parallel_phi = weights_parallel_phi[m].value;
-
-            // Average over phi distribution
-            for(int n=0; n< (int)weights_parallel_psi.size(); n++) {
-              dp.parallel_psi = weights_parallel_psi[n].value;
-              //Un-normalize by volume
-              double _ptvalue = weights_shortA[i].weight
-                  * weights_midB[j].weight
-                  * weights_longC[k].weight
-                  * weights_parallel_theta[l].weight
-                  * weights_parallel_phi[m].weight
-                  * weights_parallel_psi[n].weight
-                  * csparallelepiped_analytical_2DXY(&dp, qx, qy)
-              * weights_shortA[i].value*weights_midB[j].value
-              * weights_longC[k].value;
-
-              if (weights_parallel_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_parallel_theta[l].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              vol += weights_shortA[i].weight
-                  * weights_midB[j].weight
-                  * weights_longC[k].weight
-                  * weights_shortA[i].value*weights_midB[j].value
-                  * weights_longC[k].value;
-              //Find norm for volume
-              norm_vol += weights_shortA[i].weight
-                  * weights_midB[j].weight
-                  * weights_longC[k].weight;
-
-              norm += weights_shortA[i].weight
-                  * weights_midB[j].weight
-                  * weights_longC[k].weight
-                  * weights_parallel_theta[l].weight
-                  * weights_parallel_phi[m].weight
-                  * weights_parallel_psi[n].weight;
-            }
-          }
-
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_parallel_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CSParallelepipedModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CSParallelepipedModel :: calculate_ER() {
-  CSParallelepipedParameters dp;
-  dp.shortA   = shortA();
-  dp.midB   = midB();
-  dp.longC  = longC();
-  dp.rimA   = rimA();
-  dp.rimB   = rimB();
-  dp.rimC  = rimC();
-
-  double rad_out = 0.0;
-  double pi = 4.0*atan(1.0);
-  double suf_rad = sqrt((dp.shortA*dp.midB+2.0*dp.rimA*dp.midB+2.0*dp.rimA*dp.shortA)/pi);
-  double height =(dp.longC + 2.0*dp.rimC);
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the short_edgeA
-  vector<WeightPoint> weights_shortA;
-  shortA.get_weights(weights_shortA);
-
-  // Get the dispersion points for the longer_edgeB
-  vector<WeightPoint> weights_midB;
-  midB.get_weights(weights_midB);
-
-  // Get angular averaging for the longuest_edgeC
-  vector<WeightPoint> weights_longC;
-  longC.get_weights(weights_longC);
-
-  // Loop over radius weight points
-  for(int i=0; i< (int)weights_shortA.size(); i++) {
-    dp.shortA = weights_shortA[i].value;
-
-    // Loop over longer_edgeB weight points
-    for(int j=0; j< (int)weights_midB.size(); j++) {
-      dp.midB = weights_midB[j].value;
-
-      // Average over longuest_edgeC distribution
-      for(int k=0; k< (int)weights_longC.size(); k++) {
-        dp.longC = weights_longC[k].value;
-        //Calculate surface averaged radius
-        //This is rough approximation.
-        suf_rad = sqrt((dp.shortA*dp.midB+2.0*dp.rimA*dp.midB+2.0*dp.rimA*dp.shortA)/pi);
-        height =(dp.longC + 2.0*dp.rimC);
-        //Note: output of "DiamCyl(dp.length,dp.radius)" is a DIAMETER.
-        sum +=weights_shortA[i].weight* weights_midB[j].weight
-            * weights_longC[k].weight*DiamCyl(height, suf_rad)/2.0;
-        norm += weights_shortA[i].weight* weights_midB[j].weight*weights_longC[k].weight;
-      }
-    }
-  }
-
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl(length,radius)" is DIAMETER.
-    rad_out = DiamCyl(dp.longC, suf_rad)/2.0;}
-  return rad_out;
-
-}
-double CSParallelepipedModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/cylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/cylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,420 +1,0 @@
-/**
-	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;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "libmultifunc/libfunc.h"
-}
-#include "cylinder.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double length;
-    double sldCyl;
-    double sldSolv;
-    double background;
-    double cyl_theta;
-    double cyl_phi;
-    double M0_sld_cyl;
-    double M_theta_cyl;
-    double M_phi_cyl;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} CylinderParameters;
-
-CylinderModel :: CylinderModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(20.0, true);
-	radius.set_min(0.0);
-	length     = Parameter(400.0, true);
-	length.set_min(0.0);
-	sldCyl   = Parameter(4.e-6);
-	sldSolv   = Parameter(1.e-6);
-	background = Parameter(0.0);
-	cyl_theta  = Parameter(0.0, true);
-	cyl_phi    = Parameter(0.0, true);
-	M0_sld_cyl = Parameter(0.0e-6);
-	M_theta_cyl = Parameter(0.0);
-	M_phi_cyl = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CylinderModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = length();
-	dp[3] = sldCyl();
-	dp[4] = sldSolv();
-	dp[5] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp[2] = weights_len[j].value;
-			//Un-normalize by volume
-			sum += weights_rad[i].weight
-				* weights_len[j].weight * CylinderForm(dp, q)
-				*pow(weights_rad[i].value,2)*weights_len[j].value;
-
-			//Find average volume
-			vol += weights_rad[i].weight
-				* weights_len[j].weight *pow(weights_rad[i].value,2)*weights_len[j].value;
-			norm += weights_rad[i].weight
-				* weights_len[j].weight;
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double cylinder_analytical_2D_scaled(CylinderParameters *pars, double q, double q_x, double q_y) {
-    double cyl_x, cyl_y;//, cyl_z;
-    //double q_z;
-    double alpha, vol, cos_val;
-    double answer = 0.0;
-    double form = 0.0;
-    //convert angle degree to radian
-    double pi = 4.0*atan(1.0);
-    double theta = pars->cyl_theta * pi/180.0;
-    double phi = pars->cyl_phi * pi/180.0;
-    double sld_solv = pars->sldSolv;
-    double sld_cyl = pars->sldCyl;
-    double m_max = pars->M0_sld_cyl;
-    double m_max_solv = pars->M0_sld_solv;
-    double contrast = 0.0;
-
-    // Cylinder orientation
-	cyl_x = cos(theta) * cos(phi);
-    cyl_y = sin(theta);
-    //cyl_z = -cos(theta) * sin(phi);
-    // q vector
-    //q_z = 0.0;
-
-    // Compute the angle btw vector q and the
-    // axis of the cylinder
-    cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-    // The following test should always pass
-    if (fabs(cos_val)>1.0) {
-      printf("cyl_ana_2D: Unexpected error: |cos(alpha)=%g|>1\n", cos_val);
-      printf("cyl_ana_2D: at theta=%g and phi=%g.", theta, phi);
-      return 1.0;
-    }
-
-    // Note: cos(alpha) = 0 and 1 will get an
-    // undefined value from CylKernel
-  alpha = acos( cos_val );
-  if (alpha == 0.0){
-  	alpha = 1.0e-26;
-  	}
-  // Call the IGOR library function to get the kernel
-  //answer = CylKernel(q, pars->radius, pars->length/2.0, alpha) / sin(alpha);
-
-    // Call the IGOR library function to get the kernel
-    form = CylKernel(q, pars->radius, pars->length/2.0, alpha) / sin(alpha);
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-		// Multiply by contrast^2
-		contrast = (pars->sldCyl - pars->sldSolv);
-  		answer = contrast * contrast * form;
-	}
-	else{
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_cyl;
-		double m_theta = pars->M_theta_cyl;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld;
-		polar_sld p_sld_solv;
-		p_sld = cal_msld(1, qx, qy, sld_cyl, m_max, m_theta, m_phi, 
-			 			in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv, 
-			 			in_spin, out_spin, s_theta);
-		//up_up	
-		if (in_spin > 0.0 && out_spin > 0.0){			 
-			answer += ((p_sld.uu- p_sld_solv.uu) * (p_sld.uu- p_sld_solv.uu) * form);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			answer += ((p_sld.dd - p_sld_solv.dd) * (p_sld.dd - p_sld_solv.dd) * form);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			answer += ((p_sld.re_ud - p_sld_solv.re_ud) * (p_sld.re_ud - p_sld_solv.re_ud) * form);
-			answer += ((p_sld.im_ud - p_sld_solv.im_ud) * (p_sld.im_ud - p_sld_solv.im_ud) * form);
-			}
-		//down_up	
-		if (in_spin < 1.0 && out_spin > 0.0){
-			answer += ((p_sld.re_du - p_sld_solv.re_du) * (p_sld.re_du - p_sld_solv.re_du) * form);
-			answer += ((p_sld.im_du - p_sld_solv.im_du) * (p_sld.im_du - p_sld_solv.im_du) * form);
-			}
-	}
-
-    //normalize by cylinder volume
-    //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-    vol = acos(-1.0) * pars->radius * pars->radius * pars->length;
-    answer *= vol;
-
-    //convert to [cm-1]
-    answer *= 1.0e8;
-
-    //Scale
-    answer *= pars->scale;
-
-    // add in the background
-    answer += pars->background;
-
-    return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-static double cylinder_analytical_2DXY(CylinderParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * 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 CylinderModel :: operator()(double qx, double qy) {
-	CylinderParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.radius     = radius();
-	dp.length     = length();
-	dp.sldCyl   = sldCyl();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	dp.cyl_theta  = cyl_theta();
-	dp.cyl_phi    = cyl_phi();
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_cyl =  M_phi_cyl();
-	dp.M_theta_cyl =  M_theta_cyl();
-	dp.M0_sld_cyl =  M0_sld_cyl();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-	
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_theta;
-	cyl_theta.get_weights(weights_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_phi;
-	cyl_phi.get_weights(weights_phi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-
-
-		// Loop over length weight points
-		for(size_t j=0; j<weights_len.size(); j++) {
-			dp.length = weights_len[j].value;
-
-			// Average over theta distribution
-			for(size_t k=0; k<weights_theta.size(); k++) {
-				dp.cyl_theta = weights_theta[k].value;
-
-				// Average over phi distribution
-				for(size_t l=0; l<weights_phi.size(); l++) {
-					dp.cyl_phi = weights_phi[l].value;
-					//Un-normalize by volume
-					double _ptvalue = weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight
-						* cylinder_analytical_2DXY(&dp, qx, qy)
-						*pow(weights_rad[i].value,2)*weights_len[j].value;
-					if (weights_theta.size()>1) {
-						_ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-					}
-					sum += _ptvalue;
-					//Find average volume
-					vol += weights_rad[i].weight
-							* weights_len[j].weight
-							* pow(weights_rad[i].value,2)*weights_len[j].value;
-					//Find norm for volume
-					norm_vol += weights_rad[i].weight
-							* weights_len[j].weight;
-
-					norm += weights_rad[i].weight
-						* weights_len[j].weight
-						* weights_theta[k].weight
-						* weights_phi[l].weight;
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_theta.size()>1) norm = norm / asin(1.0);
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CylinderModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CylinderModel :: calculate_ER() {
-	CylinderParameters dp;
-
-	dp.radius     = radius();
-	dp.length     = length();
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-			sum +=weights_length[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-			norm += weights_length[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-	return rad_out;
-}
-double CylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/dabmodel.cpp
===================================================================
--- src/sas/models/c_extension/c_models/dabmodel.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,61 +1,0 @@
-
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-/**
-
-   Scattering model class for the DAB (Debye Anderson Brumberger) Model
-
-**/
-
-
-
-#include <math.h>
-#include "parameters.hh"
-#include "dabmodel.h"
-
-DABModel::DABModel() {
-  length = Parameter(50.0);
-  scale = Parameter(1.0);
-  background = Parameter(0.0);
-
-}
-
-double DABModel::operator()(double q) {
-  double d_length = length();
-  double d_scale = scale();
-  double d_background = background();
-
-  double numerator = d_scale*pow(d_length,3);
-  double denominator = pow(1 + pow(q*d_length,2),2);
-
-  return numerator / denominator + d_background;
-  
-
-
-}
-
-double DABModel::operator()(double qx,double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double DABModel::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double DABModel::calculate_VR() {
-  return 1.0;
-}
-
-double DABModel::evaluate_rphi(double q,double phi) {
-  double qx = q * cos(phi);
-  double qy = q * sin(phi);
-  return this->operator()(qx,qy);
-}
Index: src/sas/models/c_extension/c_models/dispersion_visitor.cpp
===================================================================
--- src/sas/models/c_extension/c_models/dispersion_visitor.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,132 +1,0 @@
-#include "dispersion_visitor.hh"
-#include "parameters.hh"
-
-#ifndef __MODELS_STANDALONE__
-extern "C" {
-	#include <Python.h>
-}
-#endif
-
-void DispersionVisitor:: dispersion_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	DispersionModel * disp = (DispersionModel*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "flat"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-#endif
-}
-
-void DispersionVisitor:: gaussian_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	GaussianDispersion * disp = (GaussianDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "gaussian"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
-#endif
-}
-
-void DispersionVisitor:: rectangle_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	RectangleDispersion * disp = (RectangleDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "rectangle"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
-#endif
-}
-
-void DispersionVisitor:: lognormal_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	LogNormalDispersion * disp = (LogNormalDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "lognormal"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
-#endif
-}
-
-
-void DispersionVisitor:: schulz_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	SchulzDispersion * disp = (SchulzDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "schulz"));
-    PyDict_SetItemString(dict, "npts",  Py_BuildValue("i", disp->npts));
-    PyDict_SetItemString(dict, "width", Py_BuildValue("d", disp->width));
-    PyDict_SetItemString(dict, "nsigmas", Py_BuildValue("d", disp->nsigmas));
-#endif
-}
-
-void DispersionVisitor:: array_to_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	ArrayDispersion * disp = (ArrayDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-    PyDict_SetItemString(dict, "type",  Py_BuildValue("s", "array"));
-#endif
-}
-
-void DispersionVisitor:: dispersion_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	DispersionModel * disp = (DispersionModel*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts  = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-#endif
-}
-
-void DispersionVisitor:: gaussian_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	GaussianDispersion * disp = (GaussianDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts    = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width   = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-	disp->nsigmas = PyFloat_AsDouble( PyDict_GetItemString(dict, "nsigmas") );
-#endif
-}
-
-void DispersionVisitor:: rectangle_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	RectangleDispersion * disp = (RectangleDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts    = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width   = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-	disp->nsigmas = PyFloat_AsDouble( PyDict_GetItemString(dict, "nsigmas") );
-#endif
-}
-
-void DispersionVisitor:: lognormal_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	LogNormalDispersion * disp = (LogNormalDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts    = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width   = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-	disp->nsigmas = PyFloat_AsDouble( PyDict_GetItemString(dict, "nsigmas") );
-#endif
-}
-void DispersionVisitor:: schulz_from_dict(void* dispersion, void* dictionary) {
-#ifndef __MODELS_STANDALONE__
-	SchulzDispersion * disp = (SchulzDispersion*)dispersion;
-	PyObject * dict = (PyObject*)dictionary;
-
-	disp->npts    = PyInt_AsLong( PyDict_GetItemString(dict, "npts") );
-	disp->width   = PyFloat_AsDouble( PyDict_GetItemString(dict, "width") );
-	disp->nsigmas = PyFloat_AsDouble( PyDict_GetItemString(dict, "nsigmas") );
-#endif
-}
-
-void DispersionVisitor:: array_from_dict(void* dispersion, void* dictionary) {}
Index: src/sas/models/c_extension/c_models/ellipsoid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/ellipsoid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,344 +1,0 @@
-/**
-	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 "ellipsoid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius_a;
-  double radius_b;
-  double sldEll;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} EllipsoidParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double ellipsoid_analytical_2D_scaled(EllipsoidParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-  // Ellipsoid orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0.0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("ellipsoid_ana_2D: Unexpected error: cos(alpha)>1\n");
-    return 0;
-  }
-
-  // Angle between rotation axis and q vector
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel
-  answer = EllipsoidKernel(q, pars->radius_b, pars->radius_a, cos_val);
-
-  // Multiply by contrast^2
-  answer *= (pars->sldEll - pars->sldSolv) * (pars->sldEll - pars->sldSolv);
-
-  //normalize by cylinder volume
-  vol = 4.0/3.0 * acos(-1.0) * pars->radius_b * pars->radius_b * pars->radius_a;
-  answer *= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the ellipsoid
- * @param q: q-value
- * @return: function value
- */
-static double ellipsoid_analytical_2DXY(EllipsoidParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return ellipsoid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-EllipsoidModel :: EllipsoidModel() {
-  scale      = Parameter(1.0);
-  radius_a   = Parameter(20.0, true);
-  radius_a.set_min(0.0);
-  radius_b   = Parameter(400.0, true);
-  radius_b.set_min(0.0);
-  sldEll   = Parameter(4.e-6);
-  sldSolv   = Parameter(1.e-6);
-  background = Parameter(0.0);
-  axis_theta  = Parameter(57.325, true);
-  axis_phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double EllipsoidModel :: operator()(double q) {
-  double dp[6];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius_a();
-  dp[2] = radius_b();
-  dp[3] = sldEll();
-  dp[4] = sldSolv();
-  dp[5] = 0.0;
-
-  // Get the dispersion points for the radius_a
-  vector<WeightPoint> weights_rad_a;
-  radius_a.get_weights(weights_rad_a);
-
-  // Get the dispersion points for the radius_b
-  vector<WeightPoint> weights_rad_b;
-  radius_b.get_weights(weights_rad_b);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius_a weight points
-  for(size_t i=0; i<weights_rad_a.size(); i++) {
-    dp[1] = weights_rad_a[i].value;
-
-    // Loop over radius_b weight points
-    for(size_t j=0; j<weights_rad_b.size(); j++) {
-      dp[2] = weights_rad_b[j].value;
-      //Un-normalize  by volume
-      sum += weights_rad_a[i].weight
-          * weights_rad_b[j].weight * EllipsoidForm(dp, q)
-      * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-
-      //Find average volume
-      vol += weights_rad_a[i].weight
-          * weights_rad_b[j].weight
-          * pow(weights_rad_b[j].value,2)
-      * weights_rad_a[i].value;
-      norm += weights_rad_a[i].weight
-          * weights_rad_b[j].weight;
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 EllipsoidModel :: operator()(double qx, double qy) {
-  EllipsoidParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.radius_a   = radius_a();
-  dp.radius_b   = radius_b();
-  dp.sldEll   = sldEll();
-  dp.sldSolv   = sldSolv();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi   = axis_phi();
-
-  // Get the dispersion points for the radius_a
-  vector<WeightPoint> weights_rad_a;
-  radius_a.get_weights(weights_rad_a);
-
-  // Get the dispersion points for the radius_b
-  vector<WeightPoint> weights_rad_b;
-  radius_b.get_weights(weights_rad_b);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad_a.size(); i++) {
-    dp.radius_a = weights_rad_a[i].value;
-
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_rad_b.size(); j++) {
-      dp.radius_b = weights_rad_b[j].value;
-
-      // Average over theta distribution
-      for(size_t k=0; k<weights_theta.size(); k++) {
-        dp.axis_theta = weights_theta[k].value;
-
-        // Average over phi distribution
-        for(size_t l=0; l<weights_phi.size(); l++) {
-          dp.axis_phi = weights_phi[l].value;
-          //Un-normalize by volume
-          double _ptvalue = weights_rad_a[i].weight
-              * weights_rad_b[j].weight
-              * weights_theta[k].weight
-              * weights_phi[l].weight
-              * ellipsoid_analytical_2DXY(&dp, qx, qy)
-          * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-          if (weights_theta.size()>1) {
-            _ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-          }
-          sum += _ptvalue;
-          //Find average volume
-          vol += weights_rad_a[i].weight
-              * weights_rad_b[j].weight
-              * pow(weights_rad_b[j].value,2) * weights_rad_a[i].value;
-          //Find norm for volume
-          norm_vol += weights_rad_a[i].weight
-              * weights_rad_b[j].weight;
-
-          norm += weights_rad_a[i].weight
-              * weights_rad_b[j].weight
-              * weights_theta[k].weight
-              * weights_phi[l].weight;
-
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double EllipsoidModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double EllipsoidModel :: calculate_ER() {
-  EllipsoidParameters dp;
-
-  dp.radius_a = radius_a();
-  dp.radius_b = radius_b();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_radius_a;
-  radius_a.get_weights(weights_radius_a);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius_b;
-  radius_b.get_weights(weights_radius_b);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_radius_b.size(); i++) {
-    dp.radius_b = weights_radius_b[i].value;
-    for(int k=0; k< (int)weights_radius_a.size(); k++) {
-      dp.radius_a = weights_radius_a[k].value;
-      sum +=weights_radius_b[i].weight
-          * weights_radius_a[k].weight*DiamEllip(dp.radius_a,dp.radius_b)/2.0;
-      norm += weights_radius_b[i].weight* weights_radius_a[k].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = DiamEllip(dp.radius_a,dp.radius_b)/2.0;}
-
-  return rad_out;
-}
-double EllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/ellipticalcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/ellipticalcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,466 +1,0 @@
-/**
-	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>
-#include <stdlib.h>
-using namespace std;
-#include "elliptical_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double r_minor;
-  double r_ratio;
-  double length;
-  double sldCyl;
-  double sldSolv;
-  double background;
-  double cyl_theta;
-  double cyl_phi;
-  double cyl_psi;
-} EllipticalCylinderParameters;
-
-
-static double elliptical_cylinder_kernel(EllipticalCylinderParameters *pars, double q, double cos_val, double cos_nu, double cos_mu) {
-  double qr;
-  double qL;
-  double Be,Si;
-  double r_major;
-  double kernel;
-
-  r_major = pars->r_ratio * pars->r_minor;
-
-  qr = q*sqrt( r_major*r_major*cos_nu*cos_nu + pars->r_minor*pars->r_minor*cos_mu*cos_mu );
-  qL = q*pars->length*cos_val/2.0;
-
-  if (qr==0){
-    Be = 0.5;
-  }else{
-    Be = NR_BessJ1(qr)/qr;
-  }
-  if (qL==0){
-    Si = 1.0;
-  }else{
-    Si = sin(qL)/qL;
-  }
-
-
-  kernel = 2.0*Be * Si;
-  return kernel*kernel;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double elliptical_cylinder_analytical_2D_scaled(EllipticalCylinderParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  double ella_x, ella_y, ellb_x, ellb_y;
-  //double q_z;
-  double vol, cos_val;
-  double cos_mu, cos_nu;
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->cyl_theta * pi/180.0;
-  double phi = pars->cyl_phi * pi/180.0;
-  double psi = pars->cyl_psi * pi/180.0;
-
-  //Cylinder orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0;
-
-  // Note: cos(alpha) = 0 and 1 will get an
-  // undefined value from CylKernel
-  //alpha = acos( cos_val );
-
-  //ellipse orientation:
-  // the elliptical corss section was transformed and projected
-  // into the detector plane already through sin(alpha)and furthermore psi remains as same
-  // on the detector plane.
-  // So, all we need is to calculate the angle (nu) of the minor axis of the ellipse wrt
-  // the wave vector q.
-
-  //x- y- component on the detector plane.
-  ella_x =  -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  ella_y =  sin(psi)*cos(theta);
-  ellb_x =  -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  ellb_y =  cos(theta)*cos(psi);
-  
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // calculate the axis of the ellipse wrt q-coord.
-  cos_nu = ella_x*q_x + ella_y*q_y;
-  cos_mu = ellb_x*q_x + ellb_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val = 1.0;
-  }
-  if (fabs(cos_nu)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(nu)>1\n");
-    cos_nu = 1.0;
-  }
-  if (fabs(cos_mu)>1.0) {
-    //printf("cyl_ana_2D: Unexpected error: cos(nu)>1\n");
-    cos_mu = 1.0;
-  }
-  answer = elliptical_cylinder_kernel(pars, q, cos_val, cos_nu, cos_mu);
-
-  // Multiply by contrast^2
-  answer *= (pars->sldCyl - pars->sldSolv) * (pars->sldCyl - pars->sldSolv);
-
-  //normalize by cylinder volume
-  //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-  vol = acos(-1.0) * pars->r_minor * pars->r_minor * pars->r_ratio * pars->length;
-  answer *= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @return: function value
- */
-static double elliptical_cylinder_analytical_2DXY(EllipticalCylinderParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return elliptical_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-EllipticalCylinderModel :: EllipticalCylinderModel() {
-  scale      = Parameter(1.0);
-  r_minor    = Parameter(20.0, true);
-  r_minor.set_min(0.0);
-  r_ratio    = Parameter(1.5, true);
-  r_ratio.set_min(0.0);
-  length     = Parameter(400.0, true);
-  length.set_min(0.0);
-  sldCyl   = Parameter(4.e-6);
-  sldSolv   = Parameter(1.e-6);
-  background = Parameter(0.0);
-  cyl_theta  = Parameter(57.325, true);
-  cyl_phi    = Parameter(0.0, true);
-  cyl_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double EllipticalCylinderModel :: operator()(double q) {
-  double dp[7];
-
-  dp[0] = scale();
-  dp[1] = r_minor();
-  dp[2] = r_ratio();
-  dp[3] = length();
-  dp[4] = sldCyl();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the r_minor
-  vector<WeightPoint> weights_rad;
-  r_minor.get_weights(weights_rad);
-
-  // Get the dispersion points for the r_ratio
-  vector<WeightPoint> weights_rat;
-  r_ratio.get_weights(weights_rat);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over r_minor weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[1] = weights_rad[i].value;
-
-    // Loop over r_ratio weight points
-    for(size_t j=0; j<weights_rat.size(); j++) {
-      dp[2] = weights_rat[j].value;
-
-      // Loop over length weight points
-      for(size_t k=0; k<weights_len.size(); k++) {
-        dp[3] = weights_len[k].value;
-        //Un-normalize  by volume
-        sum += weights_rad[i].weight
-            * weights_len[k].weight
-            * weights_rat[j].weight
-            * EllipCyl20(dp, q)
-        * pow(weights_rad[i].value,2) * weights_rat[j].value
-        * weights_len[k].value;
-        //Find average volume
-        vol += weights_rad[i].weight
-            * weights_len[k].weight
-            * weights_rat[j].weight
-            * pow(weights_rad[i].value,2) * weights_rat[j].value
-            * weights_len[k].value;
-        norm += weights_rad[i].weight
-            * weights_len[k].weight
-            * weights_rat[j].weight;
-      }
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 EllipticalCylinderModel :: operator()(double qx, double qy) {
-  EllipticalCylinderParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.r_minor    = r_minor();
-  dp.r_ratio    = r_ratio();
-  dp.length     = length();
-  dp.sldCyl   = sldCyl();
-  dp.sldSolv   = sldSolv();
-  dp.background = 0.0;
-  dp.cyl_theta  = cyl_theta();
-  dp.cyl_phi    = cyl_phi();
-  dp.cyl_psi    = cyl_psi();
-
-  // Get the dispersion points for the r_minor
-  vector<WeightPoint> weights_rad;
-  r_minor.get_weights(weights_rad);
-
-  // Get the dispersion points for the r_ratio
-  vector<WeightPoint> weights_rat;
-  r_ratio.get_weights(weights_rat);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  cyl_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  cyl_phi.get_weights(weights_phi);
-
-  // Get angular averaging for psi
-  vector<WeightPoint> weights_psi;
-  cyl_psi.get_weights(weights_psi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over minor radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.r_minor = weights_rad[i].value;
-
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp.length = weights_len[j].value;
-
-      // Loop over r_ration weight points
-      for(size_t m=0; m<weights_rat.size(); m++) {
-        dp.r_ratio = weights_rat[m].value;
-
-        // Average over theta distribution
-        for(size_t k=0; k<weights_theta.size(); k++) {
-          dp.cyl_theta = weights_theta[k].value;
-
-          // Average over phi distribution
-          for(size_t l=0; l<weights_phi.size(); l++) {
-            dp.cyl_phi = weights_phi[l].value;
-
-            // Average over phi distribution
-            for(size_t o=0; o<weights_psi.size(); o++) {
-              dp.cyl_psi = weights_psi[o].value;
-              //Un-normalize by volume
-              double _ptvalue = weights_rad[i].weight
-                  * weights_len[j].weight
-                  * weights_rat[m].weight
-                  * weights_theta[k].weight
-                  * weights_phi[l].weight
-                  * weights_psi[o].weight
-                  * elliptical_cylinder_analytical_2DXY(&dp, qx, qy)
-              * pow(weights_rad[i].value,2)
-              * weights_len[j].value
-              * weights_rat[m].value;
-              if (weights_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_theta[k].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              vol += weights_rad[i].weight
-                  * weights_len[j].weight
-                  * weights_rat[m].weight
-                  * pow(weights_rad[i].value,2)
-              * weights_len[j].value
-              * weights_rat[m].value;
-              //Find norm for volume
-              norm_vol += weights_rad[i].weight
-                  * weights_len[j].weight
-                  * weights_rat[m].weight;
-
-              norm += weights_rad[i].weight
-                  * weights_len[j].weight
-                  * weights_rat[m].weight
-                  * weights_theta[k].weight
-                  * weights_phi[l].weight
-                  * weights_psi[o].weight;
-
-            }
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double EllipticalCylinderModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double EllipticalCylinderModel :: calculate_ER() {
-  EllipticalCylinderParameters dp;
-  dp.r_minor    = r_minor();
-  dp.r_ratio    = r_ratio();
-  dp.length     = length();
-  double rad_out = 0.0;
-  double suf_rad = sqrt(dp.r_minor*dp.r_minor*dp.r_ratio);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the r_minor
-  vector<WeightPoint> weights_rad;
-  r_minor.get_weights(weights_rad);
-
-  // Get the dispersion points for the r_ratio
-  vector<WeightPoint> weights_rat;
-  r_ratio.get_weights(weights_rat);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Loop over minor radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.r_minor = weights_rad[i].value;
-
-    // Loop over length weight points
-    for(size_t j=0; j<weights_len.size(); j++) {
-      dp.length = weights_len[j].value;
-
-      // Loop over r_ration weight points
-      for(size_t m=0; m<weights_rat.size(); m++) {
-        dp.r_ratio = weights_rat[m].value;
-        //Calculate surface averaged radius
-        suf_rad = sqrt(dp.r_minor * dp.r_minor * dp.r_ratio);
-
-        //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-        sum +=weights_rad[i].weight *weights_len[j].weight
-            * weights_rat[m].weight*DiamCyl(dp.length, suf_rad)/2.0;
-        norm += weights_rad[i].weight *weights_len[j].weight* weights_rat[m].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-    rad_out = DiamCyl(dp.length, suf_rad)/2.0;}
-
-  return rad_out;
-}
-double EllipticalCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/fcc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fcc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,338 +1,0 @@
-/**
-	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 "fcc.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-} FCParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double fc_analytical_2D_scaled(FCParameters *pars, double q, double q_x, double q_y) {
-  double b3_x, b3_y, b1_x, b1_y, b2_x, b2_y; //, b3_z
-  double q_z;
-  double cos_val_b3, cos_val_b2, cos_val_b1;
-  double a1_dot_q, a2_dot_q,a3_dot_q;
-  double answer;
-  double Pi = 4.0*atan(1.0);
-  double aa, Da, qDa_2, latticeScale, Zq, Fkq, Fkq_2;
-
-  double dp[5];
-  //convert angle degree to radian
-  double theta = pars->theta * Pi/180.0;
-  double phi = pars->phi * Pi/180.0;
-  double psi = pars->psi * Pi/180.0;
-  dp[0] = 1.0;
-  dp[1] = pars->radius;
-  dp[2] = pars->sldSph;
-  dp[3] = pars->sldSolv;
-  dp[4] = 0.0;
-
-  aa = pars->dnn;
-  Da = pars->d_factor*aa;
-  qDa_2 = pow(q*Da,2.0);
-  //contrast = pars->sldSph - pars->sldSolv;
-
-  latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.0),3.0);
-  // q vector
-  q_z = 0.0; // for SANS; assuming qz is negligible
-  /// Angles here are respect to detector coordinate
-  ///  instead of against q coordinate in PRB 36(46), 3(6), 1754(3854)
-  // b3 axis orientation
-  b3_x = cos(theta) * cos(phi);
-  b3_y = sin(theta);
-  //b3_z = -cos(theta) * sin(phi);
-  cos_val_b3 =  b3_x*q_x + b3_y*q_y;// + b3_z*q_z;
-  
-  // b1 axis orientation
-  b1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  b1_y = sin(psi)*cos(theta);
-  cos_val_b1 = b1_x*q_x + b1_y*q_y;
-  
-  // b2 axis orientation
-  b2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  b2_y = cos(theta)*cos(psi);
-  cos_val_b2 =  b2_x*q_x + b2_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val_b3)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b3 = 1.0;
-  }
-  if (fabs(cos_val_b2)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b2 = 1.0;
-  }
-  if (fabs(cos_val_b1)>1.0) {
-    //printf("bcc_ana_2D: Unexpected error: cos()>1\n");
-    cos_val_b1 = 1.0;
-  }
-  // Compute the angle btw vector q and the a3 axis
-  a3_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b1);
-
-  // a1 axis
-  a1_dot_q = 0.5*aa*q*(cos_val_b2+cos_val_b3);
-
-  // a2 axis
-  a2_dot_q = 0.5*aa*q*(cos_val_b3+cos_val_b1);
-
-
-  // Get Fkq and Fkq_2
-  Fkq = exp(-0.5*pow(Da/aa,2.0)*(a1_dot_q*a1_dot_q+a2_dot_q*a2_dot_q+a3_dot_q*a3_dot_q));
-  Fkq_2 = Fkq*Fkq;
-  // Call Zq=Z1*Z2*Z3
-  Zq = (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a1_dot_q)+Fkq_2);
-  Zq = Zq * (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a2_dot_q)+Fkq_2);
-  Zq = Zq * (1.0-Fkq_2)/(1.0-2.0*Fkq*cos(a3_dot_q)+Fkq_2);
-
-  // Use SphereForm directly from libigor
-  answer = SphereForm(dp,q)*Zq;
-
-  //consider scales
-  answer *= latticeScale * pars->scale;
-
-  // This FIXES a singualrity the kernel in libigor.
-  if ( answer == INFINITY || answer == NAN){
-    answer = 0.0;
-  }
-
-  // add background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static double fc_analytical_2DXY(FCParameters *pars, double qx, double qy){
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return fc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-FCCrystalModel :: FCCrystalModel() {
-  scale      = Parameter(1.0);
-  dnn		= Parameter(220.0);
-  d_factor = Parameter(0.06);
-  radius     = Parameter(40.0, true);
-  radius.set_min(0.0);
-  sldSph   = Parameter(3.0e-6);
-  sldSolv   = Parameter(6.3e-6);
-  background = Parameter(0.0);
-  theta  = Parameter(0.0, true);
-  phi    = Parameter(0.0, true);
-  psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FCCrystalModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = dnn();
-  dp[2] = d_factor();
-  dp[3] = radius();
-  dp[4] = sldSph();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-  double result;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[3] = weights_rad[i].value;
-
-    //Un-normalize SphereForm by volume
-    result = FCC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-    // This FIXES a singualrity the kernel in libigor.
-    if ( result == INFINITY || result == NAN){
-      result = 0.0;
-    }
-    sum += weights_rad[i].weight
-        * result;
-    //Find average volume
-    vol += weights_rad[i].weight
-        * pow(weights_rad[i].value,3);
-
-    norm += weights_rad[i].weight;
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 FCCrystalModel :: operator()(double qx, double qy) {
-  FCParameters dp;
-  dp.scale      = scale();
-  dp.dnn   = dnn();
-  dp.d_factor   = d_factor();
-  dp.radius  = radius();
-  dp.sldSph   = sldSph();
-  dp.sldSolv   = sldSolv();
-  dp.background = 0.0;
-  dp.theta  = theta();
-  dp.phi    = phi();
-  dp.psi    = psi();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  phi.get_weights(weights_phi);
-
-  // Get angular averaging for psi
-  vector<WeightPoint> weights_psi;
-  psi.get_weights(weights_psi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.radius = weights_rad[i].value;
-    // Average over theta distribution
-    for(size_t j=0; j< weights_theta.size(); j++) {
-      dp.theta = weights_theta[j].value;
-      // Average over phi distribution
-      for(size_t k=0; k< weights_phi.size(); k++) {
-        dp.phi = weights_phi[k].value;
-        // Average over phi distribution
-        for(size_t l=0; l< weights_psi.size(); l++) {
-          dp.psi = weights_psi[l].value;
-          //Un-normalize SphereForm by volume
-          double _ptvalue = weights_rad[i].weight
-              * weights_theta[j].weight
-              * weights_phi[k].weight
-              * weights_psi[l].weight
-              * fc_analytical_2DXY(&dp, qx, qy);
-          //* pow(weights_rad[i].value,3.0);
-          // Consider when there is infinte or nan.
-          if ( _ptvalue == INFINITY || _ptvalue == NAN){
-            _ptvalue = 0.0;
-          }
-          if (weights_theta.size()>1) {
-            _ptvalue *= fabs(cos(weights_theta[j].value*pi/180.0));
-          }
-          sum += _ptvalue;
-          // This model dose not need the volume of spheres correction!!!
-          norm += weights_rad[i].weight
-              * weights_theta[j].weight
-              * weights_phi[k].weight
-              * weights_psi[l].weight;
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the FCCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FCCrystalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FCCrystalModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double FCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/flexcyl_ellipX.cpp
===================================================================
--- src/sas/models/c_extension/c_models/flexcyl_ellipX.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,216 +1,0 @@
-/**
-	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 "flexcyl_ellipX.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double length;
-  double kuhn_length;
-  double radius;
-  double axis_ratio;
-  double sldCyl;
-  double sldSolv;
-  double background;
-} FlexCylEXParameters;
-
-FlexCylEllipXModel :: FlexCylEllipXModel() {
-  scale      = Parameter(1.0);
-  length     = Parameter(1000.0, true);
-  length.set_min(0.0);
-  kuhn_length = Parameter(100.0, true);
-  kuhn_length.set_min(0.0);
-  radius  = Parameter(20.0, true);
-  radius.set_min(0.0);
-  axis_ratio = Parameter(1.5);
-  axis_ratio.set_min(0.0);
-  sldCyl   = Parameter(1.0e-6);
-  sldSolv   = Parameter(6.3e-6);
-  background = Parameter(0.0001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FlexCylEllipXModel :: operator()(double q) {
-  double dp[8];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = length();
-  dp[2] = kuhn_length();
-  dp[3] = radius();
-  dp[4] = axis_ratio();
-  dp[5] = sldCyl();
-  dp[6] = sldSolv();
-  dp[7] = 0.0;
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_len;
-  length.get_weights(weights_len);
-
-  // Get the dispersion points for the kuhn_length
-  vector<WeightPoint> weights_kuhn;
-  kuhn_length.get_weights(weights_kuhn);
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get the dispersion points for the axis_ratio
-  vector<WeightPoint> weights_ratio;
-  axis_ratio.get_weights(weights_ratio);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over length weight points
-  for(int i=0; i< (int)weights_len.size(); i++) {
-    dp[1] = weights_len[i].value;
-
-    // Loop over kuhn_length weight points
-    for(int j=0; j< (int)weights_kuhn.size(); j++) {
-      dp[2] = weights_kuhn[j].value;
-
-      // Loop over radius weight points
-      for(int k=0; k< (int)weights_rad.size(); k++) {
-        dp[3] = weights_rad[k].value;
-        // Loop over axis_ratio weight points
-        for(int l=0; l< (int)weights_ratio.size(); l++) {
-          dp[4] = weights_ratio[l].value;
-
-          //Un-normalize by volume
-          sum += weights_len[i].weight * weights_kuhn[j].weight*weights_rad[k].weight
-              * weights_ratio[l].weight * FlexCyl_Ellip(dp, q)
-          * (pow(weights_rad[k].value,2.0) * weights_ratio[l].value * weights_len[i].value);
-          //Find weighted volume
-          vol += weights_rad[k].weight * weights_kuhn[j].weight
-              * weights_len[i].weight * weights_ratio[l].weight
-              *pow(weights_rad[k].value,2.0)* weights_ratio[l].weight*weights_len[i].value;
-          norm += weights_len[i].weight * weights_kuhn[j].weight
-              *weights_rad[k].weight* weights_ratio[l].weight;
-        }
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 FlexCylEllipXModel :: 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 triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FlexCylEllipXModel :: evaluate_rphi(double q, double phi) {
-  //double qx = q*cos(phi);
-  //double qy = q*sin(phi);
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FlexCylEllipXModel :: calculate_ER() {
-  FlexCylEXParameters dp;
-
-  dp.radius  = radius();
-  dp.length     = length();
-  dp.axis_ratio  = axis_ratio();
-
-  double rad_out = 0.0;
-  double suf_rad = sqrt(dp.radius*dp.radius*dp.axis_ratio );
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the total length
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get the dispersion points for minor radius
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for axis ratio = major_radius/minor_radius
-  vector<WeightPoint> weights_ratio ;
-  axis_ratio.get_weights(weights_ratio);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_length.size(); i++) {
-    dp.length = weights_length[i].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      // Loop over axis_ratio weight points
-      for(int l=0; l< (int)weights_ratio.size(); l++) {
-        dp.axis_ratio = weights_ratio[l].value;
-        suf_rad = sqrt(dp.radius  * dp.radius  * dp.axis_ratio);
-        //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-        sum +=weights_length[i].weight * weights_radius[k].weight
-            * weights_ratio[l].weight *DiamCyl(dp.length,suf_rad)/2.0;
-        norm += weights_length[i].weight* weights_radius[k].weight* weights_ratio[l].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-    rad_out = DiamCyl(dp.length,suf_rad)/2.0;}
-
-  return rad_out;
-}
-double FlexCylEllipXModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/flexiblecylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/flexiblecylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,195 +1,0 @@
-/**
-	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
- *
- *	TODO: add 2d
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "flexible_cylinder.h"
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double length;
-  double kuhn_length;
-  double radius;
-  double sldCyl;
-  double sldSolv;
-  double background;
-} FlexibleCylinderParameters;
-
-FlexibleCylinderModel :: FlexibleCylinderModel() {
-	scale      = Parameter(1.0);
-	length     = Parameter(1000.0, true);
-	length.set_min(0.0);
-	kuhn_length = Parameter(100.0, true);
-	kuhn_length.set_min(0.0);
-	radius  = Parameter(20.0, true);
-	radius.set_min(0.0);
-	sldCyl   = Parameter(1.0e-6);
-	sldSolv   = Parameter(6.3e-6);
-	background = Parameter(0.0001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FlexibleCylinderModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = length();
-	dp[2] = kuhn_length();
-	dp[3] = radius();
-	dp[4] = sldCyl();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the length
-	vector<WeightPoint> weights_len;
-	length.get_weights(weights_len);
-
-	// Get the dispersion points for the kuhn_length
-	vector<WeightPoint> weights_kuhn;
-	kuhn_length.get_weights(weights_kuhn);
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over semi axis A weight points
-	for(int i=0; i< (int)weights_len.size(); i++) {
-		dp[1] = weights_len[i].value;
-
-		// Loop over semi axis B weight points
-		for(int j=0; j< (int)weights_kuhn.size(); j++) {
-			dp[2] = weights_kuhn[j].value;
-
-			// Loop over semi axis C weight points
-			for(int k=0; k< (int)weights_rad.size(); k++) {
-				dp[3] = weights_rad[k].value;
-				//Un-normalize by volume
-				sum += weights_len[i].weight
-					* weights_kuhn[j].weight*weights_rad[k].weight * FlexExclVolCyl(dp, q)
-					* pow(weights_rad[k].value,2.0)*weights_len[i].value;
-				//Find average volume
-				vol += weights_rad[k].weight
-					* weights_len[i].weight
-					* weights_kuhn[j].weight
-					*pow(weights_rad[k].value,2.0)*weights_len[i].value;
-				norm += weights_len[i].weight
-					* weights_kuhn[j].weight*weights_rad[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + 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 FlexibleCylinderModel :: 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 triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FlexibleCylinderModel :: evaluate_rphi(double q, double phi) {
-	//double qx = q*cos(phi);
-	//double qy = q*sin(phi);
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FlexibleCylinderModel :: calculate_ER() {
-	FlexibleCylinderParameters dp;
-
-	dp.radius  = radius();
-	dp.length     = length();
-
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_length;
-	length.get_weights(weights_length);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_length.size(); i++) {
-		dp.length = weights_length[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-			sum +=weights_length[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-			norm += weights_length[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-	return rad_out;
-}
-double FlexibleCylinderModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/fractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/**
-	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 "fractal.h"
-
-extern "C" {
-#include "libTwoPhase.h"
-}
-
-FractalModel :: FractalModel() {
-  scale      = Parameter(1.0);
-  radius = Parameter(5.0, true);
-  radius.set_min(0.0);
-  fractal_dim = Parameter(2.0);
-  cor_length = Parameter(100.0);
-  sldBlock = Parameter(2.0e-6);
-  sldSolv= Parameter(6.35e-6);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FractalModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = fractal_dim();
-  dp[3] = cor_length();
-  dp[4] = sldBlock();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[1] = weights_rad[i].value;
-
-    //Un-normalize Fractal by volume
-    sum += weights_rad[i].weight
-        * Fractal(dp, fabs(q)) * pow(weights_rad[i].value,3);
-    //Find average volume
-    vol += weights_rad[i].weight
-        * pow(weights_rad[i].value,3);
-
-    norm += weights_rad[i].weight;
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 FractalModel :: 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 FractalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FractalModel :: calculate_ER() {
-  //NOT implemented yet!!! 'cause None shape Model
-  return 0.0;
-}
-double FractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/fuzzysphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/fuzzysphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,184 +1,0 @@
-/**
-	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
- */
-
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "fuzzysphere.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// scattering from a uniform sphere w/ fuzzy surface
-// Modified from FuzzySpheres in libigor/libSphere.c without polydispersion: JHC
-static double fuzzysphere_kernel(double dp[], double q){
-  double pi,x,xr;
-  double radius,sldSph,sldSolv,scale,bkg,delrho,fuzziness,f2,bes,vol,f;   //my local names
-
-  pi = 4.0*atan(1.0);
-  x= q;
-  scale = dp[0];
-  radius = dp[1];
-  fuzziness = dp[2];
-  sldSph = dp[3];
-  sldSolv = dp[4];
-  bkg = dp[5];
-  delrho=sldSph-sldSolv;
-
-  xr = x*radius;
-  //handle xr==0 separately
-  if(xr == 0.0){
-    bes = 1.0;
-  }else{
-    bes = 3.0*(sin(xr)-xr*cos(xr))/(xr*xr*xr);
-  }
-  vol = 4.0*pi/3.0*radius*radius*radius;
-  f = vol*bes*delrho;   // [=] A
-  f *= exp(-0.5*fuzziness*fuzziness*x*x);
-  // normalize to single particle volume, convert to 1/cm
-  f2 = f * f / vol * 1.0e8;   // [=] 1/cm
-
-  f2 *= scale;
-  f2 += bkg;
-
-    return(f2); //scale, and add in the background
-}
-
-FuzzySphereModel :: FuzzySphereModel() {
-	scale      = Parameter(0.01);
-	radius     = Parameter(60.0, true);
-	radius.set_min(0.0);
-	fuzziness  = Parameter(10.0);
-	fuzziness.set_min(0.0);
-	sldSph   = Parameter(1.0e-6);
-	sldSolv   = Parameter(3.0e-6);
-	background = Parameter(0.001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double FuzzySphereModel :: operator()(double q) {
-	double dp[6];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = fuzziness();
-	dp[3] = sldSph();
-	dp[4] = sldSolv();
-	dp[5] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-
-	// Get the dispersion points for the fuzziness
-	vector<WeightPoint> weights_fuzziness;
-	fuzziness.get_weights(weights_fuzziness);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		dp[1] = weights_radius[i].value;
-		// Loop over fuzziness weight points
-		for(size_t j=0; j<weights_fuzziness.size(); j++) {
-			dp[2] = weights_fuzziness[j].value;
-
-			//Un-normalize SphereForm by volume
-			sum += weights_radius[i].weight * weights_fuzziness[j].weight
-				* fuzzysphere_kernel(dp, q) * pow(weights_radius[i].value,3);
-			//Find average volume : Note the fuzziness has no contribution to the volume
-			vol += weights_radius[i].weight
-				* pow(weights_radius[i].value,3);
-
-			norm += weights_radius[i].weight * weights_fuzziness[j].weight;
-			norm_vol += weights_radius[i].weight;
-		}
-	}
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-	return sum/norm + 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 FuzzySphereModel :: 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 sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double FuzzySphereModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double FuzzySphereModel :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	// No need to consider the fuzziness.
-	vector<WeightPoint> weights_radius;
-	radius.get_weights(weights_radius);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_radius.size(); i++) {
-		sum += weights_radius[i].weight
-			* weights_radius[i].value;
-		norm += weights_radius[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = radius();}
-
-	return rad_out;
-}
-double FuzzySphereModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/gaussian.cpp
===================================================================
--- src/sas/models/c_extension/c_models/gaussian.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/**
-	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
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "gaussian.h"
-
-Gaussian :: Gaussian() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D Gaussian function.
- * The function is normalized to the 'scale' parameter.
- *
- * f(x)=scale * 1/(sigma^2*2pi)e^(-(x-mu)^2/2sigma^2)
- *
- * @param q: q-value
- * @return: function value
- */
-double Gaussian :: operator()(double q) {
-  double sigma2 = pow(sigma(), 2);
-  return scale() / sigma2 * exp( -pow((q-center()), 2) / (2*sigma2));
-}
-
-/**
- * Function to evaluate 2D Gaussian  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Gaussian(x) * Gaussian(y)
- *
- * where both Gaussians share the same parameters.
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Gaussian :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D Gaussian  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Gaussian(x) * Gaussian(y)
- *
- * where both Gaussians share the same parameters.
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Gaussian :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Gaussian :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Gaussian :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/hollowcylinder.cpp
===================================================================
--- src/sas/models/c_extension/c_models/hollowcylinder.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,423 +1,0 @@
-/**
-	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 "hollow_cylinder.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double core_radius;
-  double radius;
-  double length;
-  double sldCyl;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} HollowCylinderParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the hollow cylinder
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double hollow_cylinder_analytical_2D_scaled(HollowCylinderParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y; //, cyl_z
-  //double q_z;
-  double  alpha,vol, cos_val;
-  double answer;
-  //convert angle degree to radian
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-  // Cylinder orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val);
-    return 0;
-  }
-
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel
-  answer = HolCylKernel(q, pars->core_radius, pars->radius, pars->length, cos_val);
-
-  // Multiply by contrast^2
-  answer *= (pars->sldCyl - pars->sldSolv)*(pars->sldCyl - pars->sldSolv);
-
-  //normalize by cylinder volume
-  vol=pi*((pars->radius*pars->radius)-(pars->core_radius *pars->core_radius))
-          *(pars->length);
-  answer *= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the Hollow cylinder
- * @param q: q-value
- * @return: function value
- */
-static double hollow_cylinder_analytical_2DXY(HollowCylinderParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return hollow_cylinder_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-HollowCylinderModel :: HollowCylinderModel() {
-  scale      = Parameter(1.0);
-  core_radius = Parameter(20.0, true);
-  core_radius.set_min(0.0);
-  radius  = Parameter(30.0, true);
-  radius.set_min(0.0);
-  length     = Parameter(400.0, true);
-  length.set_min(0.0);
-  sldCyl  = Parameter(6.3e-6);
-  sldSolv  = Parameter(1.0e-6);
-  background = Parameter(0.0);
-  axis_theta = Parameter(0.0, true);
-  axis_phi   = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double HollowCylinderModel :: operator()(double q) {
-  double dp[7];
-
-  dp[0] = scale();
-  dp[1] = core_radius();
-  dp[2] = radius();
-  dp[3] = length();
-  dp[4] = sldCyl();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_radius);
-
-  // Get the dispersion points for the shell radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over core radius weight points
-  for(int i=0; i< (int)weights_core_radius.size(); i++) {
-    dp[1] = weights_core_radius[i].value;
-
-    // Loop over length weight points
-    for(int j=0; j< (int)weights_length.size(); j++) {
-      dp[3] = weights_length[j].value;
-
-      // Loop over shell radius weight points
-      for(int k=0; k< (int)weights_radius.size(); k++) {
-        dp[2] = weights_radius[k].value;
-        //Un-normalize  by volume
-        sum += weights_core_radius[i].weight
-            * weights_length[j].weight
-            * weights_radius[k].weight
-            * HollowCylinder(dp, q)
-        * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2))
-        * weights_length[j].value;
-        //Find average volume
-        vol += weights_core_radius[i].weight
-            * weights_length[j].weight
-            * weights_radius[k].weight
-            * (pow(weights_radius[k].value,2)-pow(weights_core_radius[i].value,2))
-            * weights_length[j].value;
-
-        norm += weights_core_radius[i].weight
-            * weights_length[j].weight
-            * weights_radius[k].weight;
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 HollowCylinderModel :: operator()(double qx, double qy) {
-  HollowCylinderParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.core_radius     = core_radius();
-  dp.radius  = radius();
-  dp.length     = length();
-  dp.sldCyl   = sldCyl();
-  dp.sldSolv  = sldSolv();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi   = axis_phi();
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_radius);
-
-  // Get the dispersion points for the shell radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over core radius weight points
-  for(int i=0; i<(int)weights_core_radius.size(); i++) {
-    dp.core_radius = weights_core_radius[i].value;
-
-
-    // Loop over length weight points
-    for(int j=0; j<(int)weights_length.size(); j++) {
-      dp.length = weights_length[j].value;
-
-      // Loop over shell radius weight points
-      for(int m=0; m< (int)weights_radius.size(); m++) {
-        dp.radius = weights_radius[m].value;
-
-        // Average over theta distribution
-        for(int k=0; k< (int)weights_theta.size(); k++) {
-          dp.axis_theta = weights_theta[k].value;
-
-          // Average over phi distribution
-          for(int l=0; l< (int)weights_phi.size(); l++) {
-            dp.axis_phi = weights_phi[l].value;
-            //Un-normalize by volume
-            double _ptvalue = weights_core_radius[i].weight
-                * weights_length[j].weight
-                * weights_radius[m].weight
-                * weights_theta[k].weight
-                * weights_phi[l].weight
-                * hollow_cylinder_analytical_2DXY(&dp, qx, qy)
-            / ((pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2))
-                * weights_length[j].value);
-            if (weights_theta.size()>1) {
-              _ptvalue *= fabs(cos(weights_theta[k].value * pi/180.0));
-            }
-            sum += _ptvalue;
-            //Find average volume
-            vol += weights_core_radius[i].weight
-                * weights_length[j].weight
-                * weights_radius[m].weight
-                * (pow(weights_radius[m].value,2)-pow(weights_core_radius[i].value,2))
-                * weights_length[j].value;
-            //Find norm for volume
-            norm_vol += weights_core_radius[i].weight
-                * weights_length[j].weight
-                * weights_radius[m].weight;
-
-            norm += weights_core_radius[i].weight
-                * weights_length[j].weight
-                * weights_radius[m].weight
-                * weights_theta[k].weight
-                * weights_phi[l].weight;
-
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm/asin(1.0);
-  if (vol != 0.0 || norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum*(vol/norm_vol);}
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the  cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double HollowCylinderModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double HollowCylinderModel :: calculate_ER() {
-  HollowCylinderParameters dp;
-
-  dp.radius  = radius();
-  dp.length     = length();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_length.size(); i++) {
-    dp.length = weights_length[i].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-      sum +=weights_length[i].weight
-          * weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0;
-      norm += weights_length[i].weight* weights_radius[k].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-    rad_out = DiamCyl(dp.length,dp.radius)/2.0;}
-
-  return rad_out;
-}
-/**
- * Function to calculate volf_ratio for shell
- * @return: volf_ratio value
- */
-double HollowCylinderModel :: calculate_VR() {
-  HollowCylinderParameters dp;
-  dp.core_radius = core_radius();
-  dp.radius  = radius();
-  dp.length  = length();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum_tot = 0.0;
-  double sum_shell = 0.0;
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_length;
-  length.get_weights(weights_length);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_radius);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_length.size(); i++) {
-    dp.length = weights_length[i].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      for(int j=0; j<(int)weights_core_radius.size(); j++) {
-    	  dp.core_radius = weights_core_radius[j].value;
-		  sum_tot +=weights_length[i].weight* weights_core_radius[j].weight
-			  * weights_radius[k].weight*pow(dp.radius, 2);
-		  sum_shell += weights_length[i].weight* weights_core_radius[j].weight
-			  * weights_radius[k].weight*(pow(dp.radius, 2)-pow(dp.core_radius, 2));
-      }
-    }
-  }
-    if (sum_tot == 0.0){
-      //return the default value
-      rad_out =  1.0;}
-    else{
-      //return ratio value
-      return sum_shell/sum_tot;
-    }
-}
Index: src/sas/models/c_extension/c_models/lamellar.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellar.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/**
-	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 "lamellar.h"
-
-/*  LamellarFFX  :  calculates the form factor of a lamellar structure - no S(q) effects included
-            -NO polydispersion included
-*/
-static double lamellar_kernel(double dp[], double q){
-  double scale,del,sld_bi,sld_sol,contr,bkg;    //local variables of coefficient wave
-  double inten, qval,Pq;
-  double Pi;
-
-
-  Pi = 4.0*atan(1.0);
-  scale = dp[0];
-  del = dp[1];
-  sld_bi = dp[2];
-  sld_sol = dp[3];
-  bkg = dp[4];
-  qval = q;
-  contr = sld_bi -sld_sol;
-
-  Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del));
-
-  inten = 2.0*Pi*scale*Pq/(qval*qval);    //this is now dimensionless...
-
-  inten /= del;     //normalize by the thickness (in A)
-
-  inten *= 1.0e8;   // 1/A to 1/cm
-
-  return(inten+bkg);
-}
-
-LamellarModel :: LamellarModel() {
-	scale      = Parameter(1.0);
-	bi_thick     = Parameter(50.0, true);
-	bi_thick.set_min(0.0);
-	sld_bi    = Parameter(1.0e-6);
-	sld_sol    = Parameter(6.3e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarModel :: operator()(double q) {
-	double dp[5];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = bi_thick();
-	dp[2] = sld_bi();
-	dp[3] = sld_sol();
-	dp[4] = 0.0;
-
-	// Get the dispersion points for the bi_thick
-	vector<WeightPoint> weights_bi_thick;
-	bi_thick.get_weights(weights_bi_thick);
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over short_edgeA weight points
-	for(int i=0; i< (int)weights_bi_thick.size(); i++) {
-		dp[1] = weights_bi_thick[i].value;
-
-		sum += weights_bi_thick[i].weight * lamellar_kernel(dp, q);
-		norm += weights_bi_thick[i].weight;
-
-	}
-
-	return sum/norm + 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 LamellarModel :: 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 lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-double LamellarModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/lamellarFF_HG.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarFF_HG.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/**
-	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 "lamellarFF_HG.h"
-
-extern "C" {
-#include "libCylinder.h"
-}
-
-LamellarFFHGModel :: LamellarFFHGModel() {
-  scale      = Parameter(1.0);
-  t_length     = Parameter(15.0, true);
-  t_length.set_min(0.0);
-  h_thickness    = Parameter(10.0, true);
-  h_thickness.set_min(0.0);
-  sld_tail   = Parameter(4e-7);
-  sld_head  = Parameter(3e-6);
-  sld_solvent    = Parameter(6e-6);
-  background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarFFHGModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = t_length();
-  dp[2] = h_thickness();
-  dp[3] = sld_tail();
-  dp[4] = sld_head();
-  dp[5] = sld_solvent();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the tail length
-  vector<WeightPoint> weights_t_length;
-  t_length.get_weights(weights_t_length);
-
-  // Get the dispersion points for the head thickness
-  vector<WeightPoint> weights_h_thickness;
-  h_thickness.get_weights(weights_h_thickness);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over semi axis A weight points
-  for(int i=0; i< (int)weights_t_length.size(); i++) {
-    dp[1] = weights_t_length[i].value;
-
-    for (int j=0; j< (int)weights_h_thickness.size(); j++){
-      dp[2] = weights_h_thickness[j].value;
-
-      sum += weights_t_length[i].weight* weights_h_thickness[j].weight*LamellarFF_HG(dp, q);
-      norm += weights_t_length[i].weight* weights_h_thickness[j].weight;
-    }
-
-  }
-  return sum/norm + 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 LamellarFFHGModel :: 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 lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarFFHGModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarFFHGModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double LamellarFFHGModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/lamellarPC.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPC.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,123 +1,0 @@
-/**
-	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 "lamellarPC.h"
-
-extern "C" {
-#include "libCylinder.h"
-}
-
-LamellarPCrystalModel :: LamellarPCrystalModel() {
-  scale      = Parameter(1.0);
-  thickness     = Parameter(33.0, true);
-  thickness.set_min(0.0);
-  Nlayers    = Parameter(20.0, true);
-  Nlayers.set_min(0.0);
-  spacing   = Parameter(250);
-  pd_spacing   = Parameter(0.0);
-  sld_layer  = Parameter(1.0e-6);
-  sld_solvent    = Parameter(6.34e-6);
-  background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPCrystalModel :: operator()(double q) {
-  double dp[8];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = thickness();
-  dp[2] = Nlayers();
-  dp[3] = spacing();
-  dp[4] = pd_spacing();
-  dp[5] = sld_layer();
-  dp[6] = sld_solvent();
-  dp[7] = 0.0; // Do not apply background here.
-
-  // Get the dispersion points for the head thickness
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Let's provide from the func which is more accurate especially for small q region.
-  // Get the dispersion points for the tail length
-  //vector<WeightPoint> weights_spacing;
-  //spacing.get_weights(weights_spacing);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over thickness and spacing weight points
-  for(int i=0; i< (int)weights_thickness.size(); i++) {
-    dp[1] = weights_thickness[i].value;
-    //for (int j=0; j< (int)weights_spacing.size(); j++){
-    //dp[3] = weights_spacing[j].value;
-    sum += weights_thickness[i].weight*Lamellar_ParaCrystal(dp, q);
-    norm += weights_thickness[i].weight;
-    //}
-  }
-  //apply norm and background
-  return sum/norm + 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 LamellarPCrystalModel :: 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 lamellar
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPCrystalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPCrystalModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double LamellarPCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/lamellarPS.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPS.cpp	(revision 37649847151eecf7e862b5e7e11d0449a0941b2e)
+++ 	(revision )
@@ -1,188 +1,0 @@
-/**
-	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
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "lamellarPS.h"
-
-extern "C" {
-#include "libCylinder.h"
-}
-
-/*LamellarPS_kernel() was moved from libigor to get rid of polydipersity in del(thickness) that we provide from control panel.
-  LamellarPSX  :  calculates the form factor of a lamellar structure - with S(q) effects included
--------
-------- resolution effects ARE NOT included, but only a CONSTANT default value, not the real q-dependent resolution!!
-
- */
-static double LamellarPS_kernel(double dp[], double q)
-{
-  double scale,dd,del,sld_bi,sld_sol,contr,NN,Cp,bkg;   //local variables of coefficient wave
-  double inten, qval,Pq,Sq,alpha,temp,t1,t2,t3,dQ;
-  double Pi,Euler,dQDefault,fii;
-  int ii,NNint;
-  Euler = 0.5772156649;   // Euler's constant
-  dQDefault = 0.0;    //[=] 1/A, q-resolution, default value
-  dQ = dQDefault;
-
-  Pi = 4.0*atan(1.0);
-  qval = q;
-
-  scale = dp[0];
-  dd = dp[1];
-  del = dp[2];
-  sld_bi = dp[3];
-  sld_sol = dp[4];
-  NN = trunc(dp[5]);    //be sure that NN is an integer
-  Cp = dp[6];
-  bkg = dp[7];
-
-  contr = sld_bi - sld_sol;
-
-  Pq = 2.0*contr*contr/qval/qval*(1.0-cos(qval*del));
-
-  NNint = (int)NN;    //cast to an integer for the loop
-  ii=0;
-  Sq = 0.0;
-  for(ii=1;ii<=(NNint-1);ii+=1) {
-
-    fii = (double)ii;   //do I really need to do this?
-
-    temp = 0.0;
-    alpha = Cp/4.0/Pi/Pi*(log(Pi*ii) + Euler);
-    t1 = 2.0*dQ*dQ*dd*dd*alpha;
-    t2 = 2.0*qval*qval*dd*dd*alpha;
-    t3 = dQ*dQ*dd*dd*ii*ii;
-
-    temp = 1.0-ii/NN;
-    temp *= cos(dd*qval*ii/(1.0+t1));
-    temp *= exp(-1.0*(t2 + t3)/(2.0*(1.0+t1)) );
-    temp /= sqrt(1.0+t1);
-
-    Sq += temp;
-  }
-
-  Sq *= 2.0;
-  Sq += 1.0;
-
-  inten = 2.0*Pi*scale*Pq*Sq/(dd*qval*qval);
-
-  inten *= 1.0e8;   // 1/A to 1/cm
-
-  return(inten+bkg);
-}
-
-LamellarPSModel :: LamellarPSModel() {
-  scale      = Parameter(1.0);
-  spacing    = Parameter(400.0, true);
-  spacing.set_min(0.0);
-  delta     = Parameter(30.0);
-  delta.set_min(0.0);
-  sld_bi   = Parameter(6.3e-6);
-  sld_sol   = Parameter(1.0e-6);
-  n_plates     = Parameter(20.0);
-  caille = Parameter(0.1);
-  background = Parameter(0.0);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPSModel :: operator()(double q) {
-  double dp[8];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = spacing();
-  dp[2] = delta();
-  dp[3] = sld_bi();
-  dp[4] = sld_sol();
-  dp[5] = n_plates();
-  dp[6] = caille();
-  dp[7] = 0.0;
-
-
-  // Get the dispersion points for spacing and delta (thickness)
-  vector<WeightPoint> weights_spacing;
-  spacing.get_weights(weights_spacing);
-  vector<WeightPoint> weights_delta;
-  delta.get_weights(weights_delta);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Loop over short_edgeA weight points
-  for(int i=0; i< (int)weights_spacing.size(); i++) {
-    dp[1] = weights_spacing[i].value;
-    //for(int j=0; j< (int)weights_spacing.size(); j++) {    BUGS fixed March 2015
-    for(int j=0; j< (int)weights_delta.size(); j++) {
-      //dp[2] = weights_delta[i].value;        BUG
-      dp[2] = weights_delta[j].value;
-
-      sum += weights_spacing[i].weight * weights_delta[j].weight * LamellarPS_kernel(dp, q);
-      norm += weights_spacing[i].weight * weights_delta[j].weight;
-    }
-  }
-  return sum/norm + 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 LamellarPSModel :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPSModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPSModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double LamellarPSModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/lamellarPS_HG.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lamellarPS_HG.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/**
-	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
- *
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lamellarPS_HG.h"
-
-extern "C" {
-	#include "libCylinder.h"
-}
-
-LamellarPSHGModel :: LamellarPSHGModel() {
-	scale      = Parameter(1.0);
-	spacing    = Parameter(40.0, true);
-	spacing.set_min(0.0);
-	deltaT     = Parameter(10.0, true);
-	deltaT.set_min(0.0);
-	deltaH     = Parameter(2.0, true);
-	deltaH.set_min(0.0);
-	sld_tail    = Parameter(4e-7);
-	sld_head    = Parameter(2e-6);
-	sld_solvent   = Parameter(6e-6);
-	n_plates     = Parameter(30);
-	caille = Parameter(0.001);
-	background = Parameter(0.001);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double LamellarPSHGModel :: operator()(double q) {
-	double dp[10];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = spacing();
-	dp[2] = deltaT();
-	dp[3] = deltaH();
-	dp[4] = sld_tail();
-	dp[5] = sld_head();
-	dp[6] = sld_solvent();
-	dp[7] = n_plates();
-	dp[8] = caille();
-	dp[9] = 0.0;
-
-
-	// Get the dispersion points for (deltaT) thickness of the tail
-	vector<WeightPoint> weights_deltaT;
-	deltaT.get_weights(weights_deltaT);
-
-	// Get the dispersion points for (deltaH) thickness of the head
-	vector<WeightPoint> weights_deltaH;
-	deltaH.get_weights(weights_deltaH);
-
-	// Get the dispersion points for spacing
-	vector<WeightPoint> weights_spacing;
-	spacing.get_weights(weights_spacing);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Loop over deltaT  weight points
-	for(int i=0; i< (int)weights_deltaT.size(); i++) {
-		dp[2] = weights_deltaT[i].value;
-
-		// Loop over deltaH weight points
-		for(int j=0; j< (int)weights_deltaH.size(); j++) {
-			dp[3] = weights_deltaH[j].value;
-			// Loop over spacing weight points
-			for(int k=0; k< (int)weights_spacing.size(); k++) {
-				dp[1] = weights_spacing[k].value;
-
-				sum += weights_deltaT[i].weight * weights_deltaH[j].weight *weights_spacing[k].weight
-								*LamellarPS_HG(dp, q);
-				norm += weights_deltaT[i].weight * weights_deltaH[j].weight * weights_spacing[k].weight;
-			}
-		}
-	}
-	return sum/norm + 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 LamellarPSHGModel :: 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 lamellarPS_HG
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LamellarPSHGModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LamellarPSHGModel :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-double LamellarPSHGModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/linearpearls.cpp
===================================================================
--- src/sas/models/c_extension/c_models/linearpearls.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,219 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "linearpearls.h"
-
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static double linear_pearls_kernel(double dp[], double q) {
-  //fit parameters
-  double scale = dp[0];
-  double radius = dp[1];
-  double edge_separation = dp[2];
-  double num_pearls = dp[3];
-  double sld_pearl = dp[4];
-  double sld_solv = dp[5];
-  double background = dp[6];
-  //others
-  double psi = 0.0;
-  double n_contrib = 0.0;
-  double form_factor = 0.0;
-  //Pi
-  double pi = 4.0 * atan(1.0);
-  //relative sld
-  double contrast_pearl = sld_pearl - sld_solv;
-  //each volume
-  double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0);
-  //total volume
-  double tot_vol = num_pearls * pearl_vol;
-  //mass
-  double m_s = contrast_pearl * pearl_vol;
-  //center to center distance between the neighboring pearls
-  double separation = edge_separation + 2.0 * radius;
-  //integer
-  int num = 0;
-  int n_max = 0;
-  // constraints
-  if (scale<=0 || radius<=0 || edge_separation<0 || num_pearls<=0){
-	  return 0.0;
-  }
-  //sine functions of a pearl
-  psi = sin(q * radius);
-  psi -= q * radius * cos(q * radius);
-  psi /= pow((q * radius), 3.0);
-
-  // N pearls contribution
-  n_max = num_pearls - 1;
-  for(num=0; num<=n_max; num++) {
-
-	  if (num == 0){
-		  n_contrib = num_pearls;
-		  continue;
-	  }
-	  n_contrib += (2.0*(num_pearls-double(num))*sinc(q*separation*double(num)));
-  }
-  // form factor for num_pearls
-  form_factor = n_contrib;
-  form_factor *= pow((m_s*psi*3.0), 2.0);
-  form_factor /= (tot_vol * 1.0e-8); // norm by volume and A^-1 to cm^-1
-
-  // scale and background
-  form_factor *= scale;
-  form_factor += background;
-  return (form_factor);
-}
-
-LinearPearlsModel :: LinearPearlsModel() {
-  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);
-  num_pearls = Parameter(3);
-  num_pearls.set_min(0.0);
-  sld_pearl = Parameter(1.0e-06);
-  sld_solv = Parameter(6.3e-06);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D LinearPearlsModel function
- * @param q: q-value
- * @return: function value
- */
-double LinearPearlsModel :: operator()(double q) {
-  double dp[7];
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = edge_separation();
-  dp[3] = num_pearls();
-  dp[4] = sld_pearl();
-  dp[5] = sld_solv();
-  dp[6] = 0.0;
-  double pi = 4.0*atan(1.0);
-  // No polydispersion supported in this model.
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-  vector<WeightPoint> 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 pearl_vol = 0.0;
-  double tot_vol = 0.0;
-  // Loop over core weight points
-  for(size_t i=0; i<weights_radius.size(); i++) {
-    dp[1] = weights_radius[i].value;
-    // Loop over thick_inter0 weight points
-    for(size_t j=0; j<weights_edge_separation.size(); j++) {
-      dp[2] = weights_edge_separation[j].value;
-      pearl_vol = 4.0 /3.0 * pi * pow(dp[1], 3);
-      tot_vol += dp[3] * pearl_vol;
-      //Un-normalize Sphere by volume
-      sum += weights_radius[i].weight * weights_edge_separation[j].weight
-          * linear_pearls_kernel(dp,q) * tot_vol;
-      //Find average volume
-      vol += weights_radius[i].weight * weights_edge_separation[j].weight
-          * tot_vol;
-      norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D LinearPearlsModel function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LinearPearlsModel :: operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate LinearPearlsModel function
- * @param pars: parameters of the StringOfPearlsModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LinearPearlsModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate TOTAL radius
- * Todo: decide whether or not we keep this calculation
- * @return: effective radius value
- */
-// No polydispersion supported in this model.
-// Calculate max radius assumming max_radius = effective radius
-// Note that this max radius is not affected by sld of layer, sld of interface, or
-// sld of solvent.
-double LinearPearlsModel :: calculate_ER() {
-	LinearPearlsParameters dp;
-
-  dp.scale = scale();
-  dp.radius = radius();
-  dp.edge_separation = edge_separation();
-  dp.num_pearls = num_pearls();
-
-  double rad_out = 0.0;
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-  vector<WeightPoint> weights_edge_separation;
-  edge_separation.get_weights(weights_edge_separation);
-  // Perform the computation, with all weight points
-  double pearl_vol = 0.0;
-  double tot_vol = 0.0;
-  // Loop over core weight points
-  for(size_t i=0; i<weights_radius.size(); i++) {
-    dp.radius = weights_radius[i].value;
-    // Loop over thick_inter0 weight points
-    for(size_t j=0; j<weights_edge_separation.size(); j++) {
-      dp.edge_separation = weights_edge_separation[j].value;
-      pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-      tot_vol = dp.num_pearls * pearl_vol;
-      //Find  volume
-      // This may be a too much approximation
-      //Todo: decided whether or not we keep this calculation
-      sum += weights_radius[i].weight * weights_edge_separation[j].weight
-          * pow(3.0*tot_vol/4.0/pi,0.333333);
-      norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-    }
-  }
-
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-    tot_vol = dp.num_pearls * pearl_vol;
-
-    rad_out =  pow((3.0*tot_vol/4.0/pi), 0.33333);
-  }
-
-  return rad_out;
-
-}
-double LinearPearlsModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/logNormal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/logNormal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/**
-	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
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "logNormal.h"
-
-LogNormal :: LogNormal() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D Log normal function.
- * The function is normalized to the 'scale' parameter.
- *
- * f(x)=scale * 1/(sigma*math.sqrt(2pi))e^(-1/2*((math.log(x)-mu)/sigma)^2)
- *
- * @param q: q-value
- * @return: function value
- */
-double LogNormal :: operator()(double q) {
-  double sigma2 = pow(sigma(), 2);
-  return scale() / (q*sigma2) * exp( -pow((log(q) - center()), 2) / (2*sigma2));
-}
-
-/**
- * Function to evaluate 2D LogNormal  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = LogNormal(x) * LogNormal(y)
- *
- * where both LogNormals share the same parameters.
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double LogNormal :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D LogNormal  function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = LogNormal(x) * LogNormal(y)
- *
- * where both LogNormals share the same parameters.
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double LogNormal :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double LogNormal :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double LogNormal :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/lorentzian.cpp
===================================================================
--- src/sas/models/c_extension/c_models/lorentzian.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/**
-	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
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "lorentzian.h"
-
-Lorentzian :: Lorentzian() {
-  scale  = Parameter(1.0, true);
-  gamma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double Lorentzian :: operator()(double q) {
-  double delta2 = pow( (q-center()), 2);
-  return scale() / acos(-1.0) * 0.5*gamma() /
-      (delta2 + 0.25*gamma()*gamma());
-}
-
-/**
- * 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 Lorentzian :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Lorentzian :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Lorentzian :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Lorentzian :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/massfractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/massfractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,129 +1,0 @@
-/**
-	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;
-}
-double MassFractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/masssurfacefractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/masssurfacefractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,160 +1,0 @@
-/**
-	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 background;
-  }
-  if (mass_dim > 6.0){
-	  return background;
-  }
-  if (surface_dim < 1e-16){
-	  return background;
-  }
-  if (surface_dim > 6.0){
-	  return background;
-  }
-  tot_dim = 6.0 - surface_dim - mass_dim;
-  //singulars
-  if (tot_dim < 0.0){
-	  return background;
-  }
-
-  //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 background;
-
-  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;
-}
-double MassSurfaceFractal :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/micelleSphCore.cpp
===================================================================
--- src/sas/models/c_extension/c_models/micelleSphCore.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/**
-	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>
-#include <iostream>
-using namespace std;
-#include "micelleSphCore.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-
-MicelleSphCoreModel :: MicelleSphCoreModel() {
-    scale      = Parameter(1.0);
-    ndensity   = Parameter(8.94e15);
-    ndensity.set_min(0.0);
-    v_core     = Parameter(62624.0);
-    v_core.set_min(0.0);
-    v_corona   = Parameter(61940.0);
-    v_corona.set_min(0.0);
-    rho_solv   = Parameter(6.4e-6);
-    rho_core   = Parameter(3.4e-7);
-    rho_corona = Parameter(8.0e-7);
-    radius_core = Parameter(45.0, true);
-    radius_core.set_min(0.0);
-    radius_gyr = Parameter(20.0, true);
-    radius_gyr.set_min(0.0);
-    d_penetration = Parameter(1.0);
-    d_penetration.set_min(0.0);
-    n_aggreg = Parameter(6.0);
-    n_aggreg.set_min(1.0);
-    background = Parameter(0.0);
-}
-
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double MicelleSphCoreModel :: operator()(double q) {
-	double dp[12];
-	
-	// Fill parameter array
-	// Add the background after averaging
-        dp[0] = scale();
-        dp[1] = ndensity();
-        dp[2] = v_core();
-        dp[3] = v_corona();
-        dp[4] = rho_solv();
-        dp[5] = rho_core();
-        dp[6] = rho_corona();
-        dp[7] = radius_core();
-        dp[8] = radius_gyr();
-        dp[9] = d_penetration();
-        dp[10] = n_aggreg();
-        dp[11] = 0.0;
-
-
-        // Get the dispersion points for the core radius
-        vector<WeightPoint> weights_rcore;
-        radius_core.get_weights(weights_rcore);
-
-         // Get the dispersion points for the gyration radius
-        vector<WeightPoint> weights_rgyr;
-        radius_gyr.get_weights(weights_rgyr);
-
-       // Perform the computation, with all weight points
-        double sum = 0.0;
-        double norm = 0.0;
-        double vol = 0.0;
-	double vol_micelle = 0.0;
-
-        // Loop over core radius weight points
-        for(int i=0; i< (int)weights_rcore.size(); i++) {
-
-            dp[7] = weights_rcore[i].value;
-
-            // Loop over gyration radius weight points
-            for(int j=0; j< (int)weights_rgyr.size(); j++) {
-
-                dp[8] = weights_rgyr[j].value;
-		
-		//cout << "\n loop i,j = " << i << "  " << j;
-		//cout << "\n radius_core: value weight = " << weights_rcore[i].value << "  " << weights_rcore[i].weight;
-		//cout << "\n radius_gyr:  value weight = " << weights_rgyr[j].value << "  " << weights_rgyr[j].weight;
-                //cout << "\n";
-
-                vol_micelle = pow(weights_rcore[i].value+weights_rgyr[j].value,3);
-
-                //Un-normalize SphereForm by volume
-                sum += weights_rcore[i].weight *  weights_rgyr[j].weight *
-		       MicelleSphericalCore(dp, q) *
-                       vol_micelle;
-      
-                //Find average volume
-                vol += weights_rcore[i].weight * weights_rgyr[j].weight * vol_micelle;
-
-                norm += weights_rcore[i].weight * weights_rgyr[j].weight;
-	    }	
-
-        }
-
-        if (vol != 0.0 && norm != 0.0) {
-             //Re-normalize by avg volume
-             sum = sum/(vol/norm);}
-	     
-        return sum/norm + 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 MicelleSphCoreModel :: 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 model
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double MicelleSphCoreModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MicelleSphCoreModel :: calculate_ER() {
-	return 1.0;
-}
-
-
-/**
- * Function to calculate particle volume/total volume for shape models:
- *	Most case returns 1 but for example for the vesicle model it is 
- *	(total volume - core volume)/total volume 
- *	(< 1 depending on the thickness).
- * @return: effective radius value
- */
-double MicelleSphCoreModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/multishell.cpp
===================================================================
--- src/sas/models/c_extension/c_models/multishell.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,199 +1,0 @@
-/**
-	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 "multishell.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-typedef struct {
-  double scale;
-  double core_radius;
-  double s_thickness;
-  double w_thickness;
-  double core_sld;
-  double shell_sld;
-  double n_pairs;
-  double background;
-
-} MultiShellParameters;
-
-MultiShellModel :: MultiShellModel() {
-  scale      = Parameter(1.0);
-  core_radius     = Parameter(60.0, true);
-  core_radius.set_min(0.0);
-  s_thickness  = Parameter(10.0, true);
-  s_thickness.set_min(0.0);
-  w_thickness   = Parameter(10.0, true);
-  w_thickness.set_min(0.0);
-  core_sld   = Parameter(6.4e-6);
-  shell_sld   = Parameter(4.0e-7);
-  n_pairs   = Parameter(2);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double MultiShellModel :: operator()(double q) {
-  double dp[8];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = core_radius();
-  dp[2] = s_thickness();
-  dp[3] = w_thickness();
-  dp[4] = core_sld();
-  dp[5] = shell_sld();
-  dp[6] = n_pairs();
-  dp[7] = 0.0;
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_radius);
-
-  // Get the dispersion points for the s_thickness
-  vector<WeightPoint> weights_s_thickness;
-  s_thickness.get_weights(weights_s_thickness);
-
-  // Get the dispersion points for the w_thickness
-  vector<WeightPoint> weights_w_thickness;
-  w_thickness.get_weights(weights_w_thickness);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(int i=0; i< (int)weights_core_radius.size(); i++) {
-    dp[1] = weights_core_radius[i].value;
-    for(int j=0; j< (int)weights_s_thickness.size(); j++){
-      dp[2] = weights_s_thickness[j].value;
-      for(int k=0; k< (int)weights_w_thickness.size(); k++){
-        dp[3] = weights_w_thickness[k].value;
-        //Un-normalize SphereForm by volume
-        sum += weights_core_radius[i].weight*weights_s_thickness[j].weight
-            *weights_w_thickness[k].weight* MultiShell(dp, q)
-        *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3);
-        //Find average volume
-        vol += weights_core_radius[i].weight*weights_s_thickness[j].weight
-            *weights_w_thickness[k].weight
-            *pow(weights_core_radius[i].value+dp[6]*weights_s_thickness[j].value+(dp[6]-1)*weights_w_thickness[k].value,3);
-        norm += weights_core_radius[i].weight*weights_s_thickness[j].weight
-            *weights_w_thickness[k].weight;
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 MultiShellModel :: 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 multishell
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double MultiShellModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double MultiShellModel :: calculate_ER() {
-  MultiShellParameters dp;
-
-  dp.core_radius     = core_radius();
-  dp.s_thickness  = s_thickness();
-  dp.w_thickness  = w_thickness();
-  dp.n_pairs = n_pairs();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  if (dp.n_pairs <= 0.0 ){
-    dp.n_pairs = 0.0;
-  }
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_core_radius;
-  core_radius.get_weights(weights_core_radius);
-
-  // Get the dispersion points for the s_thickness
-  vector<WeightPoint> weights_s_thickness;
-  s_thickness.get_weights(weights_s_thickness);
-
-  // Get the dispersion points for the w_thickness
-  vector<WeightPoint> weights_w_thickness;
-  w_thickness.get_weights(weights_w_thickness);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_s_thickness.size(); i++) {
-    dp.s_thickness = weights_s_thickness[i].value;
-    for(int j=0; j< (int)weights_w_thickness.size(); j++) {
-      dp.w_thickness = weights_w_thickness[j].value;
-      for(int k=0; k< (int)weights_core_radius.size(); k++) {
-        dp.core_radius = weights_core_radius[k].value;
-        sum += weights_s_thickness[i].weight*weights_w_thickness[j].weight
-            * weights_core_radius[k].weight*(dp.core_radius+dp.n_pairs*dp.s_thickness+(dp.n_pairs-1.0)*dp.w_thickness);
-        norm += weights_s_thickness[i].weight*weights_w_thickness[j].weight* weights_core_radius[k].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = (dp.core_radius+dp.n_pairs*dp.s_thickness+(dp.n_pairs-1.0)*dp.w_thickness);}
-
-  return rad_out;
-}
-double MultiShellModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/onion.cpp
===================================================================
--- src/sas/models/c_extension/c_models/onion.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,679 +1,0 @@
-/**
-	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>
-#include <stdlib.h>
-using namespace std;
-#include "onion.h"
-
-// Convenience parameter structure
-typedef struct {
-  int n_shells;
-  double scale;
-  double rad_core0;
-  double sld_core0;
-  double sld_solv;
-  double background;
-  double sld_out_shell1;
-  double sld_out_shell2;
-  double sld_out_shell3;
-  double sld_out_shell4;
-  double sld_out_shell5;
-  double sld_out_shell6;
-  double sld_out_shell7;
-  double sld_out_shell8;
-  double sld_out_shell9;
-  double sld_out_shell10;
-  double sld_in_shell1;
-  double sld_in_shell2;
-  double sld_in_shell3;
-  double sld_in_shell4;
-  double sld_in_shell5;
-  double sld_in_shell6;
-  double sld_in_shell7;
-  double sld_in_shell8;
-  double sld_in_shell9;
-  double sld_in_shell10;
-
-  double A_shell1;
-  double A_shell2;
-  double A_shell3;
-  double A_shell4;
-  double A_shell5;
-  double A_shell6;
-  double A_shell7;
-  double A_shell8;
-  double A_shell9;
-  double A_shell10;
-
-  double thick_shell1;
-  double thick_shell2;
-  double thick_shell3;
-  double thick_shell4;
-  double thick_shell5;
-  double thick_shell6;
-  double thick_shell7;
-  double thick_shell8;
-  double thick_shell9;
-  double thick_shell10;
-
-  int func_shell1;
-  int func_shell2;
-  int func_shell3;
-  int func_shell4;
-  int func_shell5;
-  int func_shell6;
-  int func_shell7;
-  int func_shell8;
-  int func_shell9;
-  int func_shell10;
-} OnionParameters;
-
-// some details can be found in sld_cal.c
-static double so_kernel(double dp[], double q) {
-  int n = dp[0];
-  double scale = dp[1];
-  double rad_core0 = dp[2];
-  double sld_core0 = dp[3];
-  double sld_solv = dp[4];
-  double background = dp[5];
-  int i,j;
-  double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2;
-  double sign;
-  double pi;
-  double r0 = 0.0;
-
-  double *sld_out;
-  double *slope;
-  double *sld_in;
-  double *thick;
-  double *A;
-  int *fun_type;
-
-  sld_out = (double*)malloc((n+2)*sizeof(double));
-  slope = (double*)malloc((n+2)*sizeof(double));
-  sld_in = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  A = (double*)malloc((n+2)*sizeof(double));
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-
-  for (i =1; i<=n; i++){
-    sld_out[i] = dp[i+5];
-    sld_in[i] = dp[i+15];
-    A[i] = dp[i+25];
-    thick[i] = dp[i+35];
-    fun_type[i] = dp[i+45];
-  }
-  sld_out[0] = sld_core0;
-  sld_out[n+1] = sld_solv;
-  sld_in[0] = sld_core0;
-  sld_in[n+1] = sld_solv;
-  thick[0] = rad_core0;
-  thick[n+1] = 1e+10;
-  A[0] = 0.0;
-  A[n+1] = 0.0;
-  fun_type[0] = 0;
-  fun_type[n+1] = 0;
-
-
-  pi = 4.0*atan(1.0);
-  f = 0.0;
-  r = 0.0;
-  vol = 0.0;
-  vol_pre = 0.0;
-  vol_sub = 0.0;
-
-  for (i =0; i<= n+1; i++){
-    if (thick[i] == 0.0){
-      continue;
-    }
-    if (fun_type[i]== 0 ){
-      slope[i] = 0.0;
-      A[i] = 0.0;
-    }
-    vol_pre = vol;
-    switch(fun_type[i]){
-    case 2 :
-      r0 = r;
-      if (A[i] == 0.0){
-        slope[i] = 0.0;
-      }
-      else{
-        slope[i] = (sld_out[i]-sld_in[i])/(exp(A[i])-1.0);
-      }
-      for (j=0; j<2; j++){
-        if ( i == 0 && j == 0){
-          continue;
-        }
-        if (i == n+1 && j == 1){
-          continue;
-        }
-        if ( j == 1){
-          sign = 1.0;
-          r += thick[i];
-        }
-        else{
-          sign = -1.0;
-        }
-        qr = q * r;
-        alpha = A[i] * r/thick[i];
-        fun = 0.0;
-        if(qr == 0.0){
-          fun = sign * 1.0;
-          bes = sign * 1.0;
-        }
-        else{
-          if (fabs(A[i]) > 0.0 ){
-            fun = 3.0 * ((alpha*alpha - qr * qr) * sin(qr) - 2.0 * alpha * qr * cos(qr))/ ((alpha * alpha + qr * qr) * (alpha * alpha + qr * qr) * qr);
-            fun = fun - 3.0 * (alpha * sin(qr) - qr * cos(qr)) / ((alpha * alpha + qr * qr) * qr);
-            fun = - sign *fun;
-            bes = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-          }
-          else {
-            fun = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-            bes = sign * 3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-          }
-        }
-        contr = slope[i]*exp(A[i]*(r-r0)/thick[i]);
-
-        vol = 4.0 * pi / 3.0 * r * r * r;
-        //if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && A[i]==0.0){
-        //  vol_sub += (vol_pre - vol);
-        //}
-        f += vol * (contr * (fun) + (sld_in[i]-slope[i]) * bes);
-      }
-      break;
-    default :
-      if (fun_type[i]==0){
-        slope[i] = 0.0;
-      }
-      else{
-        slope[i]= (sld_out[i] -sld_in[i])/thick[i];
-      }
-      contr = sld_in[i]-slope[i]*r;
-      for (j=0; j<2; j++){
-        if ( i == 0 && j == 0){
-          continue;
-        }
-        if (i == n+1 && j == 1){
-          continue;
-        }
-        if ( j == 1){
-          sign = 1.0;
-          r += thick[i];
-        }
-        else{
-          sign = -1.0;
-        }
-
-        qr = q * r;
-        fun = 0.0;
-        if(qr == 0.0){
-          bes = sign * 1.0;
-        }
-        else{
-          bes = sign *  3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-          if (fabs(slope[i]) > 0.0 ){
-            fun = sign * 3.0 * r * (2.0*qr*sin(qr)-((qr*qr)-2.0)*cos(qr))/(qr * qr * qr * qr);
-          }
-        }
-        vol = 4.0 * pi / 3.0 * r * r * r;
-        //if (j == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){
-        //  vol_sub += (vol_pre - vol);
-        //}
-        f += vol * (bes * contr + fun * slope[i]);
-      }
-      break;
-    }
-
-  }
-  //vol += vol_sub;
-  f2 = f * f / vol * 1.0e8;
-  f2 *= scale;
-  f2 += background;
-
-  free(sld_out);
-  free(slope);
-  free(sld_in);
-  free(thick);
-  free(A);
-  free(fun_type);
-
-  return (f2);
-}
-
-
-OnionModel :: OnionModel() {
-  n_shells = Parameter(1.0);
-  scale = Parameter(1.0);
-  rad_core0 = Parameter(200.0);
-  rad_core0.set_min(0.0);
-  sld_core0 = Parameter(1e-06);
-  sld_solv = Parameter(6.4e-06);
-  background = Parameter(0.0);
-
-  sld_out_shell1 = Parameter(1.0e-06);
-  sld_out_shell2 = Parameter(1.0e-06);
-  sld_out_shell3 = Parameter(1.0e-06);
-  sld_out_shell4 = Parameter(1.0e-06);
-  sld_out_shell5 = Parameter(1.0e-06);
-  sld_out_shell6 = Parameter(1.0e-06);
-  sld_out_shell7 = Parameter(1.0e-06);
-  sld_out_shell8 = Parameter(1.0e-06);
-  sld_out_shell9 = Parameter(1.0e-06);
-  sld_out_shell10 = Parameter(1.0e-06);
-
-  sld_in_shell1 = Parameter(2.3e-06);
-  sld_in_shell2 = Parameter(2.6e-06);
-  sld_in_shell3 = Parameter(2.9e-06);
-  sld_in_shell4 = Parameter(3.2e-06);
-  sld_in_shell5 = Parameter(3.5e-06);
-  sld_in_shell6 = Parameter(3.8e-06);
-  sld_in_shell7 = Parameter(4.1e-06);
-  sld_in_shell8 = Parameter(4.4e-06);
-  sld_in_shell9 = Parameter(4.7e-06);
-  sld_in_shell10 = Parameter(5.0e-06);
-
-  A_shell1 = Parameter(1.0);
-  A_shell2 = Parameter(1.0);
-  A_shell3 = Parameter(1.0);
-  A_shell4 = Parameter(1.0);
-  A_shell5 = Parameter(1.0);
-  A_shell6 = Parameter(1.0);
-  A_shell7 = Parameter(1.0);
-  A_shell8 = Parameter(1.0);
-  A_shell9 = Parameter(1.0);
-  A_shell10 = Parameter(1.0);
-
-  thick_shell1 = Parameter(50.0);
-  thick_shell1.set_min(0.0);
-  thick_shell2 = Parameter(50.0);
-  thick_shell2.set_min(0.0);
-  thick_shell3 = Parameter(50.0);
-  thick_shell3.set_min(0.0);
-  thick_shell4 = Parameter(50.0);
-  thick_shell4.set_min(0.0);
-  thick_shell5 = Parameter(50.0);
-  thick_shell5.set_min(0.0);
-  thick_shell6 = Parameter(50.0);
-  thick_shell6.set_min(0.0);
-  thick_shell7 = Parameter(50.0);
-  thick_shell7.set_min(0.0);
-  thick_shell8 = Parameter(50.0);
-  thick_shell8.set_min(0.0);
-  thick_shell9 = Parameter(50.0);
-  thick_shell9.set_min(0.0);
-  thick_shell10 = Parameter(50.0);
-  thick_shell10.set_min(0.0);
-
-  func_shell1 = Parameter(2);
-  func_shell2 = Parameter(2);
-  func_shell3 = Parameter(2);
-  func_shell4 = Parameter(2);
-  func_shell5 = Parameter(2);
-  func_shell6 = Parameter(2);
-  func_shell7 = Parameter(2);
-  func_shell8 = Parameter(2);
-  func_shell9 = Parameter(2);
-  func_shell10 = Parameter(2);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double OnionModel :: operator()(double q) {
-  double dp[56];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = n_shells();
-  dp[1] = scale();
-  dp[2] = rad_core0();
-  dp[3] = sld_core0();
-  dp[4] = sld_solv();
-  dp[5] = 0.0;
-
-  dp[6] = sld_out_shell1();
-  dp[7] = sld_out_shell2();
-  dp[8] = sld_out_shell3();
-  dp[9] = sld_out_shell4();
-  dp[10] = sld_out_shell5();
-  dp[11] = sld_out_shell6();
-  dp[12] = sld_out_shell7();
-  dp[13] = sld_out_shell8();
-  dp[14] = sld_out_shell9();
-  dp[15] = sld_out_shell10();
-
-  dp[16] = sld_in_shell1();
-  dp[17] = sld_in_shell2();
-  dp[18] = sld_in_shell3();
-  dp[19] = sld_in_shell4();
-  dp[20] = sld_in_shell5();
-  dp[21] = sld_in_shell6();
-  dp[22] = sld_in_shell7();
-  dp[23] = sld_in_shell8();
-  dp[24] = sld_in_shell9();
-  dp[25] = sld_in_shell10();
-
-  dp[26] = A_shell1();
-  dp[27] = A_shell2();
-  dp[28] = A_shell3();
-  dp[29] = A_shell4();
-  dp[30] = A_shell5();
-  dp[31] = A_shell6();
-  dp[32] = A_shell7();
-  dp[33] = A_shell8();
-  dp[34] = A_shell9();
-  dp[35] = A_shell10();
-
-  dp[36] = thick_shell1();
-  dp[37] = thick_shell2();
-  dp[38] = thick_shell3();
-  dp[39] = thick_shell4();
-  dp[40] = thick_shell5();
-  dp[41] = thick_shell6();
-  dp[42] = thick_shell7();
-  dp[43] = thick_shell8();
-  dp[44] = thick_shell9();
-  dp[45] = thick_shell10();
-
-  dp[46] = func_shell1();
-  dp[47] = func_shell2();
-  dp[48] = func_shell3();
-  dp[49] = func_shell4();
-  dp[50] = func_shell5();
-  dp[51] = func_shell6();
-  dp[52] = func_shell7();
-  dp[53] = func_shell8();
-  dp[54] = func_shell9();
-  dp[55] = func_shell10();
-
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  rad_core0.get_weights(weights_rad);
-
-  // Get the dispersion points for the thick 1
-  vector<WeightPoint> weights_s1;
-  thick_shell1.get_weights(weights_s1);
-
-  // Get the dispersion points for the thick 2
-  vector<WeightPoint> weights_s2;
-  thick_shell2.get_weights(weights_s2);
-
-  // Get the dispersion points for the thick 3
-  vector<WeightPoint> weights_s3;
-  thick_shell3.get_weights(weights_s3);
-
-  // Get the dispersion points for the thick 4
-  vector<WeightPoint> weights_s4;
-  thick_shell4.get_weights(weights_s4);
-
-  // Get the dispersion points for the thick 5
-  vector<WeightPoint> weights_s5;
-  thick_shell5.get_weights(weights_s5);
-
-  // Get the dispersion points for the thick 6
-  vector<WeightPoint> weights_s6;
-  thick_shell6.get_weights(weights_s6);
-
-  // Get the dispersion points for the thick 7
-  vector<WeightPoint> weights_s7;
-  thick_shell7.get_weights(weights_s7);
-
-  // Get the dispersion points for the thick 8
-  vector<WeightPoint> weights_s8;
-  thick_shell8.get_weights(weights_s8);
-  // Get the dispersion points for the thick 9
-  vector<WeightPoint> weights_s9;
-  thick_shell9.get_weights(weights_s9);
-
-  // Get the dispersion points for the thick 10
-  vector<WeightPoint> weights_s10;
-  thick_shell10.get_weights(weights_s10);
-
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[2] = weights_rad[i].value;
-    // Loop over radius weight points
-    for(size_t j=0; j<weights_s1.size(); j++) {
-      dp[36] = weights_s1[j].value;
-      // Loop over radius weight points
-      for(size_t k=0; k<weights_s2.size(); k++) {
-        dp[37] = weights_s2[k].value;
-        // Loop over radius weight points
-        for(size_t l=0; l<weights_s3.size(); l++) {
-          dp[38] = weights_s3[l].value;
-          // Loop over radius weight points
-          for(size_t m=0; m<weights_s4.size(); m++) {
-            dp[39] = weights_s4[m].value;
-            for(size_t n=0; n<weights_s5.size(); n++) {
-              dp[40] = weights_s5[n].value;
-              for(size_t o=0; o<weights_s6.size(); o++) {
-                dp[41] = weights_s6[o].value;
-                for(size_t p=0; p<weights_s7.size(); p++) {
-                  dp[42] = weights_s7[p].value;
-                  for(size_t t=0; t<weights_s8.size(); t++) {
-                    dp[43] = weights_s8[t].value;
-                    for(size_t r=0; r<weights_s9.size(); r++) {
-                      dp[44] = weights_s9[r].value;
-                      for(size_t s=0; s<weights_s10.size(); s++) {
-                        dp[45] = weights_s10[s].value;
-                        //Un-normalize Shells by volume
-                        sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-                            *weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-                            *weights_s9[r].weight*weights_s10[s].weight
-                            * so_kernel(dp,q) * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value
-                                +weights_s5[n].value+weights_s6[o].value+weights_s7[p].value+weights_s8[t].value
-                                +weights_s9[r].value+weights_s10[s].value),3.0);
-                        //Find average volume
-                        vol += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-                            *weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-                            *weights_s9[r].weight*weights_s10[s].weight
-                            * pow((weights_rad[i].value+weights_s1[j].value+weights_s2[k].value+weights_s3[l].value+weights_s4[m].value
-                                +weights_s5[n].value+weights_s6[o].value+weights_s7[p].value+weights_s8[t].value
-                                +weights_s9[r].value+weights_s10[s].value),3.0);
-                        norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-                            *weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-                            *weights_s9[r].weight*weights_s10[s].weight;
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 OnionModel :: 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 sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double OnionModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double OnionModel :: calculate_ER() {
-  OnionParameters dp;
-  dp.rad_core0 = rad_core0();
-  dp.thick_shell1 = thick_shell1();
-  dp.thick_shell2 = thick_shell2();
-  dp.thick_shell3 = thick_shell3();
-  dp.thick_shell4 = thick_shell4();
-  dp.thick_shell5 = thick_shell5();
-  dp.thick_shell6 = thick_shell6();
-  dp.thick_shell7 = thick_shell7();
-  dp.thick_shell8 = thick_shell8();
-  dp.thick_shell9 = thick_shell9();
-  dp.thick_shell10 = thick_shell10();
-
-  double rad_out = 0.0;
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  rad_core0.get_weights(weights_rad);
-
-  // Get the dispersion points for the thick 1
-  vector<WeightPoint> weights_s1;
-  thick_shell1.get_weights(weights_s1);
-
-  // Get the dispersion points for the thick 2
-  vector<WeightPoint> weights_s2;
-  thick_shell2.get_weights(weights_s2);
-
-  // Get the dispersion points for the thick 3
-  vector<WeightPoint> weights_s3;
-  thick_shell3.get_weights(weights_s3);
-
-  // Get the dispersion points for the thick 4
-  vector<WeightPoint> weights_s4;
-  thick_shell4.get_weights(weights_s4);
-  // Get the dispersion points for the thick 5
-  vector<WeightPoint> weights_s5;
-  thick_shell5.get_weights(weights_s5);
-
-  // Get the dispersion points for the thick 6
-  vector<WeightPoint> weights_s6;
-  thick_shell6.get_weights(weights_s6);
-
-  // Get the dispersion points for the thick 7
-  vector<WeightPoint> weights_s7;
-  thick_shell7.get_weights(weights_s7);
-
-  // Get the dispersion points for the thick 8
-  vector<WeightPoint> weights_s8;
-  thick_shell8.get_weights(weights_s8);
-  // Get the dispersion points for the thick 9
-  vector<WeightPoint> weights_s9;
-  thick_shell9.get_weights(weights_s9);
-
-  // Get the dispersion points for the thick 10
-  vector<WeightPoint> weights_s10;
-  thick_shell10.get_weights(weights_s10);
-
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.rad_core0 = weights_rad[i].value;
-    // Loop over radius weight points
-    for(size_t j=0; j<weights_s1.size(); j++) {
-      dp.thick_shell1 = weights_s1[j].value;
-      // Loop over radius weight points
-      for(size_t k=0; k<weights_s2.size(); k++) {
-        dp.thick_shell2 = weights_s2[k].value;
-        // Loop over radius weight points
-        for(size_t l=0; l<weights_s3.size(); l++) {
-          dp.thick_shell3 = weights_s3[l].value;
-          // Loop over radius weight points
-          for(size_t m=0; m<weights_s4.size(); m++) {
-            dp.thick_shell4 = weights_s4[m].value;
-            // Loop over radius weight points
-            for(size_t n=0; j<weights_s5.size(); n++) {
-              dp.thick_shell5 = weights_s5[n].value;
-              // Loop over radius weight points
-              for(size_t o=0; k<weights_s6.size(); o++) {
-                dp.thick_shell6 = weights_s6[o].value;
-                // Loop over radius weight points
-                for(size_t p=0; l<weights_s7.size(); p++) {
-                  dp.thick_shell7 = weights_s7[p].value;
-                  // Loop over radius weight points
-                  for(size_t t=0; m<weights_s8.size(); t++) {
-                    dp.thick_shell8 = weights_s8[t].value;
-                    // Loop over radius weight points
-                    for(size_t r=0; l<weights_s9.size(); r++) {
-                      dp.thick_shell8 = weights_s9[r].value;
-                      // Loop over radius weight points
-                      for(size_t s=0; m<weights_s10.size(); s++) {
-                        dp.thick_shell10 = weights_s10[s].value;
-                        //Un-normalize FourShell by volume
-                        sum += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight*weights_s4[m].weight
-                            *weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight*weights_s8[t].weight
-                            *weights_s9[r].weight*weights_s10[s].weight
-                            * (dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4+dp.thick_shell5
-                                +dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10);
-                        norm += weights_rad[i].weight*weights_s1[j].weight*weights_s2[k].weight*weights_s3[l].weight
-                            *weights_s4[m].weight*weights_s5[n].weight*weights_s6[o].weight*weights_s7[p].weight
-                            *weights_s8[t].weight*weights_s9[r].weight*weights_s10[s].weight;
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = dp.rad_core0+dp.thick_shell1+dp.thick_shell2+dp.thick_shell3+dp.thick_shell4
-        +dp.thick_shell5+dp.thick_shell6+dp.thick_shell7+dp.thick_shell8+dp.thick_shell9+dp.thick_shell10;}
-  return rad_out;
-}
-double OnionModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/parallelepiped.cpp
===================================================================
--- src/sas/models/c_extension/c_models/parallelepiped.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,543 +1,0 @@
-/**
-	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
- *
- *	TODO: add 2D function
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-
-extern "C" {
-	#include "libCylinder.h"
-	#include "libStructureFactor.h"
-	#include "libmultifunc/libfunc.h"
-}
-#include "parallelepiped.h"
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double short_a;
-    double short_b;
-    double long_c;
-    double sldPipe;
-    double sldSolv;
-    double background;
-    double parallel_theta;
-    double parallel_phi;
-    double parallel_psi;
-    double M0_sld_pipe;
-    double M_theta_pipe;
-    double M_phi_pipe;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} ParallelepipedParameters;
-
-
-static double pkernel(double a, double b,double c, double ala, double alb, double alc){
-    // mu passed in is really mu*sqrt(1-sig^2)
-    double argA,argB,argC,tmp1,tmp2,tmp3;     //local variables
-
-    //handle arg=0 separately, as sin(t)/t -> 1 as t->0
-    argA = a*ala/2.0;
-    argB = b*alb/2.0;
-    argC = c*alc/2.0;
-    if(argA==0.0) {
-    tmp1 = 1.0;
-  } else {
-    tmp1 = sin(argA)*sin(argA)/argA/argA;
-    }
-    if (argB==0.0) {
-    tmp2 = 1.0;
-  } else {
-    tmp2 = sin(argB)*sin(argB)/argB/argB;
-    }
-
-    if (argC==0.0) {
-    tmp3 = 1.0;
-  } else {
-    tmp3 = sin(argC)*sin(argC)/argC/argC;
-    }
-
-    return (tmp1*tmp2*tmp3);
-
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y) {
-  double cparallel_x, cparallel_y, bparallel_x, bparallel_y, parallel_x, parallel_y;
-  //double q_z;
-  double vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;
-
-  double answer = 0.0;
-  double form = 0.0;
-  double pi = 4.0*atan(1.0);
-  
-  //convert angle degree to radian
-  double theta = pars->parallel_theta * pi/180.0;
-  double phi = pars->parallel_phi * pi/180.0;
-  double psi = pars->parallel_psi * pi/180.0;
-  double sld_solv = pars->sldSolv;
-  double sld_pipe = pars->sldPipe;
-  double m_max = pars->M0_sld_pipe;
-  double m_max_solv = pars->M0_sld_solv;
-  double contrast = 0.0;
-    
-  edgeA = pars->short_a;
-  edgeB = pars->short_b;
-  edgeC = pars->long_c;
-
-
-    // parallelepiped c axis orientation
-    cparallel_x = cos(theta) * cos(phi);
-    cparallel_y = sin(theta);
-    //cparallel_z = -cos(theta) * sin(phi);
-
-    // q vector
-    //q_z = 0.0;
-
-    // Compute the angle btw vector q and the
-    // axis of the parallelepiped
-    cos_val_c = cparallel_x*q_x + cparallel_y*q_y;// + cparallel_z*q_z;
-    //alpha = acos(cos_val_c);
-
-    // parallelepiped a axis orientation
-    parallel_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-    parallel_y = sin(psi)*cos(theta);
-	//parallel_z = sin(theta)*sin(phi)*sin(psi)+cos(phi)*cos(psi);
-	
-    cos_val_a = parallel_x*q_x + parallel_y*q_y;
-
-    // parallelepiped b axis orientation
-    bparallel_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-    bparallel_y = cos(theta)*cos(psi);
-    //bparallel_z = sin(theta)*sin(phi)*cos(psi)-sin(psi)*cos(phi);
-    
-    // axis of the parallelepiped
-    cos_val_b = bparallel_x*q_x + bparallel_y*q_y;
-
-    // The following test should always pass
-    if (fabs(cos_val_c)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_c = 1.0;
-    }
-    if (fabs(cos_val_a)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_a = 1.0;
-    }
-    if (fabs(cos_val_b)>1.0) {
-      //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-      cos_val_b = 1.0;
-    }
-  // Call the IGOR library function to get the kernel
-  form = pkernel( q*edgeA, q*edgeB, q*edgeC, cos_val_a, cos_val_b, cos_val_c);
-  
-  if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-      // Multiply by contrast^2
-      contrast = (pars->sldPipe - pars->sldSolv);
- 	  answer = contrast * contrast * form;
-  }
-  else{
-	  double qx = q_x;
-	  double qy = q_y;
-	  double s_theta = pars->Up_theta;
-	  double m_phi = pars->M_phi_pipe;
-	  double m_theta = pars->M_theta_pipe;
-	  double m_phi_solv = pars->M_phi_solv;
-	  double m_theta_solv = pars->M_theta_solv;
-	  double in_spin = pars->Up_frac_i;
-	  double out_spin = pars->Up_frac_f;
-	  polar_sld p_sld;
-	  polar_sld p_sld_solv;
-	  p_sld = cal_msld(1, qx, qy, sld_pipe, m_max, m_theta, m_phi, 
-	  	 			in_spin, out_spin, s_theta);
-	  p_sld_solv = cal_msld(1, qx, qy, sld_solv, m_max_solv, m_theta_solv, m_phi_solv, 
-			 			in_spin, out_spin, s_theta);
-	  //up_up	
-	  if (in_spin > 0.0 && out_spin > 0.0){			 
-		  answer += ((p_sld.uu- p_sld_solv.uu) * (p_sld.uu- p_sld_solv.uu) * form);
-		  }
-	  //down_down
-	  if (in_spin < 1.0 && out_spin < 1.0){
-		  answer += ((p_sld.dd - p_sld_solv.dd) * (p_sld.dd - p_sld_solv.dd) * form);
-		  }
-	  //up_down
-	  if (in_spin > 0.0 && out_spin < 1.0){
-		  answer += ((p_sld.re_ud - p_sld_solv.re_ud) * (p_sld.re_ud - p_sld_solv.re_ud) * form);
-		  answer += ((p_sld.im_ud - p_sld_solv.im_ud) * (p_sld.im_ud - p_sld_solv.im_ud) * form);
-		  }
-	  //down_up	
-	  if (in_spin < 1.0 && out_spin > 0.0){
-		  answer += ((p_sld.re_du - p_sld_solv.re_du) * (p_sld.re_du - p_sld_solv.re_du) * form);
-		  answer += ((p_sld.im_du - p_sld_solv.im_du) * (p_sld.im_du - p_sld_solv.im_du) * form);
-		  }
-  }
-  
-
-  //normalize by cylinder volume
-  //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vparallel
-  vol = edgeA* edgeB * edgeC;
-  answer *= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the parallelepiped
- * @param q: q-value
- * @return: function value
- */
-static double parallelepiped_analytical_2DXY(ParallelepipedParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-    return parallelepiped_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-ParallelepipedModel :: ParallelepipedModel() {
-	scale      = Parameter(1.0);
-	short_a     = Parameter(35.0, true);
-	short_a.set_min(1.0);
-	short_b     = Parameter(75.0, true);
-	short_b.set_min(1.0);
-	long_c     = Parameter(400.0, true);
-	long_c.set_min(1.0);
-	sldPipe   = Parameter(6.3e-6);
-	sldSolv   = Parameter(1.0e-6);
-	background = Parameter(0.0);
-	parallel_theta  = Parameter(0.0, true);
-	parallel_phi    = Parameter(0.0, true);
-	parallel_psi    = Parameter(0.0, true);
-	M0_sld_pipe = Parameter(0.0e-6);
-	M_theta_pipe = Parameter(0.0);
-	M_phi_pipe = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double ParallelepipedModel :: operator()(double q) {
-	double dp[7];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = short_a();
-	dp[2] = short_b();
-	dp[3] = long_c();
-	dp[4] = sldPipe();
-	dp[5] = sldSolv();
-	dp[6] = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get the dispersion points for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over short_edgeA weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp[1] = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp[2] = weights_short_b[j].value;
-
-			// Loop over longuest_edgeC weight points
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp[3] = weights_long_c[k].value;
-				//Un-normalize  by volume
-				sum += weights_short_a[i].weight * weights_short_b[j].weight
-					* weights_long_c[k].weight * Parallelepiped(dp, q)
-					* weights_short_a[i].value*weights_short_b[j].value
-					* weights_long_c[k].value;
-				//Find average volume
-				vol += weights_short_a[i].weight * weights_short_b[j].weight
-					* weights_long_c[k].weight
-					* weights_short_a[i].value * weights_short_b[j].value
-					* weights_long_c[k].value;
-
-				norm += weights_short_a[i].weight
-					 * weights_short_b[j].weight * weights_long_c[k].weight;
-			}
-		}
-	}
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-
-	return sum/norm + 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 ParallelepipedModel :: operator()(double qx, double qy) {
-	ParallelepipedParameters dp;
-	// Fill parameter array
-	dp.scale      = scale();
-	dp.short_a   = short_a();
-	dp.short_b   = short_b();
-	dp.long_c  = long_c();
-	dp.sldPipe   = sldPipe();
-	dp.sldSolv   = sldSolv();
-	dp.background = 0.0;
-	//dp.background = background();
-	dp.parallel_theta  = parallel_theta();
-	dp.parallel_phi    = parallel_phi();
-	dp.parallel_psi    = parallel_psi();
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_pipe =  M_phi_pipe();
-	dp.M_theta_pipe =  M_theta_pipe();
-	dp.M0_sld_pipe =  M0_sld_pipe();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get angular averaging for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-	// Get angular averaging for theta
-	vector<WeightPoint> weights_parallel_theta;
-	parallel_theta.get_weights(weights_parallel_theta);
-
-	// Get angular averaging for phi
-	vector<WeightPoint> weights_parallel_phi;
-	parallel_phi.get_weights(weights_parallel_phi);
-
-	// Get angular averaging for psi
-	vector<WeightPoint> weights_parallel_psi;
-	parallel_psi.get_weights(weights_parallel_psi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double norm_vol = 0.0;
-	double vol = 0.0;
-	double pi = 4.0*atan(1.0);
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp.short_a = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp.short_b = weights_short_b[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp.long_c = weights_long_c[k].value;
-
-				// Average over theta distribution
-				for(int l=0; l< (int)weights_parallel_theta.size(); l++) {
-				dp.parallel_theta = weights_parallel_theta[l].value;
-
-					// Average over phi distribution
-					for(int m=0; m< (int)weights_parallel_phi.size(); m++) {
-						dp.parallel_phi = weights_parallel_phi[m].value;
-
-						// Average over phi distribution
-						for(int n=0; n< (int)weights_parallel_psi.size(); n++) {
-							dp.parallel_psi = weights_parallel_psi[n].value;
-							//Un-normalize by volume
-							double _ptvalue = weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight
-								* parallelepiped_analytical_2DXY(&dp, qx, qy)
-								* weights_short_a[i].value*weights_short_b[j].value
-								* weights_long_c[k].value;
-
-							if (weights_parallel_theta.size()>1) {
-								_ptvalue *= fabs(cos(weights_parallel_theta[l].value*pi/180.0));
-							}
-							sum += _ptvalue;
-							//Find average volume
-							vol += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_short_a[i].value*weights_short_b[j].value
-								* weights_long_c[k].value;
-							//Find norm for volume
-							norm_vol += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight;
-
-							norm += weights_short_a[i].weight
-								* weights_short_b[j].weight
-								* weights_long_c[k].weight
-								* weights_parallel_theta[l].weight
-								* weights_parallel_phi[m].weight
-								* weights_parallel_psi[n].weight;
-						}
-					}
-
-				}
-			}
-		}
-	}
-	// Averaging in theta needs an extra normalization
-	// factor to account for the sin(theta) term in the
-	// integration (see documentation).
-	if (weights_parallel_theta.size()>1) norm = norm / asin(1.0);
-
-	if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm_vol);}
-
-	return sum/norm + background();
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ParallelepipedModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ParallelepipedModel :: calculate_ER() {
-	ParallelepipedParameters dp;
-	dp.short_a   = short_a();
-	dp.short_b   = short_b();
-	dp.long_c  = long_c();
-	double rad_out = 0.0;
-	double pi = 4.0*atan(1.0);
-	double suf_rad = sqrt(dp.short_a*dp.short_b/pi);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the short_edgeA
-	vector<WeightPoint> weights_short_a;
-	short_a.get_weights(weights_short_a);
-
-	// Get the dispersion points for the longer_edgeB
-	vector<WeightPoint> weights_short_b;
-	short_b.get_weights(weights_short_b);
-
-	// Get angular averaging for the longuest_edgeC
-	vector<WeightPoint> weights_long_c;
-	long_c.get_weights(weights_long_c);
-
-	// Loop over radius weight points
-	for(int i=0; i< (int)weights_short_a.size(); i++) {
-		dp.short_a = weights_short_a[i].value;
-
-		// Loop over longer_edgeB weight points
-		for(int j=0; j< (int)weights_short_b.size(); j++) {
-			dp.short_b = weights_short_b[j].value;
-
-			// Average over longuest_edgeC distribution
-			for(int k=0; k< (int)weights_long_c.size(); k++) {
-				dp.long_c = weights_long_c[k].value;
-				//Calculate surface averaged radius
-				//This is rough approximation.
-				suf_rad = sqrt(dp.short_a*dp.short_b/pi);
-
-				//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-				sum +=weights_short_a[i].weight* weights_short_b[j].weight
-					* weights_long_c[k].weight*DiamCyl(dp.long_c, suf_rad)/2.0;
-				norm += weights_short_a[i].weight* weights_short_b[j].weight*weights_long_c[k].weight;
-			}
-		}
-	}
-
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(length,radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.long_c, suf_rad)/2.0;}
-	return rad_out;
-
-}
-double ParallelepipedModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/parameters.cpp
===================================================================
--- src/sas/models/c_extension/c_models/parameters.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,467 +1,0 @@
-/**
-	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
- */
-#include "parameters.hh"
-#include <stdio.h>
-#include <math.h>
-using namespace std;
-
-#if defined(_MSC_VER)
-#include "gamma_win.h"
-#endif
-
-/**
- * TODO: normalize all dispersion weight lists
- */
-
-
-/**
- * Weight points
- */
-WeightPoint :: WeightPoint() {
-	value = 0.0;
-	weight = 0.0;
-}
-
-WeightPoint :: WeightPoint(double v, double w) {
-	value = v;
-	weight = w;
-}
-
-/**
- * Dispersion models
- */
-DispersionModel :: DispersionModel() {
-	npts  = 1;
-	width = 0.0;
-};
-
-void DispersionModel :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->dispersion_to_dict(from, to);
-}
-void DispersionModel :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->dispersion_from_dict(from, to);
-}
-void DispersionModel :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			double val = value + sig * (1.0*double(i)/double(npts-1) - 0.5);
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  )
-				weights.insert(weights.end(), WeightPoint(val, 1.0));
-		}
-	}
-}
-
-/**
- * Method to set the weights
- * Not implemented for this class
- */
-void DispersionModel :: set_weights(int npoints, double* values, double* weights){}
-
-/**
- * Gaussian dispersion
- */
-
-GaussianDispersion :: GaussianDispersion() {
-	npts  = 35;
-	width = 0.0;
-	nsigmas = 3;
-};
-
-void GaussianDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->gaussian_to_dict(from, to);
-}
-void GaussianDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->gaussian_from_dict(from, to);
-}
-
-double gaussian_weight(double mean, double sigma, double x) {
-	double vary, expo_value;
-    vary = x-mean;
-    expo_value = -vary*vary/(2.0*sigma*sigma);
-    //return 1.0;
-    return exp(expo_value);
-}
-
-/**
- * Gaussian dispersion
- * @param mean: mean value of the Gaussian
- * @param sigma: standard deviation of the Gaussian
- * @param x: value at which the Gaussian is evaluated
- * @return: value of the Gaussian
- */
-void GaussianDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 3;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  ) {
-				double _w = gaussian_weight(value, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-/**
- * Flat dispersion
- */
-
-RectangleDispersion :: RectangleDispersion() {
-	npts  = 35;
-	width = 0.0;
-	nsigmas = 1.73205;
-};
-
-void RectangleDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->rectangle_to_dict(from, to);
-}
-void RectangleDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->rectangle_from_dict(from, to);
-}
-
-double rectangle_weight(double mean, double sigma, double x) {
-    double wid = fabs(sigma) * sqrt(3.0);
-    if (x>= (mean-wid) && x<=(mean+wid)){
-    	return 1.0;
-    }
-    else{
-    	return 0.0;
-    }
-}
-
-/**
- * Flat dispersion
- * @param mean: mean value
- * @param sigma: half width of top hat function
- * @param x: value at which the Flat is evaluated
- * @return: value of the Flat
- */
-void RectangleDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 1.73205;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  ) {
-				double _w = rectangle_weight(value, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-/**
- * LogNormal dispersion
- */
-
-LogNormalDispersion :: LogNormalDispersion() {
-	npts  = 80;
-	width = 0.0;
-	nsigmas = 8.0;
-};
-
-void LogNormalDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->lognormal_to_dict(from, to);
-}
-void LogNormalDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->lognormal_from_dict(from, to);
-}
-
-double lognormal_weight(double mean, double sigma, double x) {
-
-	double sigma2 = pow(sigma, 2.0);
-	return 1.0/(x*sigma) * exp( -pow((log(x) - mean), 2.0) / (2.0*sigma2));
-
-}
-
-/**
- * Lognormal dispersion
- * @param mean: mean value of the LogNormal
- * @param sigma: standard deviation of the LogNormal
- * @param x: value at which the LogNormal is evaluated
- * @return: value of the LogNormal
- */
-void LogNormalDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 8.0;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			// Note that the definition of sigma is different from Gaussian
-			if ((*par).has_min==false){
-				// sig  for angles
-				sig = width;
-			}
-			else{
-				// by lognormal definition, PD is same as sigma
-				sig = width * value;
-			}
-			
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			//constant bin in real space
-			double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
-			// sigma in the lognormal function is in ln(R) space, thus needs converting
-			sig = fabs(sig/value); 
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  ) {
-				double _w = lognormal_weight(log(value), sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-				//printf("%g \t %g\n",val,_w);
-
-			}
-		}
-	}
-}
-
-
-
-/**
- * Schulz dispersion
- */
-
-SchulzDispersion :: SchulzDispersion() {
-	npts  = 80;
-	width = 0.0;
-	nsigmas = 8.0;
-};
-
-void SchulzDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->schulz_to_dict(from, to);
-}
-void SchulzDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->schulz_from_dict(from, to);
-}
-
-double schulz_weight(double mean, double sigma, double x) {
-    double z = pow(mean/ sigma, 2.0)-1.0;
-	double R= x/mean;
-	double zz= z+1.0;
-	double expo;
-	expo = zz*log(zz)+z*log(R)-R*zz-log(mean)-lgamma(zz);
-	return  exp(expo);
-}
-
-/**
- * Schulz dispersion
- * @param mean: mean value of the Schulz
- * @param sigma: standard deviation of the Schulz
- * @param x: value at which the Schulz is evaluated
- * @return: value of the Schulz
- */
-void SchulzDispersion :: operator() (void *param, vector<WeightPoint> &weights){
-	// Check against zero width
-	if (width<=0) {
-		width = 0.0;
-		npts  = 1;
-		nsigmas = 8.0;
-	}
-
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-	double sig;
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			if ((*par).has_min==false){
-				// width = sigma for angles
-				sig = width;
-			}
-			else{
-				//width = polydispersity (=sigma/value) for length
-				sig = width * value;
-			}
-			// We cover n(nsigmas) times sigmas on each side of the mean
-			double val = value + sig * (2.0*nsigmas*double(i)/double(npts-1) - nsigmas);
-
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  ) {
-				double _w = schulz_weight(value, sig, val);
-				weights.insert(weights.end(), WeightPoint(val, _w));
-			}
-		}
-	}
-}
-
-
-
-
-/**
- * Array dispersion based on input arrays
- */
-
-void ArrayDispersion :: accept_as_source(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->array_to_dict(from, to);
-}
-void ArrayDispersion :: accept_as_destination(DispersionVisitor* visitor, void* from, void* to) {
-	visitor->array_from_dict(from, to);
-}
-
-/**
- * Method to get the weights
- */
-void ArrayDispersion :: operator() (void *param, vector<WeightPoint> &weights) {
-	Parameter* par = (Parameter*)param;
-	double value = (*par)();
-
-	if (npts<2) {
-		weights.insert(weights.end(), WeightPoint(value, 1.0));
-	} else {
-		for(int i=0; i<npts; i++) {
-			double val = _values[i]; //+ value;  //ToDo: Talk to Paul and put back the 'value'.
-
-			if ( ((*par).has_min==false || val>(*par).min)
-			  && ((*par).has_max==false || val<(*par).max)  )
-				weights.insert(weights.end(), WeightPoint(val, _weights[i]));
-		}
-	}
-}
-/**
- * Method to set the weights
- */
-void ArrayDispersion :: set_weights(int npoints, double* values, double* weights){
-	npts = npoints;
-	_values = values;
-	_weights = weights;
-}
-
-
-/**
- * Parameters
- */
-Parameter :: Parameter() {
-	value = 0;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = false;
-	dispersion = new GaussianDispersion();
-}
-
-Parameter :: Parameter(double _value) {
-	value = _value;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = false;
-	dispersion = new GaussianDispersion();
-}
-
-Parameter :: Parameter(double _value, bool disp) {
-	value = _value;
-	min   = 0.0;
-	max   = 0.0;
-	has_min = false;
-	has_max = false;
-	has_dispersion = disp;
-	dispersion = new GaussianDispersion();
-}
-
-void Parameter :: get_weights(vector<WeightPoint> &weights) {
-	(*dispersion)((void*)this, weights);
-}
-
-void Parameter :: set_min(double value) {
-	has_min = true;
-	min = value;
-}
-
-void Parameter :: set_max(double value) {
-	has_max = true;
-	max = value;
-}
-
-double Parameter :: operator()() {
-	return value;
-}
-
-double Parameter :: operator=(double _value){
-	value = _value;
-	return value;
-}
Index: src/sas/models/c_extension/c_models/pearlnecklace.cpp
===================================================================
--- src/sas/models/c_extension/c_models/pearlnecklace.cpp	(revision 422e7e87d1b13cc3f1c0d788f448ca9d50f417a8)
+++ 	(revision )
@@ -1,286 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "pearlnecklace.h"
-
-extern "C" {
-#include "libmultifunc/libfunc.h"
-}
-
-static double pearl_necklace_kernel(double dp[], double q) {
-  // fit parameters
-  double scale = dp[0];
-  double radius = dp[1];
-  double edge_separation = dp[2];
-  double thick_string = dp[3];
-  double num_pearls = floor(dp[4]+0.5);  // Force integer number of pearls
-  double sld_pearl = dp[5];
-  double sld_string = dp[6];
-  double sld_solv = dp[7];
-  double background = dp[8];
-
-  //relative slds
-  double contrast_pearl = sld_pearl - sld_solv;
-  double contrast_string = sld_string - sld_solv;
-
-  // number of string segments
-  double num_strings = num_pearls - 1.0;
-
-  //Pi
-  double pi = 4.0*atan(1.0);
-
-  // each volumes
-  double string_vol = edge_separation * pi * pow((thick_string / 2.0), 2);
-  double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3);
-
-  //total volume
-  double tot_vol;
-  //each masses
-  double m_r= contrast_string * string_vol;
-  double m_s= contrast_pearl * pearl_vol;
-  double psi;
-  double gamma;
-  double beta;
-  //form factors
-  double sss; //pearls
-  double srr; //strings
-  double srs; //cross
-  double A_s;
-  double srr_1;
-  double srr_2;
-  double srr_3;
-  double form_factor;
-
-  tot_vol = num_strings * string_vol;
-  tot_vol += num_pearls * pearl_vol;
-
-  //sine functions of a pearl
-  psi = sin(q*radius);
-  psi -= q * radius * cos(q * radius);
-  psi /= pow((q * radius), 3);
-  psi *= 3.0;
-
-  // Note take only 20 terms in Si series: 10 terms may be enough though.
-  gamma = Si(q* edge_separation);
-  gamma /= (q* edge_separation);
-  beta = Si(q * (edge_separation + radius));
-  beta -= Si(q * radius);
-  beta /= (q* edge_separation);
-
-  // center to center distance between the neighboring pearls
-  A_s = edge_separation + 2.0 * radius;
-
-  // form factor for num_pearls
-  sss = 1.0 - pow(sinc(q*A_s), num_pearls );
-  sss /= pow((1.0-sinc(q*A_s)), 2);
-  sss *= -sinc(q*A_s);
-  sss -= num_pearls/2.0;
-  sss += num_pearls/(1.0-sinc(q*A_s));
-  sss *= 2.0 * pow((m_s*psi), 2);
-
-  // form factor for num_strings (like thin rods)
-  srr_1 = -pow(sinc(q*edge_separation/2.0), 2);
-
-  srr_1 += 2.0 * gamma;
-  srr_1 *= num_strings;
-  srr_2 = 2.0/(1.0-sinc(q*A_s));
-  srr_2 *= num_strings;
-  srr_2 *= pow(beta, 2);
-  srr_3 = 1.0 - pow(sinc(q*A_s), num_strings);
-  srr_3 /= pow((1.0-sinc(q*A_s)), 2);
-  srr_3 *= pow(beta, 2);
-  srr_3 *= -2.0;
-
-  // total srr
-  srr = srr_1 + srr_2 + srr_3;
-  srr *= pow(m_r, 2);
-
-  // form factor for correlations
-  srs = 1.0;
-  srs -= pow(sinc(q*A_s), num_strings);
-  srs /= pow((1.0-sinc(q*A_s)), 2);
-  srs *= -sinc(q*A_s);
-  srs += (num_strings/(1.0-sinc(q*A_s)));
-  srs *= 4.0;
-  srs *= (m_r * m_s * beta * psi);
-
-  form_factor = sss + srr + srs;
-  form_factor /= (tot_vol * 1.0e-8); // norm by volume and A^-1 to cm^-1
-
-  // scale and background
-  form_factor *= scale;
-  form_factor += background;
-  return (form_factor);
-}
-
-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<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-  vector<WeightPoint> 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.size(); i++) {
-    dp[1] = weights_radius[i].value;
-    // Loop over thick_inter0 weight points
-    for(size_t j=0; j<weights_edge_separation.size(); j++) {
-      dp[2] = weights_edge_separation[j].value;
-      pearl_vol = 4.0 /3.0 * pi * pow(dp[1], 3);
-      string_vol =dp[2] * pi * pow((dp[3] / 2.0), 2);
-      tot_vol = (dp[4] - 1.0) * string_vol;
-      tot_vol += dp[4] * pearl_vol;
-      //Un-normalize Sphere by volume
-      sum += weights_radius[i].weight * weights_edge_separation[j].weight
-          * pearl_necklace_kernel(dp,q) * tot_vol;
-      //Find average volume
-      vol += weights_radius[i].weight * weights_edge_separation[j].weight
-          * tot_vol;
-      norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D PearlNecklaceModel function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double PearlNecklaceModel :: operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate PearlNecklaceModel function
- * @param pars: parameters of the PearlNecklaceModel
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double PearlNecklaceModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate TOTAL radius
- * Todo: decide whether or not we keep this calculation
- * @return: effective radius value
- */
-// No polydispersion supported in this model.
-// Calculate max radius assumming max_radius = effective radius
-// Note that this max radius is not affected by sld of layer, sld of interface, or
-// sld of solvent.
-double PearlNecklaceModel :: calculate_ER() {
-  PeralNecklaceParameters dp;
-
-  dp.scale = scale();
-  dp.radius = radius();
-  dp.edge_separation = edge_separation();
-  dp.thick_string = thick_string();
-  dp.num_pearls = num_pearls();
-
-  double rad_out = 0.0;
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double pi = 4.0*atan(1.0);
-  // No polydispersion supported in this model.
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-  vector<WeightPoint> 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<weights_radius.size(); i++) {
-    dp.radius = weights_radius[i].value;
-    // Loop over thick_inter0 weight points
-    for(size_t j=0; j<weights_edge_separation.size(); j++) {
-      dp.edge_separation = weights_edge_separation[j].value;
-      pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-      string_vol =dp.edge_separation * pi * pow((dp.thick_string / 2.0), 2);
-      tot_vol = (dp.num_pearls - 1.0) * string_vol;
-      tot_vol += dp.num_pearls * pearl_vol;
-      //Find  volume
-      // This may be a too much approximation
-      //Todo: decided whether or not we keep this calculation
-      sum += weights_radius[i].weight * weights_edge_separation[j].weight
-          * pow(3.0*tot_vol/4.0/pi,0.333333);
-      norm += weights_radius[i].weight * weights_edge_separation[j].weight;
-    }
-  }
-
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    pearl_vol = 4.0 /3.0 * pi * pow(dp.radius , 3);
-    string_vol =dp.edge_separation * pi * pow((dp.thick_string / 2.0), 2);
-    tot_vol = (dp.num_pearls - 1.0) * string_vol;
-    tot_vol += dp.num_pearls * pearl_vol;
-
-    rad_out =  pow((3.0*tot_vol/4.0/pi), 0.33333);
-  }
-
-  return rad_out;
-
-}
-double PearlNecklaceModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/polygausscoil.cpp
===================================================================
--- src/sas/models/c_extension/c_models/polygausscoil.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,144 +1,0 @@
-/**
-	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 "polygausscoil.h"
-
-extern "C" {
-	#include "libTwoPhase.h"
-}
-
-Poly_GaussCoil :: Poly_GaussCoil() {
-	scale      = Parameter(1.0);
-	rg     = Parameter(60.0, true);
-	rg.set_min(0.0);
-	poly_m   = Parameter(2.0);
-	background = Parameter(0.001);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double Poly_GaussCoil :: operator()(double q) {
-	double dp[4];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = rg();
-	dp[2] = poly_m();
-	dp[3] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rg.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-
-
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* PolyGaussCoil(dp, q) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-
-
-	sum = PolyGaussCoil(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 Poly_GaussCoil :: 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 sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Poly_GaussCoil :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Poly_GaussCoil :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	rg.get_weights(weights_rad);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		sum += weights_rad[i].weight
-			* weights_rad[i].value;
-		norm += weights_rad[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = rg();}
-
-	return rad_out;
-}
-double Poly_GaussCoil :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/pringles.cpp
===================================================================
--- src/sas/models/c_extension/c_models/pringles.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,351 +1,0 @@
-/**
- * PringlesModel
- *
- * (c) 2013 / Andrew J Jackson / andrew.jackson@esss.se
- *
- * Model for "pringles" particle from K. Edler @ Bath University
- *
- */
-#include <math.h>
-#include "parameters.hh"
-#include "pringles.h"
-#include "cephes.h"
-using namespace std;
-
-extern "C"
-{
-#include "GaussWeights.h"
-#include "libStructureFactor.h"
-}
-
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double thickness;
-    double alpha;
-    double beta;
-    double sldCyl;
-    double sldSolv;
-    double background;
-    double cyl_theta;
-    double cyl_phi;
-} PringleParameters;
-
-
-PringlesModel::PringlesModel() {
-	scale = Parameter(1.0);
-	radius = Parameter(60.0,true);
-	radius.set_min(0.0);
-	thickness = Parameter(10.0,true);
-	thickness.set_min(0.0);
-	alpha = Parameter(0.001,true);
-	beta = Parameter(0.02,true);
-	sld_pringle = Parameter(1.0e-6);
-	sld_solvent = Parameter(6.35e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double PringlesModel::operator()(double q) {
-	double dp[8];
-	// Fill parameter array
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = thickness();
-	dp[3] = alpha();
-	dp[4] = beta();
-	dp[5] = sld_pringle();
-	dp[6] = sld_solvent();
-	dp[7] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Get the dispersion points for the thickness
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Get the dispersion points for alpha
-	vector<WeightPoint> weights_alpha;
-	alpha.get_weights(weights_alpha);
-
-	// Get the dispersion points for beta
-	vector<WeightPoint> weights_beta;
-	beta.get_weights(weights_beta);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double volnorm = 0.0;
-	double vol = 0.0;
-	double Pi;
-
-	Pi = 4.0 * atan(1.0);
-
-	// Loop over alpha weight points
-	for (size_t i = 0; i < weights_alpha.size(); i++) {
-		dp[3] = weights_alpha[i].value;
-
-		//Loop over beta weight points
-		for (size_t j = 0; j < weights_beta.size(); j++) {
-			dp[4] = weights_beta[j].value;
-
-			// Loop over thickness weight points
-			for (size_t k = 0; k < weights_thick.size(); k++) {
-				dp[2] = weights_thick[k].value;
-
-				// Loop over radius weight points
-				for (size_t l = 0; l < weights_rad.size(); l++) {
-					dp[1] = weights_rad[l].value;
-					sum += weights_rad[l].weight * weights_thick[k].weight
-							* weights_alpha[i].weight * weights_beta[j].weight
-							* pringle_form(dp, q);
-					//Find average volume
-					vol += weights_rad[l].weight * weights_thick[k].weight * Pi * pow(weights_rad[l].value, 2) * weights_thick[k].value;
-					volnorm += weights_rad[l].weight * weights_thick[k].weight;
-					norm +=  weights_rad[l].weight * weights_thick[k].weight * weights_alpha[i].weight * weights_beta[j].weight;
-
-				}
-			}
-		}
-	}
-
-	if (vol > 0.0 && norm > 0.0) {
-		//normalize by avg volume
-		sum = sum * (vol/volnorm);
-		return sum/norm + background();
-	} else {
-		return 0.0;
-	}
-}
-
-/**
- * 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 PringlesModel::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 model
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double PringlesModel::evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double PringlesModel::calculate_ER() {
-	PringleParameters dp;
-
-	dp.radius     = radius();
-	dp.thickness  = thickness();
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the major shell
-	vector<WeightPoint> weights_thick;
-	thickness.get_weights(weights_thick);
-
-	// Get the dispersion points for the minor shell
-	vector<WeightPoint> weights_radius ;
-	radius.get_weights(weights_radius);
-
-	// Loop over major shell weight points
-	for(int i=0; i< (int)weights_thick.size(); i++) {
-		dp.thickness = weights_thick[i].value;
-		for(int k=0; k< (int)weights_radius.size(); k++) {
-			dp.radius = weights_radius[k].value;
-			//Note: output of "DiamCyl(dp.thick,dp.radius)" is DIAMETER.
-			sum +=weights_thick[i].weight
-				* weights_radius[k].weight*DiamCyl(dp.thickness,dp.radius)/2.0;
-			norm += weights_thick[i].weight* weights_radius[k].weight;
-		}
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		//Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-		rad_out = DiamCyl(dp.thickness,dp.radius)/2.0;}
-
-	return rad_out;
-}
-/**
- * Function to calculate particle volume/total volume for shape models:
- *    Most case returns 1 but for example for the vesicle model it is
- *    (total volume - core volume)/total volume
- *    (< 1 depending on the thickness).
- * @return: effective radius value
- */
-double PringlesModel::calculate_VR() {
-	return 1.0;
-}
-
-/*
- * Useful work functions start here!
- *
- */
-
-static double pringle_form(double dp[], double q) {
-
-	double Pi;
-	int nord = 76, i=0;			//order of integration
-	double uplim, lolim;		//upper and lower integration limits
-	double summ, phi, yyy, answer, vcyl;			//running tally of integration
-	double delrho;
-
-	Pi = 4.0 * atan(1.0);
-	lolim = 0.0;
-	uplim = Pi / 2.0;
-
-	summ = 0.0;			//initialize integral
-
-	delrho = dp[5] - dp[6] ; //make contrast term
-
-	for (i = 0; i < nord; i++) {
-		phi = (Gauss76Z[i] * (uplim - lolim) + uplim + lolim) / 2.0;
-		yyy = Gauss76Wt[i] * pringle_kernel(dp, q, phi);
-		summ += yyy;
-	}
-
-	answer = (uplim - lolim) / 2.0 * summ;
-
-	answer *= delrho*delrho;
-
-    //normalize by cylinder volume
-	//vcyl=Pi*dp[1]*dp[1]*dp[2];
-	//answer *= vcyl;
-
-    //convert to [cm-1]
-	answer *= 1.0e8;
-
-    //Scale by volume fraction
-	answer *= dp[0];
-
-	return answer;
-}
-
-static double pringle_kernel(double dp[], double q, double phi) {
-
-	double sumterm, sincarg, sincterm, nn, retval;
-
-	sincarg = q * dp[2] * cos(phi) / 2.0; //dp[2] = thickness
-	sincterm = pow(sin(sincarg) / sincarg, 2.0);
-
-	//calculate sum term from n = -3 to 3
-	sumterm = 0;
-	for (nn = -3; nn <= 3; nn = nn + 1) {
-		sumterm = sumterm
-				+ (pow(pringleC(dp, q, phi, nn), 2.0)
-						+ pow(pringleS(dp, q, phi, nn), 2.0));
-	}
-
-	retval = 4.0 * sin(phi) * sumterm * sincterm;
-
-	return retval;
-
-}
-
-static double pringleC(double dp[], double q, double phi, double n) {
-
-	double nord, va, vb, summ;
-	double bessargs, cosarg, bessargcb;
-	double r, retval, yyy;
-	int ii;
-	// set up the integration
-	// end points and weights
-	nord = 76;
-	va = 0;
-	vb = dp[1]; //radius
-
-	// evaluate at Gauss points
-	// remember to index from 0,size-1
-
-	summ = 0.0;		// initialize integral
-	ii = 0;
-	do {
-		// Using 76 Gauss points
-		r = (Gauss76Z[ii] * (vb - va) + vb + va) / 2.0;
-
-		bessargs = q * r * sin(phi);
-		cosarg = q * r * r * dp[3] * cos(phi);
-		bessargcb = q * r * r * dp[4] * cos(phi);
-
-		yyy = Gauss76Wt[ii] * r * cos(cosarg) * jn(n, bessargcb)
-				* jn(2 * n, bessargs);
-		summ += yyy;
-
-		ii += 1;
-	} while (ii < nord);			// end of loop over quadrature points
-	//
-	// calculate value of integral to return
-
-	retval = (vb - va) / 2.0 * summ;
-
-	retval = retval / pow(r, 2.0);
-
-	return retval;
-}
-
-static double pringleS(double dp[], double q, double phi, double n) {
-
-	double nord, va, vb, summ;
-	double bessargs, sinarg, bessargcb;
-	double r, retval, yyy;
-	int ii;
-	// set up the integration
-	// end points and weights
-	nord = 76;
-	va = 0;
-	vb = dp[1]; //radius
-
-	// evaluate at Gauss points
-	// remember to index from 0,size-1
-
-	summ = 0.0;		// initialize integral
-	ii = 0;
-	do {
-		// Using 76 Gauss points
-		r = (Gauss76Z[ii] * (vb - va) + vb + va) / 2.0;
-
-		bessargs = q * r * sin(phi);
-		sinarg = q * r * r * dp[3] * cos(phi);
-		bessargcb = q * r * r * dp[4] * cos(phi);
-
-		yyy = Gauss76Wt[ii] * r * sin(sinarg) * jn(n, bessargcb)
-				* jn(2 * n, bessargs);
-
-		summ += yyy;
-
-		ii += 1;
-	} while (ii < nord);			// end of loop over quadrature points
-	//
-	// calculate value of integral to return
-
-	retval = (vb - va) / 2.0 * summ;
-
-	retval = retval / pow(r, 2.0);
-
-	return retval;
-}
Index: src/sas/models/c_extension/c_models/raspberry.cpp
===================================================================
--- src/sas/models/c_extension/c_models/raspberry.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,245 +1,0 @@
-/**
-	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
- */
-
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "raspberry.h"
-
-// scattering
-// Modified from igor model: JHC - May 04, 2012
-//
-// you should write your function to calculate the intensity
-// for a single q-value (that's the input parameter x)
-// based on the wave (array) of parameters that you send it (w)
-// Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.
-//  model calculation
-//
-static double raspberry_func(double dp[], double q){
-	// variables are:							
-	//[0] volume fraction large spheres
-	//[1] radius large sphere (A)
-	//[2] sld large sphere (A-2)
-	//[3] volume fraction small spheres
-	//[4] radius small sphere (A)
-	//[5] fraction of small spheres at surface
-	//[6] sld small sphere
-	//[7] small sphere penetration (A) 
-	//[8] sld solvent
-	//[9] background (cm-1)
-	double vfL, rL, sldL, vfS, rS, sldS, deltaS, delrhoL, delrhoS, bkg, sldSolv, aSs;
-	vfL = dp[0];
-	rL = dp[1];
-	sldL = dp[2];
-	vfS = dp[3];
-	rS = dp[4];
-	aSs = dp[5];
-	sldS = dp[6];
-	deltaS = dp[7];
-	sldSolv = dp[8];
-	bkg = dp[9];
-	
-	delrhoL = fabs(sldL - sldSolv);
-	delrhoS = fabs(sldS - sldSolv);	
-	
-	double VL, VS, Np, f2, fSs;
-	double pi = 4.0*atan(1.0);
-	  
-	VL = 4*pi/3*pow(rL,3.0);
-	VS = 4*pi/3*pow(rS,3.0);
-	Np = aSs*4.0*pow(((rL+deltaS)/rS), 2.0);
-	fSs = Np*vfL*VS/vfS/VL;
-	
-	double rasp_temp[8];
-	rasp_temp[0] = dp[0];
-	rasp_temp[1] = dp[1];
-	rasp_temp[2] = delrhoL;
-	rasp_temp[3] = dp[3];
-	rasp_temp[4] = dp[4];
-	rasp_temp[5] = dp[5];
-	rasp_temp[6] = delrhoS;
-	rasp_temp[7] = dp[7];
-
-	f2 = raspberry_kernel(rasp_temp,q);
-	f2+= vfS*(1.0-fSs)*pow(delrhoS, 2)*VS*rasp_bes(q,rS)*rasp_bes(q,rS);
-	
-	// normalize to single particle volume and convert to 1/cm
-	f2 *= 1.0e8;		// [=] 1/cm
-	
-	return (f2+bkg);	// Scale, then add in the background
-}
-
-double raspberry_kernel(double dp[], double q){
-	// variables are:							
-	//[0] volume fraction large spheres
-	//[1] radius large sphere (A)
-	//[2] sld large sphere (A-2)
-	//[3] volume fraction small spheres
-	//[4] radius small sphere (A)
-	//[5] fraction of small spheres at surface
-	//[6] sld small sphere
-	//[7] small sphere penetration (A) 
-
-	double vfL, rL, vfS, rS, deltaS;
-	double delrhoL, delrhoS, qval, aSs;
-	vfL = dp[0];
-	rL = dp[1];
-	delrhoL = dp[2];
-	vfS = dp[3];
-	rS = dp[4];
-	aSs = dp[5];
-	delrhoS = dp[6];
-	deltaS = dp[7];
-			
-	qval = q;		//rename the input q-value, purely for readability
-	double pi = 4.0*atan(1.0);
-		
-	double psiL,psiS,f2;
-	double sfLS,sfSS;
-	double VL,VS,slT,Np,fSs;
-
-	VL = 4.0*pi/3.0*pow(rL,3.0);
-	VS = 4.0*pi/3.0*pow(rS,3.0);
-
-	Np = aSs*4.0*(rS/(rL+deltaS))*VL/VS; 
-
-	fSs = Np*vfL*VS/vfS/VL;
-
-	slT = delrhoL*VL + Np*delrhoS*VS;
-
-	psiL = rasp_bes(qval,rL);
-	psiS = rasp_bes(qval,rS);
-
-	sfLS = psiL*psiS*(sin(qval*(rL+deltaS*rS))/qval/(rL+deltaS*rS));
-	sfSS = psiS*psiS*pow((sin(qval*(rL+deltaS*rS))/qval/(rL+deltaS*rS)),2);
-		
-	f2 = delrhoL*delrhoL*VL*VL*psiL*psiL; 
-	f2 += Np*delrhoS*delrhoS*VS*VS*psiS*psiS; 
-	f2 += Np*(Np-1)*delrhoS*delrhoS*VS*VS*sfSS; 
-	f2 += 2*Np*delrhoL*delrhoS*VL*VS*sfLS;
-	if (f2 != 0.0){
-		f2 = f2/slT/slT;
-	}
-
-	f2 = f2*(vfL*delrhoL*delrhoL*VL + vfS*fSs*Np*delrhoS*delrhoS*VS);
-
-	return f2;
-}
-
-double rasp_bes(double qval, double rad){
-	double retval;
-	retval = 3.0*(sin(qval*rad)-qval*rad*cos(qval*rad))/(qval*qval*qval)/(rad*rad*rad);
-	return retval;
-}
-
-RaspBerryModel :: RaspBerryModel() {
-	volf_Lsph = Parameter(0.05);
-	radius_Lsph = Parameter(5000.0, true);
-	radius_Lsph.set_min(0.0);
-	sld_Lsph = Parameter(-4.0e-7);
-	volf_Ssph = Parameter(0.005);
-	radius_Ssph = Parameter(100.0, true);
-	radius_Ssph.set_min(0.0);
-	surfrac_Ssph = Parameter(0.4);
-	sld_Ssph = Parameter(3.5e-6);
-	delta_Ssph = Parameter(0.0);
-	sld_solv   = Parameter(6.3e-6);
-	background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double RaspBerryModel :: operator()(double q) {
-	double dp[10];
-	// Add the background after averaging
-	dp[0] = volf_Lsph();
-	dp[1] = radius_Lsph();
-	dp[2] = sld_Lsph();
-	dp[3] = volf_Ssph();
-	dp[4] = radius_Ssph();
-	dp[5] = surfrac_Ssph();
-	dp[6] = sld_Ssph();
-	dp[7] = delta_Ssph();
-	dp[8] = sld_solv();
-	dp[9] = 0.0;
-
-	// Get the dispersion points for the radius_Lsph
-	vector<WeightPoint> weights_radius_Lsph;
-	radius_Lsph.get_weights(weights_radius_Lsph);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	//double norm_vol = 0.0;
-	//double vol = 0.0;
-
-	// Loop over radius_Lsph weight points
-	for(size_t i=0; i<weights_radius_Lsph.size(); i++) {
-		dp[1] = weights_radius_Lsph[i].value;
-			//Un-normalize by volume
-			sum += weights_radius_Lsph[i].weight
-				* raspberry_func(dp, q);// * pow(weights_radius_Lsph[i].value,3.0);
-			//Find average volume 
-			//vol += weights_radius_Lsph[i].weight
-			//	* pow(weights_radius_Lsph[i].value,3.0);
-			norm += weights_radius_Lsph[i].weight;
-			//norm_vol += weights_radius_Lsph[i].weight;
-		}
-	
-	//if (vol != 0.0 && norm_vol != 0.0) {
-		//Re-normalize by avg volume
-		//sum = sum/(vol/norm_vol);}
-	return sum/norm + 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 RaspBerryModel :: 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 
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RaspBerryModel :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RaspBerryModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double RaspBerryModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/refl.cpp
===================================================================
--- src/sas/models/c_extension/c_models/refl.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,303 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-#include "refl.h"
-using namespace std;
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-#define lamda 4.62
-
-static double re_kernel(double dp[], double q) {
-  int n = dp[0];
-  int i,j;
-
-  double scale = dp[1];
-  double thick_inter_sub = dp[2];
-  double sld_sub = dp[4];
-  double sld_super = dp[5];
-  double background = dp[6];
-
-  double total_thick=0.0;
-  double nsl=21.0; //nsl = Num_sub_layer:
-  int n_s;
-  double sld_i,dz,phi,R,ko2;
-  double fun;
-  double pi;
-
-  double* sld;
-  double* thick_inter;
-  double* thick;
-  int*fun_type;
-  complex  phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,two,n_sub,n_sup,knp1,Xnp1;
-
-  sld = (double*)malloc((n+2)*sizeof(double));
-  thick_inter = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-
-  fun_type[0] = dp[3];
-  for (i =1; i<=n; i++){
-    sld[i] = dp[i+6];
-    thick_inter[i]= dp[i+16];
-    thick[i] = dp[i+26];
-    fun_type[i] = dp[i+36];
-    total_thick += thick[i] + thick_inter[i];
-  }
-  sld[0] = sld_sub;
-  sld[n+1] = sld_super;
-
-  thick[0] = total_thick/5.0;
-  thick[n+1] = total_thick/5.0;
-  thick_inter[0] = thick_inter_sub;
-  thick_inter[n+1] = 0.0;
-
-  pi = 4.0*atan(1.0);
-  Xn = cassign(0.0,0.0);
-  one = cassign(1.0,0.0);
-  two = cassign(0.0,-2.0);
-
-  //Checking if floor is available.
-  //no imaginary sld inputs in this function yet
-  n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),0.0);
-  n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),0.0);
-  ko2 = pow(2.0*pi/lamda,2.0);
-
-  phi = asin(lamda*q/(4.0*pi));
-  phi1 = cplx_div(rcmult(phi,one),n_sup);
-  alpha = cplx_mult(n_sup,cplx_cos(phi1));
-  alpha2 = cplx_mult(alpha,alpha);
-
-  nnp1=n_sub;
-  knp1=cplx_sqrt(rcmult(ko2,cplx_sub(cplx_mult(nnp1,nnp1),alpha2)));  //nnp1*ko*sin(phinp1)
-  Xnp1=cassign(0.0,0.0);
-  dz = 0.0;
-  // iteration for # of layers +sub from the top
-  for (i=1;i<=n+1; i++){
-    if (fun_type[i-1]==1)
-      fun = 5;
-    else
-      fun = 0;
-    //iteration for 9 sub-layers
-    for (j=0;j<2;j++){
-      for (n_s=0;n_s<nsl; n_s++){
-        if (j==1){
-          if (i==n+1)
-            break;
-          dz = thick[i];
-          sld_i = sld[i];
-        }
-        else{
-          dz = thick_inter[i-1]/nsl;//nsl;
-          if (sld[i-1] == sld[i]){
-            sld_i = sld[i];
-          }
-          else{
-            sld_i = intersldfunc(fun,nsl, n_s+0.5, 2.5, sld[i-1], sld[i]);
-          }
-        }
-        nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),0.0);
-        nn2=cplx_mult(nn,nn);
-
-        kn=cplx_sqrt(rcmult(ko2,cplx_sub(nn2,alpha2)));        //nn*ko*sin(phin)
-        an=cplx_exp(rcmult(dz,cplx_mult(two,kn)));
-
-        fnm=cplx_sub(kn,knp1);
-        fnp=cplx_add(kn,knp1);
-        rn=cplx_div(fnm,fnp);
-        Xn=cplx_mult(an,cplx_div(cplx_add(rn,Xnp1),cplx_add(one,cplx_mult(rn,Xnp1))));    //Xn=an*((rn+Xnp1*anp1)/(1+rn*Xnp1*anp1))
-
-        Xnp1=Xn;
-        knp1=kn;
-
-        if (j==1)
-          break;
-      }
-    }
-  }
-  R=pow(Xn.re,2.0)+pow(Xn.im,2.0);
-  // This temperarily fixes the total reflection for Rfunction and linear.
-  // ToDo: Show why it happens that Xn.re=0 and Xn.im >1!
-  if (Xn.im == 0.0){
-    R=1.0;
-  }
-  R *= scale;
-  R += background;
-
-  free(sld);
-  free(thick_inter);
-  free(thick);
-  free(fun_type);
-
-  return R;
-
-}
-ReflModel :: ReflModel() {
-  n_layers = Parameter(1.0);
-  scale = Parameter(1.0);
-  thick_inter0 = Parameter(1.0);
-  func_inter0 = Parameter(0);
-  sld_bottom0 = Parameter(2.07e-06);
-  sld_medium = Parameter(1.0e-06);
-  background = Parameter(0.0);
-
-
-  sld_flat1 = Parameter(3.0e-06);
-  sld_flat2 = Parameter(3.5e-06);
-  sld_flat3 = Parameter(4.0e-06);
-  sld_flat4 = Parameter(3.5e-06);
-  sld_flat5 = Parameter(4.0e-06);
-  sld_flat6 = Parameter(3.5e-06);
-  sld_flat7 = Parameter(4.0e-06);
-  sld_flat8 = Parameter(3.5e-06);
-  sld_flat9 = Parameter(4.0e-06);
-  sld_flat10 = Parameter(3.5e-06);
-
-
-  thick_inter1 = Parameter(1);
-  thick_inter2 = Parameter(1);
-  thick_inter3 = Parameter(1);
-  thick_inter4 = Parameter(1);
-  thick_inter5 = Parameter(1);
-  thick_inter6 = Parameter(1);
-  thick_inter7 = Parameter(1);
-  thick_inter8 = Parameter(1);
-  thick_inter9 = Parameter(1);
-  thick_inter10 = Parameter(1);
-
-
-  thick_flat1 = Parameter(15);
-  thick_flat2 = Parameter(100);
-  thick_flat3 = Parameter(100);
-  thick_flat4 = Parameter(100);
-  thick_flat5 = Parameter(100);
-  thick_flat6 = Parameter(100);
-  thick_flat7 = Parameter(100);
-  thick_flat8 = Parameter(100);
-  thick_flat9 = Parameter(100);
-  thick_flat10 = Parameter(100);
-
-
-  func_inter1 = Parameter(0);
-  func_inter2 = Parameter(0);
-  func_inter3 = Parameter(0);
-  func_inter4 = Parameter(0);
-  func_inter5 = Parameter(0);
-  func_inter6 = Parameter(0);
-  func_inter7 = Parameter(0);
-  func_inter8 = Parameter(0);
-  func_inter9 = Parameter(0);
-  func_inter10 = Parameter(0);
-
-}
-
-/**
- * Function to evaluate 1D NR function
- * @param q: q-value
- * @return: function value
- */
-double ReflModel :: operator()(double q) {
-  double dp[47];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = n_layers();
-  dp[1] = scale();
-  dp[2] = thick_inter0();
-  dp[3] = func_inter0();
-  dp[4] = sld_bottom0();
-  dp[5] = sld_medium();
-  dp[6] = background();
-
-  dp[7] = sld_flat1();
-  dp[8] = sld_flat2();
-  dp[9] = sld_flat3();
-  dp[10] = sld_flat4();
-  dp[11] = sld_flat5();
-  dp[12] = sld_flat6();
-  dp[13] = sld_flat7();
-  dp[14] = sld_flat8();
-  dp[15] = sld_flat9();
-  dp[16] = sld_flat10();
-
-  dp[17] = thick_inter1();
-  dp[18] = thick_inter2();
-  dp[19] = thick_inter3();
-  dp[20] = thick_inter4();
-  dp[21] = thick_inter5();
-  dp[22] = thick_inter6();
-  dp[23] = thick_inter7();
-  dp[24] = thick_inter8();
-  dp[25] = thick_inter9();
-  dp[26] = thick_inter10();
-
-  dp[27] = thick_flat1();
-  dp[28] = thick_flat2();
-  dp[29] = thick_flat3();
-  dp[30] = thick_flat4();
-  dp[31] = thick_flat5();
-  dp[32] = thick_flat6();
-  dp[33] = thick_flat7();
-  dp[34] = thick_flat8();
-  dp[35] = thick_flat9();
-  dp[36] = thick_flat10();
-
-  dp[37] = func_inter1();
-  dp[38] = func_inter2();
-  dp[39] = func_inter3();
-  dp[40] = func_inter4();
-  dp[41] = func_inter5();
-  dp[42] = func_inter6();
-  dp[43] = func_inter7();
-  dp[44] = func_inter8();
-  dp[45] = func_inter9();
-  dp[46] = func_inter10();
-
-  // Get the dispersion points for the radius
-  //vector<WeightPoint> weights_thick;
-  //thick_inter0.get_weights(weights_thick_inter0);
-
-
-  return re_kernel(dp,q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double ReflModel :: operator()(double qx, double qy) {
-  // For 2D set qy as q, ignoring qx.
-  double q = qy;//sqrt(qx*qx + qy*qy);
-  if (q < 0.0){
-    return 0.0;
-  }
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ReflModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ReflModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double ReflModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/refl_adv.cpp
===================================================================
--- src/sas/models/c_extension/c_models/refl_adv.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,381 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-#include "refl_adv.h"
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-using namespace std;
-
-#define lamda 4.62
-
-
-double re_adv_kernel(double dp[], double q) {
-  int n = dp[0];
-  int i,j;
-  double nsl;
-
-  double scale = dp[1];
-  double thick_inter_sub = dp[2];
-  double sld_sub = dp[4];
-  double sld_super = dp[5];
-  double background = dp[6];
-  double npts = dp[69]; //number of sub_layers in each interface
-
-  double total_thick=0.0;
-
-  int n_s;
-  double sld_i,sldim_i,dz,phi,R,ko2;
-  double pi;
-
-  int* fun_type;
-  double* sld;
-  double* sld_im;
-  double* thick_inter;
-  double* thick;
-  double* fun_coef;
-  complex  phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,two,n_sub,n_sup,knp1,Xnp1;
-
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-  sld = (double*)malloc((n+2)*sizeof(double));
-  sld_im = (double*)malloc((n+2)*sizeof(double));
-  thick_inter = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  fun_coef = (double*)malloc((n+2)*sizeof(double));
-
-  fun_type[0] = dp[3];
-  fun_coef[0] = fabs(dp[70]);
-  for (i =1; i<=n; i++){
-    sld[i] = dp[i+6];
-    thick_inter[i]= dp[i+16];
-    thick[i] = dp[i+26];
-    fun_type[i] = dp[i+36];
-    sld_im[i] = dp[i+46];
-    fun_coef[i] = fabs(dp[i+56]);
-    //printf("type_func2 =%g\n",fun_coef[i]);
-
-    total_thick += thick[i] + thick_inter[i];
-  }
-  sld[0] = sld_sub;
-  sld[n+1] = sld_super;
-  sld_im[0] = fabs(dp[1+66]);
-  sld_im[n+1] = fabs(dp[2+66]);
-  thick[0] = total_thick/5.0;
-  thick[n+1] = total_thick/5.0;
-  thick_inter[0] = thick_inter_sub;
-  thick_inter[n+1] = 0.0;
-  fun_coef[n+1] = 0.0;
-
-  nsl=npts;//21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
-
-  pi = 4.0*atan(1.0);
-  one = cassign(1.0,0.0);
-  Xn = cassign(0.0,0.0);
-  two = cassign(0.0,-2.0);
-
-  //Checking if floor is available.
-  //no imaginary sld inputs in this function yet
-  n_sub=cassign(1.0-sld_sub*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[0]);
-  n_sup=cassign(1.0-sld_super*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sld_im[n+1]);
-  ko2 = pow(2.0*pi/lamda,2.0);
-
-  phi = asin(lamda*q/(4.0*pi));
-  phi1 = cplx_div(rcmult(phi,one),n_sup);
-  alpha = cplx_mult(n_sup,cplx_cos(phi1));
-  alpha2 = cplx_mult(alpha,alpha);
-
-  nnp1=n_sub;
-  knp1=cplx_sqrt(rcmult(ko2,cplx_sub(cplx_mult(nnp1,nnp1),alpha2)));  //nnp1*ko*sin(phinp1)
-  Xnp1=cassign(0.0,0.0);
-  dz = 0.0;
-  // iteration for # of layers +sub from the top
-  for (i=1;i<=n+1; i++){
-    //if (fun_coef[i]==0.0)
-    //  // this condition protects an error in numerical multiplication
-    //  fun_coef[i] = 1e-14;
-    //iteration for 9 sub-layers
-    for (j=0;j<2;j++){
-      for (n_s=0;n_s<nsl; n_s++){
-        // for flat layer
-        if (j==1){
-          if (i==n+1)
-            break;
-          dz = thick[i];
-          sld_i = sld[i];
-          sldim_i = sld_im[i];
-        }
-        // for interface
-        else{
-          dz = thick_inter[i-1]/nsl;
-          if (sld[i-1] == sld[i]){
-            sld_i = sld[i];
-          }
-          else{
-            sld_i = intersldfunc(fun_type[i-1],nsl, n_s+0.5, fun_coef[i-1], sld[i-1], sld[i]);
-          }
-          if (sld_im[i-1] == sld_im[i]){
-            sldim_i = sld_im[i];
-          }
-          else{
-            sldim_i = intersldfunc(fun_type[i-1],nsl, n_s+0.5, fun_coef[i-1], sld_im[i-1], sld_im[i]);
-          }
-        }
-        nn = cassign(1.0-sld_i*pow(lamda,2.0)/(2.0*pi),pow(lamda,2.0)/(2.0*pi)*sldim_i);
-        nn2=cplx_mult(nn,nn);
-
-        kn=cplx_sqrt(rcmult(ko2,cplx_sub(nn2,alpha2)));        //nn*ko*sin(phin)
-        an=cplx_exp(rcmult(dz,cplx_mult(two,kn)));
-
-        fnm=cplx_sub(kn,knp1);
-        fnp=cplx_add(kn,knp1);
-        rn=cplx_div(fnm,fnp);
-        Xn=cplx_mult(an,cplx_div(cplx_add(rn,Xnp1),cplx_add(one,cplx_mult(rn,Xnp1))));    //Xn=an*((rn+Xnp1*anp1)/(1+rn*Xnp1*anp1))
-
-        Xnp1=Xn;
-        knp1=kn;
-        // no for-loop for flat layer
-        if (j==1)
-          break;
-      }
-    }
-  }
-  R=pow(Xn.re,2.0)+pow(Xn.im,2.0);
-  // This temperarily fixes the total reflection for Rfunction and linear.
-  // ToDo: Show why it happens that Xn.re=0 and Xn.im >1!
-  if (Xn.im == 0.0 || R > 1){
-    R=1.0;
-  }
-  R *= scale;
-  R += background;
-
-  free(fun_type);
-  free(sld);
-  free(sld_im);
-  free(thick_inter);
-  free(thick);
-  free(fun_coef);
-
-  return R;
-
-}
-ReflAdvModel :: ReflAdvModel() {
-  n_layers = Parameter(1.0);
-  scale = Parameter(1.0);
-  thick_inter0 = Parameter(1.0);
-  func_inter0 = Parameter(0);
-  sld_bottom0 = Parameter(2.07e-06);
-  sld_medium = Parameter(1.0e-06);
-  background = Parameter(0.0);
-
-
-  sld_flat1 = Parameter(2.7e-06);
-  sld_flat2 = Parameter(3.5e-06);
-  sld_flat3 = Parameter(4.0e-06);
-  sld_flat4 = Parameter(3.5e-06);
-  sld_flat5 = Parameter(4.0e-06);
-  sld_flat6 = Parameter(3.5e-06);
-  sld_flat7 = Parameter(4.0e-06);
-  sld_flat8 = Parameter(3.5e-06);
-  sld_flat9 = Parameter(4.0e-06);
-  sld_flat10 = Parameter(3.5e-06);
-
-
-  thick_inter1 = Parameter(1.0);
-  thick_inter2 = Parameter(1.0);
-  thick_inter3 = Parameter(1.0);
-  thick_inter4 = Parameter(1.0);
-  thick_inter5 = Parameter(1.0);
-  thick_inter6 = Parameter(1.0);
-  thick_inter7 = Parameter(1.0);
-  thick_inter8 = Parameter(1.0);
-  thick_inter9 = Parameter(1.0);
-  thick_inter10 = Parameter(1.0);
-
-
-  thick_flat1 = Parameter(15.0);
-  thick_flat2 = Parameter(100.0);
-  thick_flat3 = Parameter(100.0);
-  thick_flat4 = Parameter(100.0);
-  thick_flat5 = Parameter(100.0);
-  thick_flat6 = Parameter(100.0);
-  thick_flat7 = Parameter(100.0);
-  thick_flat8 = Parameter(100.0);
-  thick_flat9 = Parameter(100.0);
-  thick_flat10 = Parameter(100.0);
-
-
-  func_inter1 = Parameter(0);
-  func_inter2 = Parameter(0);
-  func_inter3 = Parameter(0);
-  func_inter4 = Parameter(0);
-  func_inter5 = Parameter(0);
-  func_inter6 = Parameter(0);
-  func_inter7 = Parameter(0);
-  func_inter8 = Parameter(0);
-  func_inter9 = Parameter(0);
-  func_inter10 = Parameter(0);
-
-  sldIM_flat1 = Parameter(0);
-  sldIM_flat2 = Parameter(0);
-  sldIM_flat3 = Parameter(0);
-  sldIM_flat4 = Parameter(0);
-  sldIM_flat5 = Parameter(0);
-  sldIM_flat6 = Parameter(0);
-  sldIM_flat7 = Parameter(0);
-  sldIM_flat8 = Parameter(0);
-  sldIM_flat9 = Parameter(0);
-  sldIM_flat10 = Parameter(0);
-
-  nu_inter1 = Parameter(2.5);
-  nu_inter2 = Parameter(2.5);
-  nu_inter3 = Parameter(2.5);
-  nu_inter4 = Parameter(2.5);
-  nu_inter5 = Parameter(2.5);
-  nu_inter6 = Parameter(2.5);
-  nu_inter7 = Parameter(2.5);
-  nu_inter8 = Parameter(2.5);
-  nu_inter9 = Parameter(2.5);
-  nu_inter10 = Parameter(2.5);
-
-  sldIM_sub0 = Parameter(0.0);
-  sldIM_medium = Parameter(0.0);
-  npts_inter = Parameter(21.0);
-  nu_inter0 = Parameter(2.5);
-}
-
-/**
- * Function to evaluate 1D NR function
- * @param q: q-value
- * @return: function value
- */
-double ReflAdvModel :: operator()(double q) {
-  double dp[71];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = n_layers();
-  dp[1] = scale();
-  dp[2] = thick_inter0();
-  dp[3] = func_inter0();
-  dp[4] = sld_bottom0();
-  dp[5] = sld_medium();
-  dp[6] = background();
-
-  dp[7] = sld_flat1();
-  dp[8] = sld_flat2();
-  dp[9] = sld_flat3();
-  dp[10] = sld_flat4();
-  dp[11] = sld_flat5();
-  dp[12] = sld_flat6();
-  dp[13] = sld_flat7();
-  dp[14] = sld_flat8();
-  dp[15] = sld_flat9();
-  dp[16] = sld_flat10();
-
-  dp[17] = thick_inter1();
-  dp[18] = thick_inter2();
-  dp[19] = thick_inter3();
-  dp[20] = thick_inter4();
-  dp[21] = thick_inter5();
-  dp[22] = thick_inter6();
-  dp[23] = thick_inter7();
-  dp[24] = thick_inter8();
-  dp[25] = thick_inter9();
-  dp[26] = thick_inter10();
-
-  dp[27] = thick_flat1();
-  dp[28] = thick_flat2();
-  dp[29] = thick_flat3();
-  dp[30] = thick_flat4();
-  dp[31] = thick_flat5();
-  dp[32] = thick_flat6();
-  dp[33] = thick_flat7();
-  dp[34] = thick_flat8();
-  dp[35] = thick_flat9();
-  dp[36] = thick_flat10();
-
-  dp[37] = func_inter1();
-  dp[38] = func_inter2();
-  dp[39] = func_inter3();
-  dp[40] = func_inter4();
-  dp[41] = func_inter5();
-  dp[42] = func_inter6();
-  dp[43] = func_inter7();
-  dp[44] = func_inter8();
-  dp[45] = func_inter9();
-  dp[46] = func_inter10();
-
-  dp[47] = sldIM_flat1();
-  dp[48] = sldIM_flat2();
-  dp[49] = sldIM_flat3();
-  dp[50] = sldIM_flat4();
-  dp[51] = sldIM_flat5();
-  dp[52] = sldIM_flat6();
-  dp[53] = sldIM_flat7();
-  dp[54] = sldIM_flat8();
-  dp[55] = sldIM_flat9();
-  dp[56] = sldIM_flat10();
-
-  dp[57] = nu_inter1();
-  dp[58] = nu_inter2();
-  dp[59] = nu_inter3();
-  dp[60] = nu_inter4();
-  dp[61] = nu_inter5();
-  dp[62] = nu_inter6();
-  dp[63] = nu_inter7();
-  dp[64] = nu_inter8();
-  dp[65] = nu_inter9();
-  dp[66] = nu_inter10();
-
-  dp[67] = sldIM_sub0();
-  dp[68] = sldIM_medium();
-  dp[69] = npts_inter();
-  dp[70] = nu_inter0();
-  // Get the dispersion points for the radius
-  //vector<WeightPoint> weights_thick;
-  //thick_inter0.get_weights(weights_thick_inter0);
-
-
-  return re_adv_kernel(dp,q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double ReflAdvModel :: operator()(double qx, double qy) {
-  // For 2D set qy as q, ignoring qx.
-  double q = qy;//sqrt(qx*qx + qy*qy);
-  if (q < 0.0){
-    return 0.0;
-  }
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate 2D NR function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double ReflAdvModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double ReflAdvModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double ReflAdvModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/rpa.cpp
===================================================================
--- src/sas/models/c_extension/c_models/rpa.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,542 +1,0 @@
-/**
-	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>
-#include "rpa.h"
-
-using namespace std;
-
-static double rpa_kernel(double dp[], double q) {
-  int lCASE = dp[0];
-
-  double Na,Nb,Nc,Nd,Nab,Nac,Nad,Nbc,Nbd,Ncd;
-  double Phia,Phib,Phic,Phid,Phiab,Phiac,Phiad;
-  double Phibc,Phibd,Phicd;
-  double va,vb,vc,vd,vab,vac,vad,vbc,vbd,vcd;
-  double m;
-  double ba,bb,bc,bd;
-  double Xa,Xb,Xc,Xd;
-  double Paa,S0aa,Pab,S0ab,Pac,S0ac,Pad,S0ad;
-  double S0ba,Pbb,S0bb,Pbc,S0bc,Pbd,S0bd;
-  double S0ca,S0cb,Pcc,S0cc,Pcd,S0cd;
-  double S0da,S0db,S0dc,Pdd,S0dd;
-  double Kaa,Kab,Kac,Kad,Kba,Kbb,Kbc,Kbd;
-  double Kca,Kcb,Kcc,Kcd,Kda,Kdb,Kdc,Kdd;
-  double Zaa,Zab,Zac,Zba,Zbb,Zbc,Zca,Zcb,Zcc;
-  double DenT,T11,T12,T13,T21,T22,T23,T31,T32,T33;
-  double Y1,Y2,Y3,X11,X12,X13,X21,X22,X23,X31,X32,X33;
-  double ZZ,DenQ1,DenQ2,DenQ3,DenQ,Q11,Q12,Q13,Q21,Q22,Q23,Q31,Q32,Q33;
-  double N11,N12,N13,N21,N22,N23,N31,N32,N33;
-  double M11,M12,M13,M21,M22,M23,M31,M32,M33;
-  double S11,S12,S13,S14,S21,S22,S23,S24;
-  double S31,S32,S33,S34,S41,S42,S43,S44;
-  double La,Lb,Lc,Ld,Lad,Lbd,Lcd,Nav,Intg;
-  double scale, background;
-
-  int ii=13;  //dp[ii<13] = fittable, else fixed
-
-  Na=1000.0;
-  Nb=1000.0;
-  Nc=1000.0;
-  Nd=1000.0;  //DEGREE OF POLYMERIZATION
-  Phia=0.25;
-  Phib=0.25;
-  Phic=0.25;
-  Phid=0.25 ; //VOL FRACTION
-  Kab=-0.0004;
-  Kac=-0.0004;
-  Kad=-0.0004;  //CHI PARAM
-  Kbc=-0.0004;
-  Kbd=-0.0004;
-  Kcd=-0.0004;
-  La=1.0e-12;
-  Lb=1.0e-12;
-  Lc=1.0e-12;
-  Ld=0.0e-12;   //SCATT. LENGTH
-  va=100.0;
-  vb=100.0;
-  vc=100.0;
-  vd=100.0  ; //SPECIFIC VOLUME
-  ba=5.0;
-  bb=5.0;
-  bc=5.0;
-  bd=5.0;   //SEGMENT LENGTH
-
-  //lCASE was shifted to N-1 from the original code
-  if (lCASE <= 1){
-    Phia=0.0000001;
-    Phib=0.0000001;
-    Phic=0.5;
-    Phid=0.5;
-    Nc=dp[ii+8];
-    Phic=dp[ii+9];
-    vc=dp[ii+10];
-    Lc=dp[ii+11];
-    bc=dp[3];
-    Nd=dp[ii+12];
-    Phid=dp[ii+13];
-    vd=dp[ii+14];
-    Ld=dp[ii+15];
-    bd=dp[4];
-    Kcd=dp[10];
-    scale=dp[11];
-    background=dp[12];
-  }
-  else if ((lCASE > 1) && (lCASE <= 4)){
-    Phia=0.0000001;
-    Phib=0.333333;
-    Phic=0.333333;
-    Phid=0.333333;
-    Nb=dp[ii+4];
-    Phib=dp[ii+5];
-    vb=dp[ii+6];
-    Lb=dp[ii+7];
-    bb=dp[2];
-    Nc=dp[ii+8];
-    Phic=dp[ii+9];
-    vc=dp[ii+10];
-    Lc=dp[ii+11];
-    bc=dp[3];
-    Nd=dp[ii+12];
-    Phid=dp[ii+13];
-    vd=dp[ii+14];
-    Ld=dp[ii+15];
-    bd=dp[4];
-    Kbc=dp[8];
-    Kbd=dp[9];
-    Kcd=dp[10];
-    scale=dp[11];
-    background=dp[12];
-  }
-  else {
-    Phia=0.25;
-    Phib=0.25;
-    Phic=0.25;
-    Phid=0.25;
-    Na=dp[ii+0];
-    Phia=dp[ii+1];
-    va=dp[ii+2];
-    La=dp[ii+3];
-    ba=dp[1];
-    Nb=dp[ii+4];
-    Phib=dp[ii+5];
-    vb=dp[ii+6];
-    Lb=dp[ii+7];
-    bb=dp[2];
-    Nc=dp[ii+8];
-    Phic=dp[ii+9];
-    vc=dp[ii+10];
-    Lc=dp[ii+11];
-    bc=dp[3];
-    Nd=dp[ii+12];
-    Phid=dp[ii+13];
-    vd=dp[ii+14];
-    Ld=dp[ii+15];
-    bd=dp[4];
-    Kab=dp[5];
-    Kac=dp[6];
-    Kad=dp[7];
-    Kbc=dp[8];
-    Kbd=dp[9];
-    Kcd=dp[10];
-    scale=dp[11];
-    background=dp[12];
-  }
-
-  Nab=pow((Na*Nb),(0.5));
-  Nac=pow((Na*Nc),(0.5));
-  Nad=pow((Na*Nd),(0.5));
-  Nbc=pow((Nb*Nc),(0.5));
-  Nbd=pow((Nb*Nd),(0.5));
-  Ncd=pow((Nc*Nd),(0.5));
-
-  vab=pow((va*vb),(0.5));
-  vac=pow((va*vc),(0.5));
-  vad=pow((va*vd),(0.5));
-  vbc=pow((vb*vc),(0.5));
-  vbd=pow((vb*vd),(0.5));
-  vcd=pow((vc*vd),(0.5));
-
-  Phiab=pow((Phia*Phib),(0.5));
-  Phiac=pow((Phia*Phic),(0.5));
-  Phiad=pow((Phia*Phid),(0.5));
-  Phibc=pow((Phib*Phic),(0.5));
-  Phibd=pow((Phib*Phid),(0.5));
-  Phicd=pow((Phic*Phid),(0.5));
-
-  Xa=q*q*ba*ba*Na/6.0;
-  Xb=q*q*bb*bb*Nb/6.0;
-  Xc=q*q*bc*bb*Nc/6.0;
-  Xd=q*q*bd*bb*Nd/6.0;
-
-  Paa=2.0*(exp(-Xa)-1.0+Xa)/pow(Xa,2.0);
-  S0aa=Na*Phia*va*Paa;
-  Pab=((1.0-exp(-Xa))/Xa)*((1.0-exp(-Xb))/Xb);
-  S0ab=(Phiab*vab*Nab)*Pab;
-  Pac=((1.0-exp(-Xa))/Xa)*exp(-Xb)*((1.0-exp(-Xc))/Xc);
-  S0ac=(Phiac*vac*Nac)*Pac;
-  Pad=((1.0-exp(-Xa))/Xa)*exp(-Xb-Xc)*((1.0-exp(-Xd))/Xd);
-  S0ad=(Phiad*vad*Nad)*Pad;
-
-  S0ba=S0ab;
-  Pbb=2.0*(exp(-Xb)-1.0+Xb)/pow(Xb,2.0);
-  S0bb=Nb*Phib*vb*Pbb;
-  Pbc=((1.0-exp(-Xb))/Xb)*((1.0-exp(-Xc))/Xc);
-  S0bc=(Phibc*vbc*Nbc)*Pbc;
-  Pbd=((1.0-exp(-Xb))/Xb)*exp(-Xc)*((1.0-exp(-Xd))/Xd);
-  S0bd=(Phibd*vbd*Nbd)*Pbd;
-
-  S0ca=S0ac;
-  S0cb=S0bc;
-  Pcc=2.0*(exp(-Xc)-1.0+Xc)/pow(Xc,2.0);
-  S0cc=Nc*Phic*vc*Pcc;
-  Pcd=((1.0-exp(-Xc))/Xc)*((1.0-exp(-Xd))/Xd);
-  S0cd=(Phicd*vcd*Ncd)*Pcd;
-
-  S0da=S0ad;
-  S0db=S0bd;
-  S0dc=S0cd;
-  Pdd=2.0*(exp(-Xd)-1.0+Xd)/pow(Xd,2.0);
-  S0dd=Nd*Phid*vd*Pdd;
-  //lCASE was shifted to N-1 from the original code
-  switch(lCASE){
-  case 0:
-    S0aa=0.000001;
-    S0ab=0.000002;
-    S0ac=0.000003;
-    S0ad=0.000004;
-    S0bb=0.000005;
-    S0bc=0.000006;
-    S0bd=0.000007;
-    S0cd=0.000008;
-    break;
-  case 1:
-    S0aa=0.000001;
-    S0ab=0.000002;
-    S0ac=0.000003;
-    S0ad=0.000004;
-    S0bb=0.000005;
-    S0bc=0.000006;
-    S0bd=0.000007;
-    break;
-  case 2:
-    S0aa=0.000001;
-    S0ab=0.000002;
-    S0ac=0.000003;
-    S0ad=0.000004;
-    S0bc=0.000005;
-    S0bd=0.000006;
-    S0cd=0.000007;
-    break;
-  case 3:
-    S0aa=0.000001;
-    S0ab=0.000002;
-    S0ac=0.000003;
-    S0ad=0.000004;
-    S0bc=0.000005;
-    S0bd=0.000006;
-    break;
-  case 4:
-    S0aa=0.000001;
-    S0ab=0.000002;
-    S0ac=0.000003;
-    S0ad=0.000004;
-    break;
-  case 5:
-    S0ab=0.000001;
-    S0ac=0.000002;
-    S0ad=0.000003;
-    S0bc=0.000004;
-    S0bd=0.000005;
-    S0cd=0.000006;
-    break;
-  case 6:
-    S0ab=0.000001;
-    S0ac=0.000002;
-    S0ad=0.000003;
-    S0bc=0.000004;
-    S0bd=0.000005;
-    break;
-  case 7:
-    S0ab=0.000001;
-    S0ac=0.000002;
-    S0ad=0.000003;
-    break;
-  case 8:
-    S0ac=0.000001;
-    S0ad=0.000002;
-    S0bc=0.000003;
-    S0bd=0.000004;
-    break;
-  default : //case 9:
-    break;
-  }
-  S0ba=S0ab;
-  S0ca=S0ac;
-  S0cb=S0bc;
-  S0da=S0ad;
-  S0db=S0bd;
-  S0dc=S0cd;
-
-  Kaa=0.0;
-  Kbb=0.0;
-  Kcc=0.0;
-  Kdd=0.0;
-
-  Kba=Kab;
-  Kca=Kac;
-  Kcb=Kbc;
-  Kda=Kad;
-  Kdb=Kbd;
-  Kdc=Kcd;
-
-  Zaa=Kaa-Kad-Kad;
-  Zab=Kab-Kad-Kbd;
-  Zac=Kac-Kad-Kcd;
-  Zba=Kba-Kbd-Kad;
-  Zbb=Kbb-Kbd-Kbd;
-  Zbc=Kbc-Kbd-Kcd;
-  Zca=Kca-Kcd-Kad;
-  Zcb=Kcb-Kcd-Kbd;
-  Zcc=Kcc-Kcd-Kcd;
-
-  DenT=(-(S0ac*S0bb*S0ca) + S0ab*S0bc*S0ca + S0ac*S0ba*S0cb - S0aa*S0bc*S0cb - S0ab*S0ba*S0cc + S0aa*S0bb*S0cc);
-
-  T11= (-(S0bc*S0cb) + S0bb*S0cc)/DenT;
-  T12= (S0ac*S0cb - S0ab*S0cc)/DenT;
-  T13= (-(S0ac*S0bb) + S0ab*S0bc)/DenT;
-  T21= (S0bc*S0ca - S0ba*S0cc)/DenT;
-  T22= (-(S0ac*S0ca) + S0aa*S0cc)/DenT;
-  T23= (S0ac*S0ba - S0aa*S0bc)/DenT;
-  T31= (-(S0bb*S0ca) + S0ba*S0cb)/DenT;
-  T32= (S0ab*S0ca - S0aa*S0cb)/DenT;
-  T33= (-(S0ab*S0ba) + S0aa*S0bb)/DenT;
-
-  Y1=T11*S0ad+T12*S0bd+T13*S0cd+1.0;
-  Y2=T21*S0ad+T22*S0bd+T23*S0cd+1.0;
-  Y3=T31*S0ad+T32*S0bd+T33*S0cd+1.0;
-
-  X11=Y1*Y1;
-  X12=Y1*Y2;
-  X13=Y1*Y3;
-  X21=Y2*Y1;
-  X22=Y2*Y2;
-  X23=Y2*Y3;
-  X31=Y3*Y1;
-  X32=Y3*Y2;
-  X33=Y3*Y3;
-
-  ZZ=S0ad*(T11*S0ad+T12*S0bd+T13*S0cd)+S0bd*(T21*S0ad+T22*S0bd+T23*S0cd)+S0cd*(T31*S0ad+T32*S0bd+T33*S0cd);
-
-  m=1.0/(S0dd-ZZ);
-
-  N11=m*X11+Zaa;
-  N12=m*X12+Zab;
-  N13=m*X13+Zac;
-  N21=m*X21+Zba;
-  N22=m*X22+Zbb;
-  N23=m*X23+Zbc;
-  N31=m*X31+Zca;
-  N32=m*X32+Zcb;
-  N33=m*X33+Zcc;
-
-  M11= N11*S0aa + N12*S0ab + N13*S0ac;
-  M12= N11*S0ab + N12*S0bb + N13*S0bc;
-  M13= N11*S0ac + N12*S0bc + N13*S0cc;
-  M21= N21*S0aa + N22*S0ab + N23*S0ac;
-  M22= N21*S0ab + N22*S0bb + N23*S0bc;
-  M23= N21*S0ac + N22*S0bc + N23*S0cc;
-  M31= N31*S0aa + N32*S0ab + N33*S0ac;
-  M32= N31*S0ab + N32*S0bb + N33*S0bc;
-  M33= N31*S0ac + N32*S0bc + N33*S0cc;
-
-  DenQ1=1.0+M11-M12*M21+M22+M11*M22-M13*M31-M13*M22*M31;
-  DenQ2=  M12*M23*M31+M13*M21*M32-M23*M32-M11*M23*M32+M33+M11*M33;
-  DenQ3=  -M12*M21*M33+M22*M33+M11*M22*M33;
-  DenQ=DenQ1+DenQ2+DenQ3;
-
-  Q11= (1.0 + M22-M23*M32 + M33 + M22*M33)/DenQ;
-  Q12= (-M12 + M13*M32 - M12*M33)/DenQ;
-  Q13= (-M13 - M13*M22 + M12*M23)/DenQ;
-  Q21= (-M21 + M23*M31 - M21*M33)/DenQ;
-  Q22= (1.0 + M11 - M13*M31 + M33 + M11*M33)/DenQ;
-  Q23= (M13*M21 - M23 - M11*M23)/DenQ;
-  Q31= (-M31 - M22*M31 + M21*M32)/DenQ;
-  Q32= (M12*M31 - M32 - M11*M32)/DenQ;
-  Q33= (1.0 + M11 - M12*M21 + M22 + M11*M22)/DenQ;
-
-  S11= Q11*S0aa + Q21*S0ab + Q31*S0ac;
-  S12= Q12*S0aa + Q22*S0ab + Q32*S0ac;
-  S13= Q13*S0aa + Q23*S0ab + Q33*S0ac;
-  S14=-S11-S12-S13;
-  S21= Q11*S0ba + Q21*S0bb + Q31*S0bc;
-  S22= Q12*S0ba + Q22*S0bb + Q32*S0bc;
-  S23= Q13*S0ba + Q23*S0bb + Q33*S0bc;
-  S24=-S21-S22-S23;
-  S31= Q11*S0ca + Q21*S0cb + Q31*S0cc;
-  S32= Q12*S0ca + Q22*S0cb + Q32*S0cc;
-  S33= Q13*S0ca + Q23*S0cb + Q33*S0cc;
-  S34=-S31-S32-S33;
-  S41=S14;
-  S42=S24;
-  S43=S34;
-  S44=S11+S22+S33+2.0*S12+2.0*S13+2.0*S23;
-
-  Nav=6.022045e+23;
-  Lad=(La/va-Ld/vd)*sqrt(Nav);
-  Lbd=(Lb/vb-Ld/vd)*sqrt(Nav);
-  Lcd=(Lc/vc-Ld/vd)*sqrt(Nav);
-
-  Intg=pow(Lad,2.0)*S11+pow(Lbd,2.0)*S22+pow(Lcd,2.0)*S33+2.0*Lad*Lbd*S12+2.0*Lbd*Lcd*S23+2.0*Lad*Lcd*S13;
-
-  Intg *= scale;
-  Intg += background;
-
-  return Intg;
-
-}
-
-RPAModel :: RPAModel() {
-  lcase_n = Parameter(0.0);
-  ba = Parameter(5.0);
-  bb = Parameter(5.0);
-  bc = Parameter(5.0);
-  bd = Parameter(5.0);
-
-  Kab = Parameter(-0.0004);
-  Kac = Parameter(-0.0004);
-  Kad = Parameter(-0.0004);
-  Kbc = Parameter(-0.0004);
-  Kbd = Parameter(-0.0004);
-  Kcd = Parameter(-0.0004);
-
-  scale = Parameter(1.0);
-  background = Parameter(0.0);
-
-  Na = Parameter(1000.0);
-  Phia = Parameter(0.25);
-  va = Parameter(100.0);
-  La = Parameter(1.0e-012);
-
-  Nb = Parameter(1000.0);
-  Phib = Parameter(0.25);
-  vb = Parameter(100.0);
-  Lb = Parameter(1.0e-012);
-
-  Nc = Parameter(1000.0);
-  Phic = Parameter(0.25);
-  vc = Parameter(100.0);
-  Lc = Parameter(1.0e-012);
-
-  Nd = Parameter(1000.0);
-  Phid = Parameter(0.25);
-  vd = Parameter(100.0);
-  Ld = Parameter(0.0e-012);
-
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double RPAModel :: operator()(double q) {
-  double dp[29];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  //Fittable parameters
-  dp[0] = lcase_n();
-
-  dp[1] = ba();
-  dp[2] = bb();
-  dp[3] = bc();
-  dp[4] = bd();
-
-  dp[5] = Kab();
-  dp[6] = Kac();
-  dp[7] = Kad();
-  dp[8] = Kbc();
-  dp[9] = Kbd();
-  dp[10] = Kcd();
-
-  dp[11] = scale();
-  dp[12] = background();
-
-  //Fixed parameters
-  dp[13] = Na();
-  dp[14] = Phia();
-  dp[15] = va();
-  dp[16] = La();
-
-  dp[17] = Nb();
-  dp[18] = Phib();
-  dp[19] = vb();
-  dp[20] = Lb();
-
-  dp[21] = Nc();
-  dp[22] = Phic();
-  dp[23] = vc();
-  dp[24] = Lc();
-
-  dp[25] = Nd();
-  dp[26] = Phid();
-  dp[27] = vd();
-  dp[28] = Ld();
-
-  return rpa_kernel(dp,q);
-}
-
-/**
- * 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 RPAModel :: 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 sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double RPAModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double RPAModel :: calculate_ER() {
-  //NOT implemented!!!
-  return 0.0;
-}
-double RPAModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/sc.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sc.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,338 +1,0 @@
-/**
-	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 "sc.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-// Convenience structure
-typedef struct {
-  double scale;
-  double dnn;
-  double d_factor;
-  double radius;
-  double sldSph;
-  double sldSolv;
-  double background;
-  double theta;
-  double phi;
-  double psi;
-} SCParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystalModel
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double sc_analytical_2D_scaled(SCParameters *pars, double q, double q_x, double q_y) {
-  double a3_x, a3_y, a2_x, a2_y, a1_x, a1_y; //, a3_z
-  double q_z;
-  double cos_val_a3, cos_val_a2, cos_val_a1;
-  double a1_dot_q, a2_dot_q,a3_dot_q;
-  double answer;
-  double Pi = 4.0*atan(1.0);
-  double aa, Da, qDa_2, latticeScale, Zq;
-
-  double dp[5];
-  //convert angle degree to radian
-  double theta = pars->theta * Pi/180.0;
-  double phi = pars->phi * Pi/180.0;
-  double psi = pars->psi * Pi/180.0;
-  dp[0] = 1.0;
-  dp[1] = pars->radius;
-  dp[2] = pars->sldSph;
-  dp[3] = pars->sldSolv;
-  dp[4] = 0.0;
-
-
-  aa = pars->dnn;
-  Da = pars->d_factor*aa;
-  qDa_2 = pow(q*Da,2.0);
-
-  latticeScale = (4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa,3.0);
-  /// Angles here are respect to detector coordinate instead of against q coordinate(PRB 36, 3, 1754)
-  // a3 axis orientation
-  a3_x = cos(theta) * cos(phi);
-  a3_y = sin(theta);
-  //a3_z = -cos(theta) * sin(phi);
-  // q vector
-  q_z = 0.0;
-
-  // Compute the angle btw vector q and the a3 axis
-  cos_val_a3 = a3_x*q_x + a3_y*q_y;// + a3_z*q_z;
-
-  // a1 axis orientation
-  a1_x = -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  a1_y = sin(psi)*cos(theta);
-
-  cos_val_a1 = a1_x*q_x + a1_y*q_y;
-
-  // a2 axis orientation
-  a2_x = -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  a2_y = cos(theta)*cos(psi);
-  // a2 axis
-  cos_val_a2 =  a2_x*q_x + a2_y*q_y;
-
-  // The following test should always pass
-  if (fabs(cos_val_a3)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a3 = 1.0;
-  }
-   if (fabs(cos_val_a1)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a1 = 1.0;
-  }
-   if (fabs(cos_val_a2)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val_a3 = 1.0;
-  }
-  a3_dot_q = aa*q*cos_val_a3;
-  a1_dot_q = aa*q*cos_val_a1;//*sin(alpha);
-  a2_dot_q = aa*q*cos_val_a2;
-  
-  // Call Zq=Z1*Z2*Z3
-  Zq = (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a1_dot_q)+exp(-qDa_2));
-  Zq *= (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a2_dot_q)+exp(-qDa_2));
-  Zq *= (1.0-exp(-qDa_2))/(1.0-2.0*exp(-0.5*qDa_2)*cos(a3_dot_q)+exp(-qDa_2));
-
-  // Use SphereForm directly from libigor
-  answer = SphereForm(dp,q)*Zq;
-
-  //consider scales
-  answer *= latticeScale * pars->scale;
-
-  // This FIXES a singualrity the kernel in libigor.
-  if ( answer == INFINITY || answer == NAN){
-    answer = 0.0;
-  }
-
-  // add background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SC_ParaCrystal
- * @param q: q-value
- * @return: function value
- */
-static double sc_analytical_2DXY(SCParameters *pars, double qx, double qy){
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return sc_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-SCCrystalModel :: SCCrystalModel() {
-  scale      = Parameter(1.0);
-  dnn		= Parameter(220.0);
-  d_factor = Parameter(0.06);
-  radius     = Parameter(40.0, true);
-  radius.set_min(0.0);
-  sldSph   = Parameter(3.0e-6);
-  sldSolv   = Parameter(6.3e-6);
-  background = Parameter(0.0);
-  theta  = Parameter(0.0, true);
-  phi    = Parameter(0.0, true);
-  psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SCCrystalModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = dnn();
-  dp[2] = d_factor();
-  dp[3] = radius();
-  dp[4] = sldSph();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-  double result;
-
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp[3] = weights_rad[i].value;
-
-    //Un-normalize SphereForm by volume
-    result = SC_ParaCrystal(dp, q) * pow(weights_rad[i].value,3);
-    // This FIXES a singualrity the kernel in libigor.
-    if ( result == INFINITY || result == NAN){
-      result = 0.0;
-    }
-    sum += weights_rad[i].weight
-        * result;
-    //Find average volume
-    vol += weights_rad[i].weight
-        * pow(weights_rad[i].value,3);
-
-    norm += weights_rad[i].weight;
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 SCCrystalModel :: operator()(double qx, double qy) {
-  SCParameters dp;
-  dp.scale      = scale();
-  dp.dnn   = dnn();
-  dp.d_factor   = d_factor();
-  dp.radius  = radius();
-  dp.sldSph   = sldSph();
-  dp.sldSolv   = sldSolv();
-  dp.background = 0.0;
-  dp.theta  = theta();
-  dp.phi    = phi();
-  dp.psi    = psi();
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad;
-  radius.get_weights(weights_rad);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  phi.get_weights(weights_phi);
-
-  // Get angular averaging for psi
-  vector<WeightPoint> weights_psi;
-  psi.get_weights(weights_psi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad.size(); i++) {
-    dp.radius = weights_rad[i].value;
-    // Average over theta distribution
-    for(size_t j=0; j< weights_theta.size(); j++) {
-      dp.theta = weights_theta[j].value;
-      // Average over phi distribution
-      for(size_t k=0; k< weights_phi.size(); k++) {
-        dp.phi = weights_phi[k].value;
-        // Average over phi distribution
-        for(size_t l=0; l< weights_psi.size(); l++) {
-          dp.psi = weights_psi[l].value;
-          //Un-normalize SphereForm by volume
-          double _ptvalue = weights_rad[i].weight
-              * weights_theta[j].weight
-              * weights_phi[k].weight
-              * weights_psi[l].weight
-              * sc_analytical_2DXY(&dp, qx, qy);
-          //* pow(weights_rad[i].value,3.0);
-          // Consider when there is infinte or nan.
-          if ( _ptvalue == INFINITY || _ptvalue == NAN){
-            _ptvalue = 0.0;
-          }
-          if (weights_theta.size()>1) {
-            _ptvalue *= fabs(cos(weights_theta[j].value*pi/180.0));
-          }
-          sum += _ptvalue;
-          // This model dose not need the volume of spheres correction!!!
-          //Find average volume
-          //vol += weights_rad[i].weight
-          //	* pow(weights_rad[i].value,3);
-          //Find norm for volume
-          //norm_vol += weights_rad[i].weight;
-
-          norm += weights_rad[i].weight
-              * weights_theta[j].weight
-              * weights_phi[k].weight
-              * weights_psi[l].weight;
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the SCCrystal
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SCCrystalModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SCCrystalModel :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double SCCrystalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/schulz.cpp
===================================================================
--- src/sas/models/c_extension/c_models/schulz.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,95 +1,0 @@
-/**
-	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
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "schulz.h"
-
-#if defined(_MSC_VER)
-#include "gamma_win.h"
-#endif
-
-Schulz :: Schulz() {
-  scale  = Parameter(1.0, true);
-  sigma  = Parameter(1.0, true);
-  center = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D Schulz function.
- * The function is normalized to the 'scale' parameter.
- *
- * f(x)=scale * math.pow(z+1, z+1)*math.pow((R), z)*
- *          math.exp(-R*(z+1))/(center*gamma(z+1)
- *    z= math.pow[(1/(sigma/center),2]-1
- *    R= x/center
- *
- * @param q: q-value
- * @return: function value
- */
-double Schulz :: operator()(double q) {
-  double z = pow(center()/ sigma(), 2)-1;
-  double R= q/center();
-  double zz= z+1;
-  double expo;
-  expo = log(scale())+zz*log(zz)+z*log(R)-R*zz-log(center())-lgamma(zz);
-
-  return exp(expo);//scale * pow(zz,zz) * pow(R,z) * exp(-1*R*zz)/((center) * tgamma(zz)) ;
-}
-
-/**
- * Function to evaluate 2D schulz function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Schulz(x) * Schulz(y)
- *
- * where both Shulzs share the same parameters.
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double Schulz :: operator()(double qx, double qy) {
-  return (*this).operator()(qx) * (*this).operator()(qy);
-}
-
-/**
- * Function to evaluate 2D schulz function
- * The function is normalized to the 'scale' parameter.
- *
- * f(x,y) = Schulz(x) * Schulz(y)
- *
- * where both Shulzs share the same parameters.
- * @param pars: parameters of the cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double Schulz :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double Schulz :: calculate_ER() {
-  //NOT implemented yet!!!
-  return 0.0;
-}
-double Schulz :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/sld_cal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sld_cal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/**
- * Scattering model classes
- * The classes use the IGOR library found in
- *   sansmodels/c_extensions/libmultifunc/librefl.h
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "sld_cal.h"
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-// Convenience structure
-typedef struct {
-    double fun_type;
-    double npts_inter;
-    double shell_num;
-    double nu_inter;
-    double sld_left;
-    double sld_right;
-} SLDCalParameters;
-
-/**
- * Function to calculate sld
- * @param pars: parameters
- * @param x: independent param-value
- * @return: sld value
- */
-static double sld_cal_analytical_1D(SLDCalParameters *pars, double x) {
-  double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out;
-  int fun_type;
-
-  fun = pars->fun_type;
-  nsl = pars->npts_inter;
-  n_s = pars->shell_num;
-  fun_coef = pars->nu_inter;
-  sld_l = pars-> sld_left;
-  sld_r = pars-> sld_right;
-
-  fun_type = floor(fun);
-
-  sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r);
-
-  return sld_out;
-}
-
-SLDCalFunc :: SLDCalFunc() {
-	fun_type     = Parameter(0);
-	npts_inter   = Parameter(21);
-	shell_num	 = Parameter(1);
-	nu_inter	 = Parameter(2.5);
-	sld_left 	 = Parameter(1.0e-06);
-	sld_right	 = Parameter(2.0e-06);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * @param q: q-value
- * @return: function value
- */
-double SLDCalFunc :: operator()(double q) {
-	SLDCalParameters dp;
-
-	dp.fun_type = fun_type();
-	dp.npts_inter = npts_inter();
-	dp.shell_num = shell_num();
-	dp.nu_inter = nu_inter();
-	dp.sld_left = sld_left();
-	dp.sld_right = sld_right();
-
-	return sld_cal_analytical_1D(&dp, q);
-}
-
-/**
- * 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 SLDCalFunc :: 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 cylinder
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SLDCalFunc :: evaluate_rphi(double q, double phi) {
-	return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SLDCalFunc :: calculate_ER() {
-//NOT implemented yet!!!
-	return 0.0;
-}
-double SLDCalFunc :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/sphere.cpp
===================================================================
--- src/sas/models/c_extension/c_models/sphere.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,308 +1,0 @@
-/**
-	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 "sphere.h"
-
-extern "C" {
-	#include "libSphere.h"
-	#include "libmultifunc/libfunc.h"
-}
-// Convenience parameter structure
-typedef struct {
-    double scale;
-    double radius;
-    double sldSph;
-    double sldSolv;
-    double background;
-    double M0_sld_sph;
-    double M_theta_sph;
-    double M_phi_sph;
-    double M0_sld_solv;
-    double M_theta_solv;
-    double M_phi_solv;
-    double Up_frac_i;
-	double Up_frac_f;
-	double Up_theta;
-} SphereParameters;
-
-SphereModel :: SphereModel() {
-	scale      = Parameter(1.0);
-	radius     = Parameter(20.0, true);
-	radius.set_min(0.0);
-	sldSph   = Parameter(4.0e-6);
-	sldSolv   = Parameter(1.0e-6);
-	background = Parameter(0.0);
-	M0_sld_sph = Parameter(0.0e-6);
-	M_theta_sph = Parameter(0.0);
-	M_phi_sph = Parameter(0.0); 
-	M0_sld_solv = Parameter(0.0e-6);
-	M_theta_solv = Parameter(0.0);
-	M_phi_solv = Parameter(0.0); 
-	Up_frac_i = Parameter(0.5); 
-	Up_frac_f = Parameter(0.5);
-	Up_theta = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double SphereModel :: operator()(double q) {
-	double dp[5];
-
-	// Fill parameter array for IGOR library
-	// Add the background after averaging
-	dp[0] = scale();
-	dp[1] = radius();
-	dp[2] = sldSph();
-	dp[3] = sldSolv();
-	dp[4] = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp[1] = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* SphereForm(dp, q) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-
-static double sphere_analytical_2D_scaled(SphereParameters *pars, double q, double q_x, double q_y) {
-	double dp[5];
-	//convert angle degree to radian
-	dp[0] = 1.0;
-	dp[1] = pars->radius;
-	dp[2] = 0.0;
-	dp[3] = 0.0;
-	dp[4] = 0.0;
-
-    double sldSph = pars->sldSph;
-    double sldSolv = pars->sldSolv;
-	double answer = 0.0;
-	double m_max = pars->M0_sld_sph;
-	double m_max_solv = pars->M0_sld_solv;
-
-	if (m_max < 1.0e-32 && m_max_solv < 1.0e-32){
-		dp[2] = sldSph;
-		dp[3] = sldSolv;
-		answer = SphereForm(dp, q);
-	}
-	else{
-		//double contrast = sldSph - sldSolv;
-		double qx = q_x;
-		double qy = q_y;
-		double s_theta = pars->Up_theta;
-		double m_phi = pars->M_phi_sph;
-		double m_theta = pars->M_theta_sph;
-		double m_phi_solv = pars->M_phi_solv;
-		double m_theta_solv = pars->M_theta_solv;
-		double in_spin = pars->Up_frac_i;
-		double out_spin = pars->Up_frac_f;
-		polar_sld p_sld;
-		polar_sld p_sld_solv;
-		p_sld = cal_msld(1, qx, qy, sldSph, m_max, m_theta, m_phi, 
-			 				in_spin, out_spin, s_theta);
-		p_sld_solv = cal_msld(1, qx, qy, sldSolv, m_max_solv, m_theta_solv, m_phi_solv, 
-								in_spin, out_spin, s_theta);
-		//up_up	
-		if (in_spin > 0.0 && out_spin > 0.0){			 
-			dp[2] = p_sld.uu;
-			dp[3] = p_sld_solv.uu;
-			answer += SphereForm(dp, q);
-			}
-		//down_down
-		if (in_spin < 1.0 && out_spin < 1.0){
-			dp[2] = p_sld.dd;
-			dp[3] = p_sld_solv.dd;
-			answer += SphereForm(dp, q);
-			}
-		//up_down
-		if (in_spin > 0.0 && out_spin < 1.0){
-			dp[2] = p_sld.re_ud;
-			dp[3] = p_sld_solv.re_ud;
-			answer += SphereForm(dp, q);	
-			dp[2] = p_sld.im_ud;
-			dp[3] = p_sld_solv.im_ud;
-			answer += SphereForm(dp, q);
-			}
-		//down_up	
-		if (in_spin < 1.0 && out_spin > 0.0){
-			dp[2] = p_sld.re_du;
-			dp[3] = p_sld_solv.re_du;
-			answer += SphereForm(dp, q);	
-			dp[2] = p_sld.im_du;
-			dp[3] = p_sld_solv.im_du;
-			answer += SphereForm(dp, q);
-			}
-	}
-	
-	// add in the background
-	answer *= pars->scale;
-	answer += pars->background;
-	return answer;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters
- * @param q: q-value
- * @return: function value
- */
-static double sphere_analytical_2DXY(SphereParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return sphere_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-/**
- * 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 SphereModel :: operator()(double qx, double qy) {
-	SphereParameters dp;
-	dp.scale = scale();
-	dp.radius = radius();
-	dp.sldSph = sldSph();
-	dp.sldSolv = sldSolv();
-	dp.background = 0.0;
-	dp.Up_theta =  Up_theta();
-	dp.M_phi_sph =  M_phi_sph();
-	dp.M_theta_sph =  M_theta_sph();
-	dp.M0_sld_sph =  M0_sld_sph();
-	dp.M_phi_solv =  M_phi_solv();
-	dp.M_theta_solv =  M_theta_solv();
-	dp.M0_sld_solv =  M0_sld_solv();
-	dp.Up_frac_i =  Up_frac_i();
-	dp.Up_frac_f =  Up_frac_f();
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-	double vol = 0.0;
-
-	// Loop over radius weight points
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		dp.radius = weights_rad[i].value;
-
-		//Un-normalize SphereForm by volume
-		sum += weights_rad[i].weight
-			* sphere_analytical_2DXY(&dp, qx, qy) * pow(weights_rad[i].value,3);
-		//Find average volume
-		vol += weights_rad[i].weight
-			* pow(weights_rad[i].value,3);
-
-		norm += weights_rad[i].weight;
-	}
-
-	if (vol != 0.0 && norm != 0.0) {
-		//Re-normalize by avg volume
-		sum = sum/(vol/norm);}
-	return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the sphere
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SphereModel :: evaluate_rphi(double q, double phi) {
-	double qx = q*cos(phi);
-	double qy = q*sin(phi);
-	return (*this).operator()(qx, qy);
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double SphereModel :: calculate_ER() {
-	double rad_out = 0.0;
-
-	// Perform the computation, with all weight points
-	double sum = 0.0;
-	double norm = 0.0;
-
-	// Get the dispersion points for the radius
-	vector<WeightPoint> weights_rad;
-	radius.get_weights(weights_rad);
-	// Loop over radius weight points to average the radius value
-	for(size_t i=0; i<weights_rad.size(); i++) {
-		sum += weights_rad[i].weight
-			* weights_rad[i].value;
-		norm += weights_rad[i].weight;
-	}
-	if (norm != 0){
-		//return the averaged value
-		rad_out =  sum/norm;}
-	else{
-		//return normal value
-		rad_out = radius();}
-
-	return rad_out;
-}
-double SphereModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/spheresld.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheresld.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,634 +1,0 @@
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-
-extern "C" {
-#include "libmultifunc/librefl.h"
-}
-
-#include "spheresld.h"
-
-using namespace std;
-
-// Convenience structure
-typedef struct {
-  /// number of shells
-  //  [DEFAULT]=n_shells=1
-  int n_shells;
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  double scale;
-  /// thick_inter0 [A]
-  //  [DEFAULT]=thick_inter0=50.0 [A]
-  double thick_inter0;
-  /// func_inter0
-  //  [DEFAULT]=func_inter0= 0
-  double func_inter0;
-  /// sld_core0 [1/A^(2)]
-  //  [DEFAULT]=sld_core0= 2.07e-6 [1/A^(2)]
-  double sld_core0;
-  /// sld_solv [1/A^(2)]
-  //  [DEFAULT]=sld_solv= 1.0e-6 [1/A^(2)]
-  double sld_solv;
-  /// Background
-  //  [DEFAULT]=background=0
-  double background;
-
-  //  [DEFAULT]=sld_flat1=4.0e-06 [1/A^(2)]
-  double sld_flat1;
-  //  [DEFAULT]=sld_flat2=3.5e-06 [1/A^(2)]
-  double sld_flat2;
-  //  [DEFAULT]=sld_flat3=4.0e-06 [1/A^(2)]
-  double sld_flat3;
-  //  [DEFAULT]=sld_flat4=3.5e-06 [1/A^(2)]
-  double sld_flat4;
-  //  [DEFAULT]=sld_flat5=4.0e-06 [1/A^(2)]
-  double sld_flat5;
-  //  [DEFAULT]=sld_flat6=3.5e-06 [1/A^(2)]
-  double sld_flat6;
-  //  [DEFAULT]=sld_flat7=4.0e-06 [1/A^(2)]
-  double sld_flat7;
-  //  [DEFAULT]=sld_flat8=3.5e-06 [1/A^(2)]
-  double sld_flat8;
-  //  [DEFAULT]=sld_flat9=4.0e-06 [1/A^(2)]
-  double sld_flat9;
-  //  [DEFAULT]=sld_flat10=3.5e-06 [1/A^(2)]
-  double sld_flat10;
-
-  //  [DEFAULT]=thick_inter1=50.0 [A]
-  double thick_inter1;
-  //  [DEFAULT]=thick_inter2=50.0 [A]
-  double thick_inter2;
-  //  [DEFAULT]=thick_inter3=50.0 [A]
-  double thick_inter3;
-  //  [DEFAULT]=thick_inter4=50.0 [A]
-  double thick_inter4;
-  //  [DEFAULT]=thick_inter5=50.0 [A]
-  double thick_inter5;
-  //  [DEFAULT]=thick_inter6=50.0 [A]
-  double thick_inter6;
-  //  [DEFAULT]=thick_inter7=50.0 [A]
-  double thick_inter7;
-  //  [DEFAULT]=thick_inter8=50.0 [A]
-  double thick_inter8;
-  //  [DEFAULT]=thick_inter9=50.0 [A]
-  double thick_inter9;
-  //  [DEFAULT]=thick_inter10=50.0 [A]
-  double thick_inter10;
-
-  //  [DEFAULT]=thick_flat1=100 [A]
-  double thick_flat1;
-  //  [DEFAULT]=thick_flat2=100 [A]
-  double thick_flat2;
-  //  [DEFAULT]=thick_flat3=100 [A]
-  double thick_flat3;
-  //  [DEFAULT]=thick_flat4=100 [A]
-  double thick_flat4;
-  //  [DEFAULT]=thick_flat5=100 [A]
-  double thick_flat5;
-  //  [DEFAULT]=thick_flat6=100 [A]
-  double thick_flat6;
-  //  [DEFAULT]=thick_flat7=100 [A]
-  double thick_flat7;
-  //  [DEFAULT]=thick_flat8=100 [A]
-  double thick_flat8;
-  //  [DEFAULT]=thick_flat9=100 [A]
-  double thick_flat9;
-  //  [DEFAULT]=thick_flat10=100 [A]
-  double thick_flat10;
-
-  //  [DEFAULT]=func_inter1=0
-  double func_inter1;
-  //  [DEFAULT]=func_inter2=0
-  double func_inter2;
-  //  [DEFAULT]=func_inter3=0
-  double func_inter3;
-  //  [DEFAULT]=func_inter4=0
-  double func_inter4;
-  //  [DEFAULT]=func_inter5=0
-  double func_inter5;
-  //  [DEFAULT]=func_inter6=0
-  double func_inter6;
-  //  [DEFAULT]=func_inter7=0
-  double func_inter7;
-  //  [DEFAULT]=func_inter8=0
-  double func_inter8;
-  //  [DEFAULT]=func_inter9=0
-  double func_inter9;
-  //  [DEFAULT]=func_inter10=0
-  double func_inter10;
-
-  //  [DEFAULT]=nu_inter1=2.5
-  double nu_inter1;
-  //  [DEFAULT]=nu_inter2=2.5
-  double nu_inter2;
-  //  [DEFAULT]=nu_inter3=2.5
-  double nu_inter3;
-  //  [DEFAULT]=nu_inter4=2.5
-  double nu_inter4;
-  //  [DEFAULT]=nu_inter5=2.5
-  double nu_inter5;
-  //  [DEFAULT]=nu_inter6=2.5
-  double nu_inter6;
-  //  [DEFAULT]=nu_inter7=2.5
-  double nu_inter7;
-  //  [DEFAULT]=nu_inter8=2.5
-  double nu_inter8;
-  //  [DEFAULT]=nu_inter9=2.5
-  double nu_inter9;
-  //  [DEFAULT]=nu_inter10=2.5
-  double nu_inter10;
-
-  //  [DEFAULT]=npts_inter=35.0
-  double npts_inter;
-  //  [DEFAULT]=nu_inter0=2.5
-  double nu_inter0;
-  //  [DEFAULT]=rad_core0=50.0 [A]
-  double rad_core0;
-} SphereSLDParameters;
-
-
-static double sphere_sld_kernel(double dp[], double q) {
-  int n = dp[0];
-  int i,j,k;
-
-  double scale = dp[1];
-  double thick_inter_core = dp[2];
-  double sld_core = dp[4];
-  double sld_solv = dp[5];
-  double background = dp[6];
-  double npts = dp[57]; //number of sub_layers in each interface
-  double nsl=npts;//21.0; //nsl = Num_sub_layer:  MUST ODD number in double //no other number works now
-  int n_s;
-
-  double sld_i,sld_f,dz,bes,fun,f,vol,vol_pre,vol_sub,qr,r,contr,f2;
-  double sign,slope=0.0;
-  double pi;
-
-  int* fun_type;
-  double* sld;
-  double* thick_inter;
-  double* thick;
-  double* fun_coef;
-
-  double total_thick=0.0;
-
-  fun_type = (int*)malloc((n+2)*sizeof(int));
-  sld = (double*)malloc((n+2)*sizeof(double));
-  thick_inter = (double*)malloc((n+2)*sizeof(double));
-  thick = (double*)malloc((n+2)*sizeof(double));
-  fun_coef = (double*)malloc((n+2)*sizeof(double));
-
-  fun_type[0] = dp[3];
-  fun_coef[0] = fabs(dp[58]);
-  for (i =1; i<=n; i++){
-    sld[i] = dp[i+6];
-    thick_inter[i]= dp[i+16];
-    thick[i] = dp[i+26];
-    fun_type[i] = dp[i+36];
-    fun_coef[i] = fabs(dp[i+46]);
-    total_thick += thick[i] + thick_inter[i];
-  }
-  sld[0] = sld_core;
-  sld[n+1] = sld_solv;
-  thick[0] = dp[59];
-  thick[n+1] = total_thick/5.0;
-  thick_inter[0] = thick_inter_core;
-  thick_inter[n+1] = 0.0;
-  fun_coef[n+1] = 0.0;
-
-  pi = 4.0*atan(1.0);
-  f = 0.0;
-  r = 0.0;
-  vol = 0.0;
-  vol_pre = 0.0;
-  vol_sub = 0.0;
-  sld_f = sld_core;
-
-  //floor_nsl = floor(nsl/2.0);
-
-  dz = 0.0;
-  // iteration for # of shells + core + solvent
-  for (i=0;i<=n+1; i++){
-    //iteration for N sub-layers
-    //if (fabs(thick[i]) <= 1e-24){
-    //   continue;
-    //}
-    // iteration for flat and interface
-    for (j=0;j<2;j++){
-      // iteration for sub_shells in the interface
-      // starts from #1 sub-layer
-      for (n_s=1;n_s<=nsl; n_s++){
-        // for solvent, it doesn't have an interface
-        if (i==n+1 && j==1)
-          break;
-        // for flat layers
-        if (j==0){
-          dz = thick[i];
-          sld_i = sld[i];
-          slope = 0.0;
-        }
-        // for interfacial sub_shells
-        else{
-          dz = thick_inter[i]/nsl;
-          // find sld_i at the outer boundary of sub-layer #n_s
-          sld_i = intersldfunc(fun_type[i],nsl, n_s, fun_coef[i], sld[i], sld[i+1]);
-          // calculate slope
-          slope= (sld_i -sld_f)/dz;
-        }
-        contr = sld_f-slope*r;
-        // iteration for the left and right boundary of the shells(or sub_shells)
-        for (k=0; k<2; k++){
-          // At r=0, the contribution to I is zero, so skip it.
-          if ( i == 0 && j == 0 && k == 0){
-            continue;
-          }
-          // On the top of slovent there is no interface; skip it.
-          if (i == n+1 && k == 1){
-            continue;
-          }
-          // At the right side (outer) boundary
-          if ( k == 1){
-            sign = 1.0;
-            r += dz;
-          }
-          // At the left side (inner) boundary
-          else{
-            sign = -1.0;
-          }
-          qr = q * r;
-          fun = 0.0;
-          if(qr == 0.0){
-            // sigular point
-            bes = sign * 1.0;
-          }
-          else{
-            // for flat sub-layer
-            bes = sign *  3.0 * (sin(qr) - qr * cos(qr)) / (qr * qr * qr);
-            // with linear slope
-            if (fabs(slope) > 0.0 ){
-              fun = sign * 3.0 * r * (2.0*qr*sin(qr)-((qr*qr)-2.0)*cos(qr))/(qr * qr * qr * qr);
-            }
-          }
-          // update total volume
-          vol = 4.0 * pi / 3.0 * r * r * r;
-          // we won't do the following volume correction for now.
-          // substrate empty area of volume
-          //if (k == 1 && fabs(sld_in[i]-sld_solv) < 1e-04*fabs(sld_solv) && fun_type[i]==0){
-          //  vol_sub += (vol_pre - vol);
-          //}
-          f += vol * (bes * contr + fun * slope);
-        }
-        // remember this sld as sld_f
-        sld_f =sld_i;
-        // no sub-layer iteration (n_s loop) for the flat layer
-        if (j==0)
-          break;
-      }
-    }
-  }
-  //vol += vol_sub;
-  f2 = f * f / vol * 1.0e8;
-  f2 *= scale;
-  f2 += background;
-
-  free(fun_type);
-  free(sld);
-  free(thick_inter);
-  free(thick);
-  free(fun_coef);
-
-  return (f2);
-}
-
-
-SphereSLDModel :: SphereSLDModel() {
-  n_shells = Parameter(1.0);
-  scale = Parameter(1.0);
-  thick_inter0 = Parameter(1.0, true);
-  thick_inter0.set_min(0.0);
-  func_inter0 = Parameter(0);
-  sld_core0 = Parameter(2.07e-06);
-  sld_solv = Parameter(1.0e-06);
-  background = Parameter(0.0);
-
-
-  sld_flat1 = Parameter(2.7e-06);
-  sld_flat2 = Parameter(3.5e-06);
-  sld_flat3 = Parameter(4.0e-06);
-  sld_flat4 = Parameter(3.5e-06);
-  sld_flat5 = Parameter(4.0e-06);
-  sld_flat6 = Parameter(3.5e-06);
-  sld_flat7 = Parameter(4.0e-06);
-  sld_flat8 = Parameter(3.5e-06);
-  sld_flat9 = Parameter(4.0e-06);
-  sld_flat10 = Parameter(3.5e-06);
-
-
-  thick_inter1 = Parameter(1.0);
-  thick_inter2 = Parameter(1.0);
-  thick_inter3 = Parameter(1.0);
-  thick_inter4 = Parameter(1.0);
-  thick_inter5 = Parameter(1.0);
-  thick_inter6 = Parameter(1.0);
-  thick_inter7 = Parameter(1.0);
-  thick_inter8 = Parameter(1.0);
-  thick_inter9 = Parameter(1.0);
-  thick_inter10 = Parameter(1.0);
-
-
-  thick_flat1 = Parameter(100.0);
-  thick_flat2 = Parameter(100.0);
-  thick_flat3 = Parameter(100.0);
-  thick_flat4 = Parameter(100.0);
-  thick_flat5 = Parameter(100.0);
-  thick_flat6 = Parameter(100.0);
-  thick_flat7 = Parameter(100.0);
-  thick_flat8 = Parameter(100.0);
-  thick_flat9 = Parameter(100.0);
-  thick_flat10 = Parameter(100.0);
-
-
-  func_inter1 = Parameter(0);
-  func_inter2 = Parameter(0);
-  func_inter3 = Parameter(0);
-  func_inter4 = Parameter(0);
-  func_inter5 = Parameter(0);
-  func_inter6 = Parameter(0);
-  func_inter7 = Parameter(0);
-  func_inter8 = Parameter(0);
-  func_inter9 = Parameter(0);
-  func_inter10 = Parameter(0);
-
-  nu_inter1 = Parameter(2.5);
-  nu_inter2 = Parameter(2.5);
-  nu_inter3 = Parameter(2.5);
-  nu_inter4 = Parameter(2.5);
-  nu_inter5 = Parameter(2.5);
-  nu_inter6 = Parameter(2.5);
-  nu_inter7 = Parameter(2.5);
-  nu_inter8 = Parameter(2.5);
-  nu_inter9 = Parameter(2.5);
-  nu_inter10 = Parameter(2.5);
-
-  npts_inter = Parameter(35.0);
-  nu_inter0 = Parameter(2.5);
-  rad_core0 = Parameter(60.0, true);
-  rad_core0.set_min(0.0);
-}
-
-/**
- * Function to evaluate 1D SphereSLD function
- * @param q: q-value
- * @return: function value
- */
-double SphereSLDModel :: operator()(double q) {
-  double dp[60];
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = n_shells();
-  dp[1] = scale();
-  dp[2] = thick_inter0();
-  dp[3] = func_inter0();
-  dp[4] = sld_core0();
-  dp[5] = sld_solv();
-  dp[6] = 0.0;
-
-  dp[7] = sld_flat1();
-  dp[8] = sld_flat2();
-  dp[9] = sld_flat3();
-  dp[10] = sld_flat4();
-  dp[11] = sld_flat5();
-  dp[12] = sld_flat6();
-  dp[13] = sld_flat7();
-  dp[14] = sld_flat8();
-  dp[15] = sld_flat9();
-  dp[16] = sld_flat10();
-
-  dp[17] = thick_inter1();
-  dp[18] = thick_inter2();
-  dp[19] = thick_inter3();
-  dp[20] = thick_inter4();
-  dp[21] = thick_inter5();
-  dp[22] = thick_inter6();
-  dp[23] = thick_inter7();
-  dp[24] = thick_inter8();
-  dp[25] = thick_inter9();
-  dp[26] = thick_inter10();
-
-  dp[27] = thick_flat1();
-  dp[28] = thick_flat2();
-  dp[29] = thick_flat3();
-  dp[30] = thick_flat4();
-  dp[31] = thick_flat5();
-  dp[32] = thick_flat6();
-  dp[33] = thick_flat7();
-  dp[34] = thick_flat8();
-  dp[35] = thick_flat9();
-  dp[36] = thick_flat10();
-
-  dp[37] = func_inter1();
-  dp[38] = func_inter2();
-  dp[39] = func_inter3();
-  dp[40] = func_inter4();
-  dp[41] = func_inter5();
-  dp[42] = func_inter6();
-  dp[43] = func_inter7();
-  dp[44] = func_inter8();
-  dp[45] = func_inter9();
-  dp[46] = func_inter10();
-
-  dp[47] = nu_inter1();
-  dp[48] = nu_inter2();
-  dp[49] = nu_inter3();
-  dp[50] = nu_inter4();
-  dp[51] = nu_inter5();
-  dp[52] = nu_inter6();
-  dp[53] = nu_inter7();
-  dp[54] = nu_inter8();
-  dp[55] = nu_inter9();
-  dp[56] = nu_inter10();
-
-
-  dp[57] = npts_inter();
-  dp[58] = nu_inter0();
-  dp[59] = rad_core0();
-
-  // No polydispersion supported in this model.
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad_core0;
-  rad_core0.get_weights(weights_rad_core0);
-  vector<WeightPoint> weights_thick_inter0;
-  thick_inter0.get_weights(weights_thick_inter0);
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over core weight points
-  for(size_t i=0; i<weights_rad_core0.size(); i++) {
-    dp[59] = weights_rad_core0[i].value;
-    // Loop over thick_inter0 weight points
-    for(size_t j=0; j<weights_thick_inter0.size(); j++) {
-      dp[2] = weights_thick_inter0[j].value;
-
-      //Un-normalize Sphere by volume
-      sum += weights_rad_core0[i].weight * weights_thick_inter0[j].weight
-          * sphere_sld_kernel(dp,q) * pow((weights_rad_core0[i].value +
-              weights_thick_inter0[j].value),3.0);
-      //Find average volume
-      vol += weights_rad_core0[i].weight * weights_thick_inter0[j].weight
-          * pow((weights_rad_core0[i].value+weights_thick_inter0[j].value),3.0);
-
-      norm += weights_rad_core0[i].weight * weights_thick_inter0[j].weight;
-    }
-  }
-
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D SphereSLD function
- * @param q_x: value of Q along x
- * @param q_y: value of Q along y
- * @return: function value
- */
-double SphereSLDModel :: operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return (*this).operator()(q);
-}
-
-/**
- * Function to evaluate SphereSLD function
- * @param pars: parameters of the SphereSLD
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double SphereSLDModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-
-/**
- * Function to calculate TOTAL radius
- * ToDo: Find What is the effective radius for this model.
- * @return: effective radius value
- */
-// No polydispersion supported in this model.
-// Calculate max radius assumming max_radius = effective radius
-// Note that this max radius is not affected by sld of layer, sld of interface, or
-// sld of solvent.
-double SphereSLDModel :: calculate_ER() {
-  SphereSLDParameters dp;
-
-  dp.n_shells = n_shells();
-
-  dp.rad_core0 = rad_core0();
-  dp.thick_flat1 = thick_flat1();
-  dp.thick_flat2 = thick_flat2();
-  dp.thick_flat3 = thick_flat3();
-  dp.thick_flat4 = thick_flat4();
-  dp.thick_flat5 = thick_flat5();
-  dp.thick_flat6 = thick_flat6();
-  dp.thick_flat7 = thick_flat7();
-  dp.thick_flat8 = thick_flat8();
-  dp.thick_flat9 = thick_flat9();
-  dp.thick_flat10 = thick_flat10();
-
-  dp.thick_inter0 = thick_inter0();
-  dp.thick_inter1 = thick_inter1();
-  dp.thick_inter2 = thick_inter2();
-  dp.thick_inter3 = thick_inter3();
-  dp.thick_inter4 = thick_inter4();
-  dp.thick_inter5 = thick_inter5();
-  dp.thick_inter6 = thick_inter6();
-  dp.thick_inter7 = thick_inter7();
-  dp.thick_inter8 = thick_inter8();
-  dp.thick_inter9 = thick_inter9();
-  dp.thick_inter10 = thick_inter10();
-
-  double rad_out = 0.0;
-  double out = 0.0;
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_rad_core0;
-  rad_core0.get_weights(weights_rad_core0);
-
-  // Get the dispersion points for the thick 1
-  vector<WeightPoint> weights_thick_inter0;
-  thick_inter0.get_weights(weights_thick_inter0);
-  // Loop over radius weight points
-  for(size_t i=0; i<weights_rad_core0.size(); i++) {
-    dp.rad_core0 = weights_rad_core0[i].value;
-    // Loop over radius weight points
-    for(size_t j=0; j<weights_thick_inter0.size(); j++) {
-      dp.thick_inter0 = weights_thick_inter0[j].value;
-      rad_out = dp.rad_core0 + dp.thick_inter0;
-      if (dp.n_shells > 0)
-        rad_out += dp.thick_flat1 + dp.thick_inter1;
-      if (dp.n_shells > 1)
-        rad_out += dp.thick_flat2 + dp.thick_inter2;
-      if (dp.n_shells > 2)
-        rad_out += dp.thick_flat3 + dp.thick_inter3;
-      if (dp.n_shells > 3)
-        rad_out += dp.thick_flat4 + dp.thick_inter4;
-      if (dp.n_shells > 4)
-        rad_out += dp.thick_flat5 + dp.thick_inter5;
-      if (dp.n_shells > 5)
-        rad_out += dp.thick_flat6 + dp.thick_inter6;
-      if (dp.n_shells > 6)
-        rad_out += dp.thick_flat7 + dp.thick_inter7;
-      if (dp.n_shells > 7)
-        rad_out += dp.thick_flat8 + dp.thick_inter8;
-      if (dp.n_shells > 8)
-        rad_out += dp.thick_flat9 + dp.thick_inter9;
-      if (dp.n_shells > 9)
-        rad_out += dp.thick_flat10 + dp.thick_inter10;
-      sum += weights_rad_core0[i].weight*weights_thick_inter0[j].weight
-          * (rad_out);
-      norm += weights_rad_core0[i].weight*weights_thick_inter0[j].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    out =  sum/norm;}
-  else{
-    //return normal value
-    out = dp.rad_core0 + dp.thick_inter0;
-    if (dp.n_shells > 0)
-      out += dp.thick_flat1 + dp.thick_inter1;
-    if (dp.n_shells > 1)
-      out += dp.thick_flat2 + dp.thick_inter2;
-    if (dp.n_shells > 2)
-      out += dp.thick_flat3 + dp.thick_inter3;
-    if (dp.n_shells > 3)
-      out += dp.thick_flat4 + dp.thick_inter4;
-    if (dp.n_shells > 4)
-      out += dp.thick_flat5 + dp.thick_inter5;
-    if (dp.n_shells > 5)
-      out += dp.thick_flat6 + dp.thick_inter6;
-    if (dp.n_shells > 6)
-      out += dp.thick_flat7 + dp.thick_inter7;
-    if (dp.n_shells > 7)
-      out += dp.thick_flat8 + dp.thick_inter8;
-    if (dp.n_shells > 8)
-      out += dp.thick_flat9 + dp.thick_inter9;
-    if (dp.n_shells > 9)
-      out += dp.thick_flat10 + dp.thick_inter10;
-  }
-
-  return out;
-
-}
-double SphereSLDModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/spheroid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheroid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,417 +1,0 @@
-/**
-	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>
-#include <stdlib.h>
-using namespace std;
-#include "spheroid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double equat_core;
-  double polar_core;
-  double equat_shell;
-  double polar_shell;
-  double sld_core;
-  double sld_shell;
-  double sld_solvent;
-  double background;
-  double axis_theta;
-  double axis_phi;
-
-} SpheroidParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double spheroid_analytical_2D_scaled(SpheroidParameters *pars, double q, double q_x, double q_y) {
-
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double answer;
-  double Pi = 4.0*atan(1.0);
-  double sldcs,sldss;
-
-  //convert angle degree to radian
-  double theta = pars->axis_theta * Pi/180.0;
-  double phi = pars->axis_phi * Pi/180.0;
-
-
-  // ellipsoid orientation, the axis of the rotation is consistent with the ploar axis.
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-  //del sld
-  sldcs = pars->sld_core - pars->sld_shell;
-  sldss = pars->sld_shell- pars->sld_solvent;
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-    return 0;
-  }
-
-  // Note: cos(alpha) = 0 and 1 will get an
-  // undefined value from CylKernel
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel: MUST use gfn4 not gf2 because of the def of params.
-  answer = gfn4(cos_val,pars->equat_core,pars->polar_core,pars->equat_shell,pars->polar_shell,sldcs,sldss,q);
-  //It seems that it should be normalized somehow. How???
-
-  //normalize by cylinder volume
-  //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-  vol = 4.0*Pi/3.0*pars->equat_shell*pars->equat_shell*pars->polar_shell;
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-CoreShellEllipsoidModel :: CoreShellEllipsoidModel() {
-  scale      = Parameter(1.0);
-  equat_core     = Parameter(200.0, true);
-  equat_core.set_min(0.0);
-  polar_core     = Parameter(20.0, true);
-  polar_core.set_min(0.0);
-  equat_shell   = Parameter(250.0, true);
-  equat_shell.set_min(0.0);
-  polar_shell    = Parameter(30.0, true);
-  polar_shell.set_min(0.0);
-  sld_core   = Parameter(2e-6);
-  sld_shell  = Parameter(1e-6);
-  sld_solvent = Parameter(6.3e-6);
-  background = Parameter(0.0);
-  axis_theta  = Parameter(0.0, true);
-  axis_phi    = Parameter(0.0, true);
-
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-static double spheroid_analytical_2DXY(SpheroidParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return spheroid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellEllipsoidModel :: operator()(double q) {
-  double dp[9];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = equat_core();
-  dp[2] = polar_core();
-  dp[3] = equat_shell();
-  dp[4] = polar_shell();
-  dp[5] = sld_core();
-  dp[6] = sld_shell();
-  dp[7] = sld_solvent();
-  dp[8] = 0.0;
-
-  // Get the dispersion points for the major core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points for the minor core
-  vector<WeightPoint> weights_polar_core;
-  polar_core.get_weights(weights_polar_core);
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_equat_shell;
-  equat_shell.get_weights(weights_equat_shell);
-
-  // Get the dispersion points for the minor_shell
-  vector<WeightPoint> weights_polar_shell;
-  polar_shell.get_weights(weights_polar_shell);
-
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over major core weight points
-  for(int i=0; i<(int)weights_equat_core.size(); i++) {
-    dp[1] = weights_equat_core[i].value;
-
-    // Loop over minor core weight points
-    for(int j=0; j<(int)weights_polar_core.size(); j++) {
-      dp[2] = weights_polar_core[j].value;
-
-      // Loop over major shell weight points
-      for(int k=0; k<(int)weights_equat_shell.size(); k++) {
-        dp[3] = weights_equat_shell[k].value;
-
-        // Loop over minor shell weight points
-        for(int l=0; l<(int)weights_polar_shell.size(); l++) {
-          dp[4] = weights_polar_shell[l].value;
-          //Un-normalize  by volume
-          sum += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight
-              * weights_polar_shell[l].weight * OblateForm(dp, q)
-          * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-          //Find average volume
-          vol += weights_equat_core[i].weight* weights_polar_core[j].weight
-              * weights_equat_shell[k].weight
-              * weights_polar_shell[l].weight
-              * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-          norm += weights_equat_core[i].weight* weights_polar_core[j].weight * weights_equat_shell[k].weight
-              * weights_polar_shell[l].weight;
-        }
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 OblateModel :: 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 oblate
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellEllipsoidModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-
-/**
- * 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 CoreShellEllipsoidModel :: operator()(double qx, double qy) {
-  SpheroidParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.equat_core = equat_core();
-  dp.polar_core = polar_core();
-  dp.equat_shell = equat_shell();
-  dp.polar_shell = polar_shell();
-  dp.sld_core = sld_core();
-  dp.sld_shell = sld_shell();
-  dp.sld_solvent = sld_solvent();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi = axis_phi();
-
-  // Get the dispersion points for the major core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points for the minor core
-  vector<WeightPoint> weights_polar_core;
-  polar_core.get_weights(weights_polar_core);
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_equat_shell;
-  equat_shell.get_weights(weights_equat_shell);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_polar_shell;
-  polar_shell.get_weights(weights_polar_shell);
-
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over major core weight points
-  for(int i=0; i< (int)weights_equat_core.size(); i++) {
-    dp.equat_core = weights_equat_core[i].value;
-
-    // Loop over minor core weight points
-    for(int j=0; j< (int)weights_polar_core.size(); j++) {
-      dp.polar_core = weights_polar_core[j].value;
-
-      // Loop over major shell weight points
-      for(int k=0; k< (int)weights_equat_shell.size(); k++) {
-        dp.equat_shell = weights_equat_shell[i].value;
-
-        // Loop over minor shell weight points
-        for(int l=0; l< (int)weights_polar_shell.size(); l++) {
-          dp.polar_shell = weights_polar_shell[l].value;
-
-          // Average over theta distribution
-          for(int m=0; m< (int)weights_theta.size(); m++) {
-            dp.axis_theta = weights_theta[m].value;
-
-            // Average over phi distribution
-            for(int n=0; n< (int)weights_phi.size(); n++) {
-              dp.axis_phi = weights_phi[n].value;
-              //Un-normalize by volume
-              double _ptvalue = weights_equat_core[i].weight *weights_polar_core[j].weight
-                  * weights_equat_shell[k].weight * weights_polar_shell[l].weight
-                  * weights_theta[m].weight
-                  * weights_phi[n].weight
-                  * spheroid_analytical_2DXY(&dp, qx, qy)
-              * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-              if (weights_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_theta[m].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              vol += weights_equat_shell[k].weight
-                  * weights_polar_shell[l].weight
-                  * pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-              //Find norm for volume
-              norm_vol += weights_equat_shell[k].weight
-                  * weights_polar_shell[l].weight;
-
-              norm += weights_equat_core[i].weight *weights_polar_core[j].weight
-                  * weights_equat_shell[k].weight * weights_polar_shell[l].weight
-                  * weights_theta[m].weight * weights_phi[n].weight;
-            }
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double CoreShellEllipsoidModel :: calculate_ER() {
-  SpheroidParameters dp;
-
-  dp.equat_shell = equat_shell();
-  dp.polar_shell = polar_shell();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_equat_shell;
-  equat_shell.get_weights(weights_equat_shell);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_polar_shell;
-  polar_shell.get_weights(weights_polar_shell);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_equat_shell.size(); i++) {
-    dp.equat_shell = weights_equat_shell[i].value;
-    for(int k=0; k< (int)weights_polar_shell.size(); k++) {
-      dp.polar_shell = weights_polar_shell[k].value;
-      //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-      sum +=weights_equat_shell[i].weight
-          * weights_polar_shell[k].weight*DiamEllip(dp.polar_shell,dp.equat_shell)/2.0;
-      norm += weights_equat_shell[i].weight* weights_polar_shell[k].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-    rad_out = DiamEllip(dp.polar_shell,dp.equat_shell)/2.0;}
-
-  return rad_out;
-}
-double CoreShellEllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/spheroidXT.cpp
===================================================================
--- src/sas/models/c_extension/c_models/spheroidXT.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,452 +1,0 @@
-/**
-	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
- *
- */
-// RKH 03Apr2014 a re-parametrised CoreShellEllipsoid with core axial ratio X and shell thickness T
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-#include <stdlib.h>
-using namespace std;
-#include "spheroidXT.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double equat_core;
-  double X_core;
-  double T_shell;
-  double XpolarShell;
-  double sld_core;
-  double sld_shell;
-  double sld_solvent;
-  double background;
-  double axis_theta;
-  double axis_phi;
-
-} SpheroidXTParameters;
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double spheroidXT_analytical_2D_scaled(SpheroidXTParameters *pars, double q, double q_x, double q_y) {
-
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double answer;
-  double Pi = 4.0*atan(1.0);
-  double sldcs,sldss;
-
-  //convert angle degree to radian
-  double theta = pars->axis_theta * Pi/180.0;
-  double phi = pars->axis_phi * Pi/180.0;
-
-
-  // ellipsoid orientation, the axis of the rotation is consistent with the ploar axis.
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-  //del sld
-  sldcs = pars->sld_core - pars->sld_shell;
-  sldss = pars->sld_shell- pars->sld_solvent;
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-    return 0;
-  }
-
-  // Note: cos(alpha) = 0 and 1 will get an
-  // undefined value from CylKernel
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel: MUST use gfn4 not gf2 because of the def of params.
- // was    answer = gfn4(cos_val,pars->equat_core,pars->polar_core,pars->equat_shell,pars->polar_shell,sldcs,sldss,q);
-  answer = gfn4(cos_val,pars->equat_core,  pars->equat_core*pars->X_core,   pars->equat_core + pars->T_shell,   pars->equat_core*pars->X_core + pars->T_shell*pars->XpolarShell ,sldcs,sldss,q);
-  //It seems that it should be normalized somehow. How???
-
-  //normalize by cylinder volume
-  //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-  // was vol = 4.0*Pi/3.0*pars->equat_shell*pars->equat_shell*pars->polar_shell;
-  vol = 4.0*Pi/3.0*(pars->equat_core + pars->T_shell)* (pars->equat_core + pars->T_shell) * ( pars->equat_core*pars->X_core + pars->T_shell*pars->XpolarShell);
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-CoreShellEllipsoidXTModel :: CoreShellEllipsoidXTModel() {
-  scale      = Parameter(1.0);
-  equat_core     = Parameter(20.0, true);
-  equat_core.set_min(0.0);
-  X_core     = Parameter(3.0, true);
-  X_core.set_min(0.001);
-  T_shell   = Parameter(30.0, true);
-  T_shell.set_min(0.0);
-  XpolarShell    = Parameter(1.0, true);
-  XpolarShell.set_min(0.0);
-  sld_core   = Parameter(2e-6);
-  sld_shell  = Parameter(1e-6);
-  sld_solvent = Parameter(6.3e-6);
-  background = Parameter(0.0);
-  axis_theta  = Parameter(0.0, true);
-  axis_phi    = Parameter(0.0, true);
-
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the prolate
- * @param q: q-value
- * @return: function value
- */
-
-static double spheroidXT_analytical_2DXY(SpheroidXTParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return spheroidXT_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double CoreShellEllipsoidXTModel :: operator()(double q) {
-  double dp[9];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = equat_core();
-  //dp[2] = polar_core();
-  //dp[3] = equat_shell();
-  //dp[4] = polar_shell();
-  dp[2] = equat_core()*X_core();
-  dp[3] = equat_core() + T_shell();
-  dp[4] = equat_core()*X_core() + T_shell()*XpolarShell();
-  dp[5] = sld_core();
-  dp[6] = sld_shell();
-  dp[7] = sld_solvent();
-  dp[8] = 0.0;
-
-  // Get the dispersion points for the major core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-  double wproduct = 0.0;
-
-  // Loop over equat core weight points
-  for(int i=0; i<(int)weights_equat_core.size(); i++) {
-    dp[1] = weights_equat_core[i].value;
-
-    // Loop over polar core weight points
-    for(int j=0; j<(int)weights_X_core.size(); j++) {
-      dp[2] = dp[1]*weights_X_core[j].value;
-
-      // Loop over equat outer weight points
-      for(int k=0; k<(int)weights_T_shell.size(); k++) {
-        dp[3] = dp[1] + weights_T_shell[k].value;
-
-        // Loop over polar outer weight points
-        for(int l=0; l<(int)weights_XpolarShell.size(); l++) {
-          dp[4] = dp[2] + weights_XpolarShell[l].value*weights_T_shell[k].value;
-
-          //Un-normalize  by volume
-          wproduct =weights_equat_core[i].weight* weights_X_core[j].weight * weights_T_shell[k].weight
-                  * weights_XpolarShell[l].weight;
-          sum +=  wproduct * OblateForm(dp, q) * dp[3]*dp[3]*dp[4];
-          //Find average volume
-          vol += wproduct * dp[3]*dp[3]*dp[4];
-          // was pow(weights_equat_shell[k].value,2)*weights_polar_shell[l].value;
-          norm += wproduct;
-        }
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-  return sum/norm + 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 OblateModel :: 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 oblate
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double CoreShellEllipsoidXTModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-
-/**
- * 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 CoreShellEllipsoidXTModel :: operator()(double qx, double qy) {
-  SpheroidXTParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.equat_core = equat_core();
-  dp.X_core = X_core();
-  dp.T_shell = T_shell();
-  dp.XpolarShell = XpolarShell();
-  dp.sld_core = sld_core();
-  dp.sld_shell = sld_shell();
-  dp.sld_solvent = sld_solvent();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi = axis_phi();
-
-  // Get the dispersion points for the major core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  double equat_outer = 0.0;
-  double polar_outer = 0.0;
-
-  // Loop over major core weight points
-  for(int i=0; i< (int)weights_equat_core.size(); i++) {
-    dp.equat_core = weights_equat_core[i].value;
-
-    // Loop over minor core weight points
-    for(int j=0; j< (int)weights_X_core.size(); j++) {
-      dp.X_core = weights_X_core[j].value;
-
-      // Loop over equat outer weight points
-      for(int k=0; k< (int)weights_T_shell.size(); k++) {
-        dp.T_shell = weights_T_shell[k].value;
-        equat_outer = weights_equat_core[i].value + weights_T_shell[k].value;
-
-        // Loop over polar outer weight points
-        for(int l=0; l< (int)weights_XpolarShell.size(); l++) {
-          dp.XpolarShell = weights_XpolarShell[l].value;
-          polar_outer = weights_equat_core[i].value*weights_X_core[j].value + weights_T_shell[k].value*weights_XpolarShell[l].value;
-
-          // Average over theta distribution
-          for(int m=0; m< (int)weights_theta.size(); m++) {
-            dp.axis_theta = weights_theta[m].value;
-
-            // Average over phi distribution
-            for(int n=0; n< (int)weights_phi.size(); n++) {
-              dp.axis_phi = weights_phi[n].value;
-              //Un-normalize by volume
-               double _ptvalue = weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight
-                  * weights_theta[m].weight
-                  * weights_phi[n].weight
-                  // rkh NOTE this passes the NEW parameters
-                  * spheroidXT_analytical_2DXY(&dp, qx, qy) * pow(equat_outer,2)*polar_outer;
-              if (weights_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_theta[m].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              // rkh had to change this, original weighted by outer shell volume weights only, see spheroid.cpp, which looks odd,
-              // (as has to assume that weights of other loops sume to unity) and here we need all four loops to get the outer size.
-              vol += weights_equat_core[i].weight *weights_X_core[j].weight
-                      * weights_T_shell[k].weight * weights_XpolarShell[l].weight
-                      * pow(equat_outer,2)*polar_outer;
-              //Find norm for volume
-              norm_vol += weights_equat_core[i].weight *weights_X_core[j].weight
-                      * weights_T_shell[k].weight * weights_XpolarShell[l].weight;
-
-              norm += weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight
-                  * weights_theta[m].weight * weights_phi[n].weight;
-            }
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- * rkh This now needs to integrate over all four variables as above not just two
- */
-double CoreShellEllipsoidXTModel :: calculate_ER() {
-  SpheroidXTParameters dp;
-
-  dp.equat_core = equat_core();
-  dp.X_core = X_core();
-  dp.T_shell = T_shell();
-  dp.XpolarShell = XpolarShell();
-
-  double rad_out = 0.0;
-  double equat_outer = 0.0;
-  double polar_outer = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the core
-  vector<WeightPoint> weights_equat_core;
-  equat_core.get_weights(weights_equat_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_X_core;
-  X_core.get_weights(weights_X_core);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_T_shell;
-  T_shell.get_weights(weights_T_shell);
-
-  // Get the dispersion points
-  vector<WeightPoint> weights_XpolarShell;
-  XpolarShell.get_weights(weights_XpolarShell);
-
-
-  // Loop over core weight points
-  for(int i=0; i< (int)weights_equat_core.size(); i++) {
-    dp.equat_core = weights_equat_core[i].value;
-    // Loop over weight points
-    for(int j=0; j< (int)weights_X_core.size(); j++) {
-      // Loop over weight points
-      for(int k=0; k< (int)weights_T_shell.size(); k++) {
-        equat_outer = weights_equat_core[i].value + weights_T_shell[k].value;
-        // Loop over polar outer weight points
-        for(int l=0; l< (int)weights_XpolarShell.size(); l++) {
-          polar_outer = weights_equat_core[i].value*weights_X_core[j].value + weights_T_shell[k].value*weights_XpolarShell[l].value;
-        //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-          sum +=weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight*DiamEllip(polar_outer,equat_outer)/2.0;
-          norm += weights_equat_core[i].weight *weights_X_core[j].weight
-                  * weights_T_shell[k].weight * weights_XpolarShell[l].weight;
-        }
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER.
-    rad_out = DiamEllip(dp.equat_core + dp.T_shell, dp.equat_core * dp.X_core + dp.T_shell*dp.XpolarShell)/2.0;}
-
-  return rad_out;
-}
-double CoreShellEllipsoidXTModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/stackeddisks.cpp
===================================================================
--- src/sas/models/c_extension/c_models/stackeddisks.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,396 +1,0 @@
-/**
-	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
- *
- *	TODO: refactor so that we pull in the old sansmodels.c_extensions
- *	TODO: add 2d
- */
-
-#include <math.h>
-#include "parameters.hh"
-#include <stdio.h>
-using namespace std;
-#include "stacked_disks.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double core_thick;
-  double layer_thick;
-  double core_sld;
-  double layer_sld;
-  double solvent_sld;
-  double n_stacking;
-  double sigma_d;
-  double background;
-  double axis_theta;
-  double axis_phi;
-} StackedDisksParameters;
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double stacked_disks_analytical_2D_scaled(StackedDisksParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y;//, cyl_z;
-  //double q_z;
-  double alpha, vol, cos_val;
-  double d, dum, halfheight;
-  double answer;
-  double pi = 4.0*atan(1.0);
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-
-
-  // parallelepiped orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-
-  // q vector
-  //q_z = 0;
-
-  // Compute the angle btw vector q and the
-  // axis of the parallelepiped
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    return 0;
-  }
-
-  // Note: cos(alpha) = 0 and 1 will get an
-  // undefined value from Stackdisc_kern
-  alpha = acos( cos_val );
-
-  // Call the IGOR library function to get the kernel
-  d = 2 * pars->layer_thick + pars->core_thick;
-  halfheight = pars->core_thick/2.0;
-  dum =alpha ;
-  answer = Stackdisc_kern(q, pars->radius, pars->core_sld,pars->layer_sld,
-      pars->solvent_sld, halfheight, pars->layer_thick, dum, pars->sigma_d, d, pars->n_stacking)/sin(alpha);
-
-  // Multiply by contrast^2
-  //answer *= pars->contrast*pars->contrast;
-
-  //normalize by staked disks volume
-  vol = acos(-1.0) * pars->radius * pars->radius * d * pars->n_stacking;
-  answer /= vol;
-
-  //convert to [cm-1]
-  answer *= 1.0e8;
-
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the staked disks
- * @param q: q-value
- * @return: function value
- */
-static double stacked_disks_analytical_2DXY(StackedDisksParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return stacked_disks_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-StackedDisksModel :: StackedDisksModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(3000.0, true);
-  radius.set_min(0.0);
-  core_thick  = Parameter(10.0, true);
-  core_thick.set_min(0.0);
-  layer_thick     = Parameter(15.0);
-  layer_thick.set_min(0.0);
-  core_sld = Parameter(4.0e-6);
-  layer_sld  = Parameter(-4.0e-7);
-  solvent_sld  = Parameter(5.0e-6);
-  n_stacking   = Parameter(1);
-  sigma_d   = Parameter(0);
-  background = Parameter(0.001);
-  axis_theta  = Parameter(0.0, true);
-  axis_phi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double StackedDisksModel :: operator()(double q) {
-  double dp[10];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = core_thick();
-  dp[3] = layer_thick();
-  dp[4] = core_sld();
-  dp[5] = layer_sld();
-  dp[6] = solvent_sld();
-  dp[7] = n_stacking();
-  dp[8] = sigma_d();
-  dp[9] = 0.0;
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the core_thick
-  vector<WeightPoint> weights_core_thick;
-  core_thick.get_weights(weights_core_thick);
-
-  // Get the dispersion points for the layer_thick
-  vector<WeightPoint> weights_layer_thick;
-  layer_thick.get_weights(weights_layer_thick);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over length weight points
-  for(int i=0; i< (int)weights_radius.size(); i++) {
-    dp[1] = weights_radius[i].value;
-
-    // Loop over radius weight points
-    for(int j=0; j< (int)weights_core_thick.size(); j++) {
-      dp[2] = weights_core_thick[j].value;
-
-      // Loop over thickness weight points
-      for(int k=0; k< (int)weights_layer_thick.size(); k++) {
-        dp[3] = weights_layer_thick[k].value;
-        //Un-normalize by volume
-        sum += weights_radius[i].weight
-            * weights_core_thick[j].weight * weights_layer_thick[k].weight* StackedDiscs(dp, q)
-        *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value);
-        //Find average volume
-        vol += weights_radius[i].weight
-            * weights_core_thick[j].weight * weights_layer_thick[k].weight
-            *pow(weights_radius[i].value,2)*(weights_core_thick[j].value+2*weights_layer_thick[k].value);
-        norm += weights_radius[i].weight
-            * weights_core_thick[j].weight* weights_layer_thick[k].weight;
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 StackedDisksModel :: operator()(double qx, double qy) {
-  StackedDisksParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.core_thick    = core_thick();
-  dp.radius	  = radius();
-  dp.layer_thick  = layer_thick();
-  dp.core_sld   = core_sld();
-  dp.layer_sld  = layer_sld();
-  dp.solvent_sld= solvent_sld();
-  dp.n_stacking	  = n_stacking();
-  dp.sigma_d   = sigma_d();
-  dp.background = 0.0;
-  dp.axis_theta = axis_theta();
-  dp.axis_phi   = axis_phi();
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_core_thick;
-  core_thick.get_weights(weights_core_thick);
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_layer_thick;
-  layer_thick.get_weights(weights_layer_thick);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  
-  // Loop over length weight points
-  for(int i=0; i< (int)weights_core_thick.size(); i++) {
-    dp.core_thick = weights_core_thick[i].value;
-
-    // Loop over radius weight points
-    for(int j=0; j< (int)weights_radius.size(); j++) {
-      dp.radius = weights_radius[j].value;
-
-      // Loop over thickness weight points
-      for(int k=0; k< (int)weights_layer_thick.size(); k++) {
-        dp.layer_thick = weights_layer_thick[k].value;
-
-        for(int l=0; l< (int)weights_theta.size(); l++) {
-          dp.axis_theta = weights_theta[l].value;
-
-          // Average over phi distribution
-          for(int m=0; m <(int)weights_phi.size(); m++) {
-            dp.axis_phi = weights_phi[m].value;
-
-            //Un-normalize by volume
-            double _ptvalue = weights_core_thick[i].weight
-                * weights_radius[j].weight
-                * weights_layer_thick[k].weight
-                * weights_theta[l].weight
-                * weights_phi[m].weight
-                * stacked_disks_analytical_2DXY(&dp, qx, qy)
-            *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value);
-            if (weights_theta.size()>1) {
-              _ptvalue *= fabs(cos(weights_theta[l].value*pi/180.0));
-            }
-            sum += _ptvalue;
-            //Find average volume
-            vol += weights_radius[j].weight
-                * weights_core_thick[i].weight * weights_layer_thick[k].weight
-                *pow(weights_radius[j].value,2)*(weights_core_thick[i].value+2*weights_layer_thick[k].value);
-            //Find norm for volume
-            norm_vol += weights_radius[j].weight
-                * weights_core_thick[i].weight * weights_layer_thick[k].weight;
-
-            norm += weights_core_thick[i].weight
-                * weights_radius[j].weight
-                * weights_layer_thick[k].weight
-                * weights_theta[l].weight
-                * weights_phi[m].weight;
-          }
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double StackedDisksModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double StackedDisksModel :: calculate_ER() {
-  StackedDisksParameters dp;
-
-  dp.core_thick    = core_thick();
-  dp.radius	  = radius();
-  dp.layer_thick  = layer_thick();
-  dp.n_stacking	  = n_stacking();
-
-  double rad_out = 0.0;
-  if (dp.n_stacking <= 0.0){
-    return rad_out;
-  }
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the length
-  vector<WeightPoint> weights_core_thick;
-  core_thick.get_weights(weights_core_thick);
-
-  // Get the dispersion points for the radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_layer_thick;
-  layer_thick.get_weights(weights_layer_thick);
-
-  // Loop over major shell weight points
-  for(int i=0; i< (int)weights_core_thick.size(); i++) {
-    dp.core_thick = weights_core_thick[i].value;
-    for(int j=0; j< (int)weights_layer_thick.size(); j++) {
-      dp.layer_thick = weights_layer_thick[j].value;
-      for(int k=0; k< (int)weights_radius.size(); k++) {
-        dp.radius = weights_radius[k].value;
-        //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-        sum +=weights_core_thick[i].weight*weights_layer_thick[j].weight
-            * weights_radius[k].weight*DiamCyl(dp.n_stacking*(dp.layer_thick*2.0+dp.core_thick),dp.radius)/2.0;
-        norm += weights_core_thick[i].weight*weights_layer_thick[j].weight* weights_radius[k].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER.
-    rad_out = DiamCyl(dp.n_stacking*(dp.layer_thick*2.0+dp.core_thick),dp.radius)/2.0;}
-
-  return rad_out;
-}
-double StackedDisksModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/starpolymer.cpp
===================================================================
--- src/sas/models/c_extension/c_models/starpolymer.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-#include <math.h>
-#include "parameters.hh"
-#include "starpolymer.h"
-
-StarPolymer::StarPolymer() {
- 
-  arms = Parameter(3.0);
-  R2 = Parameter(100.0);
-  scale = Parameter(1.0);
-  background = Parameter(0.0);
-
-}
-
-double StarPolymer::operator()(double q) {
-
-  double d_arms = arms();
-  double d_R2 = R2();
-  double d_scale = scale();
-  double d_background = background();
-
-  double u_2 = d_R2 * pow(q,2);
-  double v = u_2 * d_arms / (3.0 * d_arms - 2.0);
-
-  double term1 = v - 1.0 + exp(-v);
-  double term2 = ((d_arms - 1.0)/2.0)* pow((1.0 - exp(-v)),2.0);
-
-  return 2.0 * d_scale / (d_arms * pow(v,2.0)) * (term1 + term2) + d_background;
-
-}
-
-double StarPolymer::operator()(double qx, double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double StarPolymer::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double StarPolymer::calculate_VR() {
-  return 1.0;
-}
-
-double StarPolymer::evaluate_rphi(double q, double phi) {
-  double qx = q * cos(phi);
-  double qy = q * sin(phi);
-  return this->operator()(qx, qy);
-}
-
-
Index: src/sas/models/c_extension/c_models/surfacefractal.cpp
===================================================================
--- src/sas/models/c_extension/c_models/surfacefractal.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/**
-	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;
-}
-double SurfaceFractalModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/teubner_strey.cpp
===================================================================
--- src/sas/models/c_extension/c_models/teubner_strey.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/**
-	This software was developed by Institut Laue-Langevin as part of
-	Distributed Data Analysis of Neutron Scattering Experiments (DANSE).
-
-	Copyright 2012 Institut Laue-Langevin
-
-**/
-
-#include <math.h>
-#include "parameters.hh"
-#include "teubner_strey.h"
-
-TeubnerStreyModel::TeubnerStreyModel() {
-  scale = Parameter(0.1);
-  c1 = Parameter(-30.0);
-  c2 = Parameter(5000.0);
-  background = Parameter(0.0);
-}
-
-double TeubnerStreyModel::operator()(double q) { 
-  double d_scale = scale();
-  double d_c1 = c1();
-  double d_c2 = c2();
-  double d_background = background();
-
-  double term1 = d_c1 * pow(q,2);
-  double term2 = d_c2 * pow(q,4);
-
-  return 1/(d_scale + term1 + term2) + d_background;
-
-}
-
-
-double TeubnerStreyModel::operator()(double qx,double qy) {
-  double q = sqrt(qx*qx + qy*qy);
-  return this->operator()(q);
-}
-
-double TeubnerStreyModel::calculate_ER() {
-  // not implemented yet
-  return 0.0;
-}
-
-double TeubnerStreyModel::calculate_VR() {
-  return 1.0;
-}
-
-double TeubnerStreyModel::evaluate_rphi(double q,double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return this->operator()(qx, qy);
-}
-
-
-
-/***
-    Notes
-
-    This file was ported from python to C++ at ILL Grenoble in
-    July 2012. In the original python file were two functions,
-    teubnerStreyLengths and teubnerStreyDistance that did not appear
-    to be used anywhere in the code. The source for them is below:
-
-    def teubnerStreyLengths(self):
-        """
-            Calculate the correlation length (L) 
-            @return L: the correlation distance 
-        """
-        return  math.pow( 1/2 * math.pow( (self.params['scale']/self.params['c2']), 1/2 )\
-                            +(self.params['c1']/(4*self.params['c2'])),-1/2 )
-    def teubnerStreyDistance(self):
-        """
-            Calculate the quasi-periodic repeat distance (D/(2*pi)) 
-            @return D: quasi-periodic repeat distance
-        """
-        return  math.pow( 1/2 * math.pow( (self.params['scale']/self.params['c2']), 1/2 )\
-                            -(self.params['c1']/(4*self.params['c2'])),-1/2 )
-
-
-***/
Index: src/sas/models/c_extension/c_models/triaxialellipsoid.cpp
===================================================================
--- src/sas/models/c_extension/c_models/triaxialellipsoid.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,462 +1,0 @@
-/**
-	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>
-#include <stdlib.h>
-using namespace std;
-#include "triaxial_ellipsoid.h"
-
-extern "C" {
-#include "libCylinder.h"
-#include "libStructureFactor.h"
-}
-
-typedef struct {
-  double scale;
-  double semi_axisA;
-  double semi_axisB;
-  double semi_axisC;
-  double sldEll;
-  double sldSolv;
-  double background;
-  double axis_theta;
-  double axis_phi;
-  double axis_psi;
-
-} TriaxialEllipsoidParameters;
-
-static double triaxial_ellipsoid_kernel(TriaxialEllipsoidParameters *pars, double q, double cos_val, double cos_nu, double cos_mu) {
-  double t,a,b,c;
-  double kernel;
-
-  a = pars->semi_axisA ;
-  b = pars->semi_axisB ;
-  c = pars->semi_axisC ;
-
-  t = q * sqrt(a*a*cos_nu*cos_nu+b*b*cos_mu*cos_mu+c*c*cos_val*cos_val);
-  if (t==0.0){
-    kernel  = 1.0;
-  }else{
-    kernel  = 3.0*(sin(t)-t*cos(t))/(t*t*t);
-  }
-  return kernel*kernel;
-}
-
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param q_x: q_x / q
- * @param q_y: q_y / q
- * @return: function value
- */
-static double triaxial_ellipsoid_analytical_2D_scaled(TriaxialEllipsoidParameters *pars, double q, double q_x, double q_y) {
-  double cyl_x, cyl_y, ella_x, ella_y, ellb_x, ellb_y;
-  //double q_z;
-  double cos_nu, cos_mu;
-  double vol, cos_val;
-  double answer;
-  double pi = 4.0*atan(1.0);
-
-  //convert angle degree to radian
-  double theta = pars->axis_theta * pi/180.0;
-  double phi = pars->axis_phi * pi/180.0;
-  double psi = pars->axis_psi * pi/180.0;
-
-  // Cylinder orientation
-  cyl_x = cos(theta) * cos(phi);
-  cyl_y = sin(theta);
-  //cyl_z = -cos(theta) * sin(phi);
-
-  // q vector
-  //q_z = 0.0;
-
-  //dx = 1.0;
-  //dy = 1.0;
-  // Compute the angle btw vector q and the
-  // axis of the cylinder
-  cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z;
-
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    printf("cyl_ana_2D: Unexpected error: cos(alpha)>1\n");
-    return 0;
-  }
-
-  // Note: cos(alpha) = 0 and 1 will get an
-  // undefined value from CylKernel
-  //alpha = acos( cos_val );
-
-  //ellipse orientation:
-  // the elliptical corss section was transformed and projected
-  // into the detector plane already through sin(alpha)and furthermore psi remains as same
-  // on the detector plane.
-  // So, all we need is to calculate the angle (nu) of the minor axis of the ellipse wrt
-  // the wave vector q.
-
-  //x- y- component of a-axis on the detector plane.
-  ella_x =  -cos(phi)*sin(psi) * sin(theta)+sin(phi)*cos(psi);
-  ella_y =  sin(psi)*cos(theta);
-  
-  //x- y- component of b-axis on the detector plane.
-  ellb_x =  -sin(theta)*cos(psi)*cos(phi)-sin(psi)*sin(phi);
-  ellb_y =  cos(theta)*cos(psi);
-  
-  // calculate the axis of the ellipse wrt q-coord.
-  cos_nu = ella_x*q_x + ella_y*q_y;
-  cos_mu = ellb_x*q_x + ellb_y*q_y;
-  
-  // The following test should always pass
-  if (fabs(cos_val)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_val = 1.0;
-  }
-   if (fabs(cos_nu)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_nu = 1.0;
-  }
-   if (fabs(cos_mu)>1.0) {
-    //printf("parallel_ana_2D: Unexpected error: cos(alpha)>1\n");
-    cos_mu = 1.0;
-  } 
-  // Call the IGOR library function to get the kernel
-  answer = triaxial_ellipsoid_kernel(pars, q, cos_val, cos_nu, cos_mu);
-
-  // Multiply by contrast^2
-  answer *= (pars->sldEll- pars->sldSolv)*(pars->sldEll- pars->sldSolv);
-
-  //normalize by cylinder volume
-  //NOTE that for this (Fournet) definition of the integral, one must MULTIPLY by Vcyl
-  vol = 4.0* pi/3.0  * pars->semi_axisA * pars->semi_axisB * pars->semi_axisC;
-  answer *= vol;
-  //convert to [cm-1]
-  answer *= 1.0e8;
-  //Scale
-  answer *= pars->scale;
-
-  // add in the background
-  answer += pars->background;
-
-  return answer;
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @return: function value
- */
-static double triaxial_ellipsoid_analytical_2DXY(TriaxialEllipsoidParameters *pars, double qx, double qy) {
-  double q;
-  q = sqrt(qx*qx+qy*qy);
-  return triaxial_ellipsoid_analytical_2D_scaled(pars, q, qx/q, qy/q);
-}
-
-
-
-TriaxialEllipsoidModel :: TriaxialEllipsoidModel() {
-  scale      = Parameter(1.0);
-  semi_axisA     = Parameter(35.0, true);
-  semi_axisA.set_min(0.0);
-  semi_axisB     = Parameter(100.0, true);
-  semi_axisB.set_min(0.0);
-  semi_axisC  = Parameter(400.0, true);
-  semi_axisC.set_min(0.0);
-  sldEll   = Parameter(1.0e-6);
-  sldSolv   = Parameter(6.3e-6);
-  background = Parameter(0.0);
-  axis_theta  = Parameter(57.325, true);
-  axis_phi    = Parameter(57.325, true);
-  axis_psi    = Parameter(0.0, true);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double TriaxialEllipsoidModel :: operator()(double q) {
-  double dp[7];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = semi_axisA();
-  dp[2] = semi_axisB();
-  dp[3] = semi_axisC();
-  dp[4] = sldEll();
-  dp[5] = sldSolv();
-  dp[6] = 0.0;
-
-  // Get the dispersion points for the semi axis A
-  vector<WeightPoint> weights_semi_axisA;
-  semi_axisA.get_weights(weights_semi_axisA);
-
-  // Get the dispersion points for the semi axis B
-  vector<WeightPoint> weights_semi_axisB;
-  semi_axisB.get_weights(weights_semi_axisB);
-
-  // Get the dispersion points for the semi axis C
-  vector<WeightPoint> weights_semi_axisC;
-  semi_axisC.get_weights(weights_semi_axisC);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over semi axis A weight points
-  for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-    dp[1] = weights_semi_axisA[i].value;
-
-    // Loop over semi axis B weight points
-    for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-      dp[2] = weights_semi_axisB[j].value;
-
-      // Loop over semi axis C weight points
-      for(int k=0; k< (int)weights_semi_axisC.size(); k++) {
-        dp[3] = weights_semi_axisC[k].value;
-        //Un-normalize  by volume
-        sum += weights_semi_axisA[i].weight
-            * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight* TriaxialEllipsoid(dp, q)
-        * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-        //Find average volume
-        vol += weights_semi_axisA[i].weight
-            * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight
-            * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-
-        norm += weights_semi_axisA[i].weight
-            * weights_semi_axisB[j].weight * weights_semi_axisC[k].weight;
-      }
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 TriaxialEllipsoidModel :: operator()(double qx, double qy) {
-  TriaxialEllipsoidParameters dp;
-  // Fill parameter array
-  dp.scale      = scale();
-  dp.semi_axisA   = semi_axisA();
-  dp.semi_axisB     = semi_axisB();
-  dp.semi_axisC     = semi_axisC();
-  dp.sldEll   = sldEll();
-  dp.sldSolv   = sldSolv();
-  dp.background = 0.0;
-  dp.axis_theta  = axis_theta();
-  dp.axis_phi    = axis_phi();
-  dp.axis_psi    = axis_psi();
-
-  // Get the dispersion points for the semi_axis A
-  vector<WeightPoint> weights_semi_axisA;
-  semi_axisA.get_weights(weights_semi_axisA);
-
-  // Get the dispersion points for the semi_axis B
-  vector<WeightPoint> weights_semi_axisB;
-  semi_axisB.get_weights(weights_semi_axisB);
-
-  // Get the dispersion points for the semi_axis C
-  vector<WeightPoint> weights_semi_axisC;
-  semi_axisC.get_weights(weights_semi_axisC);
-
-  // Get angular averaging for theta
-  vector<WeightPoint> weights_theta;
-  axis_theta.get_weights(weights_theta);
-
-  // Get angular averaging for phi
-  vector<WeightPoint> weights_phi;
-  axis_phi.get_weights(weights_phi);
-
-  // Get angular averaging for psi
-  vector<WeightPoint> weights_psi;
-  axis_psi.get_weights(weights_psi);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double norm_vol = 0.0;
-  double vol = 0.0;
-  double pi = 4.0*atan(1.0);
-  // Loop over semi axis A weight points
-  for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-    dp.semi_axisA = weights_semi_axisA[i].value;
-
-    // Loop over semi axis B weight points
-    for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-      dp.semi_axisB = weights_semi_axisB[j].value;
-
-      // Loop over semi axis C weight points
-      for(int k=0; k < (int)weights_semi_axisC.size(); k++) {
-        dp.semi_axisC = weights_semi_axisC[k].value;
-
-        // Average over theta distribution
-        for(int l=0; l< (int)weights_theta.size(); l++) {
-          dp.axis_theta = weights_theta[l].value;
-
-          // Average over phi distribution
-          for(int m=0; m <(int)weights_phi.size(); m++) {
-            dp.axis_phi = weights_phi[m].value;
-            // Average over psi distribution
-            for(int n=0; n <(int)weights_psi.size(); n++) {
-              dp.axis_psi = weights_psi[n].value;
-              //Un-normalize  by volume
-              double _ptvalue = weights_semi_axisA[i].weight
-                  * weights_semi_axisB[j].weight
-                  * weights_semi_axisC[k].weight
-                  * weights_theta[l].weight
-                  * weights_phi[m].weight
-                  * weights_psi[n].weight
-                  * triaxial_ellipsoid_analytical_2DXY(&dp, qx, qy)
-              * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-              if (weights_theta.size()>1) {
-                _ptvalue *= fabs(cos(weights_theta[l].value*pi/180.0));
-              }
-              sum += _ptvalue;
-              //Find average volume
-              vol += weights_semi_axisA[i].weight
-                  * weights_semi_axisB[j].weight
-                  * weights_semi_axisC[k].weight
-                  * weights_semi_axisA[i].value*weights_semi_axisB[j].value*weights_semi_axisC[k].value;
-              //Find norm for volume
-              norm_vol += weights_semi_axisA[i].weight
-                  * weights_semi_axisB[j].weight
-                  * weights_semi_axisC[k].weight;
-
-              norm += weights_semi_axisA[i].weight
-                  * weights_semi_axisB[j].weight
-                  * weights_semi_axisC[k].weight
-                  * weights_theta[l].weight
-                  * weights_phi[m].weight
-                  * weights_psi[n].weight;
-            }
-          }
-
-        }
-      }
-    }
-  }
-  // Averaging in theta needs an extra normalization
-  // factor to account for the sin(theta) term in the
-  // integration (see documentation).
-  if (weights_theta.size()>1) norm = norm / asin(1.0);
-
-  if (vol != 0.0 && norm_vol != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm_vol);}
-
-  return sum/norm + background();
-}
-
-/**
- * Function to evaluate 2D scattering function
- * @param pars: parameters of the triaxial ellipsoid
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double TriaxialEllipsoidModel :: evaluate_rphi(double q, double phi) {
-  double qx = q*cos(phi);
-  double qy = q*sin(phi);
-  return (*this).operator()(qx, qy);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double TriaxialEllipsoidModel :: calculate_ER() {
-  TriaxialEllipsoidParameters dp;
-
-  dp.semi_axisA   = semi_axisA();
-  dp.semi_axisB     = semi_axisB();
-  //polar axis C
-  dp.semi_axisC     = semi_axisC();
-
-  double rad_out = 0.0;
-  //Surface average radius at the equat. cross section.
-  double suf_rad = sqrt(dp.semi_axisA * dp.semi_axisB);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-  // Get the dispersion points for the semi_axis A
-  vector<WeightPoint> weights_semi_axisA;
-  semi_axisA.get_weights(weights_semi_axisA);
-
-  // Get the dispersion points for the semi_axis B
-  vector<WeightPoint> weights_semi_axisB;
-  semi_axisB.get_weights(weights_semi_axisB);
-
-  // Get the dispersion points for the semi_axis C
-  vector<WeightPoint> weights_semi_axisC;
-  semi_axisC.get_weights(weights_semi_axisC);
-
-  // Loop over semi axis A weight points
-  for(int i=0; i< (int)weights_semi_axisA.size(); i++) {
-    dp.semi_axisA = weights_semi_axisA[i].value;
-
-    // Loop over semi axis B weight points
-    for(int j=0; j< (int)weights_semi_axisB.size(); j++) {
-      dp.semi_axisB = weights_semi_axisB[j].value;
-
-      // Loop over semi axis C weight points
-      for(int k=0; k < (int)weights_semi_axisC.size(); k++) {
-        dp.semi_axisC = weights_semi_axisC[k].value;
-
-        //Calculate surface averaged radius
-        suf_rad = sqrt(dp.semi_axisA * dp.semi_axisB);
-
-        //Sum
-        sum += weights_semi_axisA[i].weight
-            * weights_semi_axisB[j].weight
-            * weights_semi_axisC[k].weight * DiamEllip(dp.semi_axisC, suf_rad)/2.0;
-        //Norm
-        norm += weights_semi_axisA[i].weight* weights_semi_axisB[j].weight
-            * weights_semi_axisC[k].weight;
-      }
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = DiamEllip(dp.semi_axisC, suf_rad)/2.0;}
-
-  return rad_out;
-}
-double TriaxialEllipsoidModel :: calculate_VR() {
-  return 1.0;
-}
Index: src/sas/models/c_extension/c_models/vesicle.cpp
===================================================================
--- src/sas/models/c_extension/c_models/vesicle.cpp	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ 	(revision )
@@ -1,213 +1,0 @@
-/**
-	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 "vesicle.h"
-
-extern "C" {
-#include "libSphere.h"
-}
-
-typedef struct {
-  double scale;
-  double radius;
-  double thickness;
-  double solv_sld;
-  double shell_sld;
-  double background;
-} VesicleParameters;
-
-VesicleModel :: VesicleModel() {
-  scale      = Parameter(1.0);
-  radius     = Parameter(100.0, true);
-  radius.set_min(0.0);
-  thickness  = Parameter(30.0, true);
-  thickness.set_min(0.0);
-  solv_sld   = Parameter(6.36e-6);
-  shell_sld   = Parameter(5.0e-7);
-  background = Parameter(0.0);
-}
-
-/**
- * Function to evaluate 1D scattering function
- * The NIST IGOR library is used for the actual calculation.
- * @param q: q-value
- * @return: function value
- */
-double VesicleModel :: operator()(double q) {
-  double dp[6];
-
-  // Fill parameter array for IGOR library
-  // Add the background after averaging
-  dp[0] = scale();
-  dp[1] = radius();
-  dp[2] = thickness();
-  dp[3] = solv_sld();
-  dp[4] = shell_sld();
-  dp[5] = 0.0;
-
-
-  // Get the dispersion points for the core radius
-  vector<WeightPoint> weights_radius;
-  radius.get_weights(weights_radius);
-  // Get the dispersion points for the thickness
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-  double vol = 0.0;
-
-  // Loop over radius weight points
-  for(int i=0; i< (int)weights_radius.size(); i++) {
-    dp[1] = weights_radius[i].value;
-    for(int j=0; j< (int)weights_thickness.size(); j++) {
-      dp[2] = weights_thickness[j].value;
-      sum += weights_radius[i].weight
-          * weights_thickness[j].weight * VesicleForm(dp, q)
-      *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3));
-      //Find average volume
-      vol += weights_radius[i].weight * weights_thickness[j].weight
-          *(pow(weights_radius[i].value+weights_thickness[j].value,3)-pow(weights_radius[i].value,3));
-      norm += weights_radius[i].weight * weights_thickness[j].weight;
-    }
-  }
-  if (vol != 0.0 && norm != 0.0) {
-    //Re-normalize by avg volume
-    sum = sum/(vol/norm);}
-
-  return sum/norm + 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 VesicleModel :: 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 vesicle
- * @param q: q-value
- * @param phi: angle phi
- * @return: function value
- */
-double VesicleModel :: evaluate_rphi(double q, double phi) {
-  return (*this).operator()(q);
-}
-/**
- * Function to calculate effective radius
- * @return: effective radius value
- */
-double VesicleModel :: calculate_ER() {
-  VesicleParameters dp;
-
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum = 0.0;
-  double norm = 0.0;
-
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int j=0; j< (int)weights_thickness.size(); j++) {
-    dp.thickness = weights_thickness[j].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      sum += weights_thickness[j].weight
-          * weights_radius[k].weight*(dp.radius+dp.thickness);
-      norm += weights_thickness[j].weight* weights_radius[k].weight;
-    }
-  }
-  if (norm != 0){
-    //return the averaged value
-    rad_out =  sum/norm;}
-  else{
-    //return normal value
-    rad_out = (dp.radius+dp.thickness);}
-
-  return rad_out;
-}
-/**
- * Function to calculate volf_ratio for shell
- * @return: volf_ratio value
- */
-double VesicleModel :: calculate_VR() {
-  VesicleParameters dp;
-
-  dp.radius     = radius();
-  dp.thickness  = thickness();
-
-  double rad_out = 0.0;
-
-  // Perform the computation, with all weight points
-  double sum_tot = 0.0;
-  double sum_shell = 0.0;
-
-
-  // Get the dispersion points for the major shell
-  vector<WeightPoint> weights_thickness;
-  thickness.get_weights(weights_thickness);
-
-  // Get the dispersion points for the minor shell
-  vector<WeightPoint> weights_radius ;
-  radius.get_weights(weights_radius);
-
-  // Loop over major shell weight points
-  for(int j=0; j< (int)weights_thickness.size(); j++) {
-    dp.thickness = weights_thickness[j].value;
-    for(int k=0; k< (int)weights_radius.size(); k++) {
-      dp.radius = weights_radius[k].value;
-      sum_tot += weights_thickness[j].weight
-          * weights_radius[k].weight*pow((dp.radius+dp.thickness), 3);
-      sum_shell += weights_thickness[j].weight
-		  * weights_radius[k].weight*(pow((dp.radius+dp.thickness), 3)
-				  - pow((dp.radius), 3));
-    }
-  }
-  if (sum_tot == 0.0){
-    //return the default value
-    rad_out =  1.0;}
-  else{
-    //return ratio value
-    return sum_shell/sum_tot;
-  }
-}
