24 #include <openbabel/babelconfig.h> 27 # define EXTERN extern 52 #define OB_4RING_ATOM (1<<1) 53 #define OB_3RING_ATOM (1<<2) 55 #define OB_AROMATIC_ATOM (1<<3) 57 #define OB_RING_ATOM (1<<4) 59 #define OB_DONOR_ATOM (1<<7) 61 #define OB_ACCEPTOR_ATOM (1<<8) 64 #define SET_OR_UNSET_FLAG(X) \ 65 if (value) SetFlag(X); \ 70 #define OBATOM_TYPE_LEN 6 98 void SetFlag(
int flag) { _flags |= flag; }
102 bool HasFlag(
int flag) {
return((_flags & flag) ?
true :
false); }
130 void SetIdx(
int idx) { _idx = idx; _cidx = (idx-1)*3; }
132 void SetId(
unsigned long id) { _id = id; }
138 void SetIsotope(
unsigned int iso);
146 void SetType(
const char *type);
148 void SetType(
const std::string &type);
152 void SetVector(
const vector3 &v);
154 void SetVector(
const double x,
const double y,
const double z);
173 int GetFormalCharge()
const {
return(_fcharge); }
184 double GetAtomicMass()
const;
189 unsigned int GetIdx()
const {
return((
int)_idx); }
191 unsigned long GetId()
const {
return _id; }
198 unsigned int GetTotalDegree()
const {
return (
unsigned int)(_vbond.size() + _imph); }
200 unsigned int GetExplicitValence()
const;
202 unsigned int GetTotalValence()
const;
204 unsigned int GetHyb()
const;
208 unsigned int GetHvyDegree()
const;
210 unsigned int GetHeteroDegree()
const;
215 double GetX()
const {
return(x()); }
217 double GetY()
const {
return(y()); }
219 double GetZ()
const {
return(z()); }
225 if (_c)
return((*_c)[_cidx]);
230 if (_c)
return((*_c)[_cidx+1]);
235 if (_c)
return((*_c)[_cidx+2]);
243 if (_c)
return(&(*_c)[_cidx]);
249 const vector3 &GetVector()
const;
251 double GetPartialCharge();
258 bool GetNewBondVector(
vector3 &v,
double length);
266 OBBondIterator BeginBonds()
268 {
return(_vbond.begin()); }
271 {
return(_vbond.end()); }
274 OBBond *BeginBond(OBBondIterator &i);
277 OBBond *NextBond(OBBondIterator &i);
280 OBAtom *BeginNbrAtom(OBBondIterator &i);
283 OBAtom *NextNbrAtom(OBBondIterator &i);
287 double GetDistance(
int index);
289 double GetDistance(
OBAtom*);
292 double GetDistance(
vector3* v);
294 double GetAngle(
int b,
int c);
322 _vbond.insert(i, bond);
325 bool DeleteBond(
OBBond* bond);
338 bool SetHybAndGeom(
int);
343 unsigned int CountFreeOxygens()
const;
347 unsigned int CountFreeSulfurs()
const;
349 unsigned int ExplicitHydrogenCount(
bool ExcludeIsotopes=
false)
const;
351 unsigned int MemberOfRingCount()
const;
353 unsigned int MemberOfRingSize()
const;
355 unsigned int CountRingBonds()
const;
357 double SmallestBondAngle();
359 double AverageBondAngle();
364 std::pair<int, int> LewisAcidBaseCounts()
const;
370 if (_residue == NULL)
376 bool IsAromatic()
const;
378 bool IsInRing()
const;
380 bool IsInRingSize(
int)
const;
385 bool IsConnected(
OBAtom*);
393 bool IsCarboxylOxygen();
395 bool IsPhosphateOxygen();
397 bool IsSulfateOxygen();
399 bool IsNitroOxygen();
401 bool IsAmideNitrogen();
404 bool IsPolarHydrogen();
407 bool IsNonPolarHydrogen();
410 bool IsAromaticNOxide();
416 bool IsHbondAcceptor();
418 bool IsHbondAcceptorSimple();
422 bool IsHbondDonorH();
430 bool HasAlphaBetaUnsat(
bool includePandS=
true);
432 bool HasBondOfOrder(
unsigned int bo);
434 int CountBondsOfOrder(
unsigned int bo);
436 int HighestBondOrder();
438 bool HasNonSingleBond();
446 bool MatchesSMARTS(
const char *);
bool HasDoubleBond()
Definition: atom.h:442
unsigned char _imph
number of implicit hydrogens
Definition: atom.h:75
unsigned int _cidx
index into coordinate array
Definition: atom.h:85
void SetPartialCharge(double pcharge)
Set the partial charge to pcharge.
Definition: atom.h:150
double _pcharge
partial charge
Definition: atom.h:88
bool Visit
Used internally by graph traversal algorithms.
Definition: atom.h:111
void SetImplicitHCount(unsigned int val)
Set the implicit hydrogen count to val.
Definition: atom.h:140
void SetAtomicNum(int atomicnum)
Set atomic number.
Definition: atom.h:136
bool HasResidue()
Definition: atom.h:366
void SetParent(OBMol *ptr)
Attach an OBMol ptr as the parent container for this atom.
Definition: atom.h:162
unsigned short _isotope
isotope (0 = most abundant)
Definition: atom.h:78
unsigned long GetId() const
Definition: atom.h:191
double ** _c
coordinate array in double*
Definition: atom.h:89
bool IsHetAtom()
Definition: atom.h:369
Base classes to build a graph.
void SetAromatic(bool value=true)
Mark atom as being aromatic.
Definition: atom.h:164
void DeleteResidue()
Delete any residue associated with this atom.
Definition: atom.h:310
void AddBond(OBBond *bond)
Add a bond to the internal list. Does not update the bond.
Definition: atom.h:317
void SetSpinMultiplicity(short spin)
Set the atomic spin to spin. See _spinmultiplicity.
Definition: atom.h:144
void SetId(unsigned long id)
Definition: atom.h:132
OBBondIterator EndBonds()
Definition: atom.h:270
unsigned short int GetIsotope() const
Definition: atom.h:178
double GetX() const
Definition: atom.h:215
void UnsetFlag(int flag)
Unsets the bitwise flag.
Definition: atom.h:100
void ClearCoordPtr()
Clear the internal coordinate pointer.
Definition: atom.h:168
void AddResidue(OBResidue *res)
Add (set) the residue for this atom.
Definition: atom.h:308
StereoFlag
Definition: atom.h:105
Bond class.
Definition: bond.h:58
double * GetCoordinate()
Definition: atom.h:242
void SetInRing(bool value=true)
Mark an atom as belonging to at least one ring.
Definition: atom.h:166
OBAtom OBNodeBase
OBNodeBase is declared for backwards-compatibility with 2.0 and earlier code.
Definition: atom.h:41
#define OB_RING_ATOM
Atom is in a ring.
Definition: atom.h:58
const double & x() const
Access function to get the x-coordinate of the vector.
Definition: vector3.h:237
unsigned char _ele
atomic number (type unsigned char to minimize space – allows for 0..255 elements) ...
Definition: atom.h:74
Molecule Class.
Definition: mol.h:118
void SetResidue(OBResidue *res)
Attach an OBResidue res as containing this atom.
Definition: atom.h:160
void InsertBond(OBBondIterator &i, OBBond *bond)
Insert bond into the internal list at the position from i Does not modify the bond.
Definition: atom.h:320
bool HasFlag(int flag)
Definition: atom.h:102
bool HasAromaticBond()
Definition: atom.h:444
bool operator==(const OBAtom *other) const
Equivalence.
Definition: atom.h:120
unsigned int GetTotalDegree() const
Definition: atom.h:198
std::vector< OBBond * > _vbond
bonds to this atom – assumed to be one of the endpoints
Definition: atom.h:83
std::vector< OBAtom * >::iterator OBAtomIterator
A standard iterator over a vector of atoms.
Definition: atom.h:48
OBMol * _parent
parent molecule (if any)
Definition: atom.h:82
#define OB_AROMATIC_ATOM
Atom is aromatic.
Definition: atom.h:56
const double & y() const
Access function to get the y-coordinate of the vector.
Definition: vector3.h:242
std::vector< OBBond * >::iterator OBBondIterator
A standard iterator over a vector of bonds.
Definition: atom.h:46
unsigned short _flags
bitwise flags (e.g. aromaticity)
Definition: atom.h:87
unsigned int _idx
unique node index (GetIdx(), SetIdx())
Definition: atom.h:81
void SetCoordPtr(double **c)
Set the position of this atom from a pointer-driven array of coordinates.
Definition: atom.h:156
int GetSpinMultiplicity() const
Definition: atom.h:181
#define SET_OR_UNSET_FLAG(X)
Definition: atom.h:64
Represents a vector in 3-dimensional real space.
Definition: vector3.h:44
double z() const
Definition: atom.h:234
unsigned int GetAtomicNum() const
Definition: atom.h:176
Defines for residue properties, names, etc.
double GetExactMass(unsigned int atomic_number, unsigned int isotope=0)
Definition: elements.cpp:831
vector3 _v
coordinate vector
Definition: atom.h:90
void ClearBond()
Clear all bonding information in this atom (does not delete them)
Definition: atom.h:327
double x() const
Definition: atom.h:224
void SetHyb(int hyb)
Set atom hybridization (i.e., 1 = sp, 2 = sp2, 3 = sp3 ...)
Definition: atom.h:134
unsigned int GetIdx() const
Definition: atom.h:189
int GetFlag() const
Definition: atom.h:96
short _fcharge
formal charge
Definition: atom.h:77
OBResidue * _residue
parent residue (if applicable)
Definition: atom.h:91
void NewResidue()
If no residue has been set for this atom, create a new one.
Definition: atom.h:302
unsigned int GetIndex() const
Definition: atom.h:190
unsigned short _hyb
hybridization
Definition: atom.h:86
unsigned int GetCoordinateIdx() const
Definition: atom.h:194
double GetY() const
Definition: atom.h:217
void SetFlag(int flag)
Sets the bitwise flag.
Definition: atom.h:98
bool IsHetAtom(OBAtom *atom) const
Definition: residue.cpp:1098
unsigned char GetImplicitHCount() const
Definition: atom.h:206
short _spinmultiplicity
atomic spin, e.g., 2 for radical 1 or 3 for carbene
Definition: atom.h:79
bool HasSingleBond()
Definition: atom.h:440
void SetFormalCharge(int fcharge)
Set the formal charge of the atom to fcharge.
Definition: atom.h:142
OBMol * GetParent()
Definition: atom.h:255
#define OBATOM_TYPE_LEN
Definition: atom.h:70
const double & z() const
Access function to get the z-coordinate of the vector.
Definition: vector3.h:247
double y() const
Definition: atom.h:229
double GetZ() const
Definition: atom.h:219
Base Class.
Definition: base.h:239
Residue information.
Definition: residue.h:50
unsigned int GetExplicitDegree() const
Definition: atom.h:196
unsigned long _id
unique id
Definition: atom.h:93
Global namespace for all Open Babel code.
Definition: alias.h:22
Atom class.
Definition: atom.h:71