Ignore:
Timestamp:
Oct 18, 2009, 2:51:38 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
77894f
Parents:
b0ee98
git-author:
Frederik Heber <heber@…> (10/18/09 14:15:37)
git-committer:
Frederik Heber <heber@…> (10/18/09 14:51:38)
Message:

Huge refactoring: molecule::ListOfBondsPerAtom and molecule::NumberOfBondsPerAtom removed, atom::ListOfBonds introduced. Unit Test for ListOfBonds manipulation introduced.

  • changes to builder.cpp: removed CreateListOfBondsPerAtom() calls, as the creation of the global arrays is not necessary anymore
  • changes to LinkedCell: LinkedCell::CheckBounds(int[NDIM]) does not admonish out of bonds as this is not desired for the local offset which may become out of bounds.
  • changes to lists.hpp templates: BUGFIX: unlink() now sets ->next and ->previous to NULL, cleanup() uses removedwithoutcheck()
  • new templates for molecule.hpp: SumPerAtom() allows for summation of the return value of atom:...() member fiunctions. This is needed e.g. for atom::CorrectBondDegree()

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule_geometry.cpp

    rb0ee98 r872b51  
    258258{
    259259  atom *Walker = start;
    260   bond *Binder = NULL;
    261260  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    262261  double tmp;
     
    275274        Testvector.InverseMatrixMultiplication(matrix);
    276275        Translationvector.Zero();
    277         for (int i=0;i<NumberOfBondsPerAtom[Walker->nr]; i++) {
    278           Binder = ListOfBondsPerAtom[Walker->nr][i];
    279           if (Walker->nr < Binder->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing
     276        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     277         if (Walker->nr < (*Runner)->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing
    280278            for (int j=0;j<NDIM;j++) {
    281               tmp = Walker->x.x[j] - Binder->GetOtherAtom(Walker)->x.x[j];
     279              tmp = Walker->x.x[j] - (*Runner)->GetOtherAtom(Walker)->x.x[j];
    282280              if ((fabs(tmp)) > BondDistance) {
    283281                flag = false;
    284                 cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *Binder << " has to be shifted due to " << tmp << "." << endl;
     282                cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;
    285283                if (tmp > 0)
    286284                  Translationvector.x[j] -= 1.;
     
    298296#ifdef ADDHYDROGEN
    299297        // now also change all hydrogens
    300         for (int i=0;i<NumberOfBondsPerAtom[Walker->nr]; i++) {
    301           Binder = ListOfBondsPerAtom[Walker->nr][i];
    302           if (Binder->GetOtherAtom(Walker)->type->Z == 1) {
    303             Testvector.CopyVector(&Binder->GetOtherAtom(Walker)->x);
     298        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     299          if ((*Runner)->GetOtherAtom(Walker)->type->Z == 1) {
     300            Testvector.CopyVector(&(*Runner)->GetOtherAtom(Walker)->x);
    304301            Testvector.InverseMatrixMultiplication(matrix);
    305302            Testvector.AddVector(&Translationvector);
Note: See TracChangeset for help on using the changeset viewer.