Changeset 1513a74


Ignore:
Timestamp:
Apr 30, 2010, 10:07:23 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:
fa5a6a
Parents:
005e18
Message:

Declared the Vector class as single point spaces

Location:
src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    r005e18 r1513a74  
    1010                           gslvector.cpp \
    1111                           linearsystemofequations.cpp \
     12                           Space.cpp \
    1213                           vector.cpp
    1314                           
     
    1516                           gslvector.hpp \
    1617                           linearsystemofequations.hpp \
     18                           Space.hpp \
    1719                           vector.hpp
    1820                           
     
    127129                 periodentafel.cpp \
    128130                 Plane.cpp \
    129                  Space.cpp \
    130131                 tesselation.cpp \
    131132                 tesselationhelpers.cpp \
     
    166167          periodentafel.hpp \
    167168          Plane.hpp \
    168           Space.hpp \
    169169          stackclass.hpp \
    170170          tesselation.hpp \
  • src/analysis_correlation.cpp

    r005e18 r1513a74  
    131131                                checkOtherX = Vector(Othern[0], Othern[1], Othern[2]) + periodicOtherX;
    132132                                checkOtherX.MatrixMultiplication(FullMatrix);
    133                                 distance = checkX.Distance(checkOtherX);
     133                                distance = checkX.distance(checkOtherX);
    134134                                //Log() << Verbose(1) <<"Inserting " << *Walker << " and " << *OtherWalker << endl;
    135135                                outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> (Walker, OtherWalker) ) );
     
    224224                checkX = Vector(n[0], n[1], n[2]) + periodicX;
    225225                checkX.MatrixMultiplication(FullMatrix);
    226                 distance = checkX.Distance(*point);
     226                distance = checkX.distance(*point);
    227227                DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    228228                outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (Walker, point) ) );
  • src/atom.cpp

    r005e18 r1513a74  
    261261double atom::DistanceToVector(const Vector &origin) const
    262262{
    263   return origin.Distance(x);
     263  return origin.distance(x);
    264264};
    265265
  • src/atom_trajectoryparticle.cpp

    r005e18 r1513a74  
    4949  // set forces
    5050  for (int i=NDIM;i++;)
    51     Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).Distance(Sprinter->Trajectory.R.at(endstep)));
     51    Force->Matrix[0][nr][5+i] += 2.*constant*sqrt(Trajectory.R.at(startstep).distance(Sprinter->Trajectory.R.at(endstep)));
    5252};
    5353
  • src/bond.cpp

    r005e18 r1513a74  
    119119double bond::GetDistance() const
    120120{
    121   return (leftatom->node->Distance(*rightatom->node));
     121  return (leftatom->node->distance(*rightatom->node));
    122122};
    123123
  • src/molecule_dynamics.cpp

    r005e18 r1513a74  
    4848    // check whether either is zero()
    4949    if ((Norm1 < MYEPSILON) && (Norm2 < MYEPSILON)) {
    50       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.startstep));
     50      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
    5151    } else if (Norm1 < MYEPSILON) {
    5252      Sprinter = Params.PermutationMap[Walker->nr];   // find first target point
     
    6666  //        Log() << Verbose(0) << " and ";
    6767  //        Log() << Verbose(0) << trajectory2;
    68       tmp = Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.startstep));
     68      tmp = Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.startstep));
    6969  //        Log() << Verbose(0) << " with distance " << tmp << "." << endl;
    7070    } else { // determine distance by finding minimum distance
     
    166166    // first term: distance to target
    167167    Runner = Params.PermutationMap[Walker->nr];   // find target point
    168     tmp = (Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.endstep)));
     168    tmp = (Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)));
    169169    tmp *= Params.IsAngstroem ? 1. : 1./AtomicLengthToAngstroem;
    170170    result += Params.PenaltyConstants[0] * tmp;
     
    225225    while(Runner->next != mol->end) {
    226226      Runner = Runner->next;
    227       Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).Distance(Runner->Trajectory.R.at(Params.endstep)), Runner) );
     227      Params.DistanceList[Walker->nr]->insert( DistancePair(Walker->Trajectory.R.at(Params.startstep).distance(Runner->Trajectory.R.at(Params.endstep)), Runner) );
    228228    }
    229229  }
  • src/moleculelist.cpp

    r005e18 r1513a74  
    502502          if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (Binder->GetOtherAtom(Runner) != Binder->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
    503503            // 4. evaluate the morse potential for each matrix component and add up
    504             distance = Runner->x.Distance(Walker->x);
     504            distance = Runner->x.distance(Walker->x);
    505505            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
    506506            for (int k = 0; k < a; k++) {
  • src/tesselation.cpp

    r005e18 r1513a74  
    10971097    DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << OtherOptCenter << ":" << endl);
    10981098    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    1099       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(OtherOptCenter) << "." << endl);
     1099      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(OtherOptCenter) << "." << endl);
    11001100
    11011101    // remove baseline's endpoints and candidates
     
    20502050  DoLog(1) && (Log() << Verbose(1) << "The following atoms are inside sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20512051  for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2052     DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(CandidateLine.OtherOptCenter) << "." << endl);
     2052    DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
    20532053
    20542054  // remove triangles's endpoints
     
    20662066    DoLog(1) && (Log() << Verbose(1) << "External atoms inside of sphere at " << CandidateLine.OtherOptCenter << ":" << endl);
    20672067    for (TesselPointList::const_iterator Runner = ListofPoints->begin(); Runner != ListofPoints->end(); ++Runner)
    2068       DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->Distance(CandidateLine.OtherOptCenter) << "." << endl);
     2068      DoLog(1) && (Log() << Verbose(1) << "  " << *(*Runner) << " with distance " << (*Runner)->node->distance(CandidateLine.OtherOptCenter) << "." << endl);
    20692069  }
    20702070  delete (ListofPoints);
  • src/tesselationhelpers.cpp

    r005e18 r1513a74  
    8888  center->at(2) =  0.5 * m14/ m11;
    8989
    90   if (fabs(a.Distance(*center) - RADIUS) > MYEPSILON)
    91     DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.Distance(*center) - RADIUS) << " from a than RADIUS." << endl);
     90  if (fabs(a.distance(*center) - RADIUS) > MYEPSILON)
     91    DoeLog(1) && (eLog()<< Verbose(1) << "The given center is further way by " << fabs(a.distance(*center) - RADIUS) << " from a than RADIUS." << endl);
    9292
    9393  gsl_matrix_free(A);
     
    232232    alpha = 2.*M_PI - alpha;
    233233  DoLog(1) && (Log() << Verbose(1) << "INFO: RelativeNewSphereCenter is " << helper << ", RelativeOldSphereCenter is " << RelativeOldSphereCenter << " and resulting angle is " << alpha << "." << endl);
    234   radius = helper.Distance(RelativeOldSphereCenter);
     234  radius = helper.distance(RelativeOldSphereCenter);
    235235  helper.ProjectOntoPlane(NormalVector);
    236236  // check whether new center is somewhat away or at least right over the current baseline to prevent intersecting triangles
  • src/triangleintersectionlist.cpp

    r005e18 r1513a74  
    146146  if (DistanceList.empty())
    147147    for (TriangleVectorMap::const_iterator runner = IntersectionList.begin(); runner != IntersectionList.end(); runner++)
    148       DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->Distance(*(*runner).second), (*runner).first) );
     148      DistanceList.insert( pair<double, BoundaryTriangleSet *> (Point->distance(*(*runner).second), (*runner).first) );
    149149
    150150  //for (DistanceTriangleMap::const_iterator runner = DistanceList.begin(); runner != DistanceList.end(); runner++)
  • src/unittests/vectorunittest.cpp

    r005e18 r1513a74  
    159159void VectorTest::EuclidianDistancesTest()
    160160{
    161   CPPUNIT_ASSERT_EQUAL( 1., zero.Distance(unit) );
    162   CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.Distance(unit) );
    163   CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.Distance(notunit) );
    164   CPPUNIT_ASSERT_EQUAL( 1., otherunit.Distance(notunit) );
    165   CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.Distance(notunit) );
     161  CPPUNIT_ASSERT_EQUAL( 1., zero.distance(unit) );
     162  CPPUNIT_ASSERT_EQUAL( sqrt(2.), otherunit.distance(unit) );
     163  CPPUNIT_ASSERT_EQUAL( sqrt(2.), zero.distance(notunit) );
     164  CPPUNIT_ASSERT_EQUAL( 1., otherunit.distance(notunit) );
     165  CPPUNIT_ASSERT_EQUAL( sqrt(5.), two.distance(notunit) );
    166166}
    167167
  • src/vector.cpp

    r005e18 r1513a74  
    7979 * \return \f$| x - y |\f$
    8080 */
    81 double Vector::Distance(const Vector &y) const
     81double Vector::distance(const Vector &y) const
    8282{
    8383  return (sqrt(DistanceSquared(y)));
    8484};
     85
     86Vector Vector::getClosestPoint(const Vector &point) const{
     87  // the closest point to a single point space is always the single point itself
     88  return *this;
     89}
    8590
    8691/** Calculates distance between this and another vector in a periodic cell.
     
    9196double Vector::PeriodicDistance(const Vector &y, const double * const cell_size) const
    9297{
    93   double res = Distance(y), tmp, matrix[NDIM*NDIM];
     98  double res = distance(y), tmp, matrix[NDIM*NDIM];
    9499    Vector Shiftedy, TranslationVector;
    95100    int N[NDIM];
     
    115120          Shiftedy = y + TranslationVector;
    116121          // get distance and compare with minimum so far
    117           tmp = Distance(Shiftedy);
     122          tmp = distance(Shiftedy);
    118123          if (tmp < res) res = tmp;
    119124        }
  • src/vector.hpp

    r005e18 r1513a74  
    1818
    1919#include "defs.hpp"
     20#include "Space.hpp"
    2021
    2122/********************************************** declarations *******************************/
     
    2425 * basically, just a x[3] but with helpful functions
    2526 */
    26 class Vector {
     27class Vector : public Space{
    2728protected:
    2829  // this struct is used to indicate calls to the Baseconstructor from inside vectors.
     
    7980
    8081  // Methods that are derived directly from other methods
    81   double Distance(const Vector &y) const;
    8282  double Norm() const;
    8383  double NormSquared() const;
     
    9393  Vector const operator+(const Vector& b) const;
    9494  Vector const operator-(const Vector& b) const;
     95
     96  // Methods inherited from Space
     97  virtual double distance(const Vector &point) const;
     98  virtual Vector getClosestPoint(const Vector &point) const;
    9599
    96100protected:
Note: See TracChangeset for help on using the changeset viewer.