Index: realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc
===================================================================
--- realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision 41e8114c62b96dec5421a4f9ba8b34bd5e99254e)
+++ realSpaceModeling/pointsmodelpy/pointsmodelpymodule/misc.cc	(revision bbfad0a12d60eda7b1855d89098ca29f1e3967c1)
@@ -274,7 +274,9 @@
   LORESModel * thislores = static_cast<LORESModel *>(temp);
 
+  Py_BEGIN_ALLOW_THREADS
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
   thislores->DistDistributionXY(*thisvec);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i", 0);
 }
@@ -314,7 +316,9 @@
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
 
+  Py_BEGIN_ALLOW_THREADS
   PDBModel * thispdb = static_cast<PDBModel *>(temp);
   thispdb->DistDistribution(*thisvec);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i", 0);
 }
@@ -335,6 +339,7 @@
 
   ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
+  Py_BEGIN_ALLOW_THREADS
   thiscomplex->DistDistribution(*thisvec);
-
+  Py_END_ALLOW_THREADS
   return Py_BuildValue("i", 0);
 }
@@ -356,6 +361,8 @@
   IQ * thisiq = static_cast<IQ *>(temp2);
 
+  Py_BEGIN_ALLOW_THREADS
   thislores->CalculateIQ(thisiq);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i",0);
 }
@@ -375,7 +382,10 @@
 
   LORESModel * thislores = static_cast<LORESModel *>(temp);
-
-  double I = thislores->CalculateIQ(q);
-
+  
+  double I = 0.0;
+  Py_BEGIN_ALLOW_THREADS
+  I = thislores->CalculateIQ(q);
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -397,7 +407,9 @@
   LORESModel * thislores = static_cast<LORESModel *>(temp);
   IQ * thisiq = static_cast<IQ *>(temp2);
-
+  
+  Py_BEGIN_ALLOW_THREADS
   thislores->CalculateIQ_2D(thisiq,theta);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i",0);
 }
@@ -418,7 +430,9 @@
   void *temp = PyCObject_AsVoidPtr(pylores);
   LORESModel * thislores = static_cast<LORESModel *>(temp);
-
+  
+  Py_BEGIN_ALLOW_THREADS
   I = thislores->CalculateIQ_2D(qx,qy);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -442,6 +456,8 @@
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
   
+  Py_BEGIN_ALLOW_THREADS
   I = thislores->CalculateIQ_2D(*thisvec, qx,qy);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -463,6 +479,8 @@
   IQ * thisiq = static_cast<IQ *>(temp2);
 
+  Py_BEGIN_ALLOW_THREADS
   thispdb->CalculateIQ(thisiq);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i",0);
 }
@@ -484,6 +502,8 @@
   PDBModel * thispdb = static_cast<PDBModel *>(temp);
 
+  Py_BEGIN_ALLOW_THREADS
   I = thispdb->CalculateIQ_2D(qx,qy);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -507,6 +527,8 @@
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
 
+  Py_BEGIN_ALLOW_THREADS
   I = thispdb->CalculateIQ_2D(*thisvec,qx,qy);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -528,6 +550,8 @@
   IQ * thisiq = static_cast<IQ *>(temp2);
 
+  Py_BEGIN_ALLOW_THREADS
   thiscomplex->CalculateIQ(thisiq);
-
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("i",0);
 }
@@ -549,6 +573,9 @@
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
 
-  double I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy);
-
+  double I = 0.0;
+  Py_BEGIN_ALLOW_THREADS
+  I = thiscomplex->CalculateIQ_2D(*thisvec,qx,qy);
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -570,6 +597,9 @@
   vector<Point3D> * thisvec = static_cast<vector<Point3D> *>(temp2);
 
-  double I = thiscomplex->CalculateIQ_2D_Error(*thisvec,qx,qy);
-
+  double I = 0.0;
+  Py_BEGIN_ALLOW_THREADS
+  I = thiscomplex->CalculateIQ_2D_Error(*thisvec,qx,qy);
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -589,7 +619,10 @@
 
   ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
-
-  double I = thiscomplex->CalculateIQ(q);
-
+  
+  double I = 0.0;
+  Py_BEGIN_ALLOW_THREADS
+  I = thiscomplex->CalculateIQ(q);
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
@@ -609,6 +642,9 @@
   ComplexModel * thiscomplex = static_cast<ComplexModel *>(temp);
 
-  double I = thiscomplex->CalculateIQError(q);
-
+  double I = 0.0;
+  Py_BEGIN_ALLOW_THREADS
+  I = thiscomplex->CalculateIQError(q);
+  Py_END_ALLOW_THREADS
+  
   return Py_BuildValue("d",I);
 }
