IMP logo
IMP Reference Guide  2.20.2
The Integrative Modeling Platform
Molecule.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/Molecule.h \brief A decorator for Molecules.
3  *
4  * Copyright 2007-2022 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPATOM_MOLECULE_H
9 #define IMPATOM_MOLECULE_H
10 
11 #include <IMP/atom/atom_config.h>
12 #include "atom_macros.h"
13 #include "Hierarchy.h"
14 
15 #include <IMP/base_types.h>
16 #include <IMP/Particle.h>
17 #include <IMP/Model.h>
18 #include <IMP/Decorator.h>
19 
20 IMPATOM_BEGIN_NAMESPACE
21 
22 //! A decorator for a molecule.
23 /** */
24 class IMPATOMEXPORT Molecule : public Hierarchy {
25  static IntKey key();
26  static void do_setup_particle(Model *m, ParticleIndex pi,
27  Molecule = Molecule()) {
28  if (!Hierarchy::get_is_setup(m, pi)) {
30  }
31  m->add_attribute(key(), pi, 1);
32  }
33 
34  public:
36  /** Mark the particle as denoting a molecule. */
39 
40  static bool get_is_setup(Model *m, ParticleIndex pi) {
41  return m->get_has_attribute(key(), pi);
42  }
43 };
44 
45 IMP_DECORATORS(Molecule, Molecules, Hierarchies);
46 
47 /** Walk up the hierarchy to determine the molecule name. */
48 IMPATOMEXPORT std::string get_molecule_name(Hierarchy h);
49 
50 IMPATOM_END_NAMESPACE
51 
52 #endif /* IMPATOM_MOLECULE_H */
The base class for decorators.
Basic types used by IMP.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Storage of a model, its restraints, constraints and particles.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:86
Decorator for helping deal with a hierarchy of molecules.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
add particle attribute with the specified key and initial value
The standard decorator for manipulating molecular structures.
#define IMP_DECORATOR_SETUP_0(Name)
std::string get_molecule_name(Hierarchy h)
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Macros for maintaining molecular hierarchies.
static bool get_is_setup(Model *m, ParticleIndex p)
Check if the particle has the needed attributes for a cast to succeed.
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
A decorator for a molecule.
Definition: Molecule.h:24