Index: kernel/include/IMP/decorators/AtomDecorator.h =================================================================== --- kernel/include/IMP/decorators/AtomDecorator.h (revision 354) +++ kernel/include/IMP/decorators/AtomDecorator.h (working copy) @@ -15,7 +15,6 @@ #include "../Model.h" #include "utility.h" #include "XYZDecorator.h" - namespace IMP { @@ -31,15 +30,17 @@ class IMPDLLEXPORT AtomDecorator: public XYZDecorator { IMP_DECORATOR(AtomDecorator, XYZDecorator, - return p->has_attribute(type_key_), - { p->add_attribute(type_key_, AT_UNKNOWN.get_index()); }); + return p->has_attribute(name_key_), + { p->add_attribute(name_key_, AT_UNKNOWN.get_index()); + p->add_attribute(index_key_, -1); + }); protected: static IntKey element_key_; static FloatKey charge_key_; //static FloatKey vdw_radius_key_; static FloatKey mass_key_; - static IntKey type_key_; - + static IntKey name_key_; + static IntKey index_key_; public: //! The various elements currently supported /** @@ -216,11 +217,11 @@ static AtomType AT_H72; static AtomType AT_H73; - AtomType get_type() const { - return AtomType(get_particle()->get_value(type_key_)); + AtomType get_name() const { + return AtomType(get_particle()->get_value(name_key_)); } - void set_type(AtomType t); + void set_name(AtomType t); IMP_DECORATOR_GET_SET_OPT(charge, charge_key_, Float, Float, 0); @@ -230,6 +231,10 @@ IMP_DECORATOR_GET_SET_OPT(mass, mass_key_, Float, Float, 0); + IMP_DECORATOR_GET_SET(index, index_key_, + Int, unsigned int); + + }; IMP_OUTPUT_OPERATOR(AtomDecorator); Index: kernel/include/IMP/decorators/ResidueDecorator.h =================================================================== --- kernel/include/IMP/decorators/ResidueDecorator.h (revision 354) +++ kernel/include/IMP/decorators/ResidueDecorator.h (working copy) @@ -26,13 +26,13 @@ class IMPDLLEXPORT ResidueDecorator: public DecoratorBase { IMP_DECORATOR(ResidueDecorator, DecoratorBase, - return p->has_attribute(type_key_) + return p->has_attribute(name_key_) && p->has_attribute(index_key_), - { p->add_attribute(type_key_, -1); + { p->add_attribute(name_key_, -1); p->add_attribute(index_key_, -1); }); protected: - static IntKey type_key_; + static IntKey name_key_; static IntKey index_key_; public: @@ -70,12 +70,12 @@ static ResidueType GUA; static ResidueType THY; - ResidueType get_type() const { - return ResidueType(get_particle()->get_value(type_key_)); + ResidueType get_name() const { + return ResidueType(get_particle()->get_value(name_key_)); } - void set_type(ResidueType t) { - return get_particle()->set_value(type_key_, t.get_index()); + void set_name(ResidueType t) { + return get_particle()->set_value(name_key_, t.get_index()); } //! The residues index in the chain Index: kernel/src/decorators/AtomDecorator.cpp =================================================================== --- kernel/src/decorators/AtomDecorator.cpp (revision 354) +++ kernel/src/decorators/AtomDecorator.cpp (working copy) @@ -10,6 +10,10 @@ #include #include "IMP/decorators/AtomDecorator.h" +#include "IMP/decorators/ResidueDecorator.h" +#include "IMP/decorators/MolecularHierarchyDecorator.h" +#include "IMP/decorators/NameDecorator.h" + #include "IMP/log.h" namespace IMP @@ -27,7 +31,9 @@ IntKey AtomDecorator::element_key_; FloatKey AtomDecorator::charge_key_; FloatKey AtomDecorator::mass_key_; -IntKey AtomDecorator::type_key_; +IntKey AtomDecorator::name_key_; +IntKey AtomDecorator::index_key_; + TYPE_DEF(N); TYPE_DEF(H); TYPE_DEF(1H); @@ -199,16 +205,16 @@ void AtomDecorator::show(std::ostream &out, std::string prefix) const { //out <set_value(type_key_, t.get_index()); + get_particle()->set_value(name_key_, t.get_index()); } IMP_DECORATOR_INITIALIZE(AtomDecorator, XYZDecorator, @@ -217,7 +223,8 @@ charge_key_= FloatKey("atom charge"); mass_key_= FloatKey("atom mass"); //vdw_radius_key_= FloatKey("atom vdw radius"); - type_key_ = IntKey("atom type"); + name_key_ = IntKey("atom name"); + index_key_= IntKey("residue index"); TYPE_INIT(N); TYPE_INIT(H); TYPE_INIT(1H); Index: kernel/src/decorators/ResidueDecorator.cpp =================================================================== --- kernel/src/decorators/ResidueDecorator.cpp (revision 354) +++ kernel/src/decorators/ResidueDecorator.cpp (working copy) @@ -17,7 +17,7 @@ -IntKey ResidueDecorator::type_key_; +IntKey ResidueDecorator::name_key_; IntKey ResidueDecorator::index_key_; #define TYPE_INIT(STR) STR= ResidueType(#STR); @@ -54,13 +54,13 @@ void ResidueDecorator::show(std::ostream &out, std::string pre) const { out << pre << "residue #" << get_index() << " of type " - << get_type() << std::endl; + << get_name() << std::endl; } IMP_DECORATOR_INITIALIZE(ResidueDecorator, DecoratorBase, - { type_key_= IntKey("residue type"); + { name_key_= IntKey("residue name"); index_key_= IntKey("residue index"); TYPE_INIT(UNK); TYPE_INIT(GLY);