Changeset 53d894 for src/LinkedCell
- Timestamp:
- Jan 2, 2012, 1:34:29 PM (13 years ago)
- 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:
- 4834f4
- Parents:
- c80643
- git-author:
- Frederik Heber <heber@…> (12/19/11 21:50:54)
- git-committer:
- Frederik Heber <heber@…> (01/02/12 13:34:29)
- Location:
- src/LinkedCell
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/LinkedCell/LinkedCell_Model.cpp
rc80643 r53d894 351 351 break; 352 352 case Box::Bounce: 353 if (index[i] < 0) 354 index[i] = 0; 355 if (index[i] >= getSize(i)) 356 index[i] = getSize(i)-1; 353 357 break; 354 358 case Box::Ignore: 359 if (index[i] < 0) 360 index[i] = 0; 361 if (index[i] >= getSize(i)) 362 index[i] = getSize(i)-1; 355 363 break; 356 364 default: … … 362 370 363 371 /** Calculates the interval bounds of the linked cell grid. 372 * 373 * \note we assume for index to allows be valid, i.e. within the range of LinkedCell_Model::N. 374 * 364 375 * \param index index to give relative bounds to 365 376 * \param step how deep to check the neighbouring cells (i.e. number of layers to check) … … 375 386 // calculate bounds 376 387 for (size_t i=0;i<NDIM;++i) { 388 ASSERT(index[i] >= 0, 389 "LinkedCell_Model::getNeighborhoodBounds() - index "+toString(index)+" out of lower bounds."); 390 ASSERT (index[i] < getSize(i), 391 "LinkedCell_Model::getNeighborhoodBounds() - index "+toString(index)+" out of upper bounds."); 377 392 switch (domain.getConditions()[i]) { 378 393 case Box::Wrap: 394 if ((index[i] - step[i]) < 0) 395 neighbors.first[i] = getSize(i) + (index[i] - step[i]); 396 else if ((index[i] - step[i]) >= getSize(i)) 397 neighbors.first[i] = (index[i] - step[i]) - getSize(i); 398 else 399 neighbors.first[i] = index[i] - step[i]; 400 neighbors.second[i] = 2*step[i]+1; 401 break; 402 case Box::Bounce: 403 neighbors.second[i] = 2*step[i]+1; 379 404 if (index[i] - step[i] >= 0) { 380 405 neighbors.first[i] = index[i] - step[i]; 381 406 } else { 382 neighbors.first[i] = getSize(i) - (index[i] - step[i]); 407 neighbors.first[i] = 0; 408 neighbors.second[i] = index[i] + step[i]+1; 383 409 } 384 if (index[i] + step[i] < getSize(i)) { 385 neighbors.second[i] = index[i] + step[i]; 386 } else { 387 neighbors.second[i] = index[i] + step[i] - getSize(i); 410 if (index[i] + step[i] >= getSize(i)) { 411 neighbors.second[i] = getSize(i) - (index[i] - step[i]); 388 412 } 389 413 break; 390 case Box::Bounce: 391 if (index[i] - step[i] >= 0) { 414 case Box::Ignore: 415 if (index[i] - step[i] < 0) 416 neighbors.first[i] = 0; 417 else 392 418 neighbors.first[i] = index[i] - step[i]; 393 } else { 394 neighbors.first[i] = - (index[i] - step[i]); 395 } 396 if (index[i] + step[i] < getSize(i)) { 397 neighbors.second[i] = index[i] + step[i]; 398 } else { 399 const size_t shift = index[i] + step[i]; 400 const size_t mod = shift / getSize(i); 401 if ((mod / 2)*2 == mod) // even -> come in from lower bound 402 neighbors.second[i] = (shift % getSize(i)); 403 else // odd -> come in from upper bound 404 neighbors.second[i] = getSize(i) - (shift % getSize(i)); 405 } 406 break; 407 case Box::Ignore: 408 ASSERT(index[i] - step[i] >= 0, 409 "LinkedCell_Model::getNeighborhoodBounds() - lower out of bounds on 'Ignore' boundary conditions"); 410 neighbors.first[i] = index[i] - step[i]; 411 ASSERT (index[i] + step[i] < getSize(i), 412 "LinkedCell_Model::getNeighborhoodBounds() - upper out of bounds on 'Ignore' boundary conditions"); 413 neighbors.second[i] = index[i] + step[i]; 414 ASSERT(neighbors.second[i] < neighbors.first[i], 415 "LinkedCell_Model::getNeighborhoodBounds() - [" 416 +toString(neighbors.first[i])+","+toString(neighbors.second[i]) 417 +"] does not make sense as array bounds."); 419 if (index[i] + step[i] >= getSize(i)) 420 neighbors.second[i] = getSize(i) - index[i]; 421 else 422 neighbors.second[i] = 2*step[i]+1; 418 423 break; 419 424 default: -
src/LinkedCell/LinkedCell_Model.hpp
rc80643 r53d894 60 60 bool checkArrayBounds(const tripleIndex &index) const; 61 61 void applyBoundaryConditions(tripleIndex &index) const; 62 bool empty() const { return CellLookup.size() == 0; } 62 63 63 64 void addNode(const TesselPoint *Walker); -
src/LinkedCell/LinkedCell_View.cpp
rc80643 r53d894 22 22 #include "LinkedCell_View.hpp" 23 23 24 #include "CodePatterns/Log.hpp" 25 24 26 #include "Atom/TesselPoint.hpp" 25 27 #include "LinearAlgebra/Vector.hpp" … … 37 39 { 38 40 } 41 39 42 40 43 /** Return at least as many points as are inside a sphere of \a radius around \a center. … … 57 60 58 61 tripleIndex n; 59 for (n[0] = neighbors.first[0]; n[0] <= neighbors.second[0]; n[0]++) 60 for (n[1] = neighbors.first[1]; n[1] <= neighbors.second[1]; n[1]++) 61 for (n[2] = neighbors.first[2]; n[2] <= neighbors.second[2]; n[2]++) { 62 if (!LC.checkArrayBounds(n)) 63 LC.applyBoundaryConditions(n); 64 const LinkedCell &List = LC.getCell(n); 65 //LOG(1, "Current cell is " << n[0] << ", " << n[1] << ", " << n[2] << " with No. " << index << "."); 62 for (n[0] = 0; n[0] < neighbors.second[0]; n[0]++) 63 for (n[1] = 0; n[1] < neighbors.second[1]; n[1]++) 64 for (n[2] = 0; n[2] < neighbors.second[2]; n[2]++) { 65 tripleIndex absolute_n = neighbors.first + n; 66 if (!LC.checkArrayBounds(absolute_n)) 67 LC.applyBoundaryConditions(absolute_n); 68 const LinkedCell &List = LC.getCell(absolute_n); 69 LOG(1, "Current cell is " << neighbors.first << " plus " << n << ", yielding " << absolute_n << "."); 66 70 for (LinkedCell::const_iterator Runner = List.begin(); Runner != List.end(); Runner++) 67 71 TesselList.push_back(*Runner); … … 84 88 return ReturnList; 85 89 } 86
Note:
See TracChangeset
for help on using the changeset viewer.