Index: sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_models/CHardsphereStructure.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -175,5 +175,5 @@
  {
     PyArrayObject *result;
-    int i,j, x_len, y_len, dims[1];
+    int i, x_len, dims[1];
     //check validity of input vectors
     if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
@@ -188,5 +188,4 @@
 		
 	    x_len = dims[0]= x->dimensions[0];
-        y_len = dims[0]= y->dimensions[0];
 	    
 	    // Make a new double matrix of same dims
@@ -346,7 +345,4 @@
 static PyObject * calculate_ER(CHardsphereStructure *self) {
 
-	PyObject* pars;
-	int npars;
-	
 	// Get parameters
 	
Index: sansmodels/src/sans/models/c_models/barbell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/barbell.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/barbell.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -83,9 +83,9 @@
 	pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_bar.size(); i++) {
+	for(size_t i=0; i<weights_rad_bar.size(); i++) {
 		dp[1] = weights_rad_bar[i].value;
-		for(int j=0; j<weights_len_bar.size(); j++) {
+		for(size_t j=0; j<weights_len_bar.size(); j++) {
 			dp[2] = weights_len_bar[j].value;
-			for(int k=0; k<weights_rad_bell.size(); k++) {
+			for(size_t k=0; k<weights_rad_bell.size(); k++) {
 				dp[3] = weights_rad_bell[k].value;
 
@@ -125,5 +125,4 @@
 	BarBellParameters dp;
 
-	double q = sqrt(qx*qx + qy*qy);
 	dp.scale = scale();
 	dp.rad_bar = rad_bar();
@@ -163,20 +162,20 @@
 	double norm_vol = 0.0;
 	double vol = 0.0;
-	double pi,hDist,result;
+	double pi,hDist;
 	double vol_i = 0.0;
 	pi = 4.0*atan(1.0);
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_bar.size(); i++) {
+	for(size_t i=0; i<weights_rad_bar.size(); i++) {
 		dp.rad_bar = weights_rad_bar[i].value;
-		for(int j=0; j<weights_len_bar.size(); j++) {
+		for(size_t j=0; j<weights_len_bar.size(); j++) {
 			dp.len_bar = weights_len_bar[j].value;
-			for(int k=0; k<weights_rad_bell.size(); k++) {
+			for(size_t k=0; k<weights_rad_bell.size(); k++) {
 				dp.rad_bell = weights_rad_bell[k].value;
 				// Average over theta distribution
-				for(int l=0; l< weights_theta.size(); l++) {
+				for(size_t l=0; l< weights_theta.size(); l++) {
 					dp.theta = weights_theta[l].value;
 					// Average over phi distribution
-					for(int m=0; m< weights_phi.size(); m++) {
+					for(size_t m=0; m< weights_phi.size(); m++) {
 						dp.phi = weights_phi[m].value;
 						//Un-normalize Form by volume
@@ -251,3 +250,4 @@
 double BarBellModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/bcc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/bcc.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/bcc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -75,5 +75,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[3] = weights_rad[i].value;
 
@@ -107,5 +107,4 @@
 double BCCrystalModel :: operator()(double qx, double qy) {
 	BCParameters dp;
-	double q = sqrt(qx*qx + qy*qy);
 	dp.scale      = scale();
 	dp.dnn   = dnn();
@@ -142,14 +141,14 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.radius = weights_rad[i].value;
 		// Average over theta distribution
-		for(int j=0; j< weights_theta.size(); j++) {
+		for(size_t j=0; j< weights_theta.size(); j++) {
 			dp.theta = weights_theta[j].value;
 			// Average over phi distribution
-			for(int k=0; k< weights_phi.size(); k++) {
+			for(size_t k=0; k< weights_phi.size(); k++) {
 				dp.phi = weights_phi[k].value;
 				// Average over phi distribution
-				for(int l=0; l< weights_psi.size(); l++) {
+				for(size_t l=0; l< weights_psi.size(); l++) {
 					dp.psi = weights_psi[l].value;
 					//Un-normalize SphereForm by volume
@@ -207,3 +206,4 @@
 double BCCrystalModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/binaryHS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/binaryHS.cpp	(revision f9bf66165686c721c2f0b3a197f7dda1822721ad)
+++ sansmodels/src/sans/models/c_models/binaryHS.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -122,5 +122,5 @@
 double BinaryHSModel :: calculate_ER() {
 	//NOT implemented yet!!!
-	double rad_out;
+	return 0.0;
 }
 
Index: sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp	(revision f9bf66165686c721c2f0b3a197f7dda1822721ad)
+++ sansmodels/src/sans/models/c_models/binaryHS_PSF11.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -120,3 +120,4 @@
 double BinaryHSPSF11Model :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/capcyl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/capcyl.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/capcyl.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -83,9 +83,9 @@
 	pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_cyl.size(); i++) {
+	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
 		dp[1] = weights_rad_cyl[i].value;
-		for(int j=0; j<weights_len_cyl.size(); j++) {
+		for(size_t j=0; j<weights_len_cyl.size(); j++) {
 			dp[2] = weights_len_cyl[j].value;
-			for(int k=0; k<weights_rad_cap.size(); k++) {
+			for(size_t k=0; k<weights_rad_cap.size(); k++) {
 				dp[3] = weights_rad_cap[k].value;
 
@@ -125,5 +125,4 @@
 	CapCylParameters dp;
 
-	double q = sqrt(qx*qx + qy*qy);
 	dp.scale = scale();
 	dp.rad_cyl = rad_cyl();
@@ -162,20 +161,20 @@
 	double norm_vol = 0.0;
 	double vol = 0.0;
-	double pi,hDist,result;
+	double pi,hDist;
 	double vol_i = 0.0;
 	pi = 4.0*atan(1.0);
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_cyl.size(); i++) {
+	for(size_t i=0; i<weights_rad_cyl.size(); i++) {
 		dp.rad_cyl = weights_rad_cyl[i].value;
-		for(int j=0; j<weights_len_cyl.size(); j++) {
+		for(size_t j=0; j<weights_len_cyl.size(); j++) {
 			dp.len_cyl = weights_len_cyl[j].value;
-			for(int k=0; k<weights_rad_cap.size(); k++) {
+			for(size_t k=0; k<weights_rad_cap.size(); k++) {
 				dp.rad_cap = weights_rad_cap[k].value;
 				// Average over theta distribution
-				for(int l=0; l< weights_theta.size(); l++) {
+				for(size_t l=0; l< weights_theta.size(); l++) {
 					dp.theta = weights_theta[l].value;
 					// Average over phi distribution
-					for(int m=0; m< weights_phi.size(); m++) {
+					for(size_t m=0; m< weights_phi.size(); m++) {
 						dp.phi = weights_phi[m].value;
 						//Un-normalize Form by volume
@@ -250,3 +249,4 @@
 double CappedCylinderModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/corefourshell.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/corefourshell.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/corefourshell.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -103,17 +103,17 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 		// Loop over radius weight points
-		for(int j=0; j<weights_s1.size(); j++) {
+		for(size_t j=0; j<weights_s1.size(); j++) {
 			dp[3] = weights_s1[j].value;
 			// Loop over radius weight points
-			for(int k=0; k<weights_s2.size(); k++) {
+			for(size_t k=0; k<weights_s2.size(); k++) {
 				dp[5] = weights_s2[k].value;
 				// Loop over radius weight points
-				for(int l=0; l<weights_s3.size(); l++) {
+				for(size_t l=0; l<weights_s3.size(); l++) {
 					dp[7] = weights_s3[l].value;
 					// Loop over radius weight points
-					for(int m=0; m<weights_s4.size(); m++) {
+					for(size_t m=0; m<weights_s4.size(); m++) {
 						dp[9] = weights_s4[m].value;
 						//Un-normalize FourShell by volume
@@ -206,17 +206,17 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.rad_core0 = weights_rad[i].value;
 		// Loop over radius weight points
-		for(int j=0; j<weights_s1.size(); j++) {
+		for(size_t j=0; j<weights_s1.size(); j++) {
 			dp.thick_shell1 = weights_s1[j].value;
 			// Loop over radius weight points
-			for(int k=0; k<weights_s2.size(); k++) {
+			for(size_t k=0; k<weights_s2.size(); k++) {
 				dp.thick_shell2 = weights_s2[k].value;
 				// Loop over radius weight points
-				for(int l=0; l<weights_s3.size(); l++) {
+				for(size_t l=0; l<weights_s3.size(); l++) {
 					dp.thick_shell3 = weights_s3[l].value;
 					// Loop over radius weight points
-					for(int m=0; m<weights_s4.size(); m++) {
+					for(size_t m=0; m<weights_s4.size(); m++) {
 						dp.thick_shell4 = weights_s4[m].value;
 						//Un-normalize FourShell by volume
Index: sansmodels/src/sans/models/c_models/coreshellcylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/coreshellcylinder.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/coreshellcylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -85,13 +85,13 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp[3] = weights_len[j].value;
 
 			// Loop over thickness weight points
-			for(int k=0; k<weights_thick.size(); k++) {
+			for(size_t k=0; k<weights_thick.size(); k++) {
 				dp[2] = weights_thick[k].value;
 				//Un-normalize by volume
@@ -169,22 +169,22 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.radius = weights_rad[i].value;
 
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp.length = weights_len[j].value;
 
 			// Loop over thickness weight points
-			for(int m=0; m<weights_thick.size(); m++) {
+			for(size_t m=0; m<weights_thick.size(); m++) {
 				dp.thickness = weights_thick[m].value;
 
 			// Average over theta distribution
-			for(int k=0; k<weights_theta.size(); k++) {
+			for(size_t k=0; k<weights_theta.size(); k++) {
 				dp.axis_theta = weights_theta[k].value;
 
 				// Average over phi distribution
-				for(int l=0; l<weights_phi.size(); l++) {
+				for(size_t l=0; l<weights_phi.size(); l++) {
 					dp.axis_phi = weights_phi[l].value;
 					//Un-normalize by volume
Index: sansmodels/src/sans/models/c_models/coreshellsphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/coreshellsphere.cpp	(revision c451be953dd7ec3d17683e043145313f5c761ac0)
+++ sansmodels/src/sans/models/c_models/coreshellsphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -78,9 +78,9 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
 		// Loop over thickness weight points
-		for(int j=0; j<weights_thick.size(); j++) {
+		for(size_t j=0; j<weights_thick.size(); j++) {
 			dp[2] = weights_thick[j].value;
 			//Un-normalize SphereForm by volume
Index: sansmodels/src/sans/models/c_models/cylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/cylinder.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/cylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -78,9 +78,9 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp[2] = weights_len[j].value;
 			//Un-normalize by volume
@@ -144,18 +144,18 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.radius = weights_rad[i].value;
 
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp.length = weights_len[j].value;
 
 			// Average over theta distribution
-			for(int k=0; k<weights_theta.size(); k++) {
+			for(size_t k=0; k<weights_theta.size(); k++) {
 				dp.cyl_theta = weights_theta[k].value;
 
 				// Average over phi distribution
-				for(int l=0; l<weights_phi.size(); l++) {
+				for(size_t l=0; l<weights_phi.size(); l++) {
 					dp.cyl_phi = weights_phi[l].value;
 					//Un-normalize by volume
Index: sansmodels/src/sans/models/c_models/ellipsoid.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/ellipsoid.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/ellipsoid.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -78,9 +78,9 @@
 
 	// Loop over radius_a weight points
-	for(int i=0; i<weights_rad_a.size(); i++) {
+	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(int j=0; j<weights_rad_b.size(); j++) {
+		for(size_t j=0; j<weights_rad_b.size(); j++) {
 			dp[2] = weights_rad_b[j].value;
 			//Un-normalize  by volume
@@ -147,18 +147,18 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_a.size(); i++) {
+	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(int j=0; j<weights_rad_b.size(); j++) {
+		for(size_t j=0; j<weights_rad_b.size(); j++) {
 			dp.radius_b = weights_rad_b[j].value;
 
 			// Average over theta distribution
-			for(int k=0; k<weights_theta.size(); k++) {
+			for(size_t k=0; k<weights_theta.size(); k++) {
 				dp.axis_theta = weights_theta[k].value;
 
 				// Average over phi distribution
-				for(int l=0; l<weights_phi.size(); l++) {
+				for(size_t l=0; l<weights_phi.size(); l++) {
 					dp.axis_phi = weights_phi[l].value;
 					//Un-normalize by volume
Index: sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/ellipticalcylinder.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -84,13 +84,13 @@
 
 	// Loop over r_minor weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
 		// Loop over r_ratio weight points
-		for(int j=0; j<weights_rat.size(); j++) {
+		for(size_t j=0; j<weights_rat.size(); j++) {
 			dp[2] = weights_rat[j].value;
 
 			// Loop over length weight points
-			for(int k=0; k<weights_len.size(); k++) {
+			for(size_t k=0; k<weights_len.size(); k++) {
 				dp[3] = weights_len[k].value;
 				//Un-normalize  by volume
@@ -172,26 +172,26 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over minor radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.r_minor = weights_rad[i].value;
 
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp.length = weights_len[j].value;
 
 			// Loop over r_ration weight points
-			for(int m=0; m<weights_rat.size(); m++) {
+			for(size_t m=0; m<weights_rat.size(); m++) {
 				dp.r_ratio = weights_rat[m].value;
 
 			// Average over theta distribution
-			for(int k=0; k<weights_theta.size(); k++) {
+			for(size_t k=0; k<weights_theta.size(); k++) {
 				dp.cyl_theta = weights_theta[k].value;
 
 				// Average over phi distribution
-				for(int l=0; l<weights_phi.size(); l++) {
+				for(size_t l=0; l<weights_phi.size(); l++) {
 					dp.cyl_phi = weights_phi[l].value;
 
 				// Average over phi distribution
-				for(int o=0; o<weights_psi.size(); o++) {
+				for(size_t o=0; o<weights_psi.size(); o++) {
 					dp.cyl_psi = weights_psi[o].value;
 					//Un-normalize by volume
@@ -270,5 +270,4 @@
 	dp.length     = length();
 	double rad_out = 0.0;
-	double pi = 4.0*atan(1.0);
 	double suf_rad = sqrt(dp.r_minor*dp.r_minor*dp.r_ratio);
 
@@ -290,13 +289,13 @@
 
 	// Loop over minor radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.r_minor = weights_rad[i].value;
 
 		// Loop over length weight points
-		for(int j=0; j<weights_len.size(); j++) {
+		for(size_t j=0; j<weights_len.size(); j++) {
 			dp.length = weights_len[j].value;
 
 			// Loop over r_ration weight points
-			for(int m=0; m<weights_rat.size(); m++) {
+			for(size_t m=0; m<weights_rat.size(); m++) {
 				dp.r_ratio = weights_rat[m].value;
 				//Calculate surface averaged radius
Index: sansmodels/src/sans/models/c_models/fcc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fcc.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/fcc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -75,5 +75,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[3] = weights_rad[i].value;
 
@@ -107,5 +107,4 @@
 double FCCrystalModel :: operator()(double qx, double qy) {
 	FCParameters dp;
-	double q = sqrt(qx*qx + qy*qy);
 	dp.scale      = scale();
 	dp.dnn   = dnn();
@@ -142,14 +141,14 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.radius = weights_rad[i].value;
 		// Average over theta distribution
-		for(int j=0; j< weights_theta.size(); j++) {
+		for(size_t j=0; j< weights_theta.size(); j++) {
 			dp.theta = weights_theta[j].value;
 			// Average over phi distribution
-			for(int k=0; k< weights_phi.size(); k++) {
+			for(size_t k=0; k< weights_phi.size(); k++) {
 				dp.phi = weights_phi[k].value;
 				// Average over phi distribution
-				for(int l=0; l< weights_psi.size(); l++) {
+				for(size_t l=0; l< weights_psi.size(); l++) {
 					dp.psi = weights_psi[l].value;
 					//Un-normalize SphereForm by volume
@@ -206,3 +205,4 @@
 double FCCrystalModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/fractal.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fractal.cpp	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ sansmodels/src/sans/models/c_models/fractal.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -71,5 +71,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
@@ -118,3 +118,4 @@
 double FractalModel :: calculate_ER() {
 	//NOT implemented yet!!! 'cause None shape Model
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/fuzzysphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/fuzzysphere.cpp	(revision c724ccd87499a21402fee0d11d517066f99ddf9b)
+++ sansmodels/src/sans/models/c_models/fuzzysphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -68,8 +68,8 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_radius.size(); i++) {
+	for(size_t i=0; i<weights_radius.size(); i++) {
 		dp[1] = weights_radius[i].value;
 		// Loop over fuzziness weight points
-		for(int j=0; j<weights_fuzziness.size(); j++) {
+		for(size_t j=0; j<weights_fuzziness.size(); j++) {
 			dp[2] = weights_fuzziness[j].value;
 
@@ -119,11 +119,4 @@
  */
 double FuzzySphereModel :: calculate_ER() {
-	FuzzySphereParameters dp;
-	dp.scale = scale();
-	dp.radius = radius();
-	dp.fuzziness = fuzziness();
-	dp.sldSph = sldSph();
-	dp.sldSolv = sldSolv();
-	dp.background = background();
 	double rad_out = 0.0;
 
@@ -137,5 +130,5 @@
 	radius.get_weights(weights_radius);
 	// Loop over radius weight points to average the radius value
-	for(int i=0; i<weights_radius.size(); i++) {
+	for(size_t i=0; i<weights_radius.size(); i++) {
 		sum += weights_radius[i].weight
 			* weights_radius[i].value;
Index: sansmodels/src/sans/models/c_models/lamellar.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellar.cpp	(revision f9bf66165686c721c2f0b3a197f7dda1822721ad)
+++ sansmodels/src/sans/models/c_models/lamellar.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -106,3 +106,4 @@
 double LamellarModel :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp	(revision f9bf66165686c721c2f0b3a197f7dda1822721ad)
+++ sansmodels/src/sans/models/c_models/lamellarFF_HG.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -119,3 +119,4 @@
 double LamellarFFHGModel :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/lamellarPC.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPC.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/lamellarPC.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -118,3 +118,4 @@
 double LamellarPCrystalModel :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/lamellarPS.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision f10063e8f3c53d2be93abaea9c0d3d4f3061d444)
+++ sansmodels/src/sans/models/c_models/lamellarPS.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -117,4 +117,5 @@
 double LamellarPSModel :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
 
Index: sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp	(revision f9bf66165686c721c2f0b3a197f7dda1822721ad)
+++ sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -135,4 +135,5 @@
 double LamellarPSHGModel :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
 
Index: sansmodels/src/sans/models/c_models/onion.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/onion.cpp	(revision 339ce675656e3ab89eff7b84d8292a2e0ffe6109)
+++ sansmodels/src/sans/models/c_models/onion.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -223,29 +223,29 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[2] = weights_rad[i].value;
 		// Loop over radius weight points
-		for(int j=0; j<weights_s1.size(); j++) {
+		for(size_t j=0; j<weights_s1.size(); j++) {
 			dp[36] = weights_s1[j].value;
 			// Loop over radius weight points
-			for(int k=0; k<weights_s2.size(); k++) {
+			for(size_t k=0; k<weights_s2.size(); k++) {
 				dp[37] = weights_s2[k].value;
 				// Loop over radius weight points
-				for(int l=0; l<weights_s3.size(); l++) {
+				for(size_t l=0; l<weights_s3.size(); l++) {
 					dp[38] = weights_s3[l].value;
 					// Loop over radius weight points
-					for(int m=0; m<weights_s4.size(); m++) {
+					for(size_t m=0; m<weights_s4.size(); m++) {
 						dp[39] = weights_s4[m].value;
-						for(int n=0; n<weights_s5.size(); n++) {
+						for(size_t n=0; n<weights_s5.size(); n++) {
 							dp[40] = weights_s5[n].value;
-							for(int o=0; o<weights_s6.size(); o++) {
+							for(size_t o=0; o<weights_s6.size(); o++) {
 								dp[41] = weights_s6[o].value;
-								for(int p=0; p<weights_s7.size(); p++) {
+								for(size_t p=0; p<weights_s7.size(); p++) {
 									dp[42] = weights_s7[p].value;
-									for(int t=0; t<weights_s8.size(); t++) {
+									for(size_t t=0; t<weights_s8.size(); t++) {
 										dp[43] = weights_s8[t].value;
-										for(int r=0; r<weights_s9.size(); r++) {
+										for(size_t r=0; r<weights_s9.size(); r++) {
 											dp[44] = weights_s9[r].value;
-											for(int s=0; s<weights_s10.size(); s++) {
+											for(size_t s=0; s<weights_s10.size(); s++) {
 												dp[45] = weights_s10[s].value;
 												//Un-normalize Shells by volume
@@ -375,35 +375,35 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.rad_core0 = weights_rad[i].value;
 		// Loop over radius weight points
-		for(int j=0; j<weights_s1.size(); j++) {
+		for(size_t j=0; j<weights_s1.size(); j++) {
 			dp.thick_shell1 = weights_s1[j].value;
 			// Loop over radius weight points
-			for(int k=0; k<weights_s2.size(); k++) {
+			for(size_t k=0; k<weights_s2.size(); k++) {
 				dp.thick_shell2 = weights_s2[k].value;
 				// Loop over radius weight points
-				for(int l=0; l<weights_s3.size(); l++) {
+				for(size_t l=0; l<weights_s3.size(); l++) {
 					dp.thick_shell3 = weights_s3[l].value;
 					// Loop over radius weight points
-					for(int m=0; m<weights_s4.size(); m++) {
+					for(size_t m=0; m<weights_s4.size(); m++) {
 						dp.thick_shell4 = weights_s4[m].value;
 						// Loop over radius weight points
-						for(int n=0; j<weights_s5.size(); n++) {
+						for(size_t n=0; j<weights_s5.size(); n++) {
 							dp.thick_shell5 = weights_s5[n].value;
 							// Loop over radius weight points
-							for(int o=0; k<weights_s6.size(); o++) {
+							for(size_t o=0; k<weights_s6.size(); o++) {
 								dp.thick_shell6 = weights_s6[o].value;
 								// Loop over radius weight points
-								for(int p=0; l<weights_s7.size(); p++) {
+								for(size_t p=0; l<weights_s7.size(); p++) {
 									dp.thick_shell7 = weights_s7[p].value;
 									// Loop over radius weight points
-									for(int t=0; m<weights_s8.size(); t++) {
+									for(size_t t=0; m<weights_s8.size(); t++) {
 										dp.thick_shell8 = weights_s8[t].value;
 										// Loop over radius weight points
-										for(int r=0; l<weights_s9.size(); r++) {
+										for(size_t r=0; l<weights_s9.size(); r++) {
 											dp.thick_shell8 = weights_s9[r].value;
 											// Loop over radius weight points
-											for(int s=0; m<weights_s10.size(); s++) {
+											for(size_t s=0; m<weights_s10.size(); s++) {
 												dp.thick_shell10 = weights_s10[s].value;
 												//Un-normalize FourShell by volume
Index: sansmodels/src/sans/models/c_models/parameters.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/parameters.cpp	(revision a5e144109930892c523f3f5fe3372b66da099b3b)
+++ sansmodels/src/sans/models/c_models/parameters.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -171,5 +171,4 @@
 
 double rectangle_weight(double mean, double sigma, double x) {
-	double vary, expo_value;
     double wid = fabs(sigma) * sqrt(3.0);
     if (x>= (mean-wid) && x<=(mean+wid)){
@@ -265,5 +264,4 @@
 	double value = (*par)();
 	double sig;
-	double log_value;
 	if (npts<2) {
 		weights.insert(weights.end(), WeightPoint(value, 1.0));
@@ -316,5 +314,4 @@
 
 double schulz_weight(double mean, double sigma, double x) {
-	double vary, expo_value;
     double z = pow(mean/ sigma, 2.0)-1.0;
 	double R= x/mean;
@@ -463,3 +460,4 @@
 double Parameter :: operator=(double _value){
 	value = _value;
-}
+	return value;
+}
Index: sansmodels/src/sans/models/c_models/pearlnecklace.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/pearlnecklace.cpp	(revision 463eb76eeb5025572fbf0fa55f22d9895dede70f)
+++ sansmodels/src/sans/models/c_models/pearlnecklace.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -60,8 +60,8 @@
 	double tot_vol = 0.0;
 	// Loop over core weight points
-	for(int i=0; i<weights_radius.size(); i++) {
+	for(size_t i=0; i<weights_radius.size(); i++) {
 		dp[1] = weights_radius[i].value;
 		// Loop over thick_inter0 weight points
-		for(int j=0; j<weights_edge_separation.size(); j++) {
+		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);
@@ -142,8 +142,8 @@
 	double tot_vol = 0.0;
 	// Loop over core weight points
-	for(int i=0; i<weights_radius.size(); i++) {
+	for(size_t i=0; i<weights_radius.size(); i++) {
 		dp.radius = weights_radius[i].value;
 		// Loop over thick_inter0 weight points
-		for(int j=0; j<weights_edge_separation.size(); j++) {
+		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);
Index: sansmodels/src/sans/models/c_models/polygausscoil.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/polygausscoil.cpp	(revision 8569cb90e648f07efa8686c0500c2c6b5811e874)
+++ sansmodels/src/sans/models/c_models/polygausscoil.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -67,5 +67,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
@@ -117,9 +117,4 @@
  */
 double Poly_GaussCoil :: calculate_ER() {
-	PolyGaussCoilParameters dp;
-	dp.scale = scale();
-	dp.rg= rg();
-	dp.poly_m = poly_m();
-	dp.background = background();
 	double rad_out = 0.0;
 
@@ -132,5 +127,5 @@
 	rg.get_weights(weights_rad);
 	// Loop over radius weight points to average the radius value
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		sum += weights_rad[i].weight
 			* weights_rad[i].value;
Index: sansmodels/src/sans/models/c_models/refl.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/refl.cpp	(revision aae7a8dc28dde466bd8ebbb0c1a8f685310b0f26)
+++ sansmodels/src/sans/models/c_models/refl.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -170,3 +170,4 @@
 double ReflModel :: calculate_ER() {
 	//NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/refl_adv.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/refl_adv.cpp	(revision aae7a8dc28dde466bd8ebbb0c1a8f685310b0f26)
+++ sansmodels/src/sans/models/c_models/refl_adv.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -222,3 +222,4 @@
 double ReflAdvModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/rpa.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/rpa.cpp	(revision 35aface36aa7573475600ebbacb987f50386d5f8)
+++ sansmodels/src/sans/models/c_models/rpa.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -149,3 +149,4 @@
 double RPAModel :: calculate_ER() {
 //NOT implemented!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/sc.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sc.cpp	(revision 4628e31d33c0fcf223d4c2cf0eb3acdf634737a2)
+++ sansmodels/src/sans/models/c_models/sc.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -75,5 +75,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[3] = weights_rad[i].value;
 
@@ -107,5 +107,4 @@
 double SCCrystalModel :: operator()(double qx, double qy) {
 	SCParameters dp;
-	double q = sqrt(qx*qx + qy*qy);
 	dp.scale      = scale();
 	dp.dnn   = dnn();
@@ -142,14 +141,14 @@
 	double pi = 4.0*atan(1.0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp.radius = weights_rad[i].value;
 		// Average over theta distribution
-		for(int j=0; j< weights_theta.size(); j++) {
+		for(size_t j=0; j< weights_theta.size(); j++) {
 			dp.theta = weights_theta[j].value;
 			// Average over phi distribution
-			for(int k=0; k< weights_phi.size(); k++) {
+			for(size_t k=0; k< weights_phi.size(); k++) {
 				dp.phi = weights_phi[k].value;
 				// Average over phi distribution
-				for(int l=0; l< weights_psi.size(); l++) {
+				for(size_t l=0; l< weights_psi.size(); l++) {
 					dp.psi = weights_psi[l].value;
 					//Un-normalize SphereForm by volume
@@ -212,3 +211,4 @@
 double SCCrystalModel :: calculate_ER() {
 	//NOT implemented yet!!!
-}
+	return 0.0;
+}
Index: sansmodels/src/sans/models/c_models/sld_cal.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sld_cal.cpp	(revision 0164899a491d20467a714225f7ea955c852265f3)
+++ sansmodels/src/sans/models/c_models/sld_cal.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -69,3 +69,4 @@
 double SLDCalFunc :: calculate_ER() {
 //NOT implemented yet!!!
+	return 0.0;
 }
Index: sansmodels/src/sans/models/c_models/sphere.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/sphere.cpp	(revision f10063e8f3c53d2be93abaea9c0d3d4f3061d444)
+++ sansmodels/src/sans/models/c_models/sphere.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -67,5 +67,5 @@
 
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		dp[1] = weights_rad[i].value;
 
@@ -113,10 +113,4 @@
  */
 double SphereModel :: calculate_ER() {
-	SphereParameters dp;
-	dp.scale = scale();
-	dp.radius = radius();
-	dp.sldSph = sldSph();
-	dp.sldSolv = sldSolv();
-	dp.background = background();
 	double rad_out = 0.0;
 
@@ -129,5 +123,5 @@
 	radius.get_weights(weights_rad);
 	// Loop over radius weight points to average the radius value
-	for(int i=0; i<weights_rad.size(); i++) {
+	for(size_t i=0; i<weights_rad.size(); i++) {
 		sum += weights_rad[i].weight
 			* weights_rad[i].value;
Index: sansmodels/src/sans/models/c_models/spheresld.cpp
===================================================================
--- sansmodels/src/sans/models/c_models/spheresld.cpp	(revision 7a8faf89408cbad719663a9f4b3e2f655c3dd0cb)
+++ sansmodels/src/sans/models/c_models/spheresld.cpp	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -174,8 +174,8 @@
 
 	// Loop over core weight points
-	for(int i=0; i<weights_rad_core0.size(); i++) {
+	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(int j=0; j<weights_thick_inter0.size(); j++) {
+		for(size_t j=0; j<weights_thick_inter0.size(); j++) {
 			dp[2] = weights_thick_inter0[j].value;
 
@@ -273,8 +273,8 @@
 	thick_inter0.get_weights(weights_thick_inter0);
 	// Loop over radius weight points
-	for(int i=0; i<weights_rad_core0.size(); i++) {
+	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(int j=0; j<weights_thick_inter0.size(); j++) {
+		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;
Index: sansmodels/src/sans/models/libigor/libCylinder.c
===================================================================
--- sansmodels/src/sans/models/libigor/libCylinder.c	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libCylinder.c	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -1337,388 +1337,4 @@
 	
 	return answer;
-}
-
-/////////functions for WRC implementation of flexible cylinders
-static double
-Sk_WR(double q, double L, double b)
-{
-	//
-	double p1,p2,p1short,p2short,q0,qconnect;
-	double C,epsilon,ans,q0short,Sexvmodify,pi;
-	
-	pi = 4.0*atan(1.0);
-	
-	p1 = 4.12;
-	p2 = 4.42;
-	p1short = 5.36;
-	p2short = 5.62;
-	q0 = 3.1;
-	qconnect = q0/b;
-	//	
-	q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0);
-	
-	//
-	if(L/b > 10.0) {
-		C = 3.06/pow((L/b),0.44);
-		epsilon = 0.176;
-	} else {
-		C = 1.0;
-		epsilon = 0.170;
-	}
-	//
-	
-	if( L > 4*b ) { // Longer Chains
-		if (q*b <= 3.1) {		//Modified by Yun on Oct. 15,
-			Sexvmodify = Sexvnew(q, L, b);
-			ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L);
-		} else { //q(i)*b > 3.1
-			ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + pi/(q*L);
-		} 
-	} else { //L <= 4*b Shorter Chains
-		if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) {
-			if (q*b<=0.01) {
-				ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0;
-			} else {
-				ans = Sdebye1(q,L,b);
-			}
-		} else {	//q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3)
-			ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + pi/(q*L);
-		}
-	}
-	
-	return(ans);
-	//return(a2long(q, L, b, p1, p2, q0));
-}
-
-//WR named this w (too generic)
-static double
-w_WR(double x)
-{
-    double yy;
-    yy = 0.5*(1 + tanh((x - 1.523)/0.1477));
-	
-    return (yy);
-}
-
-//
-static double
-u1(double q, double L, double b)
-{
-    double yy;
-	
-    yy = Rgsquareshort(q,L,b)*q*q;
-    
-    return (yy);
-}
-
-// was named u
-static double
-u_WR(double q, double L, double b)
-{
-    double yy;
-    yy = Rgsquare(q,L,b)*q*q;
-    return (yy);
-}
-
-
-
-//
-static double
-Rgsquarezero(double q, double L, double b)
-{    
-    double yy;
-    yy = (L*b/6.0) * (1.0 - 1.5*(b/L) + 1.5*pow((b/L),2) - 0.75*pow((b/L),3)*(1.0 - exp(-2.0*(L/b))));
-    
-    return (yy);
-}
-
-//
-static double
-Rgsquareshort(double q, double L, double b)
-{    
-    double yy;
-    yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b);
-    
-    return (yy);
-}
-
-//
-static double
-Rgsquare(double q, double L, double b)
-{
-    double yy;
-    yy = AlphaSquare(L/b)*L*b/6.0;
-    
-    return (yy);
-}
-
-//
-static double
-AlphaSquare(double x)
-{    
-    double yy;
-    yy = pow( (1.0 + (x/3.12)*(x/3.12) + (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) );
-	
-    return (yy);
-}
-
-// ?? funciton is not used - but should the log actually be log10???
-static double
-miu(double x)
-{    
-    double yy;
-    yy = (1.0/8.0)*(9.0*x - 2.0 + 2.0*log(1.0 + x)/x)*exp(1.0/2.565*(1.0/x + (1.0 - 1.0/(x*x))*log(1.0 + x)));
-    
-    return (yy);
-}
-
-//
-static double
-Sdebye(double q, double L, double b)
-{    
-    double yy;
-    yy = 2.0*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1.0)/(pow((u_WR(q,L,b)),2));
-	
-    return (yy);
-}
-
-//
-static double
-Sdebye1(double q, double L, double b)
-{    
-    double yy;
-    yy = 2.0*(exp(-u1(q,L,b)) + u1(q,L,b) -1.0)/( pow((u1(q,L,b)),2.0) );
-    
-    return (yy);
-}
-
-//
-static double
-Sexv(double q, double L, double b)
-{    
-    double yy,C1,C2,C3,miu,Rg2;
-    C1=1.22;
-    C2=0.4288;
-    C3=-1.651;
-    miu = 0.585;
-	
-    Rg2 = Rgsquare(q,L,b);
-    
-    yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) +  C2*pow((q*sqrt(Rg2)),(-2.0/miu)) +    C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
-    
-    return (yy);
-}
-
-// this must be WR modified version
-static double
-Sexvnew(double q, double L, double b)
-{    
-    double yy,C1,C2,C3,miu;
-    double del=1.05,C_star2,Rg2;
-    
-    C1=1.22;
-    C2=0.4288;
-    C3=-1.651;
-    miu = 0.585;
-	
-    //calculating the derivative to decide on the corection (cutoff) term?
-    // I have modified this from WRs original code
-    
-    if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0.0 ) {
-        C_star2 = 0.0;
-    } else {
-        C_star2 = 1.0;
-    }
-	
-    Rg2 = Rgsquare(q,L,b);
-    
-	yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
-	
-    return (yy);
-}
-
-// these are the messy ones
-static double
-a2short(double q, double L, double b, double p1short, double p2short, double q0)
-{    
-    double yy,Rg2_sh;
-    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p;
-    double pi;
-	
-    E = 2.718281828459045091;
-	pi = 4.0*atan(1.0);
-    Rg2_sh = Rgsquareshort(q,L,b);
-    Rg2_sh2 = Rg2_sh*Rg2_sh;
-    t1 = ((q0*q0*Rg2_sh)/(b*b));
-    Et1 = pow(E,t1);
-    Emt1 =pow(E,-t1); 
-    q02 = q0*q0;
-    q0p = pow(q0,(-4.0 + p2short) );
-    
-    //E is the number e
-    yy = ((-(1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b*b*b*L - 8.0*b*b*b*Et1*L - 2.0*b*b*b*L*p1short + 2.0*b*b*b*Et1*L*p1short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p1short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p1short*pi*q02*q0*Rg2_sh2)))))));
-	
-    return (yy);
-}
-
-//
-static double
-a1short(double q, double L, double b, double p1short, double p2short, double q0)
-{    
-    double yy,Rg2_sh;
-    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p,b3;
-	double pi;
-    
-    E = 2.718281828459045091;
-	pi = 4.0*atan(1.0);
-    Rg2_sh = Rgsquareshort(q,L,b);
-    Rg2_sh2 = Rg2_sh*Rg2_sh;
-    b3 = b*b*b;
-    t1 = ((q0*q0*Rg2_sh)/(b*b));
-    Et1 = pow(E,t1);
-    Emt1 =pow(E,-t1); 
-    q02 = q0*q0;
-    q0p = pow(q0,(-4.0 + p1short) );
-
-    yy = ((1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p2short*pi*q02*q0*Rg2_sh2))))));
-
-    return(yy);
-}
-
-// this one will be lots of trouble
-static double
-a2long(double q, double L, double b, double p1, double p2, double q0)
-{
-    double yy,C1,C2,C3,C4,C5,miu,C,Rg2;
-    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,pi;
-    double E,b2,b3,b4,q02,q03,q04,q05,Rg22;
-    
-    pi = 4.0*atan(1.0);
-    E = 2.718281828459045091;
-    if( L/b > 10.0) {
-        C = 3.06/pow((L/b),0.44);
-    } else {
-        C = 1.0;
-    }
-	
-    C1 = 1.22;
-    C2 = 0.4288;
-    C3 = -1.651;
-    C4 = 1.523;
-    C5 = 0.1477;
-    miu = 0.585;
-	
-    Rg2 = Rgsquare(q,L,b);
-    Rg22 = Rg2*Rg2;
-    b2 = b*b;
-    b3 = b*b*b;
-    b4 = b3*b;
-    q02 = q0*q0;
-    q03 = q0*q0*q0;
-    q04 = q03*q0;
-    q05 = q04*q0;
-    
-    t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) ));
-
-    t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L;
-
-    t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5);
-
-    t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);
-
-    t5 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
-
-    t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);
-
-    t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
-
-    t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-
-    t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L;
-
-    t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
-
-
-    yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));
-
-    return (yy);
-}
-
-//need to define this on my own
-static double
-sech_WR(double x)
-{	
-	return(1/cosh(x));
-}
-
-//
-static double
-a1long(double q, double L, double b, double p1, double p2, double q0)
-{    
-    double yy,C,C1,C2,C3,C4,C5,miu,Rg2;
-    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15;
-    double E,pi;
-    double b2,b3,b4,q02,q03,q04,q05,Rg22;
-	
-    pi = 4.0*atan(1.0);
-    E = 2.718281828459045091;
-    
-    if( L/b > 10.0) {
-        C = 3.06/pow((L/b),0.44);
-    } else {
-        C = 1.0;
-    }
-	
-    C1 = 1.22;
-    C2 = 0.4288;
-    C3 = -1.651;
-    C4 = 1.523;
-    C5 = 0.1477;
-    miu = 0.585;
-	
-    Rg2 = Rgsquare(q,L,b);
-    Rg22 = Rg2*Rg2;
-    b2 = b*b;
-    b3 = b*b*b;
-    b4 = b3*b;
-    q02 = q0*q0;
-    q03 = q0*q0*q0;
-    q04 = q03*q0;
-    q05 = q04*q0;
-    
-    t1 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
-    
-    t2 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-    
-    t3 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
-    
-    t4 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-	
-    t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2))));
-    
-    t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2)))*Rg2)/b)));
-    
-    t7 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
-    
-    t8 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
-    
-    t9 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-    
-    t10 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-    
-    t11 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
-    
-    t12 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
-    
-    t13 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02* Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
-    
-    t14 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
-    
-    t15 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
-	
-    
-    yy = (pow(q0,p1)*(((-((b*pi)/(L*q0))) +t1/L +t2/(q04*Rg22) + 1.0/2.0*t3*t4)) + (t5*((pow(q0,(p1 - p2))*(((-pow(q0,(-p1)))*(((b2*pi)/(L*q02) +t6/L +t7/(2.0*C5) -t8/(C5*q04*Rg22) +t9/(q04*Rg22) -t10/(q05*Rg22) + 1.0/2.0*t11*t12)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) +t13/L +t14/(q04*Rg22) + 1.0/2.0*t15*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))));
-	
-    return (yy);
 }
 
@@ -2132,21 +1748,4 @@
 }
 
-static double
-gammaln(double xx)
-{
-	double x,y,tmp,ser;
-	static double cof[6]={76.18009172947146,-86.50532032941677,
-		24.01409824083091,-1.231739572450155,
-		0.1208650973866179e-2,-0.5395239384953e-5};
-	int j;
-	
-	y=x=xx;
-	tmp=x+5.5;
-	tmp -= (x+0.5)*log(tmp);
-	ser=1.000000000190015;
-	for (j=0;j<=5;j++) ser += cof[j]/++y;
-	return -tmp+log(2.5066282746310005*ser/x);
-}
-
 
 double
Index: sansmodels/src/sans/models/libigor/libCylinder.h
===================================================================
--- sansmodels/src/sans/models/libigor/libCylinder.h	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libCylinder.h	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -67,21 +67,400 @@
 
 /////////functions for WRC implementation of flexible cylinders
-static double Sk_WR(double q, double L, double b);
-static double w_WR(double x);
-static double u1(double q, double L, double b);
-static double u_WR(double q, double L, double b);
-static double Rgsquarezero(double q, double L, double b);
-static double Rgsquareshort(double q, double L, double b);
-static double Rgsquare(double q, double L, double b);
-static double AlphaSquare(double x);
-static double miu(double x);
-static double Sdebye(double q, double L, double b);
-static double Sdebye1(double q, double L, double b);
-static double Sexv(double q, double L, double b);
-static double Sexvnew(double q, double L, double b);
-static double a2short(double q, double L, double b, double p1short, double p2short, double q0);
-static double a1short(double q, double L, double b, double p1short, double p2short, double q0);
-static double a2long(double q, double L, double b, double p1, double p2, double q0);
-static double sech_WR(double x);
-static double a1long(double q, double L, double b, double p1, double p2, double q0);
-static double gammaln(double xx);
+static double
+gammaln(double xx)
+{
+	double x,y,tmp,ser;
+	static double cof[6]={76.18009172947146,-86.50532032941677,
+		24.01409824083091,-1.231739572450155,
+		0.1208650973866179e-2,-0.5395239384953e-5};
+	int j;
+
+	y=x=xx;
+	tmp=x+5.5;
+	tmp -= (x+0.5)*log(tmp);
+	ser=1.000000000190015;
+	for (j=0;j<=5;j++) ser += cof[j]/++y;
+	return -tmp+log(2.5066282746310005*ser/x);
+}
+
+//
+static double
+AlphaSquare(double x)
+{
+    double yy;
+    yy = pow( (1.0 + (x/3.12)*(x/3.12) + (x/8.67)*(x/8.67)*(x/8.67)),(0.176/3.0) );
+
+    return (yy);
+}
+
+//
+static double
+Rgsquarezero(double q, double L, double b)
+{
+    double yy;
+    yy = (L*b/6.0) * (1.0 - 1.5*(b/L) + 1.5*pow((b/L),2) - 0.75*pow((b/L),3)*(1.0 - exp(-2.0*(L/b))));
+
+    return (yy);
+}
+
+//
+static double
+Rgsquareshort(double q, double L, double b)
+{
+    double yy;
+    yy = AlphaSquare(L/b) * Rgsquarezero(q,L,b);
+
+    return (yy);
+}
+
+//
+static double
+Rgsquare(double q, double L, double b)
+{
+    double yy;
+    yy = AlphaSquare(L/b)*L*b/6.0;
+
+    return (yy);
+}
+
+// ?? funciton is not used - but should the log actually be log10???
+static double
+miu(double x)
+{
+    double yy;
+    yy = (1.0/8.0)*(9.0*x - 2.0 + 2.0*log(1.0 + x)/x)*exp(1.0/2.565*(1.0/x + (1.0 - 1.0/(x*x))*log(1.0 + x)));
+
+    return (yy);
+}
+
+//WR named this w (too generic)
+static double
+w_WR(double x)
+{
+    double yy;
+    yy = 0.5*(1 + tanh((x - 1.523)/0.1477));
+
+    return (yy);
+}
+
+//
+static double
+u1(double q, double L, double b)
+{
+    double yy;
+
+    yy = Rgsquareshort(q,L,b)*q*q;
+
+    return (yy);
+}
+
+// was named u
+static double
+u_WR(double q, double L, double b)
+{
+    double yy;
+    yy = Rgsquare(q,L,b)*q*q;
+    return (yy);
+}
+
+
+//
+static double
+Sdebye1(double q, double L, double b)
+{
+    double yy;
+    yy = 2.0*(exp(-u1(q,L,b)) + u1(q,L,b) -1.0)/( pow((u1(q,L,b)),2.0) );
+
+    return (yy);
+}
+
+
+//
+static double
+Sdebye(double q, double L, double b)
+{
+    double yy;
+    yy = 2.0*(exp(-u_WR(q,L,b)) + u_WR(q,L,b) -1.0)/(pow((u_WR(q,L,b)),2));
+
+    return (yy);
+}
+
+//
+static double
+Sexv(double q, double L, double b)
+{
+    double yy,C1,C2,C3,miu,Rg2;
+    C1=1.22;
+    C2=0.4288;
+    C3=-1.651;
+    miu = 0.585;
+
+    Rg2 = Rgsquare(q,L,b);
+
+    yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) +  C2*pow((q*sqrt(Rg2)),(-2.0/miu)) +    C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
+
+    return (yy);
+}
+
+// this must be WR modified version
+static double
+Sexvnew(double q, double L, double b)
+{
+    double yy,C1,C2,C3,miu;
+    double del=1.05,C_star2,Rg2;
+
+    C1=1.22;
+    C2=0.4288;
+    C3=-1.651;
+    miu = 0.585;
+
+    //calculating the derivative to decide on the corection (cutoff) term?
+    // I have modified this from WRs original code
+
+    if( (Sexv(q*del,L,b)-Sexv(q,L,b))/(q*del - q) >= 0.0 ) {
+        C_star2 = 0.0;
+    } else {
+        C_star2 = 1.0;
+    }
+
+    Rg2 = Rgsquare(q,L,b);
+
+	yy = (1.0 - w_WR(q*sqrt(Rg2)))*Sdebye(q,L,b) + C_star2*w_WR(q*sqrt(Rg2))*(C1*pow((q*sqrt(Rg2)),(-1.0/miu)) + C2*pow((q*sqrt(Rg2)),(-2.0/miu)) + C3*pow((q*sqrt(Rg2)),(-3.0/miu)));
+
+    return (yy);
+}
+
+// these are the messy ones
+static double
+a2short(double q, double L, double b, double p1short, double p2short, double q0)
+{
+    double yy,Rg2_sh;
+    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p;
+    double pi;
+
+    E = 2.718281828459045091;
+	pi = 4.0*atan(1.0);
+    Rg2_sh = Rgsquareshort(q,L,b);
+    Rg2_sh2 = Rg2_sh*Rg2_sh;
+    t1 = ((q0*q0*Rg2_sh)/(b*b));
+    Et1 = pow(E,t1);
+    Emt1 =pow(E,-t1);
+    q02 = q0*q0;
+    q0p = pow(q0,(-4.0 + p2short) );
+
+    //E is the number e
+    yy = ((-(1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b*b*b*L - 8.0*b*b*b*Et1*L - 2.0*b*b*b*L*p1short + 2.0*b*b*b*Et1*L*p1short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p1short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p1short*pi*q02*q0*Rg2_sh2)))))));
+
+    return (yy);
+}
+
+//
+static double
+a1short(double q, double L, double b, double p1short, double p2short, double q0)
+{
+    double yy,Rg2_sh;
+    double t1,E,Rg2_sh2,Et1,Emt1,q02,q0p,b3;
+	double pi;
+
+    E = 2.718281828459045091;
+	pi = 4.0*atan(1.0);
+    Rg2_sh = Rgsquareshort(q,L,b);
+    Rg2_sh2 = Rg2_sh*Rg2_sh;
+    b3 = b*b*b;
+    t1 = ((q0*q0*Rg2_sh)/(b*b));
+    Et1 = pow(E,t1);
+    Emt1 =pow(E,-t1);
+    q02 = q0*q0;
+    q0p = pow(q0,(-4.0 + p1short) );
+
+    yy = ((1.0/(L*((p1short - p2short))*Rg2_sh2)*((b*Emt1*q0p*((8.0*b3*L - 8.0*b3*Et1*L - 2.0*b3*L*p2short + 2.0*b3*Et1*L*p2short + 4.0*b*L*q02*Rg2_sh + 4.0*b*Et1*L*q02*Rg2_sh - 2.0*b*Et1*L*p2short*q02*Rg2_sh - Et1*pi*q02*q0*Rg2_sh2 + Et1*p2short*pi*q02*q0*Rg2_sh2))))));
+
+    return(yy);
+}
+
+
+//need to define this on my own
+static double
+sech_WR(double x)
+{
+	return(1/cosh(x));
+}
+
+// this one will be lots of trouble
+static double
+a2long(double q, double L, double b, double p1, double p2, double q0)
+{
+    double yy,C1,C2,C3,C4,C5,miu,C,Rg2;
+    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,pi;
+    double E,b2,b3,b4,q02,q03,q04,q05,Rg22;
+
+    pi = 4.0*atan(1.0);
+    E = 2.718281828459045091;
+    if( L/b > 10.0) {
+        C = 3.06/pow((L/b),0.44);
+    } else {
+        C = 1.0;
+    }
+
+    C1 = 1.22;
+    C2 = 0.4288;
+    C3 = -1.651;
+    C4 = 1.523;
+    C5 = 0.1477;
+    miu = 0.585;
+
+    Rg2 = Rgsquare(q,L,b);
+    Rg22 = Rg2*Rg2;
+    b2 = b*b;
+    b3 = b*b*b;
+    b4 = b3*b;
+    q02 = q0*q0;
+    q03 = q0*q0*q0;
+    q04 = q03*q0;
+    q05 = q04*q0;
+
+    t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) ));
+
+    t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L;
+
+    t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5);
+
+    t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);
+
+    t5 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
+
+    t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);
+
+    t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
+
+    t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
+
+    t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L;
+
+    t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);
+
+
+    yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));
+
+    return (yy);
+}
+//
+static double
+a1long(double q, double L, double b, double p1, double p2, double q0)
+{
+    double yy,C,C1,C2,C3,C4,C5,miu,Rg2;
+    double t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15;
+    double E,pi;
+    double b2,b3,b4,q02,q03,q04,q05,Rg22;
+
+    pi = 4.0*atan(1.0);
+    E = 2.718281828459045091;
+
+    if( L/b > 10.0) {
+        C = 3.06/pow((L/b),0.44);
+    } else {
+        C = 1.0;
+    }
+
+    C1 = 1.22;
+    C2 = 0.4288;
+    C3 = -1.651;
+    C4 = 1.523;
+    C5 = 0.1477;
+    miu = 0.585;
+
+    Rg2 = Rgsquare(q,L,b);
+    Rg22 = Rg2*Rg2;
+    b2 = b*b;
+    b3 = b*b*b;
+    b4 = b3*b;
+    q02 = q0*q0;
+    q03 = q0*q0*q0;
+    q04 = q03*q0;
+    q05 = q04*q0;
+
+    t1 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
+
+    t2 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
+
+    t3 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
+
+    t4 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
+
+    t5 = (1.0/(b*p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2))));
+
+    t6 = (b*C*(((-((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7.0*b2)/(15.0*q02*Rg2)))*Rg2)/b)));
+
+    t7 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
+
+    t8 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2));
+
+    t9 = (2.0*b4*(((2.0*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
+
+    t10 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
+
+    t11 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu));
+
+    t12 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));
+
+    t13 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15.0*q02* Rg2))) + (7.0*b2)/(15.0*q02*Rg2))));
+
+    t14 = (2.0*b4*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))));
+
+    t15 = ((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))));
+
+
+    yy = (pow(q0,p1)*(((-((b*pi)/(L*q0))) +t1/L +t2/(q04*Rg22) + 1.0/2.0*t3*t4)) + (t5*((pow(q0,(p1 - p2))*(((-pow(q0,(-p1)))*(((b2*pi)/(L*q02) +t6/L +t7/(2.0*C5) -t8/(C5*q04*Rg22) +t9/(q04*Rg22) -t10/(q05*Rg22) + 1.0/2.0*t11*t12)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) +t13/L +t14/(q04*Rg22) + 1.0/2.0*t15*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))));
+
+    return (yy);
+}
+
+
+static double
+Sk_WR(double q, double L, double b)
+{
+	//
+	double p1,p2,p1short,p2short,q0;
+	double C,ans,q0short,Sexvmodify,pi;
+
+	pi = 4.0*atan(1.0);
+
+	p1 = 4.12;
+	p2 = 4.42;
+	p1short = 5.36;
+	p2short = 5.62;
+	q0 = 3.1;
+	//
+	q0short = fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0);
+
+	//
+	if(L/b > 10.0) {
+		C = 3.06/pow((L/b),0.44);
+	} else {
+		C = 1.0;
+	}
+	//
+
+	if( L > 4*b ) { // Longer Chains
+		if (q*b <= 3.1) {		//Modified by Yun on Oct. 15,
+			Sexvmodify = Sexvnew(q, L, b);
+			ans = Sexvmodify + C * (4.0/15.0 + 7.0/(15.0*u_WR(q,L,b)) - (11.0/15.0 + 7.0/(15.0*u_WR(q,L,b)))*exp(-u_WR(q,L,b)))*(b/L);
+		} else { //q(i)*b > 3.1
+			ans = a1long(q, L, b, p1, p2, q0)/(pow((q*b),p1)) + a2long(q, L, b, p1, p2, q0)/(pow((q*b),p2)) + pi/(q*L);
+		}
+	} else { //L <= 4*b Shorter Chains
+		if (q*b <= fmax(1.9/sqrt(Rgsquareshort(q,L,b)),3.0) ) {
+			if (q*b<=0.01) {
+				ans = 1.0 - Rgsquareshort(q,L,b)*(q*q)/3.0;
+			} else {
+				ans = Sdebye1(q,L,b);
+			}
+		} else {	//q*b > max(1.9/sqrt(Rgsquareshort(q(i),L,b)),3)
+			ans = a1short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p1short)) + a2short(q,L,b,p1short,p2short,q0short)/(pow((q*b),p2short)) + pi/(q*L);
+		}
+	}
+
+	return(ans);
+	//return(a2long(q, L, b, p1, p2, q0));
+}
+
Index: sansmodels/src/sans/models/libigor/libSphere.c
===================================================================
--- sansmodels/src/sans/models/libigor/libSphere.c	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libSphere.c	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -653,4 +653,5 @@
 }
 
+/*
 static double
 LogNormal_distr(double sig, double mu, double pt)
@@ -672,4 +673,5 @@
 	return(retval);
 }
+*/
 
 // scattering from a core shell sphere with a (Schulz) polydisperse core and constant ratio (shell thickness)/(core radius)
@@ -1220,4 +1222,5 @@
 }
 
+/*
 static double
 SchulzPoint(double x, double avg, double zz) {
@@ -1245,4 +1248,5 @@
     return -tmp+log(2.5066282746310005*ser/x);
 }
+*/
 
 double
@@ -1262,7 +1266,7 @@
 	// variables are:
 	//[0] scale factor
-	//[1] radius of core []
-	//[2] SLD of the core	[-2]
-	//[3] thickness of the shell	[]
+	//[1] radius of core [ï¿œ]
+	//[2] SLD of the core	[ï¿œ-2]
+	//[3] thickness of the shell	[ï¿œ]
 	//[4] SLD of the shell
 	//[5] SLD of the solvent
@@ -1305,5 +1309,5 @@
 	f += vol*bes*contr;
 	
-	// normalize to particle volume and rescale from [-1] to [cm-1]
+	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
 	f2 = f*f/vol*1.0e8;
 	
@@ -1321,9 +1325,9 @@
 	// variables are:
 	//[0] scale factor
-	//[1] radius of core []
-	//[2] SLD of the core	[-2]
-	//[3] thickness of shell 1 []
+	//[1] radius of core [ï¿œ]
+	//[2] SLD of the core	[ï¿œ-2]
+	//[3] thickness of shell 1 [ï¿œ]
 	//[4] SLD of shell 1
-	//[5] thickness of shell 2 []
+	//[5] thickness of shell 2 [ï¿œ]
 	//[6] SLD of shell 2
 	//[7] SLD of the solvent
@@ -1379,5 +1383,5 @@
 	
 		
-	// normalize to particle volume and rescale from [-1] to [cm-1]
+	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
 	f2 = f*f/vol*1.0e8;
 	
@@ -1395,9 +1399,9 @@
 	// variables are:
 	//[0] scale factor
-	//[1] radius of core []
-	//[2] SLD of the core	[-2]
-	//[3] thickness of shell 1 []
+	//[1] radius of core [ï¿œ]
+	//[2] SLD of the core	[ï¿œ-2]
+	//[3] thickness of shell 1 [ï¿œ]
 	//[4] SLD of shell 1
-	//[5] thickness of shell 2 []
+	//[5] thickness of shell 2 [ï¿œ]
 	//[6] SLD of shell 2
 	//[7] thickness of shell 3
@@ -1467,5 +1471,5 @@
 	f += vol*bes*contr;
 		
-	// normalize to particle volume and rescale from [-1] to [cm-1]
+	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
 	f2 = f*f/vol*1.0e8;
 	
@@ -1483,9 +1487,9 @@
 	// variables are:
 	//[0] scale factor
-	//[1] radius of core []
-	//[2] SLD of the core	[-2]
-	//[3] thickness of shell 1 []
+	//[1] radius of core [ï¿œ]
+	//[2] SLD of the core	[ï¿œ-2]
+	//[3] thickness of shell 1 [ï¿œ]
 	//[4] SLD of shell 1
-	//[5] thickness of shell 2 []
+	//[5] thickness of shell 2 [ï¿œ]
 	//[6] SLD of shell 2
 	//[7] thickness of shell 3
@@ -1570,5 +1574,5 @@
 	
 		
-	// normalize to particle volume and rescale from [-1] to [cm-1]
+	// normalize to particle volume and rescale from [ï¿œ-1] to [cm-1]
 	f2 = f*f/vol*1.0e8;
 	
@@ -1997,5 +2001,5 @@
 	bes = 3.0*(sin(x*radius)-x*radius*cos(x*radius))/(x*x*x)/(radius*radius*radius);
 	vol = 4.0*pi/3.0*radius*radius*radius;
-	f = vol*bes*delrho	;	// [=] 
+	f = vol*bes*delrho	;	// [=] ï¿œ
 	// normalize to single particle volume, convert to 1/cm
 	f2 = f * f / vol * 1.0e8;		// [=] 1/cm
Index: sansmodels/src/sans/models/libigor/libSphere.h
===================================================================
--- sansmodels/src/sans/models/libigor/libSphere.h	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libSphere.h	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -49,7 +49,44 @@
 
 
-static double SchulzPoint(double x, double avg, double zz);
-static double gammln(double xx);
-static double Gauss_distr(double sig, double avg, double pt);
-static double LogNormal_distr(double sig, double mu, double pt);
+static double
+gammln(double xx) {
+    double x,y,tmp,ser;
+    static double cof[6]={76.18009172947146,-86.50532032941677,
+		24.01409824083091,-1.231739572450155,
+		0.1208650973866179e-2,-0.5395239384953e-5};
+    int j;
 
+    y=x=xx;
+    tmp=x+5.5;
+    tmp -= (x+0.5)*log(tmp);
+    ser=1.000000000190015;
+    for (j=0;j<=5;j++) ser += cof[j]/++y;
+    return -tmp+log(2.5066282746310005*ser/x);
+}
+
+static double
+LogNormal_distr(double sig, double mu, double pt)
+{
+	double retval,pi;
+
+	pi = 4.0*atan(1.0);
+	retval = (1.0/ (sig*pt*sqrt(2.0*pi)) )*exp( -0.5*(log(pt) - mu)*(log(pt) - mu)/sig/sig );
+	return(retval);
+}
+
+static double
+Gauss_distr(double sig, double avg, double pt)
+{
+	double retval,Pi;
+
+	Pi = 4.0*atan(1.0);
+	retval = (1.0/ (sig*sqrt(2.0*Pi)) )*exp(-(avg-pt)*(avg-pt)/sig/sig/2.0);
+	return(retval);
+}
+
+static double SchulzPoint(double x, double avg, double zz) {
+    double dr;
+    dr = zz*log(x) - gammln(zz+1.0)+(zz+1.0)*log((zz+1.0)/avg)-(x/avg*(zz+1.0));
+    return (exp(dr));
+};
+
Index: sansmodels/src/sans/models/libigor/libTwoPhase.c
===================================================================
--- sansmodels/src/sans/models/libigor/libTwoPhase.c	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libTwoPhase.c	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -421,5 +421,5 @@
 {
 	//w[0] = scale
-	//w[1] = radius of gyration []
+	//w[1] = radius of gyration [ï¿œ]
 	//w[2] = polydispersity, ratio of Mw/Mn
 	//w[3] = bkg [cm-1]
@@ -475,21 +475,4 @@
 
 
-static double
-gammln(double xx) {
-	
-    double x,y,tmp,ser;
-    static double cof[6]={76.18009172947146,-86.50532032941677,
-		24.01409824083091,-1.231739572450155,
-		0.1208650973866179e-2,-0.5395239384953e-5};
-    int j;
-	
-    y=x=xx;
-    tmp=x+5.5;
-    tmp -= (x+0.5)*log(tmp);
-    ser=1.000000000190015;
-    for (j=0;j<=5;j++) ser += cof[j]/++y;
-    return -tmp+log(2.5066282746310005*ser/x);
-}
-
 double
 GaussianShell(double w[], double x)
@@ -497,8 +480,8 @@
 	// variables are:							
 	//[0] scale
-	//[1] radius ()
-	//[2] thick () (thickness parameter - this is the std. dev. of the Gaussian width of the shell)
+	//[1] radius (ï¿œ)
+	//[2] thick (ï¿œ) (thickness parameter - this is the std. dev. of the Gaussian width of the shell)
 	//[3] polydispersity of the radius
-	//[4] sld shell (-2)
+	//[4] sld shell (ï¿œ-2)
 	//[5] sld solvent
 	//[6] background (cm-1)
Index: sansmodels/src/sans/models/libigor/libTwoPhase.h
===================================================================
--- sansmodels/src/sans/models/libigor/libTwoPhase.h	(revision 3a084629ca29bddd77132b00fd8ee72fffc8c66e)
+++ sansmodels/src/sans/models/libigor/libTwoPhase.h	(revision 34c2649bfe75da15bbebf2ffea0e086db7ad6320)
@@ -24,4 +24,20 @@
 
 /* internal functions */
-static double gammln(double xx);
+static double
+gammln(double xx) {
 
+    double x,y,tmp,ser;
+    static double cof[6]={76.18009172947146,-86.50532032941677,
+		24.01409824083091,-1.231739572450155,
+		0.1208650973866179e-2,-0.5395239384953e-5};
+    int j;
+
+    y=x=xx;
+    tmp=x+5.5;
+    tmp -= (x+0.5)*log(tmp);
+    ser=1.000000000190015;
+    for (j=0;j<=5;j++) ser += cof[j]/++y;
+    return -tmp+log(2.5066282746310005*ser/x);
+}
+
+
