Index: sasmodels/compare.py
===================================================================
--- sasmodels/compare.py	(revision 5d316e95135200b4ea93e182879b728131db199b)
+++ sasmodels/compare.py	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
@@ -81,4 +81,6 @@
 
     for k,v in pars.items():
+        if k.startswith("num_pearls_") or k.startswith("thick_string_"):
+            continue
         if k.endswith("_pd"):
             model.dispersion[k[:-3]]['width'] = v
Index: sasmodels/models/lib/Si.c
===================================================================
--- sasmodels/models/lib/Si.c	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
+++ sasmodels/models/lib/Si.c	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
@@ -0,0 +1,49 @@
+double Si(double x);
+// integral of sin(x)/x: approximated to w/i 1%
+double Si(double x)
+{
+	int i;
+	int nmax=6;
+	double out;
+	long power;
+	double pi = 4.0*atan(1.0);
+
+	if (x >= pi*6.2/4.0){
+		double out_sin = 0.0;
+		double out_cos = 0.0;
+		out = pi/2.0;
+
+		for (i=0; i<nmax-2; i+=1) {
+			out_cos += pow(-1.0, i) * (double)factorial(2*i) / pow(x, 2*i+1);
+			out_sin += pow(-1.0, i) * (double)factorial(2*i+1) / pow(x, 2*i+2);
+		}
+
+		out -= cos(x) * out_cos;
+		out -= sin(x) * out_sin;
+		return out;
+	}
+
+	out = 0.0;
+
+	for (i=0; i<nmax; i+=1)	{
+		if (i==0) {
+			out += x;
+			continue;
+		}
+
+		power = pow(x,(2 * i + 1));
+		out += (double)pow(-1, i) * power / ((2.0 * (double)i + 1.0) * (double)factorial(2 * i + 1));
+
+		//printf ("Si=%g %g %d\n", x, out, i);
+	}
+
+	return out;
+}
+
+int factorial(int f);
+int factorial(int f)
+{
+    if ( f == 0 ) 
+        return 1;
+    return(f * factorial(f - 1));
+}
Index: sasmodels/models/pearl_necklace.c
===================================================================
--- sasmodels/models/pearl_necklace.c	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
+++ sasmodels/models/pearl_necklace.c	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
@@ -0,0 +1,160 @@
+double _pearl_necklace_kernel(double q, double radius, double edge_separation,
+	double thick_string, double num_pearls, double sld_pearl,
+	double sld_string, double sld_solv);
+double form_volume(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls);
+double sinc(double x);
+	
+double Iq(double q, double radius, double edge_separation,
+	double string_thickness, double number_of_pearls, double sld, 
+	double string_sld, double solvent_sld);
+double Iqxy(double qx, double qy, double radius, double edge_separation,
+	double string_thickness, double number_of_pearls, double sld, 
+	double string_sld, double solvent_sld);
+	
+double ER(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls);
+double VR(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls);
+
+// From Igor library
+double _pearl_necklace_kernel(double q, double radius, double edge_separation, double thick_string,
+	double num_pearls, double sld_pearl, double sld_string, double sld_solv)
+{
+	double contrast_pearl = sld_pearl - sld_solv;
+	double contrast_string = sld_string - sld_solv;
+
+	//total volume
+	double pi = 4.0*atan(1.0);
+	double tot_vol = form_volume(radius, edge_separation, thick_string, num_pearls);
+	double string_vol = edge_separation * pi * pow((thick_string / 2.0), 2);
+	double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3);
+	double num_strings = num_pearls - 1;
+	//each mass
+	double m_r= contrast_string * string_vol;
+	double m_s= contrast_pearl * pearl_vol;
+	double psi, gamma, beta;
+	//form factors
+	double sss; //pearls
+	double srr; //strings
+	double srs; //cross
+	double A_s, srr_1, srr_2, srr_3;
+	double form_factor;
+
+	//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 * 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 *= -2.0 * pow(beta, 2);
+
+	// 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 * (m_r * m_s * beta * psi);
+
+	form_factor = sss + srr + srs;
+	form_factor /= (tot_vol * 1.0e4); // norm by volume and A^-1 to cm^-1
+
+	return (form_factor);
+}
+
+double form_volume(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls)
+{
+	double total_vol;
+
+	double pi = 4.0*atan(1.0);
+	double number_of_strings = number_of_pearls - 1.0;
+	
+	double string_vol = edge_separation * pi * pow((string_thickness / 2.0), 2);
+	double pearl_vol = 4.0 /3.0 * pi * pow(radius, 3);
+
+	total_vol = number_of_strings * string_vol;
+	total_vol += number_of_pearls * pearl_vol;
+
+	return(total_vol);
+}
+
+double sinc(double x)
+{
+	double num = sin(x);
+	double denom = x;
+	return num/denom;
+}
+
+
+double Iq(double q, double radius, double edge_separation,
+	double string_thickness, double number_of_pearls, double sld, 
+	double string_sld, double solvent_sld)
+{
+	double value = 0.0;
+	double tot_vol = 0.0;
+	
+	value = _pearl_necklace_kernel(q, radius, edge_separation, string_thickness,
+		number_of_pearls, sld, string_sld, solvent_sld);
+	tot_vol = form_volume(radius, edge_separation, string_thickness, number_of_pearls);
+
+	return value*tot_vol;
+}
+
+double Iqxy(double qx, double qy, double radius, double edge_separation,
+	double string_thickness, double number_of_pearls, double sld, 
+	double string_sld, double solvent_sld)
+{
+    double q = sqrt(qx*qx + qy*qy);
+    return(Iq(q, radius, edge_separation, string_thickness, number_of_pearls, 
+		sld, string_sld, solvent_sld));
+}
+
+
+double ER(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls)
+{
+	double tot_vol = form_volume(radius, edge_separation, string_thickness, number_of_pearls);
+	double pi = 4.0*atan(1.0);
+
+    double rad_out = pow((3.0*tot_vol/4.0/pi), 0.33333);
+    
+    return rad_out;
+}
+double VR(double radius, double edge_separation,
+	double string_thickness, double number_of_pearls)
+{
+	return 1.0;
+}
Index: sasmodels/models/pearl_necklace.py
===================================================================
--- sasmodels/models/pearl_necklace.py	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
+++ sasmodels/models/pearl_necklace.py	(revision cf404cbf1344577110785a29f1390cbabc7969b2)
@@ -0,0 +1,115 @@
+r"""
+This model provides the form factor for a pearl necklace composed of two 
+elements: *N* pearls (homogeneous spheres of radius *R*) freely jointed by *M* 
+rods (like strings - with a total mass *Mw* = *M* \* *m*\ :sub:`r` + *N* \* *m*\
+:sub:`s`, and the string segment length (or edge separation) *l* 
+(= *A* - 2\ *R*)). *A* is the center-to-center pearl separation distance.
+
+.. figure:: img/pearl_fig.jpg
+
+    Pearl Necklace schematic
+
+Definition
+----------
+
+The output of the scattering intensity function for the PearlNecklaceModel is 
+given by (Schweins, 2004)
+
+.. math::
+
+    I(q)=\frac{ \text{scale} }{V} \cdot \frac{(S_{ss}(q)+S_{ff}(q)+S_{fs}(q))}
+        {(M \cdot m_f + N \cdot m_s)^2} + \text{bkg}
+
+where
+
+.. math::
+
+    S_{ss}(q) &= sm_s^2\psi^2(q)[\frac{N}{1-sin(qA)/qA}-\frac{N}{2}-
+        \frac{1-(sin(qA)/qA)^N}{(1-sin(qA)/qA)^2}\cdot\frac{sin(qA)}{qA}] \\
+    S_{ff}(q) &= sm_r^2[M\{2\Lambda(q)-(\frac{sin(ql/2)}{ql/2})\}+
+        \frac{2M\beta^2(q)}{1-sin(qA)/qA}-2\beta^2(q)\cdot
+        \frac{1-(sin(qA)/qA)^M}{(1-sin(qA)/qA)^2}] \\
+    S_{fs}(q) &= m_r \beta (q) \cdot m_s \psi (q) \cdot 4[
+        \frac{N-1}{1-sin(qA)/qA}-\frac{1-(sin(qA)/qA)^{N-1}}{(1-sin(qA)/qA)^2}
+        \cdot \frac{sin(qA)}{qA}] \\
+    \psi(q) &= 3 \cdot \frac{sin(qR)-(qR)\cdot cos(qR)}{(qR)^3} \\
+    \Lambda(q) &= \frac{\int_0^{ql}\frac{sin(t)}{t}dt}{ql} \\
+    \beta(q) &= \frac{\int_{qR}^{q(A-R)}\frac{sin(t)}{t}dt}{ql}
+
+where the mass *m*\ :sub:`i` is (SLD\ :sub:`i` - SLD\ :sub:`solvent`) \* 
+(volume of the *N* pearls/rods). *V* is the total volume of the necklace.
+
+The 2D scattering intensity is the same as $P(q)$ above, regardless of the 
+orientation of the *q* vector.
+
+The returned value is scaled to units of |cm^-1| and the parameters of the
+pearl_necklace model are the following
+
+NB: *number_of_pearls* must be an integer.
+
+.. figure:: img/pearl_plot.jpg
+
+    1D plot using the default values (w/1000 data point).
+
+REFERENCE
+
+R Schweins and K Huber, *Particle Scattering Factor of Pearl Necklace Chains*, 
+*Macromol. Symp.* 211 (2004) 25-42 2004
+"""
+
+from numpy import inf
+
+name = "pearl_necklace"
+title = "Colloidal spheres chained together with o preferential orientation"
+description = """
+Calculate form factor for Pearl Necklace Model
+[Macromol. Symp. 2004, 211, 25-42]
+Parameters:
+background:background
+scale: scale factor
+sld: the SLD of the pearl spheres
+sld_string: the SLD of the strings
+sld_solvent: the SLD of the solvent
+number_of_pearls: number of the pearls
+radius: the radius of a pearl
+edge_separation: the length of string segment; surface to surface
+string_thickness: thickness (ie, diameter) of the string
+"""
+category = "shape:cylinder"
+
+#             ["name", "units", default, [lower, upper], "type","description"],
+parameters = [["radius", "Angstrom", 80.0, [0, inf], "volume", 
+               "Mean radius of the chained spheres"],
+              ["edge_separation", "Angstrom", 350.0, [0, inf], "volume", 
+               "Mean separation of chained particles"],
+              ["string_thickness", "Angstrom", 2.5, [0, inf], "volume", 
+               "Thickness of the chain linkage"],
+              ["number_of_pearls", "none", 3, [0, inf], "volume", 
+               "Mean number of pearls in each necklace"],
+              ["sld", "Angstrom^2", 1.0, [-inf, inf], "", 
+               "Scattering length density of the chained spheres"],
+              ["string_sld", "Angstrom^2", 1.0, [-inf, inf], "", 
+               "Scattering length density of the chain linkage"],
+              ["solvent_sld", "Angstrom^2", 6.3, [-inf, inf], "", 
+               "Scattering length density of the solvent"],
+              ]
+
+source = ["lib/Si.c", "pearl_necklace.c"]
+
+# parameters for demo
+demo = dict(scale=1, background=0, radius=80.0, edge_separation=350.0,
+            number_of_pearls=3, sld=1, solvent_sld=6.3, string_sld=1,
+            string_thickness=2.5,
+            radius_pd=.2, radius_pd_n=5,
+            edge_separation_pd=25.0, edge_separation_pd_n=5,
+            number_of_pearls_pd=0, number_of_pearls_pd_n=0,
+            string_thickness_pd=0.2, string_thickness_pd_n=5,
+           )
+
+# For testing against the old sasview models, include the converted parameter
+# names and the target sasview model name.
+oldname = 'PearlNecklaceModel'
+oldpars = dict(scale='scale',background='background',radius='radius',
+               number_of_pearls='num_pearls', solvent_sld='sld_solv',
+               string_thickness='thick_string', sld='sld_pearl',
+               string_sld='sld_string', edge_separation='edge_separation')
