00001
00002
00003
00004
00005
00006
00007
00008 #ifndef IMPATOM_ANGLE_DECORATORS_H
00009 #define IMPATOM_ANGLE_DECORATORS_H
00010
00011 #include "atom_config.h"
00012 #include <IMP/core/XYZ.h>
00013 #include <IMP/Decorator.h>
00014
00015 IMPATOM_BEGIN_NAMESPACE
00016
00017
00018
00019
00020
00021
00022
00023 class IMPATOMEXPORT Angle : public Decorator
00024 {
00025 public:
00026 IMP_DECORATOR(Angle, Decorator);
00027
00028
00029 static Angle setup_particle(Particle *p, core::XYZ a, core::XYZ b,
00030 core::XYZ c) {
00031 p->add_attribute(get_particle_key(0), a);
00032 p->add_attribute(get_particle_key(1), b);
00033 p->add_attribute(get_particle_key(2), c);
00034 return Angle(p);
00035 }
00036
00037
00038 static bool particle_is_instance(Particle *p) {
00039 for (unsigned int i = 0; i < 3; ++i) {
00040 if (!p->has_attribute(get_particle_key(i))) return false;
00041 }
00042 return true;
00043 }
00044
00045 Particle* get_particle() const {
00046 return Decorator::get_particle();
00047 }
00048
00049
00050 Particle* get_particle(unsigned int i) const {
00051 return get_particle()->get_value(get_particle_key(i));
00052 }
00053
00054 IMP_DECORATOR_GET_SET_OPT(ideal, get_ideal_key(), Float, Float, -1);
00055 IMP_DECORATOR_GET_SET_OPT(stiffness, get_stiffness_key(), Float, Float, 0.);
00056
00057 static ParticleKey get_particle_key(unsigned int i);
00058 static FloatKey get_ideal_key();
00059 static FloatKey get_stiffness_key();
00060 };
00061
00062 IMP_OUTPUT_OPERATOR(Angle);
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 class IMPATOMEXPORT Dihedral : public Decorator
00078 {
00079 public:
00080 IMP_DECORATOR(Dihedral, Decorator);
00081
00082
00083 static Dihedral setup_particle(Particle *p, core::XYZ a, core::XYZ b,
00084 core::XYZ c, core::XYZ d) {
00085 p->add_attribute(get_particle_key(0), a);
00086 p->add_attribute(get_particle_key(1), b);
00087 p->add_attribute(get_particle_key(2), c);
00088 p->add_attribute(get_particle_key(3), d);
00089 return Dihedral(p);
00090 }
00091
00092
00093 static bool particle_is_instance(Particle *p) {
00094 for (unsigned int i = 0; i < 4; ++i) {
00095 if (!p->has_attribute(get_particle_key(i))) return false;
00096 }
00097 return true;
00098 }
00099
00100 Particle* get_particle() const {
00101 return Decorator::get_particle();
00102 }
00103
00104
00105 Particle* get_particle(unsigned int i) const {
00106 return get_particle()->get_value(get_particle_key(i));
00107 }
00108
00109 IMP_DECORATOR_GET_SET_OPT(ideal, get_ideal_key(), Float, Float, -1);
00110 IMP_DECORATOR_GET_SET_OPT(multiplicity, get_multiplicity_key(),
00111 Int, Int, 0);
00112 IMP_DECORATOR_GET_SET_OPT(stiffness, get_stiffness_key(), Float, Float, 0.);
00113
00114 static ParticleKey get_particle_key(unsigned int i);
00115 static FloatKey get_ideal_key();
00116 static IntKey get_multiplicity_key();
00117 static FloatKey get_stiffness_key();
00118 };
00119
00120 IMP_OUTPUT_OPERATOR(Dihedral);
00121
00122 IMPATOM_END_NAMESPACE
00123
00124 #endif