Changeset 607eab


Ignore:
Timestamp:
Mar 1, 2011, 1:17:09 PM (14 years ago)
Author:
Frederik Heber <heber@…>
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:
632508
Parents:
cff66c
git-author:
Frederik Heber <heber@…> (02/28/11 16:06:03)
git-committer:
Frederik Heber <heber@…> (03/01/11 13:17:09)
Message:

BondGraph::...MinMaxDistance() now return range<double> instead of ref as parameter.

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/CreateAdjacencyAction.cpp

    rcff66c r607eab  
    133133                          ASSERT(OtherWalker,"TesselPoint that was not an atom retrieved from LinkedNode");
    134134                          //Log() << Verbose(1) << "Checking distance " << OtherWalker->x.PeriodicDistanceSquared(&(Walker->x), cell_size) << " against typical bond length of " << bonddistance*bonddistance << "." << endl;
    135                           range<double> MinMaxDistanceSquared(0.,0.);
    136                           BG->getMinMaxDistanceSquared(Walker, OtherWalker, MinMaxDistanceSquared);
     135                          const range<double> MinMaxDistanceSquared(
     136                              BG->getMinMaxDistanceSquared(Walker, OtherWalker));
    137137                          const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
    138138                          const bool status = MinMaxDistanceSquared.isInRange(distance);
  • src/bondgraph.cpp

    rcff66c r607eab  
    9797}
    9898
    99 void BondGraph::CovalentMinMaxDistance(
     99range<double> BondGraph::CovalentMinMaxDistance(
    100100    const element * const Walker,
    101     const element * const OtherWalker,
    102     range<double> &MinMaxDistance) const
    103 {
     101    const element * const OtherWalker) const
     102{
     103  range<double> MinMaxDistance(0.,0.);
    104104  MinMaxDistance.first = OtherWalker->getCovalentRadius() + Walker->getCovalentRadius();
    105105  MinMaxDistance.first *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    106106  MinMaxDistance.last = MinMaxDistance.first + BondThreshold;
    107107  MinMaxDistance.first -= BondThreshold;
    108 }
    109 
    110 void BondGraph::BondLengthMatrixMinMaxDistance(
     108  return MinMaxDistance;
     109}
     110
     111range<double> BondGraph::BondLengthMatrixMinMaxDistance(
    111112    const element * const Walker,
    112     const element * const OtherWalker,
    113     range<double> &MinMaxDistance) const
     113    const element * const OtherWalker) const
    114114{
    115115  ASSERT(BondLengthMatrix, "BondGraph::BondLengthMatrixMinMaxDistance() called without NULL BondLengthMatrix.");
    116116  ASSERT(Walker, "BondGraph::BondLengthMatrixMinMaxDistance() - illegal element given.");
    117117  ASSERT(OtherWalker, "BondGraph::BondLengthMatrixMinMaxDistance() - illegal other element given.");
     118  range<double> MinMaxDistance(0.,0.);
    118119  MinMaxDistance.first = GetBondLength(Walker->getAtomicNumber()-1, OtherWalker->getAtomicNumber()-1);
    119120  MinMaxDistance.first *= (IsAngstroem) ? 1. : 1. / AtomicLengthToAngstroem;
    120121  MinMaxDistance.last = MinMaxDistance.first + BondThreshold;
    121122  MinMaxDistance.first -= BondThreshold;
    122 }
    123 
    124 void BondGraph::getMinMaxDistance(
     123  return MinMaxDistance;
     124}
     125
     126range<double> BondGraph::getMinMaxDistance(
    125127    const element * const Walker,
    126     const element * const OtherWalker,
    127     range<double> &MinMaxDistance) const
    128 {
     128    const element * const OtherWalker) const
     129{
     130  range<double> MinMaxDistance(0.,0.);
    129131  if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet
    130132    LOG(2, "INFO: Using Covalent radii criterion for [min,max) distances.");
    131     CovalentMinMaxDistance(Walker, OtherWalker, MinMaxDistance);
     133    MinMaxDistance = CovalentMinMaxDistance(Walker, OtherWalker);
    132134  } else {
    133135    LOG(2, "INFO: Using Covalent radii criterion for [min,max) distances.");
    134     BondLengthMatrixMinMaxDistance(Walker, OtherWalker, MinMaxDistance);
    135   }
    136 }
    137 
    138 void BondGraph::getMinMaxDistance(
     136    MinMaxDistance = BondLengthMatrixMinMaxDistance(Walker, OtherWalker);
     137  }
     138  return MinMaxDistance;
     139}
     140
     141range<double> BondGraph::getMinMaxDistance(
    139142    const BondedParticle * const Walker,
    140     const BondedParticle * const OtherWalker,
    141     range<double> &MinMaxDistance) const
    142 {
    143   getMinMaxDistance(Walker->getType(), OtherWalker->getType(),MinMaxDistance);
    144 }
    145 
    146 void BondGraph::getMinMaxDistanceSquared(
     143    const BondedParticle * const OtherWalker) const
     144{
     145  return getMinMaxDistance(Walker->getType(), OtherWalker->getType());
     146}
     147
     148range<double> BondGraph::getMinMaxDistanceSquared(
    147149    const BondedParticle * const Walker,
    148     const BondedParticle * const OtherWalker,
    149     range<double> &MinMaxDistance) const
     150    const BondedParticle * const OtherWalker) const
    150151{
    151152  // use non-squared version
    152   getMinMaxDistance(Walker, OtherWalker,MinMaxDistance);
     153  range<double> MinMaxDistance(getMinMaxDistance(Walker, OtherWalker));
    153154  // and square
    154155  MinMaxDistance.first *= MinMaxDistance.first;
    155156  MinMaxDistance.last *= MinMaxDistance.last;
     157  return MinMaxDistance;
    156158}
    157159
     
    189191                        ASSERT(OtherWalker != NULL,
    190192                            "BondGraph::CreateAdjacency() - TesselPoint that was not an atom retrieved from LinkedNode");
    191                         range<double> MinMaxDistanceSquared(0.,0.);
    192                         getMinMaxDistanceSquared(Walker, OtherWalker, MinMaxDistanceSquared);
     193                        const range<double> MinMaxDistanceSquared(
     194                            getMinMaxDistanceSquared(Walker, OtherWalker));
    193195                        const double distance = domain.periodicDistanceSquared(OtherWalker->getPosition(),Walker->getPosition());
    194196                        LOG(2, "INFO: Checking squared distance " << distance << " against typical bond length of " << MinMaxDistanceSquared << ".");
  • src/bondgraph.hpp

    rcff66c r607eab  
    9292          otheriter != PresentElements.end();
    9393          ++otheriter) {
    94         range<double> MinMaxDistance(0.,0.);
    95         getMinMaxDistance((*iter),(*otheriter), MinMaxDistance);
     94        const range<double> MinMaxDistance(getMinMaxDistance((*iter),(*otheriter)));
    9695        if (MinMaxDistance.last > max_distance)
    9796          max_distance = MinMaxDistance.last;
     
    105104   * \param *Walker first BondedParticle
    106105   * \param *OtherWalker second BondedParticle
    107    * \param &MinMaxDistance Range for interval on return
    108    */
    109   void getMinMaxDistance(
     106   * \return Range with bond interval
     107   */
     108  range<double> getMinMaxDistance(
    110109      const BondedParticle * const Walker,
    111       const BondedParticle * const OtherWalker,
    112       range<double> &MinMaxDistance) const;
     110      const BondedParticle * const OtherWalker) const;
    113111
    114112  /** Returns SQUARED bond criterion for given pair based on a bond length matrix.
     
    117115   * \param *Walker first BondedParticle
    118116   * \param *OtherWalker second BondedParticle
    119    * \param &MinMaxDistance Range for interval on return
    120    */
    121   void getMinMaxDistanceSquared(
     117   * \return Range with bond interval
     118   */
     119  range<double> getMinMaxDistanceSquared(
    122120      const BondedParticle * const Walker,
    123       const BondedParticle * const OtherWalker,
    124       range<double> &MinMaxDistance) const;
     121      const BondedParticle * const OtherWalker) const;
    125122
    126123  /** Creates the adjacency list for a given \a Range of iterable atoms.
     
    319316   * \param *Walker first BondedParticle
    320317   * \param *OtherWalker second BondedParticle
    321    * \param &MinMaxDistance Range for interval on return
    322    */
    323   void getMinMaxDistance(
     318   * \return Range with bond interval
     319   */
     320  range<double> getMinMaxDistance(
    324321      const element * const Walker,
    325       const element * const OtherWalker,
    326       range<double> &MinMaxDistance) const;
     322      const element * const OtherWalker) const;
    327323
    328324  /** Returns bond criterion for given pair of elements based on a bond length matrix.
     
    331327   * \param *Walker first element
    332328   * \param *OtherWalker second element
    333    * @param MinMaxDistance reference to range type set on return
    334    */
    335   void BondLengthMatrixMinMaxDistance(
     329   * \return Range with bond interval
     330   */
     331  range<double> BondLengthMatrixMinMaxDistance(
    336332      const element * const Walker,
    337       const element * const OtherWalker,
    338       range<double> &MinMaxDistance) const;
     333      const element * const OtherWalker) const;
    339334
    340335  /** Returns bond criterion for given pair of elements based on covalent radius.
    341336   * \param *Walker first element
    342337   * \param *OtherWalker second element
    343    * @param MinMaxDistance reference to range type set on return
    344    */
    345   void CovalentMinMaxDistance(
     338   * \return Range with bond interval
     339   */
     340  range<double> CovalentMinMaxDistance(
    346341      const element * const Walker,
    347       const element * const OtherWalker,
    348       range<double> &MinMaxDistance) const;
     342      const element * const OtherWalker) const;
    349343
    350344
  • src/molecule.cpp

    rcff66c r607eab  
    344344   // the problem is not the H being out of the box, but InBondvector have the wrong direction
    345345   // due to TopReplacement or Origin being on the wrong side!
    346   range<double> MinMaxBondDistance(0.,0.);
    347346  const BondGraph * const BG = World::getInstance().getBondGraph();
    348   BG->getMinMaxDistance(TopOrigin,TopReplacement,MinMaxBondDistance);
     347  const range<double> MinMaxBondDistance(
     348      BG->getMinMaxDistance(TopOrigin,TopReplacement));
    349349  if (!MinMaxBondDistance.isInRange(bondlength)) {
    350350//    Log() << Verbose(4) << "InBondvector is: ";
  • src/molecule_fragmentation.cpp

    rcff66c r607eab  
    18111811          tmp = fabs(Binder->leftatom->at(i) - Binder->rightatom->at(i));
    18121812          //Log() << Verbose(3) << "Checking " << i << "th distance of " << *Binder->leftatom << " to " << *Binder->rightatom << ": " << tmp << "." << endl;
    1813           range<double> MinMaxDistance(0.,0.);
    1814           BG->getMinMaxDistance(Binder->leftatom, Binder->rightatom, MinMaxDistance);
     1813          const range<double> MinMaxDistance(
     1814              BG->getMinMaxDistance(Binder->leftatom, Binder->rightatom));
    18151815          if (!MinMaxDistance.isInRange(tmp)) {
    18161816            DoLog(2) && (Log() << Verbose(2) << "Correcting at bond " << *Binder << "." << endl);
     
    18261826      for (int i=NDIM;i--;) {
    18271827        tmp = Binder->leftatom->at(i) - Binder->rightatom->at(i);
    1828         range<double> MinMaxDistance(0.,0.);
    1829         BG->getMinMaxDistance(Binder->leftatom, Binder->rightatom, MinMaxDistance);
     1828        const range<double> MinMaxDistance(
     1829            BG->getMinMaxDistance(Binder->leftatom, Binder->rightatom));
    18301830        if (fabs(tmp) > MinMaxDistance.last)  // check against Min is not useful for components
    18311831          Translationvector[i] = (tmp < 0) ? +1. : -1.;
  • src/molecule_geometry.cpp

    rcff66c r607eab  
    393393            for (int j=0;j<NDIM;j++) {
    394394              tmp = (*iter)->at(j) - (*Runner)->GetOtherAtom(*iter)->at(j);
    395               range<double> MinMaxBondDistance(0.,0.);
    396               BG->getMinMaxDistance((*iter), (*Runner)->GetOtherAtom(*iter), MinMaxBondDistance);
     395              const range<double> MinMaxBondDistance(
     396                  BG->getMinMaxDistance((*iter), (*Runner)->GetOtherAtom(*iter)));
    397397              if (fabs(tmp) > MinMaxBondDistance.last) {  // check against Min is not useful for components
    398398                flag = false;
Note: See TracChangeset for help on using the changeset viewer.