00001 /** 00002 * \file CentroidOfRefined.h 00003 * \brief Set the coordinates of the particle to be the centoid of the 00004 * refined particles. 00005 * 00006 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00007 */ 00008 00009 #ifndef IMPCORE_CENTROID_OF_REFINED_H 00010 #define IMPCORE_CENTROID_OF_REFINED_H 00011 00012 #include "core_config.h" 00013 #include "XYZ.h" 00014 #include <IMP/Refiner.h> 00015 #include <IMP/macros.h> 00016 #include <IMP/Pointer.h> 00017 #include <IMP/Decorator.h> 00018 #include <IMP/SingletonModifier.h> 00019 00020 00021 IMPCORE_BEGIN_NAMESPACE 00022 00023 //! Set the coordinates of the particle to be the centoid of the particles. 00024 /** An exception is thrown if there are no refined particles. The weight 00025 FloatKey can be FloatKey and then all the weights will be equal. 00026 00027 \see CoverRefined 00028 \see DerivativesToRefined 00029 \see DerivativesFromRefined 00030 */ 00031 class IMPCOREEXPORT CentroidOfRefined: 00032 public SingletonModifier 00033 { 00034 IMP::internal::OwnerPointer<Refiner> refiner_; 00035 FloatKeys ks_; 00036 FloatKey w_; 00037 public: 00038 //! Set the keys ks to be the average of the refined particles. 00039 CentroidOfRefined(Refiner *r, 00040 FloatKey weight=FloatKey(), 00041 FloatKeys ks 00042 = XYZ::get_xyz_keys()); 00043 00044 IMP_SINGLETON_MODIFIER(CentroidOfRefined); 00045 }; 00046 00047 //! A particle that is the centroid of other particles. 00048 /** A decorator which sets up a particle to be the centroid of a 00049 set of other particles. 00050 00051 \usesconstraint 00052 */ 00053 IMP_SUMMARY_DECORATOR_DECL(Centroid, XYZ, XYZs); 00054 00055 IMP_DECORATORS(Centroid, XYZs); 00056 /** \decorators{Centroid} 00057 */ 00058 /** \decoratorstemp{Centroid} 00059 */ 00060 IMPCORE_END_NAMESPACE 00061 00062 #endif /* IMPCORE_CENTROID_OF_REFINED_H */