LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
loos::Atom Class Reference

Basic Atom class for handling atom properties. More...

#include <Atom.hpp>

Classes

class  UnsetProperty
 DEPRECATED exception class...use loos::UnsetProperty instead. More...
 

Public Types

enum  bits {
  nullbit = 0 , coordsbit = 1 , bondsbit = coordsbit << 1 , massbit = bondsbit << 1 ,
  chargebit = massbit << 1 , anumbit = chargebit << 1 , flagbit = anumbit << 1 , usr1bit = flagbit << 1 ,
  usr2bit = usr1bit << 1 , usr3bit = usr2bit << 1 , indexbit = usr3bit << 1 , velbit = indexbit << 1
}
 Bits in the bitmask that flag what properties have actually been set.
 

Public Member Functions

 Atom (const int i, const std::string s, const GCoord &c)
 Constructs an atom with the atomid i, atomname s, and coordinates c.
 
int id (void) const
 
void id (const int)
 
uint index (void) const
 
void index (const uint i)
 
int resid (void) const
 
void resid (const int)
 
int atomic_number (void) const
 
void atomic_number (const int)
 
std::string name (void) const
 
void name (const std::string)
 
std::string altLoc (void) const
 
void altLoc (const std::string)
 
std::string chainId (void) const
 
void chainId (const std::string)
 
std::string resname (void) const
 
void resname (const std::string)
 
std::string segid (void) const
 
void segid (const std::string)
 
std::string iCode (void) const
 
void iCode (const std::string)
 
std::string PDBelement (void) const
 
void PDBelement (const std::string)
 
const GCoordcoords (void) const
 
GCoordcoords (void)
 Returns a writable ref to the internally stored coords.
 
const GCoordvelocities (void) const
 Returns ref to the internally stored velocities (a GCoord)
 
GCoordvelocities ()
 
void coords (const GCoord &)
 Sets the coords to c.
 
void velocities (const GCoord &)
 Sets the velocities.
 
double bfactor (void) const
 
void bfactor (const double)
 
double occupancy (void) const
 
void occupancy (const double)
 
double charge (void) const
 
void charge (const double)
 Sets the charge of the atom as a double. This is NOT the PDB spec...
 
double mass (void) const
 
void mass (const double)
 
int atomType () const
 
void atomType (const int)
 
std::string recordName (void) const
 
void recordName (const std::string)
 
void clearBonds (void)
 Clear all stored bonds.
 
void addBond (const pAtom &)
 Add a bond given a pAtom (extracting the atomid of the bond)
 
void addBond (const int)
 Add a bond to an atom-id.
 
void deleteBond (const int)
 Deletes the specified bond.
 
void deleteBond (const pAtom &)
 Deletes a bond by extracting the atom-id from the passed pAtom.
 
std::vector< int > getBonds (void) const
 Returns a copy of the bond list.
 
void setBonds (const std::vector< int > &list)
 Sets the bonds list.
 
bool hasBonds (void) const
 
bool isBoundTo (const int)
 Checks to see if this atom is bound to another atom.
 
bool isBoundTo (const pAtom &)
 
bool checkProperty (const bits bitmask)
 Given a bit-mask, checks to see if those bits are set.
 
void setProperty (const bits bitmask)
 Sets user-defined bits.
 
void clearProperty (const bits bitmask)
 Clears user-defined bits...
 
std::string asString () const
 

Friends

std::ostream & operator<< (std::ostream &, const Atom &)
 Outputs an atom in pseudo-XML.
 

Detailed Description

Basic Atom class for handling atom properties.

This class handles atoms and atom properties. It stores a GCoord coordinate internally. Bonds are included, but are represented as a vector of atom-id's, which are assumed to be unique per atom...

Most properties are derived from the PDB file specification. Exceptions are noted below. Accessors for each property are provided and should be self-explanatory...

Constructor & Destructor Documentation

◆ Atom()

loos::Atom::Atom ( const int i,
const std::string s,
const GCoord & c )
inline

Constructs an atom with the atomid i, atomname s, and coordinates c.

Constructs a new atom.

Parameters
iatom-id
satom-name
cCoordinates

Member Function Documentation

◆ checkProperty()

bool loos::Atom::checkProperty ( const bits bitmask)

Given a bit-mask, checks to see if those bits are set.

For example, to check whether or not the coords have been set, do,

checkProperty(Atom::coordsbit)

You can combine checks by or'ing the bit flags, such as the following which checks whether both mass and charge have been set,

checkProperty(Atom::massbit | Atom::chargebit)

◆ coords() [1/2]

GCoord & loos::Atom::coords ( void )

Returns a writable ref to the internally stored coords.

This can cause problems since we track whether the coords are set or not via the bitmask. We assume that if you're accessing this as non-const, your intention is to set the coords, so the bit flagging coords is set automatically.

◆ coords() [2/2]

const GCoord & loos::Atom::coords ( void ) const

Returns a const ref to internally stored coordinates. This returns a const ref mainly for efficiency, rather than copying the coords...

◆ recordName()

std::string loos::Atom::recordName ( void ) const

Recordname imported from the PDB for this Atom This is mainly for atoms that come from a PDB, i.e. whether or not they were an ATOM or a HETATM

◆ setProperty()

void loos::Atom::setProperty ( const bits bitmask)

Sets user-defined bits.

The user-available property bits are flagbit, usr1bit, usr2bit, and usr3bit. Attempting to set any other bits will cause a logic_error exception to be thrown.

This facility is useful if you want to tag atoms for later processing without putting them in a separate group, for example...


The documentation for this class was generated from the following files: