Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.cc	(revision 2bb0b2679405ea89cae32c609f3efcee49488616)
@@ -375,2 +375,39 @@
   return I;
 }
+
+/*
+ * 2D simulation for oriented systems
+ * The beam direction is assumed to be in the z direction.
+ * 
+ * @param points: vector of space points
+ * @param qx: qx [A-1]
+ * @param qy: qy [A-1]
+ * @return: I(qx, qy) for the system described by the space points [cm-1]
+ * 
+ */
+double PointsModel::CalculateIQ_2D(const vector<Point3D>&points, double qx, double qy){
+	/*
+	 * TODO: the vector of points should really be part of the class
+	 * 	     This is a design flaw inherited from the original programmer.
+	 */
+	
+	int size = points.size();
+
+	double cos_term = 0;
+	double sin_term = 0;
+	for (int i = 0; i < size; i++) {
+	  	//the sld for the pair of points
+	
+		double phase = qx*points[i].getX() + qy*points[i].getY();
+			  	
+		cos_term += cos(phase) * points[i].getSLD();
+		sin_term += sin(phase) * points[i].getSLD();
+	
+	}   			
+
+	// P(q) = 1/V I(q) = (V/N)^2 (1/V) (cos_term^2 + sin_term^2) 
+	// We divide by N here and we will multiply by the density later.
+
+	return (cos_term*cos_term + sin_term*sin_term)/size;	
+}
+
Index: realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h
===================================================================
--- realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/libpointsmodelpy/points_model.h	(revision 2bb0b2679405ea89cae32c609f3efcee49488616)
@@ -21,6 +21,11 @@
   double CalculateIQ(double q);
   double CalculateIQError(double q);
+  
+  // Old lengthy 2D simulation (unchecked) 
   void CalculateIQ_2D(IQ *iq,double phi);
   double CalculateIQ_2D(double qx, double qy);
+  
+  // Fast 2D simulation
+  double CalculateIQ_2D(const vector<Point3D>&, double qx, double qy);
   
   //given a set of points, calculate distance correlation
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/bindings.cc	(revision 2bb0b2679405ea89cae32c609f3efcee49488616)
@@ -97,7 +97,11 @@
      METH_VARARGS, pypointsmodelpy_calculateIQ_2D__doc__},
 
-    //calculateIQ 2D(Qx,Qy)
-    {pypointsmodelpy_calculateI_Qxy__name__, pypointsmodelpy_calculateI_Qxy,
-     METH_VARARGS, pypointsmodelpy_calculateI_Qxy__doc__},
+     //calculateIQ 2D(points, Qx,Qy)
+     {pypointsmodelpy_calculateI_Qvxy__name__, pypointsmodelpy_calculateI_Qvxy,
+      METH_VARARGS, pypointsmodelpy_calculateI_Qvxy__doc__},
+
+      //calculateIQ 2D(Qx,Qy)
+      {pypointsmodelpy_calculateI_Qxy__name__, pypointsmodelpy_calculateI_Qxy,
+       METH_VARARGS, pypointsmodelpy_calculateI_Qxy__doc__},
 
     //PDBModel calculateIQ
@@ -105,7 +109,15 @@
      METH_VARARGS, pypointsmodelpy_get_pdb_iq__doc__},
 
-    //PDBModel calculateIQ(Qx,Qy)
-    {pypointsmodelpy_get_pdb_Iqxy__name__, pypointsmodelpy_get_pdb_Iqxy,
-     METH_VARARGS, pypointsmodelpy_get_pdb_Iqxy__doc__},
+     //PDBModel calculateIQ(Qx,Qy)
+     {pypointsmodelpy_get_pdb_Iqxy__name__, pypointsmodelpy_get_pdb_Iqxy,
+      METH_VARARGS, pypointsmodelpy_get_pdb_Iqxy__doc__},
+
+      //PDBModel calculateIQ(pts,Qx,Qy)
+      {pypointsmodelpy_get_pdb_Iqvxy__name__, pypointsmodelpy_get_pdb_Iqvxy,
+       METH_VARARGS, pypointsmodelpy_get_pdb_Iqvxy__doc__},
+
+       //ComplexModel calculateIQ(pts,Qx,Qy)
+       {pypointsmodelpy_get_complex_Iqxy__name__, pypointsmodelpy_get_complex_Iqxy,
+        METH_VARARGS, pypointsmodelpy_get_complex_Iqxy__doc__},
 
     //ComplexModel calculateIQ
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision 2bb0b2679405ea89cae32c609f3efcee49488616)
@@ -424,4 +424,27 @@
 }
 
+// method calculateI_Qxy(poitns, Qx,Qy)
+char pypointsmodelpy_calculateI_Qvxy__name__[] = "calculateI_Qvxy";
+char pypointsmodelpy_calculateI_Qvxy__doc__[] = "calculate scattering intensity on a 2D pixel";
+
+PyObject * pypointsmodelpy_calculateI_Qvxy(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0, *pypoint3dvec = 0;
+  double qx = 0, qy = 0;
+  double I = 0;
+
+  int ok = PyArg_ParseTuple(args, "OOdd", &pylores, &pypoint3dvec, &qx,&qy);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+  LORESModel * thislores = static_cast<LORESModel *>(temp);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+  
+  I = thislores->CalculateIQ_2D(*thisvec, qx,qy);
+
+  return Py_BuildValue("d",I);
+}
+
 // PDBModel method calculateIQ(iq)
 char pypointsmodelpy_get_pdb_iq__name__[] = "get_pdb_iq";
@@ -466,4 +489,27 @@
 }
 
+// PDBModel method calculateIQ_2Dv(points,qx,qy)
+char pypointsmodelpy_get_pdb_Iqvxy__name__[] = "get_pdb_Iqvxy";
+char pypointsmodelpy_get_pdb_Iqvxy__doc__[] = "calculate scattering intensity by a given (qx,qy) for PDB model";
+
+PyObject * pypointsmodelpy_get_pdb_Iqvxy(PyObject *, PyObject *args)
+{
+  PyObject *pypdb = 0, *pypoint3dvec = 0;
+  double qx = 0, qy = 0;
+  double I = 0;
+
+  int ok = PyArg_ParseTuple(args, "OOdd", &pypdb, &pypoint3dvec, &qx,&qy);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pypdb);
+  PDBModel * thispdb = static_cast<PDBModel *>(temp);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  I = thispdb->CalculateIQ_2D(*thisvec,qx,qy);
+
+  return Py_BuildValue("d",I);
+}
+
 // ComplexModel method calculateIQ(iq)
 char pypointsmodelpy_get_complex_iq__name__[] = "get_complex_iq";
@@ -485,4 +531,25 @@
 
   return Py_BuildValue("i",0);
+}
+
+//LORESModel method CalculateIQ_2D(points,qx,qy) 
+char pypointsmodelpy_get_complex_Iqxy__name__[] = "get_complex_iq_2D";
+char pypointsmodelpy_get_complex_Iqxy__doc__[] = "calculate averaged scattering intensity from a single q";
+
+PyObject * pypointsmodelpy_get_complex_Iqxy(PyObject *, PyObject *args)
+{
+  PyObject *pylores = 0, *pypoint3dvec = 0;
+  double qx = 0, qy = 0;
+  int ok = PyArg_ParseTuple(args, "OOdd", &pylores, &pypoint3dvec, &qx, &qy);
+  if(!ok) return NULL;
+
+  void *temp = PyCObject_AsVoidPtr(pylores);
+  ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+  void *temp2 = PyCObject_AsVoidPtr(pypoint3dvec);
+  vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
+
+  double I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy);
+
+  return Py_BuildValue("d",I);
 }
 
Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h	(revision f2d6445700c382c6d6dc62bc2017ea43391f7e0d)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.h	(revision 2bb0b2679405ea89cae32c609f3efcee49488616)
@@ -152,4 +152,10 @@
 PyObject * pypointsmodelpy_calculateI_Qxy(PyObject *, PyObject *);
 
+// method calculateI_Qvxy(points,Qx,Qy)
+extern char pypointsmodelpy_calculateI_Qvxy__name__[];
+extern char pypointsmodelpy_calculateI_Qvxy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_calculateI_Qvxy(PyObject *, PyObject *);
+
 // PDBModel method calculateIQ(iq)
 extern char pypointsmodelpy_get_pdb_iq__name__[];
@@ -164,4 +170,16 @@
 PyObject * pypointsmodelpy_get_pdb_Iqxy(PyObject *, PyObject *);
 
+// PDBModel method calculateIQ_2D(pts,qx,qy)
+extern char pypointsmodelpy_get_pdb_Iqvxy__name__[];
+extern char pypointsmodelpy_get_pdb_Iqvxy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_pdb_Iqvxy(PyObject *, PyObject *);
+
+// ComplexModel method calculateIQ_2D(pts,qx,qy)
+extern char pypointsmodelpy_get_complex_Iqxy__name__[];
+extern char pypointsmodelpy_get_complex_Iqxy__doc__[];
+extern "C"
+PyObject * pypointsmodelpy_get_complex_Iqxy(PyObject *, PyObject *);
+
 // ComplexModel method calculateIQ(iq)
 extern char pypointsmodelpy_get_complex_iq__name__[];
