5 #ifndef BALL_KERNEL_ATOM_H
6 #define BALL_KERNEL_ATOM_H
8 #ifndef BALL_CONCEPT_COMPOSITE_H
12 #ifndef BALL_CONCEPT_PROPERTY_H
16 #ifndef BALL_CONCEPT_RANDOMACCESSITERATOR_H
20 #ifndef BALL_MATHS_VECTOR3_H
25 #define BALL_ATOM_DEFAULT_ELEMENT &Element::UNKNOWN
26 #define BALL_ATOM_DEFAULT_CHARGE 0
27 #define BALL_ATOM_DEFAULT_FORMAL_CHARGE 0
28 #define BALL_ATOM_DEFAULT_NAME ""
29 #define BALL_ATOM_DEFAULT_TYPE_NAME "?"
30 #define BALL_ATOM_DEFAULT_POSITION 0,0,0
31 #define BALL_ATOM_DEFAULT_RADIUS 0
32 #define BALL_ATOM_DEFAULT_TYPE Atom::UNKNOWN_TYPE
33 #define BALL_ATOM_DEFAULT_VELOCITY 0,0,0
34 #define BALL_ATOM_DEFAULT_FORCE 0,0,0
43 class SecondaryStructure;
45 class MolecularInteractions;
124 MAX_NUMBER_OF_BONDS = 12
132 NUMBER_OF_PROPERTIES = 0
151 ADD_VARIANT_EXTENSIONS_AND_CHAIN_RESIDUE_ID
189 Atom(
const Atom& atom,
bool deep =
true);
240 virtual void clear();
247 virtual void destroy();
278 void set(
const Atom& atom,
bool deep =
true);
285 void get(
Atom& atom,
bool deep =
true)
const;
295 Atom& operator = (
const Atom& atom);
301 void swap(
Atom& atom);
325 void setElement(
const Element& element);
328 const Element& getElement()
const;
334 void setCharge(
float charge);
340 float getCharge()
const;
343 void setFormalCharge(
Index formal_charge);
346 Index getFormalCharge()
const;
355 const Molecule* getMolecule()
const;
367 const Fragment* getFragment()
const;
378 const Residue* getResidue()
const;
396 const Chain* getChain()
const;
401 void setName(
const String& name);
435 String getFullName(FullNameType type = ADD_VARIANT_EXTENSIONS)
const;
440 void setPosition(
const Vector3& position);
446 const Vector3& getPosition()
const;
451 void setRadius(
float radius);
454 float getRadius()
const;
457 void setType(Type atom_type);
460 Type getType()
const;
463 String getTypeName()
const;
466 void setTypeName(
const String& name);
471 void setVelocity(
const Vector3& velocity);
481 const Vector3& getVelocity()
const;
486 void setForce(
const Vector3& force);
488 const Vector3& getForce()
const;
494 Size countBonds()
const;
531 const Bond* getBond(
const Atom& atom)
const;
580 bool destroyBond(
const Atom& atom);
621 float getDistance(
const Atom& a)
const;
625 void addInteraction(
const Atom* atom,
String interaction_type,
double energy);
627 void addInteraction(
String interaction_type,
double energy);
629 void disableStoreInteractions();
631 void enableStoreInteractions();
647 bool hasBond(
const Bond& bond)
const;
657 bool isBoundTo(
const Atom& atom)
const;
664 bool isBound()
const;
673 bool isGeminal(
const Atom& atom)
const;
681 bool isVicinal(
const Atom& atom)
const;
686 virtual bool isAtom()
const {
return true; }
698 virtual bool isValid()
const;
707 virtual void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
743 : bound_((
Atom*)&atom),
749 : bound_(traits.bound_),
750 position_(traits.position_)
756 bound_ = traits.bound_;
757 position_ = traits.position_;
776 return (position_ == traits.position_);
781 return !(position_ == traits.position_);
786 return (position_ < traits.position_);
791 return (
Distance)(position_ - traits.position_);
796 return (bound_ != 0 && position_ >= 0 && position_ < bound_->number_of_bonds_);
807 bool isBegin()
const {
return (position_ == 0); }
809 void toEnd() { position_ = bound_->number_of_bonds_; }
811 bool isEnd()
const {
return (position_ >= bound_->number_of_bonds_);}
815 const Bond&
getData()
const {
return *(bound_->bond_[position_]); }
821 return (s << traits.position_ <<
' ');
824 void dump(std::ostream& s)
const
826 s << position_ << std::endl;
831 position_ = bound_->number_of_bonds_ - 1;
836 return (position_ == bound_->number_of_bonds_ - 1);
846 return (position_ <= -1);
856 position_ -= distance;
861 position_ += distance;
866 return *(bound_->bond_[index]);
871 return *(bound_->bond_[index]);
892 return BondIterator::begin(*
this);
898 return BondIterator::end(*
this);
903 <
Atom,
Bond, BondIteratorPosition, BondIteratorTraits>
909 return BondConstIterator::begin(*
this);
915 return BondConstIterator::end(*
this);
982 Bond* bond_[MAX_NUMBER_OF_BONDS];
1003 void swapLastBond_(
const Atom* atom);
1008 #ifdef BALL_COMPILER_MSVC
1013 # ifndef BALL_NO_INLINE_FUNCTIONS
1014 # include <BALL/KERNEL/atom.iC>
1018 #ifndef BALL_KERNEL_BONDITERATOR_H
1023 #endif // BALL_KERNEL_ATOM_H
#define BALL_ATOM_DEFAULT_TYPE_NAME
#define BALL_ATOM_DEFAULT_FORCE
#define BALL_ATOM_DEFAULT_CHARGE
std::reverse_iterator< BondIterator > BondReverseIterator
Reverse random access iterator for bonds.
bool store_interactions_disabled_
BondIteratorTraits(const Atom &atom)
std::list< Atom * > AtomPtrList
void forward(Distance distance)
BondConstReverseIterator rbeginBond() const
Return a constant reverse bond iterator pointing to the first atom.
static AtomIndexList free_list_
std::list< Position > AtomIndexList
ConstRandomAccessIterator< Atom, Bond, BondIteratorPosition, BondIteratorTraits > BondConstIterator
Constant random access iterator for bonds.
BondConstIterator endBond() const
Return a constant past-the-end bond iterator.
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
Distance getDistance(const BondIteratorTraits &traits) const
RandomAccessIterator< Atom, Bond, BondIteratorPosition, BondIteratorTraits > BondIterator
Bond & getData(Index index)
Index BondIteratorPosition
BondConstIterator beginBond() const
Return a constant bond iterator pointing to the first bond.
BondConstReverseIterator rendBond() const
Return a constant past-the-end bond iterator for reverse traversal.
const Bond & getData() const
#define BALL_ATOM_DEFAULT_RADIUS
BondIteratorTraits(const BondIteratorTraits &traits, bool=true)
const Bond & getData(Index index) const
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
#define BALL_ATOM_DEFAULT_FORMAL_CHARGE
#define BALL_CREATE_DEEP(name)
TVector3< float > Vector3
BondReverseIterator rbeginBond()
Return a reverse bond iterator pointing to the last bond.
void backward(Distance distance)
MolecularInteractions * interactions
BondIterator beginBond()
Return a bond iterator pointing to the first bond of the atom.
#define BALL_ATOM_DEFAULT_VELOCITY
BondReverseIterator rendBond()
Return a past-the-end bond iterator for reverse traversal.
BALL_EXPORT bool operator==(const String &s1, const String &s2)
std::reverse_iterator< BondConstIterator > BondConstReverseIterator
Constant reverse random access iterator for bonds.
BondIterator endBond()
Return a past-the-end bond iterator.
const BondIteratorPosition & getPosition() const
BondIteratorPosition & getPosition()
unsigned char number_of_bonds_
void dump(std::ostream &s) const
#define BALL_ATOM_DEFAULT_POSITION
const Atom * getContainer() const
#define BALL_ATOM_DEFAULT_TYPE
BALL_EXPORT bool operator<(const String &s1, const String &s2)