11 #include <IMP/core/core_config.h>
13 #include "internal/dihedral_helpers.h"
21 IMPCORE_BEGIN_NAMESPACE
33 static void do_setup_particle(
46 static FloatKey get_coordinate_key(
unsigned int i) {
48 return IMP::internal::xyzr_keys[i];
61 get_model()->get_sphere(get_particle_index())[i] = v;
65 get_model()->get_sphere(get_particle_index())[0] = v[0];
66 get_model()->get_sphere(get_particle_index())[1] = v[1];
67 get_model()->get_sphere(get_particle_index())[2] = v[2];
72 return get_model()->get_sphere(get_particle_index())[i];
78 get_particle()->add_to_derivative(get_coordinate_key(i), v, d);
83 get_model()->add_to_coordinate_derivatives(get_particle_index(), v, d);
89 return get_particle()->get_is_optimized(get_coordinate_key(0)) &&
90 get_particle()->get_is_optimized(get_coordinate_key(1)) &&
95 get_particle()->set_is_optimized(get_coordinate_key(0), tf);
96 get_particle()->set_is_optimized(get_coordinate_key(1), tf);
97 get_particle()->set_is_optimized(get_coordinate_key(2), tf);
110 return get_model()->get_sphere(get_particle_index()).get_center();
117 return get_model()->get_coordinate_derivatives(get_particle_index());
121 return m->get_has_attribute(get_coordinate_key(2), pi);
144 return internal::dihedral(a, b, c, d,
nullptr,
nullptr,
nullptr,
nullptr);
164 IMPCORE_END_NAMESPACE
170 IMPKERNEL_BEGIN_NAMESPACE
181 IMPKERNEL_END_NAMESPACE
Import IMP/kernel/Decorator.h in the namespace.
void add_to_derivatives(const algebra::Vector3D &v, DerivativeAccumulator &d)
Add something to the derivative of the coordinates.
Class for adding derivatives from restraints to the model.
Particle * get_particle() const
void set_vector_d_geometry(VectorD< D > &g, const VectorD< D > &v)
double get_dihedral(XYZ a, XYZ b, XYZ c, XYZ d)
Compute the dihedral angle (in radians) between the four particles.
#define IMP_DECORATOR_METHODS(Name, Parent)
Model * get_model() const
Returns the Model containing the particle.
bool get_coordinates_are_optimized() const
Get whether the coordinates are optimized.
void set_coordinate(unsigned int i, Float v)
set the ith coordinate
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Float get_derivative(int i) const
Get the ith coordinate derivative.
double get_distance(const Plane3D &pln, const Vector3D &p)
Return the distance between a plane and a point in 3D.
void transform(Hierarchy h, const algebra::Transformation3D &tr)
void set_coordinates(const algebra::Vector3D &v)
set all coordinates from a vector
static bool get_is_setup(Particle *p)
Return true if the particle can be cast to the decorator.
#define IMP_DECORATOR_SETUP_0(Name)
Import IMP/kernel/decorator_macros.h in the namespace.
A decorator for a particle with x,y,z coordinates.
Float get_coordinate(int i) const
Get the ith coordinate.
const algebra::Vector3D & get_coordinates() const
Convert it to a vector.
Class to handle individual model particles.
algebra::Vector3D get_vector_to(const XYZ &b) const
Get the vector from this particle to another.
void set_coordinates_are_optimized(bool tf) const
Set whether the coordinates are optimized.
algebra::Vector3D get_derivatives() const
Get the vector of derivatives.
double Float
Basic floating-point value (could be float, double...)
void add_attribute(TypeKey attribute_key, ParticleIndex particle, Type value)
void add_to_derivative(int i, Float v, DerivativeAccumulator &d)
Add something to the derivative of the ith coordinate.
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
#define IMP_DECORATOR_GET_SET(name, AttributeKey, Type, ReturnType)
Define methods for getting and setting a particular simple field.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Class for storing model, its restraints, constraints, and particles.