Changeset 15463a for src/LinkedCell


Ignore:
Timestamp:
Mar 18, 2013, 1:32:16 PM (12 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:
d5b90b
Parents:
335011
git-author:
Frederik Heber <heber@…> (02/26/13 15:58:21)
git-committer:
Frederik Heber <heber@…> (03/18/13 13:32:16)
Message:

Extended LinkedCell_Controller::getBestModel() to take box into account.

  • We now limit the number of cells for all models to at most 103 cells per axis.
Location:
src/LinkedCell
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/LinkedCell/LinkedCell_Controller.cpp

    r335011 r15463a  
    133133const LinkedCell_Model *LinkedCell_Controller::getBestModel(double distance) const
    134134{
     135  // first check the box with respect to the given distance
     136  // as we must not generate more than 10^3 cells per axis due to
     137  // memory constraints
     138  const RealSpaceMatrix &M = domain.getM();
     139  RealSpaceMatrix UnitMatrix;
     140  UnitMatrix.setIdentity();
     141  UnitMatrix *= M;
     142  Vector Lengths = UnitMatrix.transformToEigenbasis();
     143  double min_distance = std::numeric_limits<double>::max();
     144  double max_length = 0.;
     145  for (size_t i=0;i<NDIM;++i) {
     146    min_distance = std::min(Lengths[i], min_distance);
     147    max_length = std::max(Lengths[i], max_length);
     148  }
     149  min_distance *= 1e-3; // at most 1000 cells per axis
     150  if (distance < min_distance) {
     151    LOG(1, "INFO: Setting LC distance from given " << distance
     152        << " to " << min_distance << " due to box size.");
     153    distance = min_distance;
     154  }
     155
    135156  /// Bound distance to be within [lower_threshold, upper_threshold).
    136157  /// Note that we need to stay away from upper boundary a bit,
     
    138159  if (distance < lower_threshold)
    139160    distance = lower_threshold;
    140   if (distance > upper_threshold)
    141     distance = upper_threshold - std::numeric_limits<double>::round_error();
     161  if (distance > max_length)
     162    distance = max_length - std::numeric_limits<double>::round_error();
    142163
    143164  /// Look for all models within [0.5 distance, 2. distance).
  • src/LinkedCell/unittests/stubs/ObserverBoxStub.cpp

    r335011 r15463a  
    6666}
    6767
     68const RealSpaceMatrix &Box::getM() const
     69{
     70  return *M;
     71}
     72
    6873const RealSpaceMatrix &Box::getMinv() const
    6974{
Note: See TracChangeset for help on using the changeset viewer.