Changeset 2f1a7a
- Timestamp:
- Jun 26, 2010, 11:17:50 AM (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:
- d0f111
- Parents:
- c7b39a
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/vector.cpp
rc7b39a r2f1a7a 574 574 }; 575 575 576 /** Do a matrix multiplication with the \a *A' inverse.577 * \param *matrix NDIM_NDIM array578 */579 bool Vector::InverseMatrixMultiplication(const double * const A)580 {581 /*582 double B[NDIM*NDIM];583 double detA = RDET3(A);584 double detAReci;585 586 // calculate the inverse B587 if (fabs(detA) > MYEPSILON) {; // RDET3(A) yields precisely zero if A irregular588 detAReci = 1./detA;589 B[0] = detAReci*RDET2(A[4],A[5],A[7],A[8]); // A_11590 B[1] = -detAReci*RDET2(A[1],A[2],A[7],A[8]); // A_12591 B[2] = detAReci*RDET2(A[1],A[2],A[4],A[5]); // A_13592 B[3] = -detAReci*RDET2(A[3],A[5],A[6],A[8]); // A_21593 B[4] = detAReci*RDET2(A[0],A[2],A[6],A[8]); // A_22594 B[5] = -detAReci*RDET2(A[0],A[2],A[3],A[5]); // A_23595 B[6] = detAReci*RDET2(A[3],A[4],A[6],A[7]); // A_31596 B[7] = -detAReci*RDET2(A[0],A[1],A[6],A[7]); // A_32597 B[8] = detAReci*RDET2(A[0],A[1],A[3],A[4]); // A_33598 599 MatrixMultiplication(B);600 601 return true;602 } else {603 return false;604 }605 */606 Matrix mat = Matrix(A);607 try{608 (*this) *= mat.invert();609 return true;610 }611 catch(MathException &excpt){612 return false;613 }614 };615 616 617 576 /** Creates this vector as the b y *factors' components scaled linear combination of the given three. 618 577 * this vector = x1*factors[0] + x2* factors[1] + x3*factors[2] … … 721 680 * @param three vectors forming the matrix that defines the shape of the parallelpiped 722 681 */ 723 bool Vector::IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const682 bool Vector::IsInParallelepiped(const Vector &offset, const double * const _parallelepiped) const 724 683 { 725 684 Vector a = (*this)-offset; 726 a.InverseMatrixMultiplication(parallelepiped); 685 Matrix parallelepiped = Matrix(_parallelepiped).invert(); 686 a.MatrixMultiplication(parallelepiped); 727 687 bool isInside = true; 728 688 -
src/vector.hpp
rc7b39a r2f1a7a 61 61 void Scale(const double factor); 62 62 void MatrixMultiplication(const Matrix &M); 63 bool InverseMatrixMultiplication(const double * const M);64 63 void KeepPeriodic(const double * const matrix); 65 64 bool GetOneNormalVector(const Vector &x1);
Note:
See TracChangeset
for help on using the changeset viewer.