| [bcf653] | 1 | /*
|
|---|
| 2 | * Project: MoleCuilder
|
|---|
| 3 | * Description: creates and alters molecular systems
|
|---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| [14de469] | 8 | /** \file atom.cpp
|
|---|
| [1907a7] | 9 | *
|
|---|
| [14de469] | 10 | * Function implementations for the class atom.
|
|---|
| [1907a7] | 11 | *
|
|---|
| [14de469] | 12 | */
|
|---|
| 13 |
|
|---|
| [bf3817] | 14 | // include config.h
|
|---|
| 15 | #ifdef HAVE_CONFIG_H
|
|---|
| 16 | #include <config.h>
|
|---|
| 17 | #endif
|
|---|
| 18 |
|
|---|
| [ad011c] | 19 | #include "CodePatterns/MemDebug.hpp"
|
|---|
| [112b09] | 20 |
|
|---|
| [357fba] | 21 | #include "atom.hpp"
|
|---|
| [e41951] | 22 | #include "bond.hpp"
|
|---|
| [e2373df] | 23 | #include "CodePatterns/Log.hpp"
|
|---|
| [4a7776a] | 24 | #include "config.hpp"
|
|---|
| [f66195] | 25 | #include "element.hpp"
|
|---|
| [266237] | 26 | #include "lists.hpp"
|
|---|
| [ccd9f5] | 27 | #include "parser.hpp"
|
|---|
| [57f243] | 28 | #include "LinearAlgebra/Vector.hpp"
|
|---|
| [d346b6] | 29 | #include "World.hpp"
|
|---|
| [6cfa36] | 30 | #include "molecule.hpp"
|
|---|
| [c550dd] | 31 | #include "Shapes/Shape.hpp"
|
|---|
| [a0064e] | 32 |
|
|---|
| [36166d] | 33 | #include <iomanip>
|
|---|
| [0ba410] | 34 | #include <iostream>
|
|---|
| [36166d] | 35 |
|
|---|
| [14de469] | 36 | /************************************* Functions for class atom *************************************/
|
|---|
| 37 |
|
|---|
| [70ff32] | 38 |
|
|---|
| [14de469] | 39 | /** Constructor of class atom.
|
|---|
| 40 | */
|
|---|
| [46d958] | 41 | atom::atom() :
|
|---|
| [97b825] | 42 | father(this),
|
|---|
| 43 | sort(&nr),
|
|---|
| 44 | mol(0)
|
|---|
| [d74077] | 45 | {};
|
|---|
| [14de469] | 46 |
|
|---|
| [2319ed] | 47 | /** Constructor of class atom.
|
|---|
| 48 | */
|
|---|
| [46d958] | 49 | atom::atom(atom *pointer) :
|
|---|
| [97b825] | 50 | ParticleInfo(pointer),
|
|---|
| 51 | father(pointer),
|
|---|
| [9df680] | 52 | sort(&nr),
|
|---|
| 53 | mol(0)
|
|---|
| [2319ed] | 54 | {
|
|---|
| [443547] | 55 | setType(pointer->getType()); // copy element of atom
|
|---|
| 56 | AtomicPosition = pointer->AtomicPosition; // copy trajectory of coordination
|
|---|
| 57 | AtomicVelocity = pointer->AtomicVelocity; // copy trajectory of velocity
|
|---|
| 58 | AtomicForce = pointer->AtomicForce;
|
|---|
| [6625c3] | 59 | setFixedIon(pointer->getFixedIon());
|
|---|
| [b453f9] | 60 | };
|
|---|
| [2319ed] | 61 |
|
|---|
| [46d958] | 62 | atom *atom::clone(){
|
|---|
| [68f03d] | 63 | atom *res = new atom(this);
|
|---|
| [23b547] | 64 | World::getInstance().registerAtom(res);
|
|---|
| [46d958] | 65 | return res;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| [2319ed] | 68 |
|
|---|
| [14de469] | 69 | /** Destructor of class atom.
|
|---|
| 70 | */
|
|---|
| [1907a7] | 71 | atom::~atom()
|
|---|
| [14de469] | 72 | {
|
|---|
| [6cfa36] | 73 | removeFromMolecule();
|
|---|
| [a80241] | 74 | for(BondList::iterator iter=ListOfBonds.begin(); iter!=ListOfBonds.end();){
|
|---|
| 75 | // deleting the bond will invalidate the iterator !!!
|
|---|
| 76 | bond *bond =*(iter++);
|
|---|
| 77 | delete(bond);
|
|---|
| 78 | }
|
|---|
| [14de469] | 79 | };
|
|---|
| [e2373df] | 80 |
|
|---|
| 81 |
|
|---|
| 82 | void atom::UpdateSteps()
|
|---|
| 83 | {
|
|---|
| 84 | LOG(4,"atom::UpdateSteps() called.");
|
|---|
| 85 | // append to position, velocity and force vector
|
|---|
| 86 | AtomInfo::AppendTrajectoryStep();
|
|---|
| 87 | }
|
|---|
| 88 |
|
|---|
| [14de469] | 89 | /** Climbs up the father list until NULL, last is returned.
|
|---|
| 90 | * \return true father, i.e. whose father points to itself, NULL if it could not be found or has none (added hydrogen)
|
|---|
| 91 | */
|
|---|
| 92 | atom *atom::GetTrueFather()
|
|---|
| 93 | {
|
|---|
| [215df0] | 94 | if(father == this){ // top most father is the one that points on itself
|
|---|
| 95 | return this;
|
|---|
| 96 | }
|
|---|
| 97 | else if(!father) {
|
|---|
| 98 | return 0;
|
|---|
| 99 | }
|
|---|
| 100 | else {
|
|---|
| 101 | return father->GetTrueFather();
|
|---|
| 102 | }
|
|---|
| [14de469] | 103 | };
|
|---|
| 104 |
|
|---|
| [e65246] | 105 | /** Sets father to itself or its father in case of copying a molecule.
|
|---|
| 106 | */
|
|---|
| 107 | void atom::CorrectFather()
|
|---|
| 108 | {
|
|---|
| 109 | if (father->father == father) // same atom in copy's father points to itself
|
|---|
| 110 | father = this; // set father to itself (copy of a whole molecule)
|
|---|
| 111 | else
|
|---|
| 112 | father = father->father; // set father to original's father
|
|---|
| 113 |
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 | /** Check whether father is equal to given atom.
|
|---|
| 117 | * \param *ptr atom to compare father to
|
|---|
| 118 | * \param **res return value (only set if atom::father is equal to \a *ptr)
|
|---|
| 119 | */
|
|---|
| [b453f9] | 120 | void atom::EqualsFather ( const atom *ptr, const atom **res ) const
|
|---|
| [e65246] | 121 | {
|
|---|
| 122 | if ( ptr == father )
|
|---|
| 123 | *res = this;
|
|---|
| 124 | };
|
|---|
| 125 |
|
|---|
| [00abfc] | 126 | bool atom::isFather(const atom *ptr){
|
|---|
| 127 | return ptr==father;
|
|---|
| 128 | }
|
|---|
| 129 |
|
|---|
| [e9f8f9] | 130 | /** Checks whether atom is within the given box.
|
|---|
| 131 | * \param offset offset to box origin
|
|---|
| 132 | * \param *parallelepiped box matrix
|
|---|
| 133 | * \return true - is inside, false - is not
|
|---|
| 134 | */
|
|---|
| [c550dd] | 135 | bool atom::IsInShape(const Shape& shape) const
|
|---|
| [e9f8f9] | 136 | {
|
|---|
| [d74077] | 137 | return shape.isInside(getPosition());
|
|---|
| [e9f8f9] | 138 | };
|
|---|
| 139 |
|
|---|
| [266237] | 140 | /** Counts the number of bonds weighted by bond::BondDegree.
|
|---|
| 141 | * \param bonds times bond::BondDegree
|
|---|
| 142 | */
|
|---|
| [4455f4] | 143 | int BondedParticle::CountBonds() const
|
|---|
| [266237] | 144 | {
|
|---|
| 145 | int NoBonds = 0;
|
|---|
| 146 | for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner))
|
|---|
| 147 | NoBonds += (*Runner)->BondDegree;
|
|---|
| 148 | return NoBonds;
|
|---|
| 149 | };
|
|---|
| 150 |
|
|---|
| [b453f9] | 151 | /** Output of a single atom with given numbering.
|
|---|
| [14de469] | 152 | * \param ElementNo cardinal number of the element
|
|---|
| 153 | * \param AtomNo cardinal number among these atoms of the same element
|
|---|
| 154 | * \param *out stream to output to
|
|---|
| [1907a7] | 155 | * \param *comment commentary after '#' sign
|
|---|
| [e41951] | 156 | * \return true - \a *out present, false - \a *out is NULL
|
|---|
| [14de469] | 157 | */
|
|---|
| [e138de] | 158 | bool atom::OutputIndexed(ofstream * const out, const int ElementNo, const int AtomNo, const char *comment) const
|
|---|
| [14de469] | 159 | {
|
|---|
| 160 | if (out != NULL) {
|
|---|
| 161 | *out << "Ion_Type" << ElementNo << "_" << AtomNo << "\t" << fixed << setprecision(9) << showpoint;
|
|---|
| [d74077] | 162 | *out << at(0) << "\t" << at(1) << "\t" << at(2);
|
|---|
| [6625c3] | 163 | *out << "\t" << (int)(getFixedIon());
|
|---|
| [bce72c] | 164 | if (getAtomicVelocity().Norm() > MYEPSILON)
|
|---|
| 165 | *out << "\t" << scientific << setprecision(6) << getAtomicVelocity()[0] << "\t" << getAtomicVelocity()[1] << "\t" << getAtomicVelocity()[2] << "\t";
|
|---|
| [437922] | 166 | if (comment != NULL)
|
|---|
| 167 | *out << " # " << comment << endl;
|
|---|
| [e9f8f9] | 168 | else
|
|---|
| 169 | *out << " # molecule nr " << nr << endl;
|
|---|
| 170 | return true;
|
|---|
| 171 | } else
|
|---|
| 172 | return false;
|
|---|
| 173 | };
|
|---|
| [b453f9] | 174 |
|
|---|
| 175 | /** Output of a single atom with numbering from array according to atom::type.
|
|---|
| 176 | * \param *ElementNo cardinal number of the element
|
|---|
| 177 | * \param *AtomNo cardinal number among these atoms of the same element
|
|---|
| 178 | * \param *out stream to output to
|
|---|
| 179 | * \param *comment commentary after '#' sign
|
|---|
| 180 | * \return true - \a *out present, false - \a *out is NULL
|
|---|
| 181 | */
|
|---|
| [0ba410] | 182 | bool atom::OutputArrayIndexed(ostream * const out,const enumeration<const element*> &elementLookup, int *AtomNo, const char *comment) const
|
|---|
| [e9f8f9] | 183 | {
|
|---|
| [83f176] | 184 | AtomNo[getType()->getAtomicNumber()]++; // increment number
|
|---|
| [e9f8f9] | 185 | if (out != NULL) {
|
|---|
| [8f4df1] | 186 | const element *elemental = getType();
|
|---|
| 187 | ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
|
|---|
| [83f176] | 188 | *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[elemental->getAtomicNumber()] << "\t" << fixed << setprecision(9) << showpoint;
|
|---|
| [d74077] | 189 | *out << at(0) << "\t" << at(1) << "\t" << at(2);
|
|---|
| [6625c3] | 190 | *out << "\t" << getFixedIon();
|
|---|
| [bce72c] | 191 | if (getAtomicVelocity().Norm() > MYEPSILON)
|
|---|
| 192 | *out << "\t" << scientific << setprecision(6) << getAtomicVelocity()[0] << "\t" << getAtomicVelocity()[1] << "\t" << getAtomicVelocity()[2] << "\t";
|
|---|
| [e9f8f9] | 193 | if (comment != NULL)
|
|---|
| 194 | *out << " # " << comment << endl;
|
|---|
| [437922] | 195 | else
|
|---|
| 196 | *out << " # molecule nr " << nr << endl;
|
|---|
| [14de469] | 197 | return true;
|
|---|
| 198 | } else
|
|---|
| 199 | return false;
|
|---|
| 200 | };
|
|---|
| 201 |
|
|---|
| [6625c3] | 202 | /** Output of a single atom as one line in xyz file.
|
|---|
| [14de469] | 203 | * \param *out stream to output to
|
|---|
| [e41951] | 204 | * \return true - \a *out present, false - \a *out is NULL
|
|---|
| [14de469] | 205 | */
|
|---|
| 206 | bool atom::OutputXYZLine(ofstream *out) const
|
|---|
| 207 | {
|
|---|
| 208 | if (out != NULL) {
|
|---|
| [b5c53d] | 209 | *out << getType()->getSymbol() << "\t" << at(0) << "\t" << at(1) << "\t" << at(2) << "\t" << endl;
|
|---|
| [14de469] | 210 | return true;
|
|---|
| 211 | } else
|
|---|
| 212 | return false;
|
|---|
| 213 | };
|
|---|
| 214 |
|
|---|
| [6625c3] | 215 | /** Output of a single atom as one line in xyz file.
|
|---|
| [fcd7b6] | 216 | * \param *out stream to output to
|
|---|
| [e41951] | 217 | * \param *ElementNo array with ion type number in the config file this atom's element shall have
|
|---|
| 218 | * \param *AtomNo array with atom number in the config file this atom shall have, is increase by one automatically
|
|---|
| 219 | * \param step Trajectory time step to output
|
|---|
| 220 | * \return true - \a *out present, false - \a *out is NULL
|
|---|
| [fcd7b6] | 221 | */
|
|---|
| [882a8a] | 222 | bool atom::OutputTrajectory(ofstream * const out, const enumeration<const element*> &elementLookup, int *AtomNo, const int step) const
|
|---|
| [fcd7b6] | 223 | {
|
|---|
| [83f176] | 224 | AtomNo[getType()->getAtomicNumber()]++;
|
|---|
| [882a8a] | 225 | if (out != NULL) {
|
|---|
| 226 | const element *elemental = getType();
|
|---|
| 227 | ASSERT(elementLookup.there.find(elemental)!=elementLookup.there.end(),"Type of this atom was not in the formula upon enumeration");
|
|---|
| 228 | *out << "Ion_Type" << elementLookup.there.find(elemental)->second << "_" << AtomNo[getType()->getAtomicNumber()] << "\t" << fixed << setprecision(9) << showpoint;
|
|---|
| [056e70] | 229 | *out << getPositionAtStep(step)[0] << "\t" << getPositionAtStep(step)[1] << "\t" << getPositionAtStep(step)[2];
|
|---|
| [6625c3] | 230 | *out << "\t" << (int)(getFixedIon());
|
|---|
| [056e70] | 231 | if (getAtomicVelocityAtStep(step).Norm() > MYEPSILON)
|
|---|
| 232 | *out << "\t" << scientific << setprecision(6) << getAtomicVelocityAtStep(step)[0] << "\t" << getAtomicVelocityAtStep(step)[1] << "\t" << getAtomicVelocityAtStep(step)[2] << "\t";
|
|---|
| 233 | if (getAtomicForceAtStep(step).Norm() > MYEPSILON)
|
|---|
| 234 | *out << "\t" << scientific << setprecision(6) << getAtomicForceAtStep(step)[0] << "\t" << getAtomicForceAtStep(step)[1] << "\t" << getAtomicForceAtStep(step)[2] << "\t";
|
|---|
| [fcd7b6] | 235 | *out << "\t# Number in molecule " << nr << endl;
|
|---|
| 236 | return true;
|
|---|
| 237 | } else
|
|---|
| 238 | return false;
|
|---|
| 239 | };
|
|---|
| 240 |
|
|---|
| [681a8a] | 241 | /** Output of a single atom as one lin in xyz file.
|
|---|
| 242 | * \param *out stream to output to
|
|---|
| [e41951] | 243 | * \param step Trajectory time step to output
|
|---|
| 244 | * \return true - \a *out present, false - \a *out is NULL
|
|---|
| [681a8a] | 245 | */
|
|---|
| [e138de] | 246 | bool atom::OutputTrajectoryXYZ(ofstream * const out, const int step) const
|
|---|
| [681a8a] | 247 | {
|
|---|
| 248 | if (out != NULL) {
|
|---|
| [b5c53d] | 249 | *out << getType()->getSymbol() << "\t";
|
|---|
| [056e70] | 250 | *out << getPositionAtStep(step)[0] << "\t";
|
|---|
| 251 | *out << getPositionAtStep(step)[1] << "\t";
|
|---|
| 252 | *out << getPositionAtStep(step)[2] << endl;
|
|---|
| [681a8a] | 253 | return true;
|
|---|
| 254 | } else
|
|---|
| 255 | return false;
|
|---|
| 256 | };
|
|---|
| 257 |
|
|---|
| [4455f4] | 258 | /** Outputs the MPQC configuration line for this atom.
|
|---|
| 259 | * \param *out output stream
|
|---|
| 260 | * \param *center center of molecule subtracted from position
|
|---|
| 261 | * \param *AtomNo pointer to atom counter that is increased by one
|
|---|
| 262 | */
|
|---|
| [0dc86e2] | 263 | void atom::OutputMPQCLine(ostream * const out, const Vector *center) const
|
|---|
| [4455f4] | 264 | {
|
|---|
| [d74077] | 265 | Vector recentered(getPosition());
|
|---|
| 266 | recentered -= *center;
|
|---|
| [b5c53d] | 267 | *out << "\t\t" << getType()->getSymbol() << " [ " << recentered[0] << "\t" << recentered[1] << "\t" << recentered[2] << " ]" << endl;
|
|---|
| [4455f4] | 268 | };
|
|---|
| 269 |
|
|---|
| 270 | /** Compares the indices of \a this atom with a given \a ptr.
|
|---|
| 271 | * \param ptr atom to compare index against
|
|---|
| 272 | * \return true - this one's is smaller, false - not
|
|---|
| 273 | */
|
|---|
| [b453f9] | 274 | bool atom::Compare(const atom &ptr) const
|
|---|
| [4455f4] | 275 | {
|
|---|
| 276 | if (nr < ptr.nr)
|
|---|
| 277 | return true;
|
|---|
| 278 | else
|
|---|
| 279 | return false;
|
|---|
| 280 | };
|
|---|
| 281 |
|
|---|
| 282 | /** Returns squared distance to a given vector.
|
|---|
| 283 | * \param origin vector to calculate distance to
|
|---|
| 284 | * \return distance squared
|
|---|
| 285 | */
|
|---|
| [b453f9] | 286 | double atom::DistanceSquaredToVector(const Vector &origin) const
|
|---|
| [4455f4] | 287 | {
|
|---|
| [d74077] | 288 | return DistanceSquared(origin);
|
|---|
| [4455f4] | 289 | };
|
|---|
| 290 |
|
|---|
| 291 | /** Returns distance to a given vector.
|
|---|
| 292 | * \param origin vector to calculate distance to
|
|---|
| 293 | * \return distance
|
|---|
| 294 | */
|
|---|
| [b453f9] | 295 | double atom::DistanceToVector(const Vector &origin) const
|
|---|
| [4455f4] | 296 | {
|
|---|
| [d74077] | 297 | return distance(origin);
|
|---|
| [4455f4] | 298 | };
|
|---|
| 299 |
|
|---|
| 300 | /** Initialises the component number array.
|
|---|
| 301 | * Size is set to atom::ListOfBonds.size()+1 (last is th encode end by -1)
|
|---|
| 302 | */
|
|---|
| 303 | void atom::InitComponentNr()
|
|---|
| 304 | {
|
|---|
| 305 | if (ComponentNr != NULL)
|
|---|
| [920c70] | 306 | delete[](ComponentNr);
|
|---|
| 307 | ComponentNr = new int[ListOfBonds.size()+1];
|
|---|
| [4455f4] | 308 | for (int i=ListOfBonds.size()+1;i--;)
|
|---|
| 309 | ComponentNr[i] = -1;
|
|---|
| [14b65e] | 310 | };
|
|---|
| 311 |
|
|---|
| 312 | void atom::resetGraphNr(){
|
|---|
| 313 | GraphNr=-1;
|
|---|
| 314 | }
|
|---|
| [4455f4] | 315 |
|
|---|
| [d74077] | 316 | std::ostream & atom::operator << (std::ostream &ost) const
|
|---|
| 317 | {
|
|---|
| 318 | ParticleInfo::operator<<(ost);
|
|---|
| 319 | ost << "," << getPosition();
|
|---|
| 320 | return ost;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | std::ostream & operator << (std::ostream &ost, const atom &a)
|
|---|
| 324 | {
|
|---|
| 325 | a.ParticleInfo::operator<<(ost);
|
|---|
| 326 | ost << "," << a.getPosition();
|
|---|
| 327 | return ost;
|
|---|
| 328 | }
|
|---|
| [4455f4] | 329 |
|
|---|
| 330 | bool operator < (atom &a, atom &b)
|
|---|
| 331 | {
|
|---|
| 332 | return a.Compare(b);
|
|---|
| 333 | };
|
|---|
| 334 |
|
|---|
| [46d958] | 335 | World *atom::getWorld(){
|
|---|
| 336 | return world;
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | void atom::setWorld(World* _world){
|
|---|
| 340 | world = _world;
|
|---|
| 341 | }
|
|---|
| 342 |
|
|---|
| [88d586] | 343 | bool atom::changeId(atomId_t newId){
|
|---|
| 344 | // first we move ourselves in the world
|
|---|
| 345 | // the world lets us know if that succeeded
|
|---|
| 346 | if(world->changeAtomId(id,newId,this)){
|
|---|
| 347 | id = newId;
|
|---|
| 348 | return true;
|
|---|
| 349 | }
|
|---|
| 350 | else{
|
|---|
| 351 | return false;
|
|---|
| 352 | }
|
|---|
| 353 | }
|
|---|
| 354 |
|
|---|
| 355 | void atom::setId(atomId_t _id) {
|
|---|
| [46d958] | 356 | id=_id;
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| [ad2b411] | 359 | atomId_t atom::getId() const {
|
|---|
| [46d958] | 360 | return id;
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| [fa7989] | 363 | /** Makes the atom be contained in the new molecule \a *_mol.
|
|---|
| 364 | * Uses atom::removeFromMolecule() to delist from old molecule.
|
|---|
| 365 | * \param *_mol pointer to new molecule
|
|---|
| 366 | */
|
|---|
| [6cfa36] | 367 | void atom::setMolecule(molecule *_mol){
|
|---|
| 368 | // take this atom from the old molecule
|
|---|
| 369 | removeFromMolecule();
|
|---|
| 370 | mol = _mol;
|
|---|
| 371 | if(!mol->containsAtom(this)){
|
|---|
| [dddbfe] | 372 | mol->insert(this);
|
|---|
| [6cfa36] | 373 | }
|
|---|
| 374 | }
|
|---|
| 375 |
|
|---|
| [fa7989] | 376 | /** Returns pointer to the molecule which atom belongs to.
|
|---|
| 377 | * \return containing molecule
|
|---|
| 378 | */
|
|---|
| [e41c48] | 379 | molecule* atom::getMolecule() const {
|
|---|
| [c084cc] | 380 | return mol;
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| [fa7989] | 383 | /** Erases the atom in atom::mol's list of atoms and sets it to zero.
|
|---|
| 384 | */
|
|---|
| [6cfa36] | 385 | void atom::removeFromMolecule(){
|
|---|
| 386 | if(mol){
|
|---|
| 387 | if(mol->containsAtom(this)){
|
|---|
| 388 | mol->erase(this);
|
|---|
| 389 | }
|
|---|
| 390 | mol=0;
|
|---|
| 391 | }
|
|---|
| [1f8337] | 392 | }
|
|---|
| 393 |
|
|---|
| [e8a21f] | 394 | int atom::getNr() const{
|
|---|
| 395 | return nr;
|
|---|
| 396 | }
|
|---|
| [6cfa36] | 397 |
|
|---|
| [88d586] | 398 | atom* NewAtom(atomId_t _id){
|
|---|
| 399 | atom * res =new atom();
|
|---|
| 400 | res->setId(_id);
|
|---|
| 401 | return res;
|
|---|
| [46d958] | 402 | }
|
|---|
| 403 |
|
|---|
| [88d586] | 404 | void DeleteAtom(atom* atom){
|
|---|
| [46d958] | 405 | delete atom;
|
|---|
| [e5f64de] | 406 | }
|
|---|
| 407 |
|
|---|
| 408 | bool compareAtomElements(atom* atom1,atom* atom2){
|
|---|
| 409 | return atom1->getType()->getNumber() < atom2->getType()->getNumber();
|
|---|
| [46d958] | 410 | }
|
|---|