Changeset 5108e1


Ignore:
Timestamp:
Jun 30, 2010, 9:00:19 AM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
1da5f5
Parents:
4d206f
Message:

Removed MatrixMultiplication() method from Vector class

Location:
src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r4d206f r5108e1  
    9999                DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
    100100              x = y;
    101               x.MatrixMultiplication(M);
     101              x *= M;
    102102              newmol = World::getInstance().createMolecule();
    103103              molecules->insert(newmol);
  • src/analysis_correlation.cpp

    r4d206f r5108e1  
    142142      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
    143143        DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl);
    144         periodicX = *(*iter)->node;
    145         periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     144        periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    146145        // go through every range in xyz and get distance
    147146        for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    148147          for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    149148            for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    150               checkX = Vector(n[0], n[1], n[2]) + periodicX;
    151               checkX.MatrixMultiplication(FullMatrix);
     149              checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    152150              for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){
    153151                if ((*MolOtherWalker)->ActiveFlag) {
     
    158156                      for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)
    159157                        if ((PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {
    160                           periodicOtherX = *(*runner)->node;
    161                           periodicOtherX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     158                          periodicOtherX = FullInverseMatrix * (*(*runner)->node); // x now in [0,1)^3
    162159                          // go through every range in xyz and get distance
    163160                          for (Othern[0]=-ranges[0]; Othern[0] <= ranges[0]; Othern[0]++)
    164161                            for (Othern[1]=-ranges[1]; Othern[1] <= ranges[1]; Othern[1]++)
    165162                              for (Othern[2]=-ranges[2]; Othern[2] <= ranges[2]; Othern[2]++) {
    166                                 checkOtherX = Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX;
    167                                 checkOtherX.MatrixMultiplication(FullMatrix);
     163                                checkOtherX = FullMatrix * (Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX);
    168164                                distance = checkX.distance(checkOtherX);
    169165                                //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl;
     
    252248        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    253249          if ((*type == NULL) || ((*iter)->type == *type)) {
    254             periodicX = *(*iter)->node;
    255             periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     250            periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    256251            // go through every range in xyz and get distance
    257252            for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)
    258253              for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    259254                for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    260                   checkX = Vector(n[0], n[1], n[2]) + periodicX;
    261                   checkX.MatrixMultiplication(FullMatrix);
     255                  checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    262256                  distance = checkX.distance(*point);
    263257                  DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
     
    356350        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    357351          if ((*type == NULL) || ((*iter)->type == *type)) {
    358             periodicX = *(*iter)->node;
    359             periodicX.MatrixMultiplication(FullInverseMatrix);  // x now in [0,1)^3
     352            periodicX = FullInverseMatrix * (*(*iter)->node); // x now in [0,1)^3
    360353            // go through every range in xyz and get distance
    361354            ShortestDistance = -1.;
     
    363356              for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)
    364357                for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {
    365                   checkX = Vector(n[0], n[1], n[2]) + periodicX;
    366                   checkX.MatrixMultiplication(FullMatrix);
     358                  checkX = FullMatrix * (Vector(n[0], n[1], n[2]) + periodicX);
    367359                  TriangleIntersectionList Intersections(&checkX,Surface,LC);
    368360                  distance = Intersections.GetSmallestDistance();
  • src/boundary.cpp

    r4d206f r5108e1  
    800800
    801801  // calculate filler grid in [0,1]^3
    802   FillerDistance = Vector(distance[0], distance[1], distance[2]);
    803   FillerDistance.MatrixMultiplication(MInverse);
     802  FillerDistance = MInverse * Vector(distance[0], distance[1], distance[2]);
    804803  for(int i=0;i<NDIM;i++)
    805804    N[i] = (int) ceil(1./FillerDistance[i]);
     
    814813      for (n[2] = 0; n[2] < N[2]; n[2]++) {
    815814        // calculate position of current grid vector in untransformed box
    816         CurrentPosition = Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]);
    817         CurrentPosition.MatrixMultiplication(M);
     815        CurrentPosition = M * Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]);
    818816        // create molecule random translation vector ...
    819817        for (int i=0;i<NDIM;i++)
     
    850848          Inserter = (*iter)->x;
    851849          if (DoRandomRotation)
    852             Inserter.MatrixMultiplication(Rotations);
     850            Inserter *= Rotations;
    853851          Inserter += AtomTranslations + FillerTranslations + CurrentPosition;
    854852
    855853          // check whether inserter is inside box
    856           Inserter.MatrixMultiplication(MInverse);
     854          Inserter *= MInverse;
    857855          FillIt = true;
    858856          for (int i=0;i<NDIM;i++)
    859857            FillIt = FillIt && (Inserter[i] >= -MYEPSILON) && ((Inserter[i]-1.) <= MYEPSILON);
    860           Inserter.MatrixMultiplication(M);
     858          Inserter *= M;
    861859
    862860          // Check whether point is in- or outside
  • src/ellipsoid.cpp

    r4d206f r5108e1  
    6161  Matrix.set(1,2, sin(theta)*cos(phi));
    6262  Matrix.set(2,2, cos(theta));
    63   helper.MatrixMultiplication(Matrix);
     63  helper *= Matrix;
    6464  helper.ScaleAll(InverseLength);
    6565  //Log() << Verbose(4) << "Transformed RefPoint is at " << helper << "." << endl;
     
    8383  Matrix.set(1,2, sin(theta)*cos(phi));
    8484  Matrix.set(2,2, cos(theta));
    85   helper.MatrixMultiplication(Matrix);
     85  helper *= Matrix;
    8686  //Log() << Verbose(4) << "Intersection is at " << helper << "." << endl;
    8787
  • src/molecule.cpp

    r4d206f r5108e1  
    309309    }
    310310    matrix = ReturnFullMatrixforSymmetric(cell_size);
    311     Orthovector1.MatrixMultiplication(matrix);
     311    Orthovector1 *= matrix;
    312312    InBondvector -= Orthovector1; // subtract just the additional translation
    313313    bondlength = InBondvector.Norm();
  • src/molecule_fragmentation.cpp

    r4d206f r5108e1  
    17501750          Translationvector[i] = (tmp < 0) ? +1. : -1.;
    17511751      }
    1752       Translationvector.MatrixMultiplication(matrix);
     1752      Translationvector *= matrix;
    17531753      //Log() << Verbose(3) << "Translation vector is ";
    17541754      Log() << Verbose(0) << Translationvector <<  endl;
  • src/molecule_geometry.cpp

    r4d206f r5108e1  
    156156  const double *cell_size = World::getInstance().getDomain();
    157157  Matrix M = ReturnFullMatrixforSymmetric(cell_size);
    158   a->MatrixMultiplication(M);
     158  (*a) *= M;
    159159
    160160  return a;
     
    287287      if ((*iter)->type->Z != 1) {
    288288#endif
    289         Testvector = (*iter)->x;
    290         Testvector.MatrixMultiplication(inversematrix);
     289        Testvector = inversematrix * (*iter)->x;
    291290        Translationvector.Zero();
    292291        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
     
    305304        }
    306305        Testvector += Translationvector;
    307         Testvector.MatrixMultiplication(matrix);
     306        Testvector *= matrix;
    308307        Center += Testvector;
    309308        Log() << Verbose(1) << "vector is: " << Testvector << endl;
     
    312311        for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) {
    313312          if ((*Runner)->GetOtherAtom((*iter))->type->Z == 1) {
    314             Testvector = (*Runner)->GetOtherAtom((*iter))->x;
    315             Testvector.MatrixMultiplication(inversematrix);
     313            Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->x;
    316314            Testvector += Translationvector;
    317             Testvector.MatrixMultiplication(matrix);
     315            Testvector *= matrix;
    318316            Center += Testvector;
    319317            Log() << Verbose(1) << "Hydrogen vector is: " << Testvector << endl;
     
    386384    // the eigenvectors specify the transformation matrix
    387385    Matrix M = Matrix(evec->data);
    388     ActOnAllVectors( &Vector::MatrixMultiplication, static_cast<const Matrix>(M));
     386    BOOST_FOREACH(atom* iter, atoms){
     387      (*iter->node) *= M;
     388    }
    389389    DoLog(0) && (Log() << Verbose(0) << "done." << endl);
    390390
  • src/vector.cpp

    r4d206f r5108e1  
    125125        for (N[2]=-1;N[2]<=1;N[2]++) {
    126126          // create the translation vector
    127           TranslationVector.Zero();
    128           for (int i=NDIM;i--;)
    129             TranslationVector[i] = (double)N[i];
    130           TranslationVector.MatrixMultiplication(matrix);
     127          TranslationVector = matrix * Vector(N[0],N[1],N[2]);
    131128          // add onto the original vector to compare with
    132129          Shiftedy = y + TranslationVector;
     
    470467void Vector::WrapPeriodically(const Matrix &M, const Matrix &Minv)
    471468{
    472   MatrixMultiplication(Minv);
     469  *this *= Minv;
    473470  // truncate to [0,1] for each axis
    474471  for (int i=0;i<NDIM;i++) {
     
    479476      at(i) += 1.;
    480477  }
    481   MatrixMultiplication(M);
     478  *this *= M;
    482479};
    483480
     
    498495  return make_pair(res,helper);
    499496}
    500 
    501 /** Do a matrix multiplication.
    502  * \param *matrix NDIM_NDIM array
    503  */
    504 void Vector::MatrixMultiplication(const Matrix &M)
    505 {
    506   (*this) *= M;
    507 };
    508497
    509498/** Creates this vector as the b y *factors' components scaled linear combination of the given three.
     
    615604bool Vector::IsInParallelepiped(const Vector &offset, const double * const _parallelepiped) const
    616605{
    617   Vector a = (*this)-offset;
    618606  Matrix parallelepiped = Matrix(_parallelepiped).invert();
    619   a.MatrixMultiplication(parallelepiped);
     607  Vector a = parallelepiped * ((*this)-offset);
    620608  bool isInside = true;
    621609
  • src/vector.hpp

    r4d206f r5108e1  
    6060  void ScaleAll(const double *factor);
    6161  void Scale(const double factor);
    62   void MatrixMultiplication(const Matrix &M);
    6362  bool GetOneNormalVector(const Vector &x1);
    6463  bool MakeNormalTo(const Vector &y1);
Note: See TracChangeset for help on using the changeset viewer.