/usr/include/avogadro/atom.h is in libavogadro-dev 1.1.1-0ubuntu7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | /**********************************************************************
Atom - Atom class derived from the base Primitive class
Copyright (C) 2007 Donald Ephraim Curtis
Copyright (c) 2008-2009 Geoff Hutchison
Copyright (c) 2008-2009 Marcus D. Hanwell
Copyright (c) 2010 Konstantin Tokarev
This file is part of the Avogadro molecular editor project.
For more information, see <http://avogadro.openmolecules.net/>
Avogadro is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Avogadro is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
**********************************************************************/
#ifndef ATOM_H
#define ATOM_H
#include <avogadro/primitive.h>
#include <QtCore/QList>
namespace OpenBabel {
class OBAtom;
}
namespace Avogadro {
class Molecule;
/**
* @class Atom atom.h <avogadro/atom.h>
* @brief Representation of an atom.
* @author Marcus D. Hanwell
*
* The Atom class is a Primitive subclass that provides an Atom object. All
* atoms must be owned by a Molecule. It should also be removed by the
* Molecule that owns it.
*/
class Bond;
class Residue;
class AtomPrivate;
class A_EXPORT Atom : public Primitive
{
Q_OBJECT
public:
/**
* Constructor.
*
* @param parent the parent object, which should be a molecule.
*/
Atom(QObject *parent=0);
/**
* Destructor.
*/
~Atom();
/** @name Set atomic information
* These functions are used to set atomic information.
* @{
*/
/**
* Sets the position of the atom.
* @param vec Position of the atom.
*/
void setPos(const Eigen::Vector3d &vec);
/**
* Sets the position of the atom.
* @param vec Position of the atom.
*/
void setPos(const Eigen::Vector3d *vec) { setPos(*vec); }
/**
* Set the atomic number of the atom.
* @note This will emit an updated signal
*/
void setAtomicNumber(int num);
/**
* Set the partial charge of the atom.
* @note This is not calculated by the atom, instead call
* Molecule::calculatePartialCharges()
*/
void setPartialCharge(double charge) const;
/**
* Set the formal charge of the atom.
*/
void setFormalCharge(int charge);
/**
* Set the number of the atom in group of atoms of the same element.
*/
void setGroupIndex(unsigned int index);
/**
* Set the force vector on the atom (e.g., used to display vibrations)
*/
void setForceVector(const Eigen::Vector3d &force);
/**
* Set the custom label for the atom
*/
void setCustomLabel(const QString &label);
/**
* Set the custom color for the atom using color name
*/
void setCustomColorName(const QString &name);
/**
* Set the custom radius for the atom
*/
void setCustomRadius(const double radius);
/** @} */
/** @name Get atomic information
* These functions are used to get atomic information.
* @{
*/
/** @return A pointer to the Molecule that the Atom belongs to. */
Molecule * molecule() const { return m_molecule; }
/**
* @return The position of the atom.
*/
const Eigen::Vector3d * pos() const;
/**
* @return Atomic number of the atom.
* @note Replaces GetAtomicNum()
*/
int atomicNumber() const { return m_atomicNumber; }
/**
* @return List of bond ids to the atom.
*/
QList<unsigned long> bonds() const { return m_bonds; }
/**
* @return List of neighbor ids to the atom (atoms bonded to that atom).
*/
QList<unsigned long> neighbors() const;
/**
* Use this function to get the bond between this Atom and another.
* @param other The other Atom to test for bonding.
* @return Pointer to the bond between the two atoms, or 0.
*/
Bond * bond(const Atom *other) const;
/**
* The valence of the atom. FIXME - don't think this will cut it...
*/
double valence() const { return static_cast<double>(m_bonds.size()); }
/**
* The index of the atom in group of atoms of the same element in Molecule
*/
unsigned int groupIndex() const;
/**
* @return True if the atom is a hydrogen.
*/
bool isHydrogen() const { return m_atomicNumber == 1; }
/**
* @return Partial charge of the atom.
*/
double partialCharge() const;
/**
* @return Formal charge of the atom (default = 0)
*/
int formalCharge() const;
QString customLabel() const;
QString customColorName() const;
double customRadius() const;
/**
* @return The force vector on this atom (if any)
*/
const Eigen::Vector3d forceVector() const;
/**
* @return The Id of the Residue that the Atom is a part of.
*/
unsigned long residueId() const;
/**
* @return A pointer to the Residue that the Atom is a part of.
*/
Residue * residue() const;
/** @} */
/** @name OpenBabel conversion functions
* These functions are used convert between Avogadro and OpenBabel atoms.
* @{
*/
/**
* @return An OpenBabel::OBAtom copy of the atom.
*/
OpenBabel::OBAtom OBAtom();
//const OpenBabel::OBAtom OBAtom() const;
/**
* Copies the data from an OpenBabel::OBAtom to the atom.
*/
bool setOBAtom(OpenBabel::OBAtom *obatom);
/** @} */
/** @name Operators
* Overloaded operators.
* @{
*/
Atom& operator=(const Atom& other);
/** @} */
friend class Molecule;
friend class Bond;
friend class Residue;
protected:
/**
* Adds a reference to a bond to the atom.
*/
void addBond(unsigned long bond);
/**
* Adds a reference to a bond to the atom.
*/
void addBond(Bond* bond);
/**
* Removes the reference of the bond to the atom.
*/
void removeBond(Bond* bond);
/**
* Removes the reference of the bond to the atom.
*/
void removeBond(unsigned long bond);
/**
* Set the Residue that this Atom is a part of.
*/
void setResidue(unsigned long id);
/**
* Set the Residue that this Atom is a part of.
*/
void setResidue(const Residue *residue);
AtomPrivate * const d_ptr;
Molecule *m_molecule; /** Parent molecule - should always be valid. **/
int m_atomicNumber;
QList<unsigned long> m_bonds;
Q_DECLARE_PRIVATE(Atom)
};
} // End namespace Avoagdro
#endif
|