Index: kernel/include/IMP/singleton_scores/AttributeSingletonScore.h
===================================================================
--- kernel/include/IMP/singleton_scores/AttributeSingletonScore.h	(revision 0)
+++ kernel/include/IMP/singleton_scores/AttributeSingletonScore.h	(revision 0)
@@ -0,0 +1,36 @@
+/**
+ *  \file AttributeSingletonScore.h    
+ *  \brief A score based on the unmodified value of an attribute.
+ *
+ *  Copyright 2007-8 Sali Lab. All rights reserved.
+ */
+
+#ifndef __IMP_ATTRIBUTE_SINGLETON_SCORE_H
+#define __IMP_ATTRIBUTE_SINGLETON_SCORE_H
+
+#include "../SingletonScore.h"
+#include "../internal/ObjectPointer.h"
+
+namespace IMP
+{
+
+class UnaryFunction;
+
+//! Apply a function to an attribute.
+/** \ingroup singleton
+ */
+class IMPDLLEXPORT AttributeSingletonScore : public SingletonScore
+{
+  internal::ObjectPointer<UnaryFunction, true> f_;
+  FloatKey k_;
+public:
+  AttributeSingletonScore(FloatKey k, UnaryFunction *f);
+  virtual ~AttributeSingletonScore(){}
+  virtual Float evaluate(Particle *a,
+                         DerivativeAccumulator *da) ;
+  virtual void show(std::ostream &out=std::cout) const ;
+};
+
+} // namespace IMP
+
+#endif  /* __IMP_ATTRIBUTE_SINGLETON_SCORE_H */
Index: kernel/src/singleton_scores/AttributeSingletonScore.cpp
===================================================================
--- kernel/src/singleton_scores/AttributeSingletonScore.cpp	(revision 0)
+++ kernel/src/singleton_scores/AttributeSingletonScore.cpp	(revision 0)
@@ -0,0 +1,39 @@
+/**
+ *  \file AttributeSingletonScore.cpp
+ *  \brief A score based on an unmodified attribute value.
+ *
+ *  Copyright 2007-8 Sali Lab. All rights reserved.
+ */
+
+#include "IMP/singleton_scores/AttributeSingletonScore.h"
+#include "IMP/UnaryFunction.h"
+#include "IMP/Particle.h"
+
+namespace IMP
+{
+
+AttributeSingletonScore::AttributeSingletonScore(FloatKey k,
+                                                 UnaryFunction *f): f_(f),
+                                                                    k_(k){}
+
+Float AttributeSingletonScore::evaluate(Particle *b,
+                                        DerivativeAccumulator *da)
+{
+  if (da) {
+    Float d;
+    float r= (*f_)(b->get_value(k_), d);
+    b->add_to_derivative(k_, d, *da);
+    return r;
+  } else {
+    return (*f_)(b->get_value(k_));
+  }
+}
+
+void AttributeSingletonScore::show(std::ostream &out) const
+{
+  out << "AttributeSingletonScore using ";
+  f_->show(out);
+  out << " on " << k_;
+}
+
+} // namespace IMP
Index: kernel/pyext/IMP.i
===================================================================
--- kernel/pyext/IMP.i	(revision 441)
+++ kernel/pyext/IMP.i	(working copy)
@@ -71,6 +71,9 @@
   %pythonprepend DistanceToSingletonScore::DistanceToSingletonScore %{
         args[1].thisown=0
   %}
+  %pythonprepend AttributeSingletonScore::AttributeSingletonScore %{
+        args[1].thisown=0
+  %}
   %pythonprepend AngleTripletScore::AngleTripletScore %{
         args[0].thisown=0
   %}
@@ -135,6 +138,7 @@
 %include "IMP/pair_scores/DistancePairScore.h"
 %include "IMP/pair_scores/SphereDistancePairScore.h"
 %include "IMP/singleton_scores/DistanceToSingletonScore.h"
+%include "IMP/singleton_scores/AttributeSingletonScore.h"
 %include "IMP/triplet_scores/AngleTripletScore.h"
 %include "IMP/restraints/DistanceRestraint.h"
 %include "IMP/restraints/AngleRestraint.h"
Index: kernel/src/singleton_scores/SConscript
===================================================================
--- kernel/src/singleton_scores/SConscript	(revision 441)
+++ kernel/src/singleton_scores/SConscript	(working copy)
@@ -1,6 +1,5 @@
 Import('env')
-
-files = ['DistanceToSingletonScore.cpp']
-
-files = [File(x) for x in files]
+files=[]
+files.append(File( 'AttributeSingletonScore.cpp' ))
+files.append(File( 'DistanceToSingletonScore.cpp' ))
 Return('files')
Index: kernel/include/IMP/singleton_scores/SConscript
===================================================================
--- kernel/include/IMP/singleton_scores/SConscript	(revision 441)
+++ kernel/include/IMP/singleton_scores/SConscript	(working copy)
@@ -1,9 +1,8 @@
-import os.path
 Import('env')
-
-files = ['DistanceToSingletonScore.h']
-
-# Install the include files:
-includedir = os.path.join(env['includedir'], 'IMP', 'singleton_scores')
+import os.path
+files=[]
+files.append( 'AttributeSingletonScore.h' )
+files.append( 'DistanceToSingletonScore.h' )
+includedir = os.path.join(env['includedir'], 'IMP', 'singleton_scores' )
 inst = env.Install(includedir, files)
 env.Alias('install', inst)
Index: kernel/include/IMP.h
===================================================================
--- kernel/include/IMP.h	(revision 441)
+++ kernel/include/IMP.h	(working copy)
@@ -1,82 +1,95 @@
 /**
- *  \file IMP.h   \brief IMP, an Integrative Modeling Platform.
- *
- *  Copyright 2007-8 Sali Lab. All rights reserved.
- *
- */
-
+*  \file IMP.h   \brief IMP, an Integrative Modeling Platform.
+*
+*  Copyright 2007-8 Sali Lab. All rights reserved.
+*
+*/
 #ifndef __IMP_H
 #define __IMP_H
-
-#include "IMP/IMP_config.h"
-#include "IMP/log.h"
-#include "IMP/random.h"
-#include "IMP/base_types.h"
-#include "IMP/Particle.h"
-#include "IMP/Optimizer.h"
-#include "IMP/Restraint.h"
-#include "IMP/exception.h"
-#include "IMP/UnaryFunction.h"
-#include "IMP/unary_functions/Harmonic.h"
-#include "IMP/unary_functions/HarmonicLowerBound.h"
-#include "IMP/unary_functions/HarmonicUpperBound.h"
-#include "IMP/unary_functions/OpenCubicSpline.h"
-#include "IMP/unary_functions/ClosedCubicSpline.h"
-#include "IMP/unary_functions/Cosine.h"
-#include "IMP/unary_functions/Linear.h"
-#include "IMP/ScoreFuncParams.h"
-#include "IMP/Model.h"
-#include "IMP/PairScore.h"
-#include "IMP/SingletonScore.h"
-#include "IMP/TripletScore.h"
-#include "IMP/Vector3D.h"
-#include "IMP/VersionInfo.h"
-#include "IMP/decorators/HierarchyDecorator.h"
-#include "IMP/decorators/MolecularHierarchyDecorator.h"
-#include "IMP/decorators/NameDecorator.h"
-#include "IMP/decorators/AtomDecorator.h"
-#include "IMP/decorators/ResidueDecorator.h"
-#include "IMP/decorators/XYZDecorator.h"
-#include "IMP/decorators/bond_decorators.h"
-#include "IMP/optimizers/SteepestDescent.h"
-#include "IMP/optimizers/ConjugateGradients.h"
-#include "IMP/optimizers/MolecularDynamics.h"
-#include "IMP/optimizers/MonteCarlo.h"
-#include "IMP/optimizers/Mover.h"
-#include "IMP/optimizers/MoverBase.h"
-#include "IMP/optimizers/movers/BallMover.h"
-#include "IMP/optimizers/movers/NormalMover.h"
-#include "IMP/optimizers/states/VRMLLogOptimizerState.h"
-#include "IMP/optimizers/states/CMMLogOptimizerState.h"
-#include "IMP/optimizers/states/VelocityScalingOptimizerState.h"
-#include "IMP/pair_scores/DistancePairScore.h"
-#include "IMP/pair_scores/SphereDistancePairScore.h"
-#include "IMP/singleton_scores/DistanceToSingletonScore.h"
-#include "IMP/triplet_scores/AngleTripletScore.h"
-#include "IMP/restraints/RestraintSet.h"
-#include "IMP/restraints/DistanceRestraint.h"
-#include "IMP/restraints/AngleRestraint.h"
-#include "IMP/restraints/DihedralRestraint.h"
-#include "IMP/restraints/TorusRestraint.h"
-#include "IMP/restraints/ProximityRestraint.h"
-#include "IMP/restraints/ConnectivityRestraint.h"
-#include "IMP/restraints/PairConnectivityRestraint.h"
-#include "IMP/restraints/ExclusionVolumeRestraint.h"
-#include "IMP/restraints/NonbondedRestraint.h"
-#include "IMP/restraints/BondDecoratorRestraint.h"
-#include "IMP/restraints/SingletonListRestraint.h"
-#include "IMP/restraints/PairListRestraint.h"
-#include "IMP/restraints/TripletChainRestraint.h"
-#include "IMP/score_states/BipartiteNonbondedListScoreState.h"
-#include "IMP/score_states/MaxChangeScoreState.h"
-#include "IMP/score_states/NonbondedListScoreState.h"
-#include "IMP/score_states/BondedListScoreState.h"
-#include "IMP/score_states/BondDecoratorListScoreState.h"
-#include "IMP/score_states/AllNonbondedListScoreState.h"
-#include "IMP/score_states/AllSphereNonbondedListScoreState.h"
-
-/**
-   \namespace IMP The IMP namespace.
- */
-
+#include <IMP/base_types.h>
+#include <IMP/DecoratorBase.h>
+#include <IMP/DerivativeAccumulator.h>
+#include <IMP/exception.h>
+#include <IMP/IMP_config.h>
+#include <IMP/Index.h>
+#include <IMP/Key.h>
+#include <IMP/log.h>
+#include <IMP/macros.h>
+#include <IMP/Model.h>
+#include <IMP/Optimizer.h>
+#include <IMP/OptimizerState.h>
+#include <IMP/PairScore.h>
+#include <IMP/Particle.h>
+#include <IMP/random.h>
+#include <IMP/Restraint.h>
+#include <IMP/ScoreFuncParams.h>
+#include <IMP/ScoreState.h>
+#include <IMP/SingletonScore.h>
+#include <IMP/TripletScore.h>
+#include <IMP/UnaryFunction.h>
+#include <IMP/utility.h>
+#include <IMP/Vector3D.h>
+#include <IMP/VersionInfo.h>
+#include <IMP/decorators/AtomDecorator.h>
+#include <IMP/decorators/bond_decorators.h>
+#include <IMP/decorators/HierarchyDecorator.h>
+#include <IMP/decorators/macros.h>
+#include <IMP/decorators/MolecularHierarchyDecorator.h>
+#include <IMP/decorators/NameDecorator.h>
+#include <IMP/decorators/ResidueDecorator.h>
+#include <IMP/decorators/utility.h>
+#include <IMP/decorators/XYZDecorator.h>
+#include <IMP/internal/AttributeTable.h>
+#include <IMP/internal/graph_base.h>
+#include <IMP/internal/Grid3D.h>
+#include <IMP/internal/kernel_version_info.h>
+#include <IMP/internal/ObjectContainer.h>
+#include <IMP/internal/Object.h>
+#include <IMP/internal/ObjectPointer.h>
+#include <IMP/internal/ParticleGrid.h>
+#include <IMP/internal/Vector.h>
+#include <IMP/optimizers/ConjugateGradients.h>
+#include <IMP/optimizers/MolecularDynamics.h>
+#include <IMP/optimizers/MonteCarlo.h>
+#include <IMP/optimizers/MoverBase.h>
+#include <IMP/optimizers/Mover.h>
+#include <IMP/optimizers/SteepestDescent.h>
+#include <IMP/pair_scores/DistancePairScore.h>
+#include <IMP/pair_scores/SphereDistancePairScore.h>
+#include <IMP/restraints/AngleRestraint.h>
+#include <IMP/restraints/BondDecoratorRestraint.h>
+#include <IMP/restraints/ConnectivityRestraint.h>
+#include <IMP/restraints/DihedralRestraint.h>
+#include <IMP/restraints/DistanceRestraint.h>
+#include <IMP/restraints/ExclusionVolumeRestraint.h>
+#include <IMP/restraints/NonbondedRestraint.h>
+#include <IMP/restraints/PairConnectivityRestraint.h>
+#include <IMP/restraints/PairListRestraint.h>
+#include <IMP/restraints/ProximityRestraint.h>
+#include <IMP/restraints/RestraintSet.h>
+#include <IMP/restraints/SingletonListRestraint.h>
+#include <IMP/restraints/TorusRestraint.h>
+#include <IMP/restraints/TripletChainRestraint.h>
+#include <IMP/score_states/AllNonbondedListScoreState.h>
+#include <IMP/score_states/AllSphereNonbondedListScoreState.h>
+#include <IMP/score_states/BipartiteNonbondedListScoreState.h>
+#include <IMP/score_states/BondDecoratorListScoreState.h>
+#include <IMP/score_states/BondedListScoreState.h>
+#include <IMP/score_states/MaxChangeScoreState.h>
+#include <IMP/score_states/NonbondedListScoreState.h>
+#include <IMP/singleton_scores/AttributeSingletonScore.h>
+#include <IMP/singleton_scores/DistanceToSingletonScore.h>
+#include <IMP/triplet_scores/AngleTripletScore.h>
+#include <IMP/unary_functions/ClosedCubicSpline.h>
+#include <IMP/unary_functions/Cosine.h>
+#include <IMP/unary_functions/Harmonic.h>
+#include <IMP/unary_functions/HarmonicLowerBound.h>
+#include <IMP/unary_functions/HarmonicUpperBound.h>
+#include <IMP/unary_functions/Linear.h>
+#include <IMP/unary_functions/OpenCubicSpline.h>
+#include <IMP/optimizers/movers/BallMover.h>
+#include <IMP/optimizers/movers/NormalMover.h>
+#include <IMP/optimizers/states/CMMLogOptimizerState.h>
+#include <IMP/optimizers/states/VelocityScalingOptimizerState.h>
+#include <IMP/optimizers/states/VRMLLogOptimizerState.h>
 #endif  /* __IMP_H */