Index: kernel/include/IMP/restraints/NonbondedRestraint.h
===================================================================
--- kernel/include/IMP/restraints/NonbondedRestraint.h	(revision 338)
+++ kernel/include/IMP/restraints/NonbondedRestraint.h	(working copy)
@@ -9,13 +9,10 @@
 #ifndef __IMP_NONBONDED_RESTRAINT_H
 #define __IMP_NONBONDED_RESTRAINT_H
 
-#include <vector>
-#include <iostream>
-
 #include "../IMP_config.h"
-#include "../ModelData.h"
 #include "../Restraint.h"
 
+#include <iostream>
 
 namespace IMP
 {
@@ -32,8 +29,10 @@
       of particles.
       \param[in] ps The pair score function to apply to the pairs. This 
       object is deleted upon destruction.
+      \param[in] max_dist Pairs beyond this distance may be dropped.
    */
-  NonbondedRestraint(NonbondedListScoreState *nbl, PairScore *ps);
+  NonbondedRestraint(NonbondedListScoreState *nbl, PairScore *ps,
+                     Float max_dist= std::numeric_limits<Float>::max());
   virtual ~NonbondedRestraint(){}
 
   IMP_RESTRAINT("0.5", "Daniel Russel");
@@ -41,6 +40,7 @@
 protected:
   NonbondedListScoreState *nbl_;
   std::auto_ptr<PairScore> sf_;
+  Float max_dist_;
 };
 
 } // namespace IMP
Index: kernel/src/restraints/NonbondedRestraint.cpp
===================================================================
--- kernel/src/restraints/NonbondedRestraint.cpp	(revision 338)
+++ kernel/src/restraints/NonbondedRestraint.cpp	(working copy)
@@ -17,7 +17,9 @@
 {
 
 NonbondedRestraint::NonbondedRestraint(NonbondedListScoreState *nbl, 
-                                       PairScore *ps) : nbl_(nbl), sf_(ps)
+                                       PairScore *ps,
+                                       Float md) : nbl_(nbl), sf_(ps),
+                                                   max_dist_(md)
 {
 }
 
@@ -29,8 +31,9 @@
   IMP_CHECK_OBJECT(nbl_);
   Float score=0;
 
-  for (NonbondedListScoreState::NonbondedIterator it = nbl_->nonbonded_begin();
-       it != nbl_->nonbonded_end(); ++it) {
+  for (NonbondedListScoreState::NonbondedIterator it 
+         = nbl_->nonbonded_begin(max_dist_);
+       it != nbl_->nonbonded_end(max_dist_); ++it) {
     score += sf_->evaluate(it->first, it->second, accum);
   }