IMP  2.2.0
The Integrative Modeling Platform
CHARMMAtom.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/CHARMMAtom.h
3  * \brief A decorator for an atom that has a defined CHARMM type.
4  *
5  * Copyright 2007-2014 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPATOM_CHARMM_ATOM_H
10 #define IMPATOM_CHARMM_ATOM_H
11 
12 #include <IMP/atom/atom_config.h>
13 
14 #include "Atom.h"
15 #include "Hierarchy.h"
17 
18 #include <vector>
19 #include <limits>
20 
21 IMPATOM_BEGIN_NAMESPACE
22 
23 //! A decorator for an atom that has a defined CHARMM type.
24 class IMPATOMEXPORT CHARMMAtom : public Atom {
25  static void do_setup_particle(kernel::Model *m, kernel::ParticleIndex pi,
26  String charmm_type) {
27  IMP_USAGE_CHECK(Atom::get_is_setup(m, pi),
28  "Particle must already be an Atom particle");
29  m->add_attribute(get_charmm_type_key(), pi, charmm_type);
30  }
31 
32  public:
34  /** Create a decorator with the passed CHARMM type.
35  The particle is assumed to already have all atom attributes.
36  */
38 
39  IMP_DECORATOR_GET_SET(charmm_type, get_charmm_type_key(), String, String);
40 
41  //! Return true if the particle is an instance of a CHARMMAtom
43  return Atom::get_is_setup(m, pi) &&
44  m->get_has_attribute(get_charmm_type_key(), pi);
45  }
46 
47  static StringKey get_charmm_type_key();
48 };
49 
50 //! Get all atoms in the Hierarchy that do not have CHARMM types.
51 /** \return a list of every Atom in the given Hierarchy that is not also
52  a CHARMMAtom.
53  \see remove_charmm_untyped_atoms
54  */
55 IMPATOMEXPORT Atoms get_charmm_untyped_atoms(Hierarchy hierarchy);
56 
57 //! Remove any atom from the Hierarchy that does not have a CHARMM type.
58 /** \see get_charmm_untyped_atoms, CHARMMTopology::add_missing_atoms
59  */
60 IMPATOMEXPORT void remove_charmm_untyped_atoms(Hierarchy hierarchy);
61 
62 IMPATOM_END_NAMESPACE
63 
64 #endif /* IMPATOM_CHARMM_ATOM_H */
A base class for Keys.
Definition: kernel/Key.h:46
void remove_charmm_untyped_atoms(Hierarchy hierarchy)
Remove any atom from the Hierarchy that does not have a CHARMM type.
Simple atom decorator.
#define IMP_DECORATOR_METHODS(Name, Parent)
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex pi)
Return true if the particle is an instance of a CHARMMAtom.
Definition: CHARMMAtom.h:42
Various general useful macros for IMP.
Atoms get_charmm_untyped_atoms(Hierarchy hierarchy)
Get all atoms in the Hierarchy that do not have CHARMM types.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Decorator for helping deal with a hierarchy of molecules.
A decorator for a particle representing an atom.
Definition: atom/Atom.h:234
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
std::string String
Basic string value.
Definition: base/types.h:44
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
A decorator for an atom that has a defined CHARMM type.
Definition: CHARMMAtom.h:24
Class for storing model, its restraints, constraints, and particles.
Definition: kernel/Model.h:72