IMP logo
IMP Reference Guide  2.13.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-2020 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"
16 #include <IMP/decorator_macros.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(Model *m, 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
42  static bool get_is_setup(Model *m, ParticleIndex pi) {
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 */
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
void remove_charmm_untyped_atoms(Hierarchy hierarchy)
Remove any atom from the Hierarchy that does not have a CHARMM type.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Simple atom decorator.
Atoms get_charmm_untyped_atoms(Hierarchy hierarchy)
Get all atoms in the Hierarchy that do not have CHARMM types.
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
static bool get_is_setup(Model *m, ParticleIndex pi)
Return true if the particle is an instance of a CHARMMAtom.
Definition: CHARMMAtom.h:42
Decorator for helping deal with a hierarchy of molecules.
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
add particle atribute with the specied key and initial value
A decorator for a particle representing an atom.
Definition: atom/Atom.h:234
Various general useful macros for IMP.
A base class for Keys.
Definition: Key.h:44
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
bool get_has_attribute(TypeKey attribute_key, ParticleIndex particle) const
return true if particle has attribute with the specified key
std::string String
Basic string value.
Definition: types.h:44
A decorator for an atom that has a defined CHARMM type.
Definition: CHARMMAtom.h:24