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/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_);
127 return graph_get_edges(
get_particle(), internal::get_bond_data().graph_);
136 graph_get_edge(
get_particle(), i, internal::get_bond_data().graph_);
152 graph_get_edge(
get_particle(), i, internal::get_bond_data().graph_);
166 typedef IMP::internal::IndexingIterator<GetBond> BondIterator;
169 BondIterator bonds_begin()
const {
172 BondIterator bonds_end()
const {
173 return BondIterator(GetBond(
get_particle()), get_number_of_bonds());
181 class BondedIterator;
183 typedef IMP::internal::IndexingIterator<GetBonded> BondedIterator;
186 BondedIterator bondeds_begin()
const {
189 BondedIterator bondeds_end()
const {
190 return BondedIterator(GetBonded(
get_particle()), get_number_of_bonds());
199 inline Bonded Bond::get_bonded(
unsigned int i)
const {
201 graph_get_node(get_particle(), i, internal::get_bond_data().graph_);
206 inline Bond Bonded::GetBond::operator()(
unsigned int i)
const {
209 inline Bonded Bonded::GetBonded::operator()(
unsigned int i)
const {
238 Float stiffness = -1) {
241 bd.set_length(length);
245 if (stiffness >= 0) bd.set_stiffness(stiffness);
258 if (o.get_length() > 0) bd.set_length(o.get_length());
262 if (o.get_stiffness() >= 0) bd.set_stiffness(o.get_stiffness());
280 IMPATOMEXPORT Bond
get_bond(Bonded a, Bonded b);
289 IMP_PARTICLE_GEOMETRY(Bond, Bond, {
299 IMPATOM_END_NAMESPACE
Particle * get_particle(ParticleIndex p) const
Get the particle from an index.
The base class for decorators.
The base class for geometry.
A decorator for a particle which has bonds.
#define IMP_DECORATOR_GET_SET_OPT(name, AttributeKey, Type, ReturnType, default_value)
Define methods for getting and setting an optional simple field.
Storage of a model, its restraints, constraints and particles.
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 two particles.
Bond create_bond(Bonded a, Bonded b, Bond o)
Connect the two wrapped particles by a custom bond.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Bond create_custom_bond(Bonded a, Bonded b, Float length, Float stiffness=-1)
Connect the two wrapped particles by a custom bond.
Class for storing model, its restraints, constraints, and particles.
Implement geometry for the basic shapes from IMP.algebra.
A decorator for wrapping a particle representing a molecular bond.
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.
#define IMP_DECORATOR_SETUP_0(Name)
Particle * get_particle() const
Returns the particle decorated by this decorator.
Interface to specialized Particle types (e.g. atoms)
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Simple implementation of segments in 3D.
#define IMP_DECORATOR_METHODS(Name, Parent)
double Float
Basic floating-point value (could be float, double...)
Class to handle individual model particles.
Bond get_bond(Bonded a, Bonded b)
Get the bond between two particles.
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
int Int
Basic integer value.
Bonded get_bonded(unsigned int i) const
Get a Bonded of the ith bonded particle.