Index: sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c
===================================================================
--- sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c	(revision 129bdc402ee898067c26d6c28ad0e6d66518e12c)
+++ sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c	(revision 129bdc402ee898067c26d6c28ad0e6d66518e12c)
@@ -0,0 +1,116 @@
+// NOTE that "length" here is the full height of the core!
+static double
+form_volume(double r_minor,
+        double x_core,
+        double thick_rim,
+        double thick_face,
+        double length)
+{
+    return M_PI*(  (r_minor + thick_rim)*(r_minor*x_core + thick_rim)* length + 
+                 square(r_minor)*x_core*2.0*thick_face  );
+}
+
+static double
+Iq(double q,
+        double r_minor,
+        double x_core,
+        double thick_rim,
+        double thick_face,
+        double length,
+        double rhoc,
+        double rhoh,
+        double rhor,
+        double rhosolv,
+        double sigma)
+{
+    double si1,si2,be1,be2;
+     // core_shell_bicelle_elliptical_belt, RKH 5th Oct 2017, core_shell_bicelle_elliptical
+     // tested briefly against limiting cases of cylinder, hollow cylinder & elliptical cylinder models
+     //    const double uplim = M_PI_4;
+    const double halfheight = 0.5*length;
+    //const double va = 0.0;
+    //const double vb = 1.0;
+    // inner integral limits
+    //const double vaj=0.0;
+    //const double vbj=M_PI;
+
+    const double r_major = r_minor * x_core;
+    const double r2A = 0.5*(square(r_major) + square(r_minor));
+    const double r2B = 0.5*(square(r_major) - square(r_minor));
+    // dr1,2,3 are now for Vcore, Vcore+rim, Vcore+face,
+    const double dr1 = (-rhor - rhoh + rhoc + rhosolv) *M_PI*r_minor*r_major*
+          2.0*halfheight;
+    const double dr2 = (rhor-rhosolv) *M_PI*(r_minor+thick_rim)*(
+         r_major+thick_rim)* 2.0*halfheight;
+    const double dr3 = (rhoh-rhosolv) *M_PI*r_minor*r_major*
+         2.0*(halfheight+thick_face);
+    //initialize integral
+    double outer_sum = 0.0;
+    for(int i=0;i<76;i++) {
+        //setup inner integral over the ellipsoidal cross-section
+        // since we generate these lots of times, why not store them somewhere?
+        //const double cos_alpha = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;
+        const double cos_alpha = ( Gauss76Z[i] + 1.0 )/2.0;
+        const double sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha);
+        double inner_sum=0;
+        double sinarg1 = q*halfheight*cos_alpha;
+        double sinarg2 = q*(halfheight+thick_face)*cos_alpha;
+        si1 = sas_sinx_x(sinarg1);
+        si2 = sas_sinx_x(sinarg2);
+        for(int j=0;j<76;j++) {
+            //76 gauss points for the inner integral (WAS 20 points,so this may make unecessarily slow, but playing safe)
+            //const double beta = ( Gauss76Z[j]*(vbj-vaj) + vaj + vbj )/2.0;
+            const double beta = ( Gauss76Z[j] +1.0)*M_PI_2;
+            const double rr = sqrt(r2A - r2B*cos(beta));
+            double besarg1 = q*rr*sin_alpha;
+            double besarg2 = q*(rr+thick_rim)*sin_alpha;
+            be1 = sas_2J1x_x(besarg1);
+            be2 = sas_2J1x_x(besarg2);
+            inner_sum += Gauss76Wt[j] *square(dr1*si1*be1 +
+                                              dr2*si1*be2 +
+                                              dr3*si2*be1);
+        }
+        //now calculate outer integral
+        outer_sum += Gauss76Wt[i] * inner_sum;
+    }
+
+    return outer_sum*2.5e-05*exp(-0.5*square(q*sigma));
+}
+
+static double
+Iqxy(double qa, double qb, double qc,
+          double r_minor,
+          double x_core,
+          double thick_rim,
+          double thick_face,
+          double length,
+          double rhoc,
+          double rhoh,
+          double rhor,
+          double rhosolv,
+          double sigma)
+{
+    // THIS NEEDS TESTING
+    // Vol1,2,3 and dr1,2,3 are now for Vcore, Vcore+rim, Vcore+face,
+    const double dr1 = -rhor - rhoh + rhoc + rhosolv;
+    const double dr2 = rhor-rhosolv;
+    const double dr3 = rhoh-rhosolv;
+    const double r_major = r_minor*x_core;
+    const double halfheight = 0.5*length;
+    const double vol1 = M_PI*r_minor*r_major*length;
+    const double vol2 = M_PI*(r_minor+thick_rim)*(r_major+thick_rim)*2.0*halfheight;
+    const double vol3 = M_PI*r_minor*r_major*2.0*(halfheight+thick_face);
+
+    // Compute effective radius in rotated coordinates
+    const double qr_hat = sqrt(square(r_major*qa) + square(r_minor*qb));
+    // does this need to be changed for the "missing corners" where there there is no "belt" ?
+    const double qrshell_hat = sqrt(square((r_major+thick_rim)*qa)
+                                   + square((r_minor+thick_rim)*qb));
+    const double be1 = sas_2J1x_x( qr_hat );
+    const double be2 = sas_2J1x_x( qrshell_hat );
+    const double si1 = sas_sinx_x( halfheight*qc );
+    const double si2 = sas_sinx_x( (halfheight + thick_face)*qc );
+    const double Aq = square( vol1*dr1*si1*be1 + vol2*dr2*si1*be2 +  vol3*dr3*si2*be1);
+    return 1.0e-4 * Aq*exp(-0.5*(square(qa) + square(qb) + square(qc) )*square(sigma));
+}
+
Index: sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py
===================================================================
--- sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py	(revision 129bdc402ee898067c26d6c28ad0e6d66518e12c)
+++ sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py	(revision 129bdc402ee898067c26d6c28ad0e6d66518e12c)
@@ -0,0 +1,180 @@
+r"""
+Definition
+----------
+
+This model provides the form factor for an elliptical cylinder with a
+core-shell scattering length density profile. Thus this is a variation
+of the core-shell bicelle model, but with an elliptical cylinder for the core.
+In this version the "rim" or "belt" does NOT extend the full length of the particle,
+but has the same length as the core.
+Outer shells on the rims and flat ends may be of different thicknesses and 
+scattering length densities. The form factor is normalized by the total particle volume.
+This version includes an approximate "interfacial roughness".
+
+
+.. figure:: img/core_shell_bicelle_belt_geometry.png
+
+    Schematic cross-section of bicelle with belt. Note however that the model here
+    calculates for rectangular, not curved, rims as shown below.
+
+.. figure:: img/core_shell_bicelle_belt_parameters.png
+
+   Cross section of model used here. Users will have 
+   to decide how to distribute "heads" and "tails" between the rim, face 
+   and core regions in order to estimate appropriate starting parameters.
+
+Given the scattering length densities (sld) $\rho_c$, the core sld, $\rho_f$,
+the face sld, $\rho_r$, the rim sld and $\rho_s$ the solvent sld, the
+scattering length density variation along the bicelle axis is:
+
+.. math::
+
+    \rho(r) = 
+      \begin{cases} 
+      &\rho_c \text{ for } 0 \lt r \lt R;   -L/2 \lt z\lt L/2 \\[1.5ex]
+      &\rho_f \text{ for } 0 \lt r \lt R;   -(L/2 +t_{face}) \lt z\lt -L/2;  
+      L/2 \lt z\lt (L/2+t_{face}) \\[1.5ex]
+      &\rho_r\text{ for } R \lt r \lt R+t_{rim}; -L/2 \lt z\lt L/2
+      \end{cases}
+
+The form factor for the bicelle is calculated in cylindrical coordinates, where
+$\alpha$ is the angle between the $Q$ vector and the cylinder axis, and $\psi$ is the angle
+for the ellipsoidal cross section core, to give:
+
+.. math::
+
+    I(Q,\alpha,\psi) = \frac{\text{scale}}{V_t} \cdot
+        F(Q,\alpha, \psi)^2.sin(\alpha).exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \} + \text{background}
+
+where a numerical integration of $F(Q,\alpha, \psi)^2.sin(\alpha)$ is carried out over \alpha and \psi for:
+
+.. math::
+
+        \begin{align}    
+    F(Q,\alpha,\psi) = &\bigg[ 
+    (\rho_c -\rho_r - \rho_f + \rho_s) V_c \frac{2J_1(QR'sin \alpha)}{QR'sin\alpha}\frac{sin(QLcos\alpha/2)}{Q(L/2)cos\alpha} \\
+    &+(\rho_f - \rho_s) V_{c+f} \frac{2J_1(QR'sin\alpha)}{QR'sin\alpha}\frac{sin(Q(L/2+t_f)cos\alpha)}{Q(L/2+t_f)cos\alpha} \\
+    &+(\rho_r - \rho_s) V_{c+r} \frac{2J_1(Q(R'+t_r)sin\alpha)}{Q(R'+t_r)sin\alpha}\frac{sin(Q(L/2)cos\alpha)}{Q(L/2)cos\alpha}
+    \bigg]
+    \end{align} 
+
+where
+
+.. math::
+
+    R'=\frac{R}{\sqrt{2}}\sqrt{(1+X_{core}^{2}) + (1-X_{core}^{2})cos(\psi)}
+    
+    
+and $V_t = \pi.(R+t_r)(Xcore.R+t_r).L + 2.\pi.Xcore.R^2.t_f$ is the total volume of the bicelle, 
+$V_c = \pi.Xcore.R^2.L$ the volume of the core, $V_{c+f} = \pi.Xcore.R^2.(L+2.t_f)$ 
+the volume of the core plus the volume of the faces, $V_{c+r} = \pi.(R+t_r)(Xcore.R+t_r),.L$ 
+the volume of the core plus the rim, $R$ is the radius
+of the core, $Xcore$ is the axial ratio of the core, $L$ the length of the core, 
+$t_f$ the thickness of the face, $t_r$ the thickness of the rim and $J_1$ the usual 
+first order bessel function. The core has radii $R$ and $Xcore.R$ so is circular, 
+as for the core_shell_bicelle model, for $Xcore$ =1. Note that you may need to 
+limit the range of $Xcore$, especially if using the Monte-Carlo algorithm, as 
+setting radius to $R/Xcore$ and axial ratio to $1/Xcore$ gives an equivalent solution!
+
+An approximation for the effects of "Gaussian interfacial roughness" $\sigma$ is included, 
+by multiplying $I(Q)$ by $exp\left \{ -\frac{1}{2}Q^2\sigma^2 \right \}$ . This 
+applies, in some way, to all interfaces in the model not just the external ones.
+(Note that for a one dimensional system convolution of the scattering length density profile
+with a Gaussian of standard deviation $\sigma$ does exactly this multiplication.) Leave 
+$\sigma$ set to zero for the usual sharp interfaces.
+
+The output of the 1D scattering intensity function for randomly oriented
+bicelles is then given by integrating over all possible $\alpha$ and $\psi$.
+
+For oriented bicelles the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data, 
+for further details of the calculation and angular dispersions  see :ref:`orientation` .
+
+.. figure:: img/elliptical_cylinder_angle_definition.png
+
+    Definition of the angles for the oriented core_shell_bicelle_elliptical particles.   
+
+
+
+References
+----------
+
+.. [#]
+
+Authorship and Verification
+----------------------------
+
+* **Author:** Richard Heenan **Date:** October 5, 2017
+* **Last Modified by:**  Richard Heenan new 2d orientation **Date:** October 5, 2017
+* **Last Reviewed by:**  Richard Heenan 2d calc seems agree with 1d **Date:** Nov 2, 2017
+"""
+
+from numpy import inf, sin, cos, pi
+
+name = "core_shell_bicelle_elliptical_belt_rough"
+title = "Elliptical cylinder with a core-shell scattering length density profile.."
+description = """
+    core_shell_bicelle_elliptical_belt_rough
+    Elliptical cylinder core, optional shell on the two flat faces, and "belt" shell of 
+    uniform thickness on its rim (in this case NOT extending around the end faces).
+    with approximate interfacial roughness.
+    Please see full documentation for equations and further details.
+    Involves a double numerical integral around the ellipsoid diameter
+    and the angle of the cylinder axis to Q.
+    Compare also the core_shell_bicelle and elliptical_cylinder models.
+      """
+category = "shape:cylinder"
+
+# pylint: disable=bad-whitespace, line-too-long
+#             ["name", "units", default, [lower, upper], "type", "description"],
+parameters = [
+    ["radius",         "Ang",       30, [0, inf],    "volume",      "Cylinder core radius"],
+    ["x_core",        "None",       3,  [0, inf],    "volume",      "axial ratio of core, X = r_polar/r_equatorial"],
+    ["thick_rim",  "Ang",            8, [0, inf],    "volume",      "Rim or belt shell thickness"],
+    ["thick_face", "Ang",           14, [0, inf],    "volume",      "Cylinder face thickness"],
+    ["length",         "Ang",       50, [0, inf],    "volume",      "Cylinder length"],
+    ["sld_core",       "1e-6/Ang^2", 4, [-inf, inf], "sld",         "Cylinder core scattering length density"],
+    ["sld_face",       "1e-6/Ang^2", 7, [-inf, inf], "sld",         "Cylinder face scattering length density"],
+    ["sld_rim",        "1e-6/Ang^2", 1, [-inf, inf], "sld",         "Cylinder rim scattering length density"],
+    ["sld_solvent",    "1e-6/Ang^2", 6, [-inf, inf], "sld",         "Solvent scattering length density"],
+    ["theta",       "degrees",    90.0, [-360, 360], "orientation", "cylinder axis to beam angle"],
+    ["phi",         "degrees",    0,    [-360, 360], "orientation", "rotation about beam"],
+    ["psi",         "degrees",    0,    [-360, 360], "orientation", "rotation about cylinder axis"],
+    ["sigma",       "Ang",        0,    [0, inf],    "",            "interfacial roughness"]
+    ]
+
+# pylint: enable=bad-whitespace, line-too-long
+
+source = ["lib/sas_Si.c", "lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c",
+          "core_shell_bicelle_elliptical_belt_rough.c"]
+
+demo = dict(scale=1, background=0,
+            radius=30.0,
+            x_core=3.0,
+            thick_rim=8.0,
+            thick_face=14.0,
+            length=50.0,
+            sld_core=4.0,
+            sld_face=7.0,
+            sld_rim=1.0,
+            sld_solvent=6.0,
+            theta=90,
+            phi=0,
+            psi=0,
+            sigma=0)
+
+q = 0.1
+# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct!
+qx = q*cos(pi/6.0)
+qy = q*sin(pi/6.0)
+
+tests = [
+    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'ER', 1],
+    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0}, 'VR', 1],
+
+    [{'radius': 30.0, 'x_core': 3.0, 'thick_rim':8.0, 'thick_face':14.0, 'length':50.0,
+    'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0},
+    0.015, 189.328],
+#    [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ],
+        ]
+
+del qx, qy  # not necessary to delete, but cleaner
