9 #ifndef IMPCORE_DIRECTION_H
10 #define IMPCORE_DIRECTION_H
12 #include <IMP/core/core_config.h>
18 IMPCORE_BEGIN_NAMESPACE
35 static FloatKey get_direction_key(
unsigned int i);
39 return get_particle()->get_derivative(get_direction_key(i));
47 get_particle()->add_to_derivative(get_direction_key(i), v, d);
55 bool get_direction_is_optimized()
const;
58 void set_direction_is_optimized(
bool tf)
const;
67 void reflect() { set_direction(-get_direction()); }
76 IMPCOREEXPORT
double get_angle(Direction a, Direction b);
126 Float get_angle_derivative()
const;
131 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
141 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
148 DirectionUnitConstraint(Particle *p)
149 : IMP::Constraint(p->get_model(),
"DirectionUnitConstraint%1%")
153 friend class Direction;
155 virtual
void do_update_derivatives(DerivativeAccumulator *da)
IMP_OVERRIDE;
162 class IMPCOREEXPORT DirectionAngleConstraint : public IMP::Constraint {
167 DirectionAngleConstraint(Particle *p)
168 : IMP::Constraint(p->get_model(),
"DirectionAngleConstraint%1%")
172 friend class DirectionAngle;
173 virtual void do_update_attributes() IMP_OVERRIDE;
174 virtual
void do_update_derivatives(DerivativeAccumulator *da) IMP_OVERRIDE;
182 IMPCORE_END_NAMESPACE
The base class for decorators.
ParticleIndex get_particle_index() const
Returns the particle index decorated by this decorator.
A decorator for an angle between two directions.
void add_to_direction_derivative(int i, Float v, DerivativeAccumulator &d)
Add v to the derivative of the ith coordinate of the direction.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
double get_angle(Direction a, Direction b)
Get angle between directions.
A decorator for a particle that represents a direction in 3D.
Constraint * create_constraint(Before *b, After *a, const typename Before::Argument &t, std::string name=std::string())
Index< ParticleIndexTag > ParticleIndex
Implement a constraint on the Model.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Class for storing model, its restraints, constraints, and particles.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
Various general useful macros for IMP.
#define IMP_DECORATOR_SETUP_2(Name, FirstArgumentType, first_argument_name,SecondArgumentType, second_argument_name)
void reflect()
Flip direction so direction is reversed.
A base class for constraints.
Particle * get_particle() const
Returns the particle decorated by this decorator.
Interface to specialized Particle types (e.g. atoms)
#define IMP_DECORATOR_METHODS(Name, Parent)
double Float
Basic floating-point value (could be float, double...)
Class to handle individual particles of a Model object.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Float get_direction_derivative(int i) const
Get the derivative added to the ith coordinate of the direction.
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.