IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
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-2022 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
21IMPATOM_BEGIN_NAMESPACE
22
23//! A decorator for an atom that has a defined CHARMM type.
24class 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:
33 IMP_DECORATOR_METHODS(CHARMMAtom, Atom);
34 //! Create a decorator with the passed CHARMM type.
35 /** The particle is assumed to already have all atom attributes.
36 */
37 IMP_DECORATOR_SETUP_1(CHARMMAtom, String, charmm_type);
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 */
55IMPATOMEXPORT 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 */
60IMPATOMEXPORT void remove_charmm_untyped_atoms(Hierarchy hierarchy);
61
62IMPATOM_END_NAMESPACE
63
64#endif /* IMPATOM_CHARMM_ATOM_H */
Simple atom decorator.
Decorator for helping deal with a hierarchy of molecules.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Class for storing model, its restraints, constraints, and particles.
Definition Model.h:111
static bool get_is_setup(Model *m, ParticleIndex pi)
Return true if the particle is an instance of a CHARMMAtom.
Definition CHARMMAtom.h:42
The standard decorator for manipulating molecular structures.
Helper macros for implementing Decorators.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
#define IMP_DECORATOR_METHODS(Name, Parent)
Atoms get_charmm_untyped_atoms(Hierarchy hierarchy)
Get all atoms in the Hierarchy that do not have CHARMM types.
void remove_charmm_untyped_atoms(Hierarchy hierarchy)
Remove any atom from the Hierarchy that does not have a CHARMM type.
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
Key< 2 > StringKey
The type used to identify string attributes in the Particles.
Definition base_types.h:40
std::string String
Basic string value.
Definition types.h:43