00001 /** 00002 * \file atom/CHARMMAtom.h 00003 * \brief A decorator for an atom that has a defined CHARMM type. 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 * 00007 */ 00008 00009 #ifndef IMPATOM_CHARMM_ATOM_H 00010 #define IMPATOM_CHARMM_ATOM_H 00011 00012 #include "atom_config.h" 00013 00014 #include "Atom.h" 00015 00016 #include <vector> 00017 #include <limits> 00018 00019 IMPATOM_BEGIN_NAMESPACE 00020 00021 //! A decorator for an atom that has a defined CHARMM type. 00022 class IMPATOMEXPORT CHARMMAtom : public Atom 00023 { 00024 public: 00025 IMP_DECORATOR(CHARMMAtom, Atom); 00026 00027 /** Create a decorator with the passed CHARMM type. 00028 The particle is assumed to already have all atom attributes. 00029 */ 00030 static CHARMMAtom setup_particle(Particle *p, String charmm_type) { 00031 IMP_USAGE_CHECK(Atom::particle_is_instance(p), 00032 "Particle must already be an Atom particle"); 00033 p->add_attribute(get_charmm_type_key(), charmm_type); 00034 return CHARMMAtom(p); 00035 } 00036 00037 IMP_DECORATOR_GET_SET(charmm_type, get_charmm_type_key(), String, String); 00038 00039 //! Return true if the particle is an instance of a CHARMMAtom 00040 static bool particle_is_instance(Particle *p) { 00041 return Atom::particle_is_instance(p) 00042 && p->has_attribute(get_charmm_type_key()); 00043 } 00044 00045 static StringKey get_charmm_type_key(); 00046 }; 00047 00048 IMP_OUTPUT_OPERATOR(CHARMMAtom); 00049 00050 IMPATOM_END_NAMESPACE 00051 00052 #endif /* IMPATOM_CHARMM_ATOM_H */