00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef IMPATOM_LENNARD_JONES_H
00010 #define IMPATOM_LENNARD_JONES_H
00011
00012 #include "atom_config.h"
00013 #include <IMP/core/XYZR.h>
00014
00015 IMPATOM_BEGIN_NAMESPACE
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class IMPATOMEXPORT LennardJones: public IMP::core::XYZR
00027 {
00028 public:
00029 IMP_DECORATOR(LennardJones, IMP::core::XYZR);
00030
00031
00032
00033
00034 static LennardJones setup_particle(Particle *p, Float well_depth=0) {
00035 IMP_USAGE_CHECK(XYZR::particle_is_instance(p),
00036 "Particle must already be an XYZR particle");
00037 p->add_attribute(get_well_depth_key(), well_depth);
00038 return LennardJones(p);
00039 }
00040
00041 Float get_well_depth() const {
00042 return static_cast<Float>(get_particle()->get_value(get_well_depth_key()));
00043 }
00044
00045 void set_well_depth(Float well_depth) {
00046 IMP_USAGE_CHECK(well_depth >= 0, "well depth cannot be negative");
00047 get_particle()->set_value(get_well_depth_key(), well_depth);
00048 }
00049
00050
00051 static bool particle_is_instance(Particle *p) {
00052 return XYZR::particle_is_instance(p)
00053 && p->has_attribute(get_well_depth_key());
00054 }
00055
00056 static FloatKey get_well_depth_key();
00057 };
00058
00059 IMP_OUTPUT_OPERATOR(LennardJones);
00060
00061 IMPATOM_END_NAMESPACE
00062
00063 #endif