8 #ifndef IMPATOM_BOND_DECORATORS_H
9 #define IMPATOM_BOND_DECORATORS_H
11 #include <IMP/atom/atom_config.h>
12 #include <IMP/core/internal/graph_base.h>
13 #include "internal/bond_helpers.h"
21 #include <IMP/kernel/internal/IndexingIterator.h>
22 IMPATOM_BEGIN_NAMESPACE
47 return IMP::core::internal::graph_is_edge(m->
get_particle(pi),
48 internal::get_bond_data().graph_);
69 Bonded get_bonded(
unsigned int i)
const;
82 static FloatKey get_length_key() {
return internal::get_bond_data().length_; }
91 typedef Bond result_type;
93 GetBond() : d_(
nullptr) {}
95 Bond operator()(
unsigned int i)
const;
96 bool operator==(
const GetBond &o)
const {
return d_ == o.d_; }
99 typedef Bonded result_type;
101 GetBonded() : d_(
nullptr) {}
103 Bonded operator()(
unsigned int i)
const;
104 bool operator==(
const GetBonded &o)
const {
return d_ == o.d_; }
108 internal::get_bond_data().graph_);
116 return IMP::core::internal::graph_is_node(m->
get_particle(pi),
117 internal::get_bond_data().graph_);
121 unsigned int get_number_of_bonds()
const {
123 internal::get_bond_data().graph_);
126 IMPATOM_DEPRECATED_FUNCTION_DECL(2.1)
128 IMPATOM_DEPRECATED_FUNCTION_DEF(2.1,
"Use get_bond_indexes().");
129 return get_bond_indexes();
133 return graph_get_edges(
get_particle(), internal::get_bond_data().graph_);
142 graph_get_edge(
get_particle(), i, internal::get_bond_data().graph_);
158 graph_get_edge(
get_particle(), i, internal::get_bond_data().graph_);
172 typedef IMP::internal::IndexingIterator<GetBond> BondIterator;
175 BondIterator bonds_begin()
const {
178 BondIterator bonds_end()
const {
179 return BondIterator(GetBond(
get_particle()), get_number_of_bonds());
187 class BondedIterator;
189 typedef IMP::internal::IndexingIterator<GetBonded> BondedIterator;
192 BondedIterator bondeds_begin()
const {
195 BondedIterator bondeds_end()
const {
196 return BondedIterator(GetBonded(
get_particle()), get_number_of_bonds());
205 inline Bonded Bond::get_bonded(
unsigned int i)
const {
207 graph_get_node(get_particle(), i, internal::get_bond_data().graph_);
212 inline Bond Bonded::GetBond::operator()(
unsigned int i)
const {
215 inline Bonded Bonded::GetBonded::operator()(
unsigned int i)
const {
244 Float stiffness = -1) {
247 bd.set_length(length);
251 if (stiffness >= 0) bd.set_stiffness(stiffness);
264 if (o.get_length() > 0) bd.set_length(o.get_length());
268 if (o.get_stiffness() >= 0) bd.set_stiffness(o.get_stiffness());
286 IMPATOMEXPORT Bond
get_bond(Bonded a, Bonded b);
295 IMP_PARTICLE_GEOMETRY(Bond, Bond, {
305 IMPATOM_END_NAMESPACE
Import IMP/kernel/Decorator.h in the namespace.
Particle * get_particle() const
Particle * get_particle(ParticleIndex p) const
The base class for geometry.
A decorator for a particle which has bonds.
#define IMP_DECORATOR_METHODS(Name, Parent)
#define IMP_DECORATOR_GET_SET_OPT(name, AttributeKey, Type, ReturnType, default_value)
Define methods for getting and setting an optional simple field.
Type
The types a bond can have right now.
Bond get_bond(unsigned int i) const
Get a Bond of the ith bond.
void destroy_bond(Bond b)
Destroy the bond connecting to particles.
Bond create_custom_bond(Bonded a, Bonded b, Float length, Float stiffness=-1)
Connect the two wrapped particles by a custom bond.
Implement geometry for the basic shapes from IMP.algebra.
A decorator for wrapping a particle representing a molecular bond.
static bool get_is_setup(Particle *p)
Return true if the particle can be cast to the decorator.
Bond create_bond(Bonded a, Bonded b, Int t)
Connect the two wrapped particles by a bond.
#define IMP_DECORATOR_SETUP_0(Name)
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Represent an XYZR particle with a sphere.
A decorator for a particle with x,y,z coordinates.
Bonded get_bonded(unsigned int i) const
Get the atom i of the bond.
Class to handle individual model particles.
Storage of a model, its restraints, constraints and particles.
Classes to handle individual model particles.
double Float
Basic floating-point value (could be float, double...)
Bond get_bond(Bonded a, Bonded b)
Get the bond between two particles.
int Int
Basic integer value.
Bonded get_bonded(unsigned int i) const
Get a Bonded of the ith bonded particle.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Class for storing model, its restraints, constraints, and particles.