Changeset 273382 for src/SingleVector.cpp
- Timestamp:
- Apr 13, 2010, 1:22:42 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 1bd79e
- Parents:
- 72e7fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SingleVector.cpp
r72e7fa r273382 119 119 TranslationVector.MatrixMultiplication(matrix); 120 120 // add onto the original vector to compare with 121 Shiftedy.CopyVector(y); 122 Shiftedy.AddVector(&TranslationVector); 121 Shiftedy = y + TranslationVector; 123 122 // get distance and compare with minimum so far 124 123 tmp = Distance(Shiftedy); … … 157 156 TranslationVector.MatrixMultiplication(matrix); 158 157 // add onto the original vector to compare with 159 Shiftedy.CopyVector(y); 160 Shiftedy.AddVector(&TranslationVector); 158 Shiftedy = y + TranslationVector; 161 159 // get distance and compare with minimum so far 162 160 tmp = DistanceSquared(Shiftedy); … … 180 178 // Output(out); 181 179 // Log() << Verbose(0) << endl; 182 TestVector .CopyVector(this);180 TestVector = *this; 183 181 TestVector.InverseMatrixMultiplication(matrix); 184 182 for(int i=NDIM;i--;) { // correct periodically … … 190 188 } 191 189 TestVector.MatrixMultiplication(matrix); 192 CopyVector( &TestVector);190 CopyVector(TestVector); 193 191 // Log() << Verbose(2) << "New corrected vector is: "; 194 192 // Output(out); … … 250 248 251 249 // first create part that is orthonormal to PlaneNormal with withdraw 252 temp = *this- PlaneOffset;250 temp = (*this )- PlaneOffset; 253 251 temp.MakeNormalTo(PlaneNormal); 254 252 temp.Scale(-1.); 255 253 // then add connecting vector from plane to point 256 temp += *this-PlaneOffset;257 double sign = temp.ScalarProduct( &PlaneNormal);254 temp += (*this)-PlaneOffset; 255 double sign = temp.ScalarProduct(PlaneNormal); 258 256 if (fabs(sign) > MYEPSILON) 259 257 sign /= fabs(sign); … … 271 269 Vector helper = y; 272 270 helper.Scale(-(ScalarProduct(y))); 273 AddVector( &helper);271 AddVector(helper); 274 272 }; 275 273 … … 556 554 { 557 555 bool result = false; 558 double factor = y1.ScalarProduct( this)/y1.NormSquared();556 double factor = y1.ScalarProduct(*this)/y1.NormSquared(); 559 557 Vector x1; 560 x1.CopyVector(&y1); 561 x1.Scale(factor); 562 SubtractVector(&x1); 558 x1 = factor * y1; 559 SubtractVector(x1); 563 560 for (int i=NDIM;i--;) 564 561 result = result || (fabs(x[i]) > MYEPSILON); … … 618 615 bool SingleVector::IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const 619 616 { 620 Vector a; 621 a.CopyVector(this); 622 a.SubtractVector(&offset); 617 Vector a = (*this) - offset; 623 618 a.InverseMatrixMultiplication(parallelepiped); 624 619 bool isInside = true;
Note:
See TracChangeset
for help on using the changeset viewer.