Ignore:
Timestamp:
Apr 13, 2010, 1:22:42 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
e7ea64
Parents:
0f55b2
Message:

Prepared interface of Vector Class for transition to VectorComposites

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecule.cpp

    r0f55b2 r1f591b  
    220220//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
    221221  // create vector in direction of bond
    222   InBondvector.CopyVector(&TopReplacement->x);
    223   InBondvector.SubtractVector(&TopOrigin->x);
     222  InBondvector = TopReplacement->x - TopOrigin->x;
    224223  bondlength = InBondvector.Norm();
    225224
     
    240239    matrix = ReturnFullMatrixforSymmetric(cell_size);
    241240    Orthovector1.MatrixMultiplication(matrix);
    242     InBondvector.SubtractVector(&Orthovector1); // subtract just the additional translation
     241    InBondvector.SubtractVector(Orthovector1); // subtract just the additional translation
    243242    Free(&matrix);
    244243    bondlength = InBondvector.Norm();
     
    265264      FirstOtherAtom = World::getInstance().createAtom();    // new atom
    266265      FirstOtherAtom->type = elemente->FindElement(1);  // element is Hydrogen
    267       FirstOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     266      FirstOtherAtom->v = TopReplacement->v; // copy velocity
    268267      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    269268      if (TopReplacement->type->Z == 1) { // neither rescale nor replace if it's already hydrogen
     
    274273      }
    275274      InBondvector.Scale(&BondRescale);   // rescale the distance vector to Hydrogen bond length
    276       FirstOtherAtom->x.CopyVector(&TopOrigin->x); // set coordination to origin ...
    277       FirstOtherAtom->x.AddVector(&InBondvector);  // ... and add distance vector to replacement atom
     275      FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ...
     276      FirstOtherAtom->x = InBondvector;  // ... and add distance vector to replacement atom
    278277      AllWentWell = AllWentWell && AddAtom(FirstOtherAtom);
    279278//      Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: ";
     
    316315        }
    317316      } else {
    318         Orthovector1.GetOneNormalVector(&InBondvector);
     317        Orthovector1.GetOneNormalVector(InBondvector);
    319318      }
    320319      //Log() << Verbose(3)<< "Orthovector1: ";
     
    331330      FirstOtherAtom->type = elemente->FindElement(1);
    332331      SecondOtherAtom->type = elemente->FindElement(1);
    333       FirstOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     332      FirstOtherAtom->v = TopReplacement->v; // copy velocity
    334333      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    335       SecondOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     334      SecondOtherAtom->v = TopReplacement->v; // copy velocity
    336335      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    337336      FirstOtherAtom->father = NULL;  // we are just an added hydrogen with no father
     
    388387      SecondOtherAtom->type = elemente->FindElement(1);
    389388      ThirdOtherAtom->type = elemente->FindElement(1);
    390       FirstOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     389      FirstOtherAtom->v = TopReplacement->v; // copy velocity
    391390      FirstOtherAtom->FixedIon = TopReplacement->FixedIon;
    392       SecondOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     391      SecondOtherAtom->v = TopReplacement->v; // copy velocity
    393392      SecondOtherAtom->FixedIon = TopReplacement->FixedIon;
    394       ThirdOtherAtom->v.CopyVector(&TopReplacement->v); // copy velocity
     393      ThirdOtherAtom->v = TopReplacement->v; // copy velocity
    395394      ThirdOtherAtom->FixedIon = TopReplacement->FixedIon;
    396395      FirstOtherAtom->father = NULL;  //  we are just an added hydrogen with no father
     
    399398
    400399      // we need to vectors orthonormal the InBondvector
    401       AllWentWell = AllWentWell && Orthovector1.GetOneNormalVector(&InBondvector);
     400      AllWentWell = AllWentWell && Orthovector1.GetOneNormalVector(InBondvector);
    402401//      Log() << Verbose(3) << "Orthovector1: ";
    403402//      Orthovector1.Output(out);
     
    426425      factors[1] = f;
    427426      factors[2] = 0.;
    428       FirstOtherAtom->x.LinearCombinationOfVectors(&InBondvector, &Orthovector1, &Orthovector2, factors);
     427      FirstOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    429428      factors[1] = -0.5*f;
    430429      factors[2] = g;
    431       SecondOtherAtom->x.LinearCombinationOfVectors(&InBondvector, &Orthovector1, &Orthovector2, factors);
     430      SecondOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    432431      factors[2] = -g;
    433       ThirdOtherAtom->x.LinearCombinationOfVectors(&InBondvector, &Orthovector1, &Orthovector2, factors);
     432      ThirdOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors);
    434433
    435434      // rescale each to correct BondDistance
     
    439438
    440439      // and relative to *origin atom
    441       FirstOtherAtom->x.AddVector(&TopOrigin->x);
    442       SecondOtherAtom->x.AddVector(&TopOrigin->x);
    443       ThirdOtherAtom->x.AddVector(&TopOrigin->x);
     440      FirstOtherAtom->x += TopOrigin->x;
     441      SecondOtherAtom->x += TopOrigin->x;
     442      ThirdOtherAtom->x += TopOrigin->x;
    444443
    445444      // ... and add to molecule
     
    10221021    Log() << Verbose(5) << "Center of Gravity: " << CenterOfGravity << endl;
    10231022    Log() << Verbose(5) << "Other Center of Gravity: " << OtherCenterOfGravity << endl;
    1024     if (CenterOfGravity.DistanceSquared(&OtherCenterOfGravity) > threshold*threshold) {
     1023    if (CenterOfGravity.DistanceSquared(OtherCenterOfGravity) > threshold*threshold) {
    10251024      Log() << Verbose(4) << "Centers of gravity don't match." << endl;
    10261025      result = false;
Note: See TracChangeset for help on using the changeset viewer.