Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule_geometry.cpp

    rf66195 r99593f  
    2424{
    2525  bool status = true;
    26   Vector x;
    2726  const Vector *Center = DetermineCenterOfAll(out);
    2827  double *M = ReturnFullMatrixforSymmetric(cell_size);
    29   double *Minv = x.InverseMatrix(M);
     28  double *Minv = InverseMatrix(M);
    3029
    3130  // go through all atoms
     
    4645{
    4746  bool status = true;
    48   Vector x;
    4947  double *M = ReturnFullMatrixforSymmetric(cell_size);
    50   double *Minv = x.InverseMatrix(M);
     48  double *Minv = InverseMatrix(M);
    5149
    5250  // go through all atoms
     
    122120 * \return pointer to center of all vector
    123121 */
    124 Vector * molecule::DetermineCenterOfAll(ofstream *out)
     122Vector * molecule::DetermineCenterOfAll(ofstream *out) const
    125123{
    126124  atom *ptr = start->next;  // start at first in list
     
    198196 * \param *factor pointer to scaling factor
    199197 */
    200 void molecule::Scale(double **factor)
     198void molecule::Scale(const double ** const factor)
    201199{
    202200  atom *ptr = start;
     
    231229void molecule::TranslatePeriodically(const Vector *trans)
    232230{
    233   Vector x;
    234231  double *M = ReturnFullMatrixforSymmetric(cell_size);
    235   double *Minv = x.InverseMatrix(M);
     232  double *Minv = InverseMatrix(M);
    236233
    237234  // go through all atoms
     
    258255{
    259256  atom *Walker = start;
    260   bond *Binder = NULL;
    261257  double *matrix = ReturnFullMatrixforSymmetric(cell_size);
    262258  double tmp;
     
    275271        Testvector.InverseMatrixMultiplication(matrix);
    276272        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
     273        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     274         if (Walker->nr < (*Runner)->GetOtherAtom(Walker)->nr) // otherwise we shift one to, the other fro and gain nothing
    280275            for (int j=0;j<NDIM;j++) {
    281               tmp = Walker->x.x[j] - Binder->GetOtherAtom(Walker)->x.x[j];
     276              tmp = Walker->x.x[j] - (*Runner)->GetOtherAtom(Walker)->x.x[j];
    282277              if ((fabs(tmp)) > BondDistance) {
    283278                flag = false;
    284                 cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *Binder << " has to be shifted due to " << tmp << "." << endl;
     279                cout << Verbose(0) << "Hit: atom " << Walker->Name << " in bond " << *(*Runner) << " has to be shifted due to " << tmp << "." << endl;
    285280                if (tmp > 0)
    286281                  Translationvector.x[j] -= 1.;
     
    298293#ifdef ADDHYDROGEN
    299294        // 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);
     295        for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) {
     296          if ((*Runner)->GetOtherAtom(Walker)->type->Z == 1) {
     297            Testvector.CopyVector(&(*Runner)->GetOtherAtom(Walker)->x);
    304298            Testvector.InverseMatrixMultiplication(matrix);
    305299            Testvector.AddVector(&Translationvector);
Note: See TracChangeset for help on using the changeset viewer.