IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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
20IMPATOM_BEGIN_NAMESPACE
21
22//! A decorator for a molecule.
23/** */
24class 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:
35 IMP_DECORATOR_METHODS(Molecule, Hierarchy);
36 /** Mark the particle as denoting a molecule. */
38 IMP_DECORATOR_SETUP_1(Molecule, Molecule, other);
39
40 static bool get_is_setup(Model *m, ParticleIndex pi) {
41 return m->get_has_attribute(key(), pi);
42 }
43};
44
45IMP_DECORATORS(Molecule, Molecules, Hierarchies);
46
47/** Walk up the hierarchy to determine the molecule name. */
48IMPATOMEXPORT std::string get_molecule_name(Hierarchy h);
49
50IMPATOM_END_NAMESPACE
51
52#endif /* IMPATOM_MOLECULE_H */
The base class for decorators.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Decorator for helping deal with a hierarchy of molecules.
Macros for maintaining molecular hierarchies.
Basic types used by IMP.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
The standard decorator for manipulating molecular structures.
static bool get_is_setup(Model *m, ParticleIndex p)
Check if the particle has the needed attributes for a cast to succeed.
static Hierarchy setup_particle(Model *m, ParticleIndex pi, ParticleIndexesAdaptor children=ParticleIndexesAdaptor())
Create a Hierarchy of level t by adding the needed attributes.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATOR_SETUP_0(Name)
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
#define IMP_DECORATOR_METHODS(Name, Parent)
std::string get_molecule_name(Hierarchy h)
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
Key< 1 > IntKey
The type used to identify int attributes in the Particles.
Definition base_types.h:36