Changeset 607eab for src/bondgraph.cpp


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified 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 << ".");
Note: See TracChangeset for help on using the changeset viewer.