IMP  2.0.1
The Integrative Modeling Platform
embeddings.h
Go to the documentation of this file.
1 /**
2  * \file IMP/statistics/embeddings.h
3  * \brief Cluster sets of points.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPSTATISTICS_EMBEDDINGS_H
10 #define IMPSTATISTICS_EMBEDDINGS_H
11 
12 #include <IMP/statistics/statistics_config.h>
13 #include "Embedding.h"
14 #include "embedding_macros.h"
15 #include <IMP/ConfigurationSet.h>
16 #include <IMP/SingletonContainer.h>
17 #include <IMP/algebra/VectorD.h>
18 
19 IMPSTATISTICS_BEGIN_NAMESPACE
20 
21 //! Embed a configuration using the XYZ coordinates of a set of particles
22 /** The point for each configuration of the model is a concatenation of
23  the Cartesian coordinates of the particles contained in the passed
24  SingletonContainer.
25 
26  See ConfigurationSet for more information about the input.
27 
28  \pythonexample{basic_optimization}
29 */
30 class IMPSTATISTICSEXPORT ConfigurationSetXYZEmbedding: public Embedding {
31  mutable Pointer<ConfigurationSet> cs_;
32  IMP::OwnerPointer<SingletonContainer> sc_;
33  bool align_;
34 public:
35  /** If align is true, all the configurations are rigidly aligned with
36  the first before generating their coordinates.
37  */
39  SingletonContainerAdaptor pi,
40  bool align=false);
42 };
43 
44 
45 /** Embed particles using the values of some of their attributes.
46  By default, the Cartesian coordinates are used, but another
47  set of attributes can be chosen. When using attributes that
48  are not equivalent (for example, angular degrees of freedom),
49  it is probably useful to rescale the attributes according
50  to their ranges (see IMP::Model::get_range()). This is
51  done by passing rescale=true to the constructor.
52 */
53 class IMPSTATISTICSEXPORT ParticleEmbedding: public Embedding {
54  Particles ps_;
55  FloatKeys ks_;
56  bool rescale_;
58 public:
59  ParticleEmbedding(const ParticlesTemp &ps,
60  const FloatKeys& ks
61 #if defined(IMP_DOXYGEN)
62  =core::XYZ::get_xyz_keys()
63 #else
64  = FloatKeys(IMP::kernel::internal::xyzr_keys,
65  IMP::kernel::internal::xyzr_keys+3)
66 #endif
67 ,
68  bool rescale=false);
70 };
71 
72 
73 //! Simply return the coordinates of a VectorD
74 class IMPSTATISTICSEXPORT VectorDEmbedding: public Embedding {
76 public:
77  template <class C>
78  VectorDEmbedding(const C &vs):
79  Embedding("VectorDs"){
80  vectors_.resize(vs.size());
81  for (unsigned int i=0; i< vs.size(); ++i) {
82  vectors_[i]= algebra::VectorKD(vs[i].coordinates_begin(),
83  vs[i].coordinates_end());
84  }
85  }
86 #ifdef SWIG
93 #endif
95 };
96 
97 
98 IMPSTATISTICS_END_NAMESPACE
99 
100 #endif /* IMPSTATISTICS_EMBEDDINGS_H */