Changeset 0ec7fe


Ignore:
Timestamp:
Mar 1, 2011, 1:17:08 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:
111f4a
Parents:
300220
git-author:
Frederik Heber <heber@…> (02/28/11 15:11:16)
git-committer:
Frederik Heber <heber@…> (03/01/11 13:17:08)
Message:

Removed BondGraph::max_distance along with getter and setter.

  • SetMaxDistanceFromCovalentDistance() was nonsense and prone to faults and misunderstandings.
  • instead getMaxPossibleBondDistance() returns upper cutoff limit based on a given atomset.
Location:
src
Files:
3 edited

Legend:

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

    r300220 r0ec7fe  
    5959  BondGraph *BG = World::getInstance().getBondGraph();
    6060  ASSERT(BG != NULL, "FragmentationCreateAdjacencyAction: BondGraph is NULL.");
    61   BG->SetMaxDistanceToMaxOfCovalentRadii(AtomSetMixin<std::vector<atom *> >(World::getInstance().getSelectedAtoms()));
    62   double BondDistance = BG->getMaxDistance();
     61  double BondDistance = BG->getMaxPossibleBondDistance(AtomSetMixin<std::vector<atom *> >(World::getInstance().getSelectedAtoms()));
    6362  bool IsAngstroem = configuration->GetIsAngstroem();
    6463
  • src/bondgraph.cpp

    r300220 r0ec7fe  
    4242BondGraph::BondGraph(bool IsA) :
    4343    BondLengthMatrix(NULL),
    44     max_distance(0),
    4544    IsAngstroem(IsA)
    4645{}
     
    7372    status = false;
    7473  }
    75 
    76   // find greatest distance
    77   max_distance=0;
    78   if (status) {
    79     for(int i=0;i<TempContainer->RowCounter[0];i++)
    80       for(int j=i;j<TempContainer->ColumnCounter[0];j++)
    81         if (TempContainer->Matrix[0][i][j] > max_distance)
    82           max_distance = TempContainer->Matrix[0][i][j];
    83   }
    84   max_distance += BondThreshold;
    8574
    8675  if (status) // set to not NULL only if matrix was parsed
     
    10594    return (BondLengthMatrix->Matrix[0][firstZ][secondZ]);
    10695  }
    107 }
    108 
    109 double BondGraph::getMaxDistance() const
    110 {
    111   return max_distance;
    11296}
    11397
  • src/bondgraph.hpp

    r300220 r0ec7fe  
    6868  /** Determines the maximum of all element::CovalentRadius for elements present in \a &Set.
    6969   *
    70    * Sets BondGraph::max_distance
    71    *
    72    * \param &Set PointCloud with all particles
    73    */
    74   template <class container_type,
    75             class iterator_type,
    76             class const_iterator_type>
    77   double SetMaxDistanceToMaxOfCovalentRadii(const AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set)
    78   {
    79     max_distance = 0.;
    80 
     70   * I.e. the function returns a sensible cutoff criteria for bond recognition,
     71   * e.g. to be used for LinkedCell or others.
     72   *
     73   * \param &Set AtomSetMixin with all particles to consider
     74   */
     75  template <class container_type,
     76            class iterator_type,
     77            class const_iterator_type>
     78  double getMaxPossibleBondDistance(
     79      const AtomSetMixin<container_type,iterator_type,const_iterator_type> &Set) const
     80  {
     81    double max_distance = 0.;
     82    // get all elements
     83    std::set< const element *> PresentElements;
    8184    for(const_iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) {
    82       const double radius = (*AtomRunner)->getType()->getCovalentRadius();
    83       if (radius > max_distance)
    84         max_distance = radius;
    85     }
    86     max_distance *= 2.;
    87     max_distance += BondThreshold;
    88 
     85      PresentElements.insert( (*AtomRunner)->getType() );
     86    }
     87    // create all element combinations
     88    for (std::set< const element *>::const_iterator iter = PresentElements.begin();
     89        iter != PresentElements.end();
     90        ++iter) {
     91      for (std::set< const element *>::const_iterator otheriter = iter;
     92          otheriter != PresentElements.end();
     93          ++otheriter) {
     94        range<double> MinMaxDistance(0.,0.);
     95        getMinMaxDistance((*iter),(*otheriter), MinMaxDistance, IsAngstroem);
     96        if (MinMaxDistance.last > max_distance)
     97          max_distance = MinMaxDistance.last;
     98      }
     99    }
    89100    return max_distance;
    90101  }
    91 
    92   /** Returns the upper limit on possible bond distances.
    93    *
    94    * Is set by SetMaxDistanceToMaxOfCovalentRadii(), is needed e.g. as cutoff
    95    * for linked-cell.
    96    *
    97    * \return maximum possible bond distance
    98    */
    99   double getMaxDistance() const;
    100102
    101103  /** Returns bond criterion for given pair based on a bond length matrix.
     
    142144    if (counter > 1) {
    143145      LOG(1, "STATUS: Setting max bond distance.");
    144       SetMaxDistanceToMaxOfCovalentRadii(Set);
     146      const double max_distance = getMaxPossibleBondDistance(Set);
    145147
    146148      LOG(1, "STATUS: Creating LinkedCell structure for given " << counter << " atoms.");
     
    399401  //!> Matrix with bond lenth per two elements
    400402  MatrixContainer *BondLengthMatrix;
    401   //!> maximum distance over all bonds possible
    402   double max_distance;
    403403  //!> distance units are angstroem (true), bohr radii (false)
    404404  bool IsAngstroem;
Note: See TracChangeset for help on using the changeset viewer.