Changes in src/molecule.cpp [2ba827:24a5e0]
- File:
-
- 1 edited
-
src/molecule.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
r2ba827 r24a5e0 8 8 #include <boost/bind.hpp> 9 9 10 #include "World.hpp" 10 11 #include "atom.hpp" 11 12 #include "bond.hpp" … … 30 31 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero. 31 32 */ 32 molecule::molecule(const periodentafel * const teil) : elemente(teil), start( new atom), end(new atom),33 molecule::molecule(const periodentafel * const teil) : elemente(teil), start(World::get()->createAtom()), end(World::get()->createAtom()), 33 34 first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 34 35 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 35 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start), 36 formula(this,boost::bind(&molecule::calcFormula,this)) 36 ActiveFlag(false), IndexNr(-1), 37 formula(this,boost::bind(&molecule::calcFormula,this)), 38 last_atom(0), 39 InternalPointer(start) 37 40 { 38 41 // init atom chain list … … 52 55 }; 53 56 57 molecule *NewMolecule(){ 58 return new molecule(World::get()->getPeriode()); 59 } 60 54 61 /** Destructor of class molecule. 55 62 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero. … … 60 67 delete(first); 61 68 delete(last); 62 delete(end); 63 delete(start); 64 }; 65 69 end->getWorld()->destroyAtom(end); 70 start->getWorld()->destroyAtom(start); 71 }; 72 73 74 void DeleteMolecule(molecule *mol){ 75 delete mol; 76 } 66 77 67 78 // getter and setter … … 73 84 OBSERVE; 74 85 strncpy(name,_name.c_str(),MAXSTRINGSIZE); 86 } 87 88 moleculeId_t molecule::getId(){ 89 return id; 90 } 91 92 void molecule::setId(moleculeId_t _id){ 93 id =_id; 75 94 } 76 95 … … 135 154 OBSERVE; 136 155 if (pointer != NULL) { 137 atom *walker = new atom(pointer);156 atom *walker = pointer->clone(); 138 157 walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name"); 139 158 strcpy (walker->Name, pointer->Name); … … 242 261 switch(TopBond->BondDegree) { 243 262 case 1: 244 FirstOtherAtom = new atom(); // new atom263 FirstOtherAtom = World::get()->createAtom(); // new atom 245 264 FirstOtherAtom->type = elemente->FindElement(1); // element is Hydrogen 246 265 FirstOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity … … 299 318 300 319 // create the two Hydrogens ... 301 FirstOtherAtom = new atom();302 SecondOtherAtom = new atom();320 FirstOtherAtom = World::get()->createAtom(); 321 SecondOtherAtom = World::get()->createAtom(); 303 322 FirstOtherAtom->type = elemente->FindElement(1); 304 323 SecondOtherAtom->type = elemente->FindElement(1); … … 354 373 case 3: 355 374 // take the "usual" tetraoidal angle and add the three Hydrogen in direction of the bond (height of the tetraoid) 356 FirstOtherAtom = new atom();357 SecondOtherAtom = new atom();358 ThirdOtherAtom = new atom();375 FirstOtherAtom = World::get()->createAtom(); 376 SecondOtherAtom = World::get()->createAtom(); 377 ThirdOtherAtom = World::get()->createAtom(); 359 378 FirstOtherAtom->type = elemente->FindElement(1); 360 379 SecondOtherAtom->type = elemente->FindElement(1); … … 475 494 MDSteps++; 476 495 for(i=0;i<NumberOfAtoms;i++){ 477 Walker = new atom;496 Walker = World::get()->createAtom(); 478 497 getline(xyzfile,line,'\n'); 479 498 istringstream *item = new istringstream(line);
Note:
See TracChangeset
for help on using the changeset viewer.
