Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.cpp

    r24a5e0 r2ba827  
    88#include <boost/bind.hpp>
    99
    10 #include "World.hpp"
    1110#include "atom.hpp"
    1211#include "bond.hpp"
     
    3130 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero.
    3231 */
    33 molecule::molecule(const periodentafel * const teil) : elemente(teil), start(World::get()->createAtom()), end(World::get()->createAtom()),
     32molecule::molecule(const periodentafel * const teil) : elemente(teil), start(new atom), end(new atom),
    3433  first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0),
    3534  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))
    4037{
    4138  // init atom chain list
     
    5552};
    5653
    57 molecule *NewMolecule(){
    58   return new molecule(World::get()->getPeriode());
    59 }
    60 
    6154/** Destructor of class molecule.
    6255 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero.
     
    6760  delete(first);
    6861  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
    7766
    7867// getter and setter
     
    8473  OBSERVE;
    8574  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;
    9475}
    9576
     
    154135  OBSERVE;
    155136  if (pointer != NULL) {
    156     atom *walker = pointer->clone();
     137    atom *walker = new atom(pointer);
    157138    walker->Name = Malloc<char>(strlen(pointer->Name) + 1, "atom::atom: *Name");
    158139    strcpy (walker->Name, pointer->Name);
     
    261242  switch(TopBond->BondDegree) {
    262243    case 1:
    263       FirstOtherAtom = World::get()->createAtom();    // new atom
     244      FirstOtherAtom = new atom();    // new atom
    264245      FirstOtherAtom->type = elemente->FindElement(1);  // element is Hydrogen
    265246      FirstOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     
    318299
    319300      // create the two Hydrogens ...
    320       FirstOtherAtom = World::get()->createAtom();
    321       SecondOtherAtom = World::get()->createAtom();
     301      FirstOtherAtom = new atom();
     302      SecondOtherAtom = new atom();
    322303      FirstOtherAtom->type = elemente->FindElement(1);
    323304      SecondOtherAtom->type = elemente->FindElement(1);
     
    373354    case 3:
    374355      // 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();
    378359      FirstOtherAtom->type = elemente->FindElement(1);
    379360      SecondOtherAtom->type = elemente->FindElement(1);
     
    494475    MDSteps++;
    495476  for(i=0;i<NumberOfAtoms;i++){
    496     Walker = World::get()->createAtom();
     477    Walker = new atom;
    497478    getline(xyzfile,line,'\n');
    498479    istringstream *item = new istringstream(line);
Note: See TracChangeset for help on using the changeset viewer.