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