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