Index: sansmodels/include/TwoYukawa.h
===================================================================
--- sansmodels/include/TwoYukawa.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
+++ sansmodels/include/TwoYukawa.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -0,0 +1,57 @@
+#if !defined(TwoYukawa_h)
+#define TwoYukawa_h
+#include "parameters.hh"
+
+/**
+ * Structure definition for TwoYukawaModel (factor) parameters
+ */
+//[PYTHONCLASS] = TwoYukawaModel
+//[DESCRIPTION] =<text>Structure factor for interacting particles:                   .
+//
+//  Calculates the structure factor, S(q), for a monodisperse spherical particle interacting 
+//  through a two-Yukawa potential. The Mean Spherical Approximation is used as the 
+//  closure to solve the Ornstein-Zernicke equations.
+//
+//  The function calculated is S(q), based on the solution of the Ornstein-Zernicke equations 
+//  using the Two-Yukawa potential (in its scaled form, r=r/diam):
+//
+//  Radius is that of the hard core. The returned value is dimensionless.
+//	 </text>
+
+
+class TwoYukawaModel{
+public:
+
+  // Model parameters
+
+  /// Something volfraction
+  //  [DEFAULT]=volfraction= 0.2
+  Parameter volfraction;
+  
+  //  [DEFAULT]=effect_radius= 50.0 [A]
+  Parameter effect_radius;
+  
+  //  [DEFAULT]=scale_K1= 6.0
+  Parameter scale_K1;
+  
+  //  [DEFAULT]=decayConst_Z1= 10.0
+  Parameter decayConst_Z1;
+  
+  //  [DEFAULT]=scale_K2= -1.0
+  Parameter scale_K2;
+  
+  //  [DEFAULT]=decayConst_Z2= 2.0
+  Parameter decayConst_Z2;
+
+  // Constructor
+  TwoYukawaModel();
+
+  // 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
Index: sansmodels/include/core_shell.h
===================================================================
--- sansmodels/include/core_shell.h	(revision 6319646cf4d15b5499c126bb1c51f51bca2f1500)
+++ sansmodels/include/core_shell.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -20,4 +20,6 @@
  //				</text>
  //[FIXED]= <text> thickness.width;radius.width</text>
+ //[ORIENTATION_PARAMS]= <text> M0_sld_shell; M_theta_shell; M_phi_shell; M0_sld_core; M_theta_core; M_phi_core;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
+ //[MAGNETIC_PARAMS]= <text>  M0_sld_shell; M_theta_shell; M_phi_shell;M0_sld_core; M_theta_core; M_phi_core; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
 
 
@@ -48,4 +50,52 @@
   Parameter background;
 
+/// M0_sld_shell
+//  [DEFAULT]=M0_sld_shell=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_shell;
+
+/// M_theta_shell
+//  [DEFAULT]=M_theta_shell=0.0 [deg]
+  Parameter M_theta_shell;
+
+/// M_phi_shell
+//  [DEFAULT]=M_phi_shell=0.0 [deg]
+  Parameter M_phi_shell;
+
+/// M0_sld_core
+//  [DEFAULT]=M0_sld_core=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_core;
+
+/// M_theta_core
+//  [DEFAULT]=M_theta_core=0.0 [deg]
+  Parameter M_theta_core;
+
+/// M_phi_core
+//  [DEFAULT]=M_phi_core=0.0 [deg]
+  Parameter M_phi_core;
+
+/// M0_sld_solv
+//  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_solv;
+
+/// M_theta_solv
+//  [DEFAULT]=M_theta_solv=0.0 [deg]
+  Parameter M_theta_solv;
+
+/// M_phi_solv
+//  [DEFAULT]=M_phi_solv=0.0 [deg]
+  Parameter M_phi_solv;
+
+/// Up_frac_i
+//  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
+  Parameter Up_frac_i;
+
+/// Up_frac_f
+//  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
+  Parameter Up_frac_f;
+
+/// Up_theta
+//  [DEFAULT]=Up_theta=0.0 [deg]
+  Parameter Up_theta;
+
   // Constructor
   CoreShellModel();
Index: sansmodels/include/corefourshell.h
===================================================================
--- sansmodels/include/corefourshell.h	(revision 6319646cf4d15b5499c126bb1c51f51bca2f1500)
+++ sansmodels/include/corefourshell.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -18,5 +18,7 @@
 //		</text>
 //[FIXED]=<text>  thick_shell4.width; thick_shell1.width;thick_shell2.width;thick_shell3.width;rad_core0.width </text>
-//[ORIENTATION_PARAMS]= <text> </text>
+//[ORIENTATION_PARAMS]= <text> M0_sld_shell4; M_theta_shell4; M_phi_shell4;M0_sld_shell3; M_theta_shell3; M_phi_shell3; M0_sld_shell2; M_theta_shell2; M_phi_shell2;M0_sld_shell1; M_theta_shell1; M_phi_shell1; M0_sld_core0; M_theta_core0; M_phi_core0;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
+//[MAGNETIC_PARAMS]= <text>  M0_sld_shell4; M_theta_shell4; M_phi_shell4;M0_sld_shell3; M_theta_shell3; M_phi_shell3;M0_sld_shell2; M_theta_shell2; M_phi_shell2;M0_sld_shell1; M_theta_shell1; M_phi_shell1; M0_sld_core0; M_theta_core0; M_phi_core0; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
+
 
 class CoreFourShellModel{
@@ -75,4 +77,88 @@
   Parameter background;
 
+  /// M0_sld_shell1
+  //  [DEFAULT]=M0_sld_shell1=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_shell1;
+
+  /// M_theta_shell1
+  //  [DEFAULT]=M_theta_shell1=0.0 [deg]
+  Parameter M_theta_shell1;
+
+  /// M_phi_shell1
+  //  [DEFAULT]=M_phi_shell1=0.0 [deg]
+  Parameter M_phi_shell1;
+
+  /// M0_sld_shell2
+  //  [DEFAULT]=M0_sld_shell2=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_shell2;
+
+  /// M_theta_shell2
+  //  [DEFAULT]=M_theta_shell2=0.0 [deg]
+  Parameter M_theta_shell2;
+
+  /// M_phi_shell2
+  //  [DEFAULT]=M_phi_shell2=0.0 [deg]
+  Parameter M_phi_shell2;
+
+  /// M0_sld_shell3
+  //  [DEFAULT]=M0_sld_shell3=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_shell3;
+
+  /// M_theta_shell3
+  //  [DEFAULT]=M_theta_shell3=0.0 [deg]
+  Parameter M_theta_shell3;
+
+  /// M_phi_shell3
+  //  [DEFAULT]=M_phi_shell3=0.0 [deg]
+  Parameter M_phi_shell3;
+
+  /// M0_sld_shell4
+  //  [DEFAULT]=M0_sld_shell4=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_shell4;
+
+  /// M_theta_shell4
+  //  [DEFAULT]=M_theta_shell4=0.0 [deg]
+  Parameter M_theta_shell4;
+
+  /// M_phi_shell4
+  //  [DEFAULT]=M_phi_shell4=0.0 [deg]
+  Parameter M_phi_shell4;
+
+  /// M0_sld_core0
+  //  [DEFAULT]=M0_sld_core0=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_core0;
+
+  /// M_theta_core0
+  //  [DEFAULT]=M_theta_core0=0.0 [deg]
+  Parameter M_theta_core0;
+
+  /// M_phi_core0
+  //  [DEFAULT]=M_phi_core0=0.0 [deg]
+  Parameter M_phi_core0;
+
+  /// M0_sld_solv
+  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_solv;
+
+  /// M_theta_solv
+  //  [DEFAULT]=M_theta_solv=0.0 [deg]
+  Parameter M_theta_solv;
+
+  /// M_phi_solv
+  //  [DEFAULT]=M_phi_solv=0.0 [deg]
+  Parameter M_phi_solv;
+
+  /// Up_frac_i
+  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
+  Parameter Up_frac_i;
+
+  /// Up_frac_f
+  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
+  Parameter Up_frac_f;
+
+  /// Up_theta
+  //  [DEFAULT]=Up_theta=0.0 [deg]
+  Parameter Up_theta;
+
   // Constructor
   CoreFourShellModel();
Index: sansmodels/include/cylinder.h
===================================================================
--- sansmodels/include/cylinder.h	(revision 6319646cf4d15b5499c126bb1c51f51bca2f1500)
+++ sansmodels/include/cylinder.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -21,6 +21,6 @@
 		</text>
 	[FIXED]= <text>cyl_phi.width; cyl_theta.width; length.width;radius.width</text>
-	[ORIENTATION_PARAMS]= <text>cyl_phi; cyl_theta; cyl_phi.width; cyl_theta.width</text>
-
+	[ORIENTATION_PARAMS]= <text>cyl_phi; cyl_theta; cyl_phi.width; cyl_theta.width;M0_sld_cyl; M_theta_cyl; M_phi_cyl;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta;</text>
+	[MAGNETIC_PARAMS]= <text> M0_sld_cyl; M_theta_cyl; M_phi_cyl; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
 
  **/
@@ -61,4 +61,40 @@
   Parameter cyl_phi;
 
+  /// M0_sld_cyl
+  //  [DEFAULT]=M0_sld_cyl=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_cyl;
+
+  /// M_theta_cyl
+  //  [DEFAULT]=M_theta_cyl=0.0 [deg]
+  Parameter M_theta_cyl;
+
+  /// M_phi_cyl
+  //  [DEFAULT]=M_phi_cyl=0.0 [deg]
+  Parameter M_phi_cyl;
+
+  /// M0_sld_solv
+  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_solv;
+
+  /// M_theta_solv
+  //  [DEFAULT]=M_theta_solv=0.0 [deg]
+  Parameter M_theta_solv;
+
+  /// M_phi_solv
+  //  [DEFAULT]=M_phi_solv=0.0 [deg]
+  Parameter M_phi_solv;
+
+  /// Up_frac_i
+  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
+  Parameter Up_frac_i;
+
+  /// Up_frac_f
+  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
+  Parameter Up_frac_f;
+
+  /// Up_theta
+  //  [DEFAULT]=Up_theta=0.0 [deg]
+  Parameter Up_theta;
+
   // Constructor
   CylinderModel();
Index: sansmodels/include/libmultifunc/libfunc.h
===================================================================
--- sansmodels/include/libmultifunc/libfunc.h	(revision 5da3cc57a0d2568f3d27414a6c82006204b81eca)
+++ sansmodels/include/libmultifunc/libfunc.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -1,4 +1,12 @@
 #if !defined(o_h)
 #define libfunc_h
+typedef struct {
+	double uu;
+	double dd;
+	double re_ud;
+	double im_ud;
+	double re_du;
+	double im_du;
+} polar_sld;
 
 int factorial(int i);
@@ -9,4 +17,7 @@
 
 double gamln(double x);
+
+polar_sld cal_msld(int isangle, double qx, double qy, double bn, double m01, double mtheta1, 
+			double mphi1, double spinfraci, double spinfracf, double spintheta);
 
 void gser(float *gamser, float a, float x, float *gln);
Index: sansmodels/include/parallelepiped.h
===================================================================
--- sansmodels/include/parallelepiped.h	(revision 6319646cf4d15b5499c126bb1c51f51bca2f1500)
+++ sansmodels/include/parallelepiped.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -17,6 +17,6 @@
 		</text>
 	[FIXED]= <text>short_a.width; short_b.width; long_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-	[ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width</text>
-
+	[ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width; M0_sld_pipe; M_theta_pipe; M_phi_pipe;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta;</text>
+	[MAGNETIC_PARAMS]= <text> M0_sld_pipe; M_theta_pipe; M_phi_pipe; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
 
  **/
@@ -56,4 +56,40 @@
   Parameter parallel_psi;
 
+  /// M0_sld_pipe
+  //  [DEFAULT]=M0_sld_pipe=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_pipe;
+
+  /// M_theta_pipe
+  //  [DEFAULT]=M_theta_pipe=0.0 [deg]
+  Parameter M_theta_pipe;
+
+  /// M_phi_pipe
+  //  [DEFAULT]=M_phi_pipe=0.0 [deg]
+  Parameter M_phi_pipe;
+
+  /// M0_sld_solv
+  //  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
+  Parameter M0_sld_solv;
+
+  /// M_theta_solv
+  //  [DEFAULT]=M_theta_solv=0.0 [deg]
+  Parameter M_theta_solv;
+
+  /// M_phi_solv
+  //  [DEFAULT]=M_phi_solv=0.0 [deg]
+  Parameter M_phi_solv;
+
+  /// Up_frac_i
+  //  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
+  Parameter Up_frac_i;
+
+  /// Up_frac_f
+  //  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
+  Parameter Up_frac_f;
+
+  /// Up_theta
+  //  [DEFAULT]=Up_theta=0.0 [deg]
+  Parameter Up_theta;
+  
   // Constructor
   ParallelepipedModel();
Index: sansmodels/include/sphere.h
===================================================================
--- sansmodels/include/sphere.h	(revision fa6db8bddd1335d532cec83bac89eb720c235a65)
+++ sansmodels/include/sphere.h	(revision 318b5bbbcb046db18a8e953dccae04fc7b8a71e0)
@@ -18,39 +18,77 @@
  //		</text>
  //[FIXED]=  radius.width
- //[ORIENTATION_PARAMS]= <text> </text>
+ //[ORIENTATION_PARAMS]= <text> M0_sld_sph; M_theta_sph; M_phi_sph;M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
+ //[MAGNETIC_PARAMS]= <text> M0_sld_sph; M_theta_sph; M_phi_sph; M0_sld_solv; M_theta_solv; M_phi_solv; Up_frac_i; Up_frac_f; Up_theta; </text>
  //[CATEGORY] = Shapes & Spheres
-
+ 
 class SphereModel{
 public:
-  // Model parameters
-  /// Scale factor
-  //  [DEFAULT]=scale= 1.0
-  Parameter scale;
+	// Model parameters
+	/// Scale factor
+	//  [DEFAULT]=scale= 1.0
+	Parameter scale;
 
-  /// Radius of sphere [A]
-  //  [DEFAULT]=radius=60.0 [A]
-  Parameter radius;
+	/// Radius of sphere [A]
+	//  [DEFAULT]=radius=60.0 [A]
+	Parameter radius;
 
-  /// sldSph [1/A^(2)]
-  //  [DEFAULT]=sldSph= 2.0e-6 [1/A^(2)]
-  Parameter sldSph;
+	/// sldSph [1/A^(2)]
+	//  [DEFAULT]=sldSph= 2.0e-6 [1/A^(2)]
+	Parameter sldSph;
 
-  /// sldSolv [1/A^(2)]
-  //  [DEFAULT]=sldSolv= 1.0e-6 [1/A^(2)]
-  Parameter sldSolv;
+	/// sldSolv [1/A^(2)]
+	//  [DEFAULT]=sldSolv= 1.0e-6 [1/A^(2)]
+	Parameter sldSolv;
 
-/// Incoherent Background [1/cm]
-//  [DEFAULT]=background=0 [1/cm]
-Parameter background;
+	/// Incoherent Background [1/cm]
+	//  [DEFAULT]=background=0 [1/cm]
+	Parameter background;
 
-  // Constructor
-  SphereModel();
+	/// M0_sld_sph
+	//  [DEFAULT]=M0_sld_sph=0.0e-6 [1/A^(2)]
+	Parameter M0_sld_sph;
 
-  // 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);
+	/// M_theta_sph
+	//  [DEFAULT]=M_theta_sph=0.0 [deg]
+	Parameter M_theta_sph;
+
+	/// M_phi_sph
+	//  [DEFAULT]=M_phi_sph=0.0 [deg]
+	Parameter M_phi_sph;
+
+	/// M0_sld_solv
+	//  [DEFAULT]=M0_sld_solv=0.0e-6 [1/A^(2)]
+	Parameter M0_sld_solv;
+
+	/// M_theta_solv
+	//  [DEFAULT]=M_theta_solv=0.0 [deg]
+	Parameter M_theta_solv;
+
+	/// M_phi_solv
+	//  [DEFAULT]=M_phi_solv=0.0 [deg]
+	Parameter M_phi_solv;
+	
+	/// Up_frac_i
+	//  [DEFAULT]=Up_frac_i=0.5 [u/(u+d)]
+	Parameter Up_frac_i;
+
+	/// Up_frac_f
+	//  [DEFAULT]=Up_frac_f=0.5 [u/(u+d)]
+	Parameter Up_frac_f;
+
+	/// Up_theta
+	//  [DEFAULT]=Up_theta=0.0 [deg]
+	Parameter Up_theta;
+
+
+	// Constructor
+	SphereModel();
+
+	// 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);
 };
 
