00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef IMPATOM_CHARGED_H
00010 #define IMPATOM_CHARGED_H
00011
00012 #include "atom_config.h"
00013
00014 #include <IMP/core/XYZ.h>
00015 #include <IMP/algebra/Vector3D.h>
00016 #include <IMP/internal/constants.h>
00017
00018 #include <vector>
00019 #include <limits>
00020
00021 IMPATOM_BEGIN_NAMESPACE
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class IMPATOMEXPORT Charged: public IMP::core::XYZ
00032 {
00033 public:
00034 IMP_DECORATOR(Charged, IMP::core::XYZ);
00035
00036
00037
00038 static Charged setup_particle(Particle *p, const algebra::VectorD<3> &v,
00039 Float charge) {
00040 XYZ::setup_particle(p, v);
00041 p->add_attribute(get_charge_key(), charge);
00042 return Charged(p);
00043 }
00044
00045
00046
00047
00048 static Charged setup_particle(Particle *p, Float charge=0) {
00049 IMP_USAGE_CHECK(XYZ::particle_is_instance(p),
00050 "Particle must already be an XYZ particle");
00051 p->add_attribute(get_charge_key(), charge);
00052 return Charged(p);
00053 }
00054
00055 IMP_DECORATOR_GET_SET(charge, get_charge_key(), Float, Float);
00056
00057
00058 static bool particle_is_instance(Particle *p) {
00059 return XYZ::particle_is_instance(p)
00060 && p->has_attribute(get_charge_key());
00061 }
00062
00063 static FloatKey get_charge_key();
00064 };
00065
00066 IMP_OUTPUT_OPERATOR(Charged);
00067
00068 IMPATOM_END_NAMESPACE
00069
00070 #endif