Index: include/IMP/Particle.h
===================================================================
--- include/IMP/Particle.h	(revision 637)
+++ include/IMP/Particle.h	(working copy)
@@ -92,6 +92,12 @@
   void add_to_derivative(FloatKey name, Float value,
                          const DerivativeAccumulator &da);
 
+  //! Set whether this float attribute is optimized
+  void set_is_optimized(FloatKey k, bool tf);
+
+  //! Return whether this float attribute is optimized
+  bool get_is_optimized(FloatKey k) const;
+
   //! Get the derivative of a specified Float.
   /** \param[in] name Name of the attribute being modified.
       \exception std::out_of_range attribute does not exist.
@@ -257,6 +263,18 @@
   set_value_t(float_indexes_.get_value(name), value);
 }
 
+inline bool Particle::get_is_optimized(FloatKey name) const
+{
+  return model_->get_model_data()
+    ->get_is_optimized(float_indexes_.get_value(name));
+}
+
+inline void Particle::set_is_optimized(FloatKey name, bool tf)
+{
+  model_->get_model_data()
+    ->set_is_optimized(float_indexes_.get_value(name), tf);
+}
+
 inline void Particle::add_to_derivative(FloatKey name, Float value,
                                         const DerivativeAccumulator &da)
 {
Index: include/IMP/decorators/XYZDecorator.h
===================================================================
--- include/IMP/decorators/XYZDecorator.h	(revision 637)
+++ include/IMP/decorators/XYZDecorator.h	(working copy)
@@ -54,9 +54,22 @@
                                       DerivativeAccumulator &d) {
       get_particle()->add_to_derivative(get_coordinate_key(i), v, d);
     }
-    //! Get a FloatKey to access the ith coordinate
+    //! Get whether the coordinates are optimized
+    /**
+       Return true only if all of them are optimized. 
+     */
+    bool get_coordinates_are_optimized() const {
+      return get_particle()->get_is_optimized(get_coordinate_key(0))
+        && get_particle()->get_is_optimized(get_coordinate_key(1))
+        && get_particle()->get_is_optimized(get_coordinate_key(2));
+    }
+    //! Set whether the coordinates are optimized
+    void set_coordinates_are_optimized(bool tf) const {
+      get_particle()->set_is_optimized(get_coordinate_key(0), tf);
+      get_particle()->set_is_optimized(get_coordinate_key(1), tf);
+      get_particle()->set_is_optimized(get_coordinate_key(2), tf);
+    }
     static FloatKey get_coordinate_key(unsigned int i) {
-      decorator_initialize_static_data();
       IMP_check(i <3, "Out of range coordinate",
                 IndexException("Out of range coordinate"));
       return key_[i];
Index: src/decorators/XYZDecorator.cpp
===================================================================
--- src/decorators/XYZDecorator.cpp	(revision 637)
+++ src/decorators/XYZDecorator.cpp	(working copy)
@@ -11,12 +11,12 @@
 
 namespace IMP
 {
+// might as well initialize them statically
+  FloatKey XYZDecorator::key_[3]={FloatKey("x"), FloatKey("y"), FloatKey("z")};
 
-FloatKey XYZDecorator::key_[3];
 
 
-
-  void XYZDecorator::show(std::ostream &out, std::string prefix) const
+void XYZDecorator::show(std::ostream &out, std::string prefix) const
 {
   out << prefix << "(" << get_x()<< ", "
   << get_y() << ", " << get_z() <<")";
@@ -28,9 +28,6 @@
 
   IMP_DECORATOR_INITIALIZE(XYZDecorator, DecoratorBase,
                            {
-                             key_[0]= FloatKey("x");
-                             key_[1]= FloatKey("y");
-                             key_[2]= FloatKey("z");
                            })
   namespace {
     template <class T>