#include <atom.h>
Public Types |
|
Enumerations
|
|
enum | { UNKNOWN_TYPE = -1, ANY_TYPE = 0, MAX_NUMBER_OF_BONDS = 12 } |
Unnamed enumeration of all
non-categorized constants. More... |
|
enum | Property { NUMBER_OF_PROPERTIES = 0 } |
Predefined properties. More... |
|
enum |
FullNameType { NO_VARIANT_EXTENSIONS, ADD_VARIANT_EXTENSIONS, ADD_RESIDUE_ID, ADD_VARIANT_EXTENSIONS_AND_ID, ADD_CHAIN_RESIDUE_ID, ADD_VARIANT_EXTENSIONS_AND_CHAIN_RESIDUE_ID } |
The type of name used for
getFullName. More... |
|
Public Member Functions |
|
Constructors
|
|
Atom () | |
Default constructor. |
|
Atom (const Atom &atom, bool deep=true) | |
Copy constructor. |
|
Atom (Element &element, const String &name, const String &type_name=BALL_ATOM_DEFAULT_TYPE_NAME, Type atom_type=BALL_ATOM_DEFAULT_TYPE, const Vector3 &position=Vector3(BALL_ATOM_DEFAULT_POSITION), const Vector3 &velocity=Vector3(BALL_ATOM_DEFAULT_VELOCITY), const Vector3 &force=Vector3(BALL_ATOM_DEFAULT_FORCE), float charge=BALL_ATOM_DEFAULT_CHARGE, float radius=BALL_ATOM_DEFAULT_RADIUS, Index formal_charge=BALL_ATOM_DEFAULT_FORMAL_CHARGE) | |
Detailed state initializing
constructor. |
|
Destructors
|
|
virtual | ~Atom () |
Destructor. |
|
virtual void | clear () |
Explicit default initialization.
|
|
virtual void | destroy () |
Explicit destructor. |
|
Persistence
|
|
virtual void | persistentWrite (PersistenceManager &pm, const char *name=0) const throw (Exception::GeneralException) |
Write an Atom to a
persistent stream. |
|
virtual void | persistentRead (PersistenceManager &pm) throw (Exception::GeneralException) |
Read an Atom from
a persistent stream. |
|
Assignment methods
|
|
void | set (const Atom &atom, bool deep=true) |
Deep/shallow assignment. |
|
void | get (Atom &atom, bool deep=true) const |
Deep/shallow assignment. |
|
Atom & | operator= (const Atom &atom) |
Assignment operator. |
|
void | swap (Atom &atom) |
Swap the contents of two atoms.
|
|
bool | operator== (const Atom &atom) const |
Predicates. |
|
bool | operator!= (const Atom &atom) const |
Inequality operator. |
|
Accessors
|
|
void | setElement (const Element &element) |
Assign the atom's
element. |
|
const Element & | getElement () const |
Return the atom's
element. |
|
void | setCharge (float charge) |
Set the atom's (partial) charge.
|
|
float | getCharge () const |
Return the atom's (partial) charge.
|
|
void | setFormalCharge (Index formal_charge) |
Set the atom's formal
charge. |
|
Index | getFormalCharge () const |
Return the atom's formal
charge. |
|
const Molecule * | getMolecule () const |
Return the molecule the atom is
contained in (const). |
|
Molecule * | getMolecule () |
Return the molecule the atom is
contained in (mutable). |
|
const Fragment * | getFragment () const |
Return the fragment the atom is
contained in (const). |
|
Fragment * | getFragment () |
Return the fragment the atom is
contained in (mutable). |
|
const Residue * | getResidue () const |
Return the residue the atom is
contained in (const). |
|
Residue * | getResidue () |
Return the residue the atom is
contained in (mutable). |
|
const SecondaryStructure * | getSecondaryStructure () const |
Return the secondary structure the
atom is contained in (const). |
|
SecondaryStructure * | getSecondaryStructure () |
Return the secondary structure the
atom is contained in (mutable). |
|
const Chain * | getChain () const |
Return the chain the atom is
contained in (const). |
|
Chain * | getChain () |
Return the chain the atom is
contained in (mutable). |
|
void | setName (const String &name) |
Set the atom name. |
|
const String & | getName () const |
Return the atom name. |
|
String | getFullName (FullNameType type=ADD_VARIANT_EXTENSIONS) const |
Assemble a fully specified atom
name. |
|
void | setPosition (const Vector3 &position) |
Assign the atom coordinates.
|
|
Vector3 & | getPosition () |
Return the atom coordinates
(mutable). |
|
const Vector3 & | getPosition () const |
Return the atom coordinates
(const). |
|
void | setRadius (float radius) |
Set the atom radius. |
|
float | getRadius () const |
Return the atom radius. |
|
void | setType (Type atom_type) |
Assign the numerical atom
type. |
|
Type | getType () const |
Return the (numerical) atom
type. |
|
String | getTypeName () const |
Return the atom type
name. |
|
void | setTypeName (const String &name) |
Assign the atom type
name. |
|
void | setVelocity (const Vector3 &velocity) |
Set the atom velocity BALL uses
units of for the velocity. |
|
const Vector3 & | getVelocity () const |
Return the atom velocity. |
|
void | setForce (const Vector3 &force) |
Assign the atom's force vevtor.
|
|
const Vector3 & | getForce () const |
Return the atom's force vector
(const). |
|
Vector3 & | getForce () |
Return the atom's force vector
(mutable). |
|
Size | countBonds () const |
Return the number of
bonds. |
|
Bond * | getBond (Position index) throw (Exception::IndexOverflow) |
Return a bond by its index
(mutable). |
|
const Bond * | getBond (Position index) const throw (Exception::IndexOverflow) |
Return a bond by its index (const).
|
|
Bond * | getBond (const Atom &atom) |
Return a bond by its partner atom
(const). |
|
const Bond * | getBond (const Atom &atom) const |
Return a bond by its partner atom
(mutable) The reference is 0 if this instance does not have
a bond with atom . |
|
Miscellaneous
|
|
Bond * | createBond (Atom &atom) throw (Exception::TooManyBonds) |
Create a new bond to an atom.
|
|
Bond * | createBond (Bond &bond, Atom &atom) throw (Exception::TooManyBonds) |
Create a new bond from an already
existing instance of Bond.
|
|
Bond * | cloneBond (Bond &bond, Atom &atom) |
Create a copy of a bond. |
|
bool | destroyBond (const Atom &atom) |
Explicit bond destruction. |
|
void | destroyBonds () |
Explicit bond table destruction.
|
|
Atom * | getPartnerAtom (Position i) throw (Exception::IndexOverflow) |
Returns the Atom bound
at the i-th bond. |
|
const Atom * | getPartnerAtom (Position i) const throw (Exception::IndexOverflow) |
Returns the Atom bound
at the i-th bond. |
|
float | getDistance (const Atom &a) const |
A convenience function for computing
the distance between two atoms. |
|
Predicates
|
|
bool | hasBond (const Bond &bond) const |
Determine whether the atom takes
part in a certain bond. |
|
bool | isBoundTo (const Atom &atom) const |
Determine whether there exists a
bond to another atom. |
|
bool | isBound () const |
Determine whether the atom has any
bond. |
|
bool | isGeminal (const Atom &atom) const |
True if the two atoms are geminal.
|
|
bool | isVicinal (const Atom &atom) const |
True if the two atoms are vicinal.
|
|
Debuggers and diagnostics
|
|
virtual bool | isValid () const |
Internal state and consistency
self-validation. |
|
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal state dump. |
|
Internal iteration
|
|
bool | applyBonds (UnaryProcessor< Bond > &processor) |
Application of an unary processor on
every contained bond. |
|
Class friends |
|
|
|
typedef short | Type |
Atom
type. |
|
class | Bond |
External iteration |
|
typedef Index | BondIteratorPosition |
typedef RandomAccessIterator < Atom, Bond, BondIteratorPosition, BondIteratorTraits > |
BondIterator |
Random access iterator for
bonds. |
|
typedef ConstRandomAccessIterator < Atom, Bond, BondIteratorPosition, BondIteratorTraits > |
BondConstIterator |
Constant random
access iterator for bonds. |
|
typedef std::reverse_iterator < BondIterator > |
BondReverseIterator |
Reverse random access iterator for
bonds. |
|
typedef std::reverse_iterator < BondConstIterator > |
BondConstReverseIterator |
Constant reverse
random access iterator for bonds. |
|
class | BondIteratorTraits |
BondIterator | beginBond () |
Return a bond iterator pointing to
the first bond of the atom. |
|
BondIterator | endBond () |
Return a past-the-end bond
iterator. |
|
BondConstIterator | beginBond () const |
Return a constant bond iterator
pointing to the first bond. |
|
BondConstIterator | endBond () const |
Return a constant past-the-end bond
iterator. |
|
BondReverseIterator | rbeginBond () |
Return a reverse bond iterator
pointing to the last bond. |
|
BondReverseIterator | rendBond () |
Return a past-the-end bond iterator
for reverse traversal. |
|
BondConstReverseIterator | rbeginBond () const |
Return a constant reverse bond
iterator pointing to the first atom. |
|
BondConstReverseIterator | rendBond () const |
Return a constant past-the-end bond
iterator for reverse traversal. |
|
Efficient handling of atom attributes |
|
typedef std::list< Atom * > | AtomPtrList |
typedef std::list< Position > | AtomIndexList |
Position | getIndex () const |
Return the index in the static
attribute array. |
|
StaticAtomAttributes * | getAttributePtr () |
const StaticAtomAttributes * | getAttributePtr () const |
static Position | compact (const AtomIndexList &indices) throw (Exception::OutOfRange) |
Compact memory for a list of atoms.
|
|
static AttributeVector & | getAttributes () |
Access to the static attribute
array. |
|
static const PreciseTime & | getAttributesModificationTime () |
Get the time, when the attributes
vector was last modified. |
|
Attributes |
|
static AttributeVector | static_attributes_ |
static AtomIndexList | free_list_ |
static PreciseTime | attributes_changed_time_ |
time of the last resize of the
attributes vector |
|
Position | index_ |
const Element * | element_ |
String | name_ |
String | type_name_ |
float | radius_ |
unsigned char | number_of_bonds_ |
Bond * | bond_ [MAX_NUMBER_OF_BONDS] |
A class representing atoms. During each runtime instance of a program an atom is unique and identified by a Object::Handle . Atom equality is defined as atom identity, so there cannot be any two identical atoms. A linear ordering of atoms is defined as the linear order of the Object::Handle s.
anonymous enum |
The type of name used for getFullName.
enum BALL::Atom::Property |
Predefined properties.
Enumeration of all properties that are used by the BALL kernel.
Reimplemented in BALL::PDBAtom.
BALL::Atom::Atom | ( | ) |
Default constructor.
The state of this instance is:
BALL::Atom::Atom | ( | const Atom & | atom, | |
bool | deep =
true |
|||
) |
Copy constructor.
The copy is either deep (default) or shallow.
atom | the atom to be copied (cloned) | |
deep | make a deep (=true ) or shallow
(=false ) copy of atom |
BALL::Atom::Atom | ( | Element & | element, | |
const String & | name, | |||
const String & | type_name =
BALL_ATOM_DEFAULT_TYPE_NAME , |
|||
Type | atom_type =
BALL_ATOM_DEFAULT_TYPE , |
|||
const Vector3 & | position =
Vector3(BALL_ATOM_DEFAULT_POSITION) , |
|||
const Vector3 & | velocity =
Vector3(BALL_ATOM_DEFAULT_VELOCITY) , |
|||
const Vector3 & | force = Vector3(BALL_ATOM_DEFAULT_FORCE) , |
|||
float | charge =
BALL_ATOM_DEFAULT_CHARGE , |
|||
float | radius =
BALL_ATOM_DEFAULT_RADIUS , |
|||
Index | formal_charge =
BALL_ATOM_DEFAULT_FORMAL_CHARGE |
|||
) |
Detailed state initializing constructor.
The item bond table is empty (atom has no bonds).
element | element type of the constructed atom | |
name | name of the constructed atom | |
type_name | type name name of the constructed atom | |
atom_type | type of the constructed atom | |
position | position of the constructed atom | |
velocity | velocity of the constructed atom | |
force | force acting upon the constructed atom | |
charge | charge of the constructed atom | |
formal_charge | formal charge of the constructed atom | |
radius | radius of the constructed atom |
virtual BALL::Atom::~Atom | ( | ) | [virtual] |
Destructor.
If the atom has bonds in common with an other atom that atom is disconnected and the associated Bond instance is destroyed. Calls Atom::destroy .
bool BALL::Atom::applyBonds | ( | UnaryProcessor< Bond > & | processor | ) |
Application of an unary processor on every contained bond.
processor | a typed unary processor for Bond instances |
true
if application has been
terminated successfully, false
otherwisevirtual void BALL::Atom::clear | ( | ) | [virtual] |
Explicit default initialization.
Calls Composite::clear and resets the attributes to the default values. In contrast to destroy , the atom is not removed from any composite structure, i.e. its parent fragment pointer remains unchanged.
Reimplemented from BALL::Composite.
Reimplemented in BALL::PDBAtom.
Create a copy of a bond.
This is mostly for internal use and should not be required by most users.
static Position BALL::Atom::compact | ( | const AtomIndexList & | indices | ) | throw (Exception::OutOfRange)
[static] |
Compact memory for a list of atoms.
This method packs the static attributes of the atom in the given range into a contiguous memory segment in order to increase locality.
Bond* BALL::Atom::createBond | ( | Bond & | bond, | |
Atom & | atom | |||
) | throw (Exception::TooManyBonds) |
Create a new bond from an already existing instance of Bond.
Initialize the bond bond to connect this instance to atom . Calls Bond::createBond . The state of the bond is initialzed to the default values.
Bond* BALL::Atom::createBond | ( | Atom & | atom | ) | throw (Exception::TooManyBonds) |
Create a new bond to an atom.
Create a new instance of Bond connecting this instance to atom . Calls Bond::createBond . The state of the bond is initialized to the default values.
virtual void BALL::Atom::destroy | ( | ) | [virtual] |
Explicit destructor.
Destroy this instance explicitly and reset its attributes to the default values.
Reimplemented from BALL::Composite.
Reimplemented in BALL::PDBAtom.
bool BALL::Atom::destroyBond | ( | const Atom & | atom | ) |
Explicit bond destruction.
Destroy the bond connecting {*this atom} and atom explicitly. If the bond is auto-deletable the default destructor is called otherwise Bond::destroy .
delete
. This is due to erroneous explicit
destruction of statically allocated bonds.atom | the atom that should be disconnected from this instance |
void BALL::Atom::destroyBonds | ( | ) |
Explicit bond table destruction.
Destroy all the bonds connecting {*this atom} with another atom explicitly. If the bonds are auto-deletable the default destructors are called otherwise Bond::destroy .
delete
. This is due to erroneous
explicit destruction of statically allocated bonds.atom | the atom that should be disconnected from this instance |
virtual void BALL::Atom::dump | ( | std::ostream & | s =
std::cout , |
|
Size | depth =
0 |
|||
) | const [virtual] |
Internal state dump.
Dump the current internal state of this instance to the output ostream s with dumping depth depth . For debugging purposes only.
s | - output stream where to output the internal state | |
depth | - the dumping depth |
Reimplemented from BALL::Composite.
Reimplemented in BALL::PDBAtom.
void BALL::Atom::get | ( | Atom & | atom, | |
bool | deep =
true |
|||
) | const |
static const PreciseTime& BALL::Atom::getAttributesModificationTime | ( | ) | [static] |
Get the time, when the attributes vector was last modified.
This needed for the GeometricObject 's in VIEW, because they store pointer to the position of atoms. These have to be updated, after a resize of the vector.
Return a bond by its partner atom (mutable) The reference is 0 if this instance does not have a bond with atom .
atom | the atom that is considered to have a bond with this instance |
Return a bond by its partner atom (const).
The reference is 0 if this instance does not have a bond with atom .
atom | the atom that is considered to have a bond with this instance |
atom
with this instance, 0 if this instance
does not have a bond with atomconst Bond* BALL::Atom::getBond | ( | Position | index | ) | const throw (Exception::IndexOverflow) |
Return a bond by its index (const).
IndexOverflow | if index >=
MAX_NUMBER_OF_BONDS |
Bond* BALL::Atom::getBond | ( | Position | index | ) | throw (Exception::IndexOverflow) |
Return a bond by its index (mutable).
The reference is 0 if this instance does not have a bond with index index .
index | the index of the bond to be accessed to |
IndexOverflow | if index >=
MAX_NUMBER_OF_BONDS |
const Chain* BALL::Atom::getChain | ( | ) | const |
Return the chain the atom is contained in (const).
A NULL pointer is returned if this atom is not part of a chain.
Reimplemented in BALL::PDBAtom.
float BALL::Atom::getCharge | ( | ) | const |
Return the atom's (partial) charge.
Charges should be assigned in multiples of the proton charge (elementary charge).
float BALL::Atom::getDistance | ( | const Atom & | a | ) | const |
A convenience function for computing the distance between two atoms.
This is equivalent to calling this->getPosition().getDistance(a.getPosition())
a | the atom to which to compute the distance |
const Fragment* BALL::Atom::getFragment | ( | ) | const |
Return the fragment the atom is contained in (const).
A NULL pointer is returned if this atom is not part of a fragment.
String BALL::Atom::getFullName | ( | FullNameType | type =
ADD_VARIANT_EXTENSIONS |
) | const |
Assemble a fully specified atom name.
This method returns at fully specified atom name as used
for charge and type assignments. The name consists of the
name of the residue the atom is contained in, a colon, and
the atom name. Blanks are removed from both names. For
example, for the alpha carbon atom of isoleucine
getFullName
will return the name
ILE:CA
. For N terminal residues,
-N
is appended to the residue name, for C
terminal residues -C
. If the residue is a CYS
involved in a disulphide bridge, an additional
-S
or S
(for terminal residue) is
appended. For single amino acids (C and N terminal)
-M
is added.
type | if type is set to
Atom::NO_VARIANT_EXTENSIONS , the
variant extension (-XX ) is
omitted |
const Molecule* BALL::Atom::getMolecule | ( | ) | const |
Return the molecule the atom is contained in (const).
A NULL pointer is returned if this atom is not part of a molecule.
const Atom* BALL::Atom::getPartnerAtom | ( | Position | i | ) | const throw (Exception::IndexOverflow) |
Returns the Atom bound at the i-th bond.
This is a convenience function for: getBond(i)->getBoundAtom(*this)
i | The index of the partner atom |
Atom* BALL::Atom::getPartnerAtom | ( | Position | i | ) | throw (Exception::IndexOverflow) |
Returns the Atom bound at the i-th bond.
This is a convenience function for: getBond(i)->getBoundAtom(*this)
i | The index of the partner atom |
Exception::IndexOverflow | is thrown if i >= countBonds(). This exception originates from getBond(i) |
const Residue* BALL::Atom::getResidue | ( | ) | const |
Return the residue the atom is contained in (const).
A NULL pointer is returned if this atom is not part of a residue.
Reimplemented in BALL::PDBAtom.
const SecondaryStructure* BALL::Atom::getSecondaryStructure | ( | ) | const |
Return the secondary structure the atom is contained in (const).
A NULL pointer is returned if this atom is not part of a secondary structure.
const Vector3& BALL::Atom::getVelocity | ( | ) | const |
Return the atom velocity.
BALL uses units of for the velocity.
bool BALL::Atom::hasBond | ( | const Bond & | bond | ) | const |
Determine whether the atom takes part in a certain bond.
bond | the bond in question |
true
if the bond bond
connects this instance with another atom,
false
otherwisebool BALL::Atom::isBound | ( | ) | const |
Determine whether the atom has any bond.
true
if an atom is bound to this
instance, false
otherwisebool BALL::Atom::isBoundTo | ( | const Atom & | atom | ) | const |
Determine whether there exists a bond to another atom.
Calls Atom::getBond . Hydrogen bonds (type = Bond::TYPE__HYDROGEN) are ignored.
atom | the atom in question |
true
if bond connects atom
with {*this atom}, false
otherwisebool BALL::Atom::isGeminal | ( | const Atom & | atom | ) | const |
True if the two atoms are geminal.
Two atoms are geminal if they do not share a common bond but both have a bond to a third atom. For example the two hydrogen atoms in water are geminal. Hydrogen bonds (type = Bond::TYPE__HYDROGEN) are ignored.
atom | the second atom |
atom
is geminal to
this instancevirtual bool BALL::Atom::isValid | ( | ) | const [virtual] |
Internal state and consistency self-validation.
true
if the internal state of
this instance is correct (self-validated) and consistent,
false
otherwiseReimplemented from BALL::Composite.
bool BALL::Atom::isVicinal | ( | const Atom & | atom | ) | const |
True if the two atoms are vicinal.
Two atoms are vicinal if they are separated by three bonds (1-4 position). Hydrogen bonds (type = Bond::TYPE__HYDROGEN) are ignored.
atom | the second atom |
atom
is vicinal to
this instancebool BALL::Atom::operator!= | ( | const Atom & | atom | ) | const |
Inequality operator.
bool BALL::Atom::operator== | ( | const Atom & | atom | ) | const |
Predicates.
Equality operator. Two atoms are equal if they have the same handle.
virtual void BALL::Atom::persistentRead | ( | PersistenceManager & | pm | ) | throw (Exception::GeneralException)
[virtual] |
Read an Atom from a persistent stream.
pm | the persistence manager |
Reimplemented from BALL::Composite.
Reimplemented in BALL::PDBAtom.
virtual void BALL::Atom::persistentWrite | ( | PersistenceManager & | pm, | |
const char * | name =
0 |
|||
) | const throw (Exception::GeneralException)
[virtual] |
Write an Atom to a persistent stream.
pm | the persistence manager |
Reimplemented from BALL::Composite.
Reimplemented in BALL::PDBAtom.
void BALL::Atom::set | ( | const Atom & | atom, | |
bool | deep =
true |
|||
) |
Deep/shallow assignment.
The assignment is either deep or shallow (default is
deep). In the case of a deep assignment, all composites
contained in atom
are copied as well.
atom | the atom to be copied | |
deep | make a deep (=true) or shallow
(=false) copy of atom |
void BALL::Atom::setCharge | ( | float | charge | ) |
Set the atom's (partial) charge.
Charges should be assigned in multiples of the proton charge (elementary charge).
void BALL::Atom::setForce | ( | const Vector3 & | force | ) |
Assign the atom's force vevtor.
BALL uses units of Newton (1 N = 1 J/m) as the unit of force.
void BALL::Atom::setPosition | ( | const Vector3 & | position | ) |
Assign the atom coordinates.
BALL uses units of Angstrom for atom coordinates.
void BALL::Atom::setRadius | ( | float | radius | ) |
Set the atom radius.
BALL uses units of Angstrom for the atom radii.
void BALL::Atom::swap | ( | Atom & | atom | ) |
Swap the contents of two atoms.
The static attributes are swapped by exchanging the indices of the two atoms!
atom | the atom being swapped with this instance |