Index: src/sans/models/c_extension/c_models/micelleSphCore.cpp
===================================================================
--- src/sans/models/c_extension/c_models/micelleSphCore.cpp	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
+++ src/sans/models/c_extension/c_models/micelleSphCore.cpp	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
@@ -0,0 +1,176 @@
+/**
+	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/sans/models/c_extension/libigor/libSphere.c
===================================================================
--- src/sans/models/c_extension/libigor/libSphere.c	(revision 230f479e04002ef42bafef9a227d586459b717c1)
+++ src/sans/models/c_extension/libigor/libSphere.c	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
@@ -2330,3 +2330,83 @@
 }
 
-
+// Micelle with spherical core 
+// J.S. Pedersen, J. Appl. Cryst. 33, 637 (2000)
+
+double
+MicelleSphericalCore(double dp[], double q)
+{
+	double x, pi;
+	double ndensity, v_core, v_corona, rho_solv, rho_core, rho_corona;      // local names of input params
+	double radius_core, radius_gyr, d_penetration, n_aggreg, bkg, scale;    // local names of input params
+	double beta_core, beta_corona, qr, qrg, qrg2, qrdrg, bes_core, bes_corona; 
+	double term1, term2, term3, term4, debye_chain, chain_ampl, i_micelle;
+
+	x = q;
+	
+	scale = dp[0];
+	ndensity = dp[1];      // number density [1/cm^3]
+	v_core = dp[2];        // volume block in core [A^3]
+	v_corona = dp[3];      // volume block in corona [A^3]
+	rho_solv = dp[4];      // sld of solvent [1/A^2]
+	rho_core = dp[5];      // sld of core [1/A^2]
+	rho_corona = dp[6];    // sld of corona [1/A^2]
+	radius_core = dp[7];   // radius of core [A]
+	radius_gyr = dp[8];    // radius of gyration of chains in corona [A]
+	d_penetration = dp[9]; // close to unity, mimics non-penetration of gaussian chains
+	n_aggreg = dp[10];     // aggregation number of the micelle
+	bkg = dp[11];          // background
+	
+	beta_core = v_core * (rho_core - rho_solv);
+	beta_corona = v_corona * (rho_corona - rho_solv);
+	
+	
+        // Self-correlation term of the core
+
+	qr = x*radius_core;
+	if(qr == 0){bes_core = 1.0;} else {bes_core = 3.0*(sin(qr)-qr*cos(qr))/(qr*qr*qr);}
+	
+        term1 = n_aggreg * n_aggreg * beta_core * beta_core * bes_core * bes_core;
+
+        // Self-correlation term of the chains
+
+	qrg = x*radius_gyr;
+	qrg2 = qrg*qrg;
+	if(qrg2 == 0){debye_chain = 1.0;} else {debye_chain = 2.0*(exp(-qrg2)-1+qrg2)/(qrg2*qrg2);}
+	
+        term2 = n_aggreg * beta_corona * beta_corona * debye_chain;
+
+        // Interference cross-term between core and chains
+
+	if(qrg2 == 0){chain_ampl = 1.0;} else {chain_ampl = (1-exp(-qrg2))/qrg2;}
+
+	qrdrg = x * (radius_core + d_penetration * radius_gyr);
+	if(qrdrg == 0){bes_corona = 1.0;} else {bes_corona = sin(qrdrg)/qrdrg;}
+
+        term3 = 2 * n_aggreg * n_aggreg * beta_core * beta_corona * bes_core * chain_ampl * bes_corona;
+
+        // Interference cross-term between chains
+
+        term4 = n_aggreg * (n_aggreg - 1.0) * beta_corona * beta_corona * chain_ampl * chain_ampl * bes_corona * bes_corona;
+
+        // I(q)_micelle : Sum of 4 terms computed above
+	
+	i_micelle = term1 + term2 + term3 + term4 ; 
+
+	// rescale from [A^2] to [cm^2]
+	
+	i_micelle *= 1.0e-16;
+
+	// "normalize" by number density --> intensity in [cm-1]
+	
+	i_micelle *= ndensity;
+	
+	//scale if desired
+	i_micelle *= scale;
+
+	// add in the background
+	i_micelle += bkg;
+	
+	return(i_micelle);
+	
+}
+
Index: src/sans/models/c_extension/libigor/libSphere.h
===================================================================
--- src/sans/models/c_extension/libigor/libSphere.h	(revision 230f479e04002ef42bafef9a227d586459b717c1)
+++ src/sans/models/c_extension/libigor/libSphere.h	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
@@ -34,4 +34,5 @@
 double SC_ParaCrystal(double dp[], double q);
 double FuzzySpheres(double dp[], double q);
+double MicelleSphericalCore(double dp[], double q);
 
 //function prototypes
Index: src/sans/models/include/micelleSphCore.h
===================================================================
--- src/sans/models/include/micelleSphCore.h	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
+++ src/sans/models/include/micelleSphCore.h	(revision 0d41aeedfd6519366eed15ea18fecad753bea94f)
@@ -0,0 +1,90 @@
+#if !defined(micelleSphCore_h)
+#define micelleSphCore_h
+#include "parameters.hh"
+
+/**
+[PYTHONCLASS] = MicelleSphCoreModel
+[DISP_PARAMS] = radius_core, radius_gyr
+[DESCRIPTION] = <text>
+                Model parameters:   
+                ndensity : number density of micelles
+                v_core: volume block in core
+                v_corona: volume block in corona
+                rho_solv: sld of solvent 
+                rho_core: sld of core
+                rho_corona: sld of corona
+                radius_core: radius of core
+                radius_gyr: radius of gyration of chains in corona 
+                d_penetration: close to unity, mimics non-penetration of gaussian chains
+                n_aggreg: aggregation number of the micelle
+                background: incoherent background
+                scale : scale factor
+		</text>
+[FIXED]= <text> radius_core.width; radius_gyr.width </text>
+[ORIENTATION_PARAMS]= <text> </text>
+**/
+
+class MicelleSphCoreModel{
+public:
+
+    // Model parameters
+  
+    /// Scale factor
+    //  [DEFAULT]=scale= 1.0
+    Parameter scale;
+
+    /// Number density of micelles [1/cm^(3)]
+    //  [DEFAULT]=ndensity= 8.94e15 [1/cm^(3)]
+    Parameter ndensity;
+
+    /// Core volume [A]
+    //  [DEFAULT]=v_core= 62624. [A^3]
+    Parameter v_core;
+
+    /// Corona volume [A^(3)]
+    //  [DEFAULT]=v_corona= 61940. [A^(3)]
+    Parameter v_corona;
+
+    /// solvent scattering length density [1/A^(2)]
+    //  [DEFAULT]=rho_solv= 6.4e-6 [1/A^(2)]
+    Parameter rho_solv;
+
+    /// core scattering length density [1/A^(2)]
+    //  [DEFAULT]=rho_core= 3.4e-7 [1/A^(2)]
+    Parameter rho_core;
+
+    /// corona scattering length density [1/A^(2)]
+    //  [DEFAULT]=rho_corona= 8.0e-7 [1/A^(2)]
+    Parameter rho_corona;
+
+    /// core radius [A]
+    //  [DEFAULT]=radius_core= 45.0 [A]
+    Parameter radius_core;
+
+    /// radius of gyration of chains in corona[A]
+    //  [DEFAULT]=radius_gyr= 20.0 [A]
+    Parameter radius_gyr;
+
+    /// d factor to mimic non-penetration of Gaussian chains, close to unity 
+    //  [DEFAULT]=d_penetration= 1.0 
+    Parameter d_penetration;
+
+    /// aggregation number of the micelle 
+    //  [DEFAULT]=n_aggreg= 6.0 
+    Parameter n_aggreg;
+
+    /// Incoherent Background [1/cm]
+    //  [DEFAULT]=background=0 [1/cm]
+    Parameter background;
+
+    //Constructor
+    MicelleSphCoreModel();
+    
+    // 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);
+};
+#endif
