- Timestamp:
- Aug 3, 2009, 4:45:38 PM (15 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:
- ee1b16
- Parents:
- 9c20aa
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/linkedcell.cpp
r9c20aa r0f4538 129 129 130 130 /** Calculates the index for a given atom *Walker. 131 * \param *Walker atom to set index to131 * \param Walker atom to set index to 132 132 * \return if the atom is also found in this cell - true, else - false 133 133 */ 134 bool LinkedCell::SetIndexToAtom( atom *Walker)134 bool LinkedCell::SetIndexToAtom(const atom &Walker) 135 135 { 136 136 bool status = false; 137 137 for (int i=0;i<NDIM;i++) { 138 n[i] = (int)floor((Walker ->x.x[i] - min.x[i])/RADIUS);138 n[i] = (int)floor((Walker.x.x[i] - min.x[i])/RADIUS); 139 139 } 140 140 141 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 141 142 if (CheckBounds()) { 142 143 for (LinkedAtoms::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++) 143 status = status || ((*Runner) == Walker);144 status = status || ((*Runner) == &Walker); 144 145 return status; 145 146 } else { 146 cerr << Verbose(1) << " ERROR: Atom "<< *Walker << " at " << Walker->x << " is out of bounds." << endl;147 cerr << Verbose(1) << "WARN: Atom "<< Walker << " at " << Walker.x << " is out of bounds." << endl; 147 148 return false; 148 149 } 150 }; 151 152 /** Calculates the interval bounds of the linked cell grid. 153 * \param *lower lower bounds 154 * \param *upper upper bounds 155 */ 156 void LinkedCell::GetNeighbourBounds(int lower[NDIM], int upper[NDIM]) 157 { 158 for (int i=0;i<NDIM;i++) { 159 lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0; 160 upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1; 161 //cout << " [" << Nlower[i] << "," << Nupper[i] << "] "; 162 // check for this axis whether the point is outside of our grid 163 if (n[i] < 0) 164 upper[i] = lower[i]; 165 if (n[i] > N[i]) 166 lower[i] = upper[i]; 167 168 //cout << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl; 169 } 149 170 }; 150 171 … … 153 174 * \return Vector is inside bounding box - true, else - false 154 175 */ 155 bool LinkedCell::SetIndexToVector( Vector *x)176 bool LinkedCell::SetIndexToVector(const Vector *x) 156 177 { 157 178 bool status = true; -
src/linkedcell.hpp
r9c20aa r0f4538 11 11 #define LinkedAtoms list <atom *> 12 12 13 class LinkedCell {13 class LinkedCell { 14 14 public: 15 15 Vector max; // upper boundary … … 25 25 ~LinkedCell(); 26 26 LinkedAtoms* GetCurrentCell(); 27 bool SetIndexToAtom(atom *Walker); 28 bool SetIndexToVector(Vector *x); 27 bool SetIndexToAtom(const atom &Walker); 28 bool SetIndexToVector(const Vector *x); 29 void GetNeighbourBounds(int lower[NDIM], int upper[NDIM]); 29 30 bool CheckBounds(); 30 31
Note:
See TracChangeset
for help on using the changeset viewer.