Changeset 1f591b for molecuilder/src/molecule.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 PM (15 years ago)
- Children:
- e7ea64
- Parents:
- 0f55b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecule.cpp
r0f55b2 r1f591b 220 220 // Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl; 221 221 // create vector in direction of bond 222 InBondvector.CopyVector(&TopReplacement->x); 223 InBondvector.SubtractVector(&TopOrigin->x); 222 InBondvector = TopReplacement->x - TopOrigin->x; 224 223 bondlength = InBondvector.Norm(); 225 224 … … 240 239 matrix = ReturnFullMatrixforSymmetric(cell_size); 241 240 Orthovector1.MatrixMultiplication(matrix); 242 InBondvector.SubtractVector( &Orthovector1); // subtract just the additional translation241 InBondvector.SubtractVector(Orthovector1); // subtract just the additional translation 243 242 Free(&matrix); 244 243 bondlength = InBondvector.Norm(); … … 265 264 FirstOtherAtom = World::getInstance().createAtom(); // new atom 266 265 FirstOtherAtom->type = elemente->FindElement(1); // element is Hydrogen 267 FirstOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity266 FirstOtherAtom->v = TopReplacement->v; // copy velocity 268 267 FirstOtherAtom->FixedIon = TopReplacement->FixedIon; 269 268 if (TopReplacement->type->Z == 1) { // neither rescale nor replace if it's already hydrogen … … 274 273 } 275 274 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 atom275 FirstOtherAtom->x = TopOrigin->x; // set coordination to origin ... 276 FirstOtherAtom->x = InBondvector; // ... and add distance vector to replacement atom 278 277 AllWentWell = AllWentWell && AddAtom(FirstOtherAtom); 279 278 // Log() << Verbose(4) << "Added " << *FirstOtherAtom << " at: "; … … 316 315 } 317 316 } else { 318 Orthovector1.GetOneNormalVector( &InBondvector);317 Orthovector1.GetOneNormalVector(InBondvector); 319 318 } 320 319 //Log() << Verbose(3)<< "Orthovector1: "; … … 331 330 FirstOtherAtom->type = elemente->FindElement(1); 332 331 SecondOtherAtom->type = elemente->FindElement(1); 333 FirstOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity332 FirstOtherAtom->v = TopReplacement->v; // copy velocity 334 333 FirstOtherAtom->FixedIon = TopReplacement->FixedIon; 335 SecondOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity334 SecondOtherAtom->v = TopReplacement->v; // copy velocity 336 335 SecondOtherAtom->FixedIon = TopReplacement->FixedIon; 337 336 FirstOtherAtom->father = NULL; // we are just an added hydrogen with no father … … 388 387 SecondOtherAtom->type = elemente->FindElement(1); 389 388 ThirdOtherAtom->type = elemente->FindElement(1); 390 FirstOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity389 FirstOtherAtom->v = TopReplacement->v; // copy velocity 391 390 FirstOtherAtom->FixedIon = TopReplacement->FixedIon; 392 SecondOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity391 SecondOtherAtom->v = TopReplacement->v; // copy velocity 393 392 SecondOtherAtom->FixedIon = TopReplacement->FixedIon; 394 ThirdOtherAtom->v .CopyVector(&TopReplacement->v); // copy velocity393 ThirdOtherAtom->v = TopReplacement->v; // copy velocity 395 394 ThirdOtherAtom->FixedIon = TopReplacement->FixedIon; 396 395 FirstOtherAtom->father = NULL; // we are just an added hydrogen with no father … … 399 398 400 399 // we need to vectors orthonormal the InBondvector 401 AllWentWell = AllWentWell && Orthovector1.GetOneNormalVector( &InBondvector);400 AllWentWell = AllWentWell && Orthovector1.GetOneNormalVector(InBondvector); 402 401 // Log() << Verbose(3) << "Orthovector1: "; 403 402 // Orthovector1.Output(out); … … 426 425 factors[1] = f; 427 426 factors[2] = 0.; 428 FirstOtherAtom->x.LinearCombinationOfVectors( &InBondvector, &Orthovector1, &Orthovector2, factors);427 FirstOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors); 429 428 factors[1] = -0.5*f; 430 429 factors[2] = g; 431 SecondOtherAtom->x.LinearCombinationOfVectors( &InBondvector, &Orthovector1, &Orthovector2, factors);430 SecondOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors); 432 431 factors[2] = -g; 433 ThirdOtherAtom->x.LinearCombinationOfVectors( &InBondvector, &Orthovector1, &Orthovector2, factors);432 ThirdOtherAtom->x.LinearCombinationOfVectors(InBondvector, Orthovector1, Orthovector2, factors); 434 433 435 434 // rescale each to correct BondDistance … … 439 438 440 439 // 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; 444 443 445 444 // ... and add to molecule … … 1022 1021 Log() << Verbose(5) << "Center of Gravity: " << CenterOfGravity << endl; 1023 1022 Log() << Verbose(5) << "Other Center of Gravity: " << OtherCenterOfGravity << endl; 1024 if (CenterOfGravity.DistanceSquared( &OtherCenterOfGravity) > threshold*threshold) {1023 if (CenterOfGravity.DistanceSquared(OtherCenterOfGravity) > threshold*threshold) { 1025 1024 Log() << Verbose(4) << "Centers of gravity don't match." << endl; 1026 1025 result = false;
Note:
See TracChangeset
for help on using the changeset viewer.