- Timestamp:
- Aug 3, 2009, 6:58:46 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:
- ab1932
- Parents:
- 2319ed (diff), 8c54a3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/atom.cpp
r2319ed r0dbddc 108 108 }; 109 109 110 ostream & operator << (ostream &ost, const atom &a) 110 ostream & operator << (ostream &ost, const atom &a) 111 111 { 112 112 ost << "[" << a.Name << "|" << &a << "]"; … … 118 118 * \return true - this one's is smaller, false - not 119 119 */ 120 bool atom::Compare( atom &ptr)120 bool atom::Compare(const atom &ptr) 121 121 { 122 122 if (nr < ptr.nr) -
src/boundary.cpp
r2319ed r0dbddc 1152 1152 FillerDistance.InverseMatrixMultiplication(M); 1153 1153 for(int i=0;i<NDIM;i++) 1154 N[i] = ceil(1./FillerDistance.x[i]);1154 N[i] = (int) ceil(1./FillerDistance.x[i]); 1155 1155 1156 1156 // go over [0,1]^3 filler grid … … 1164 1164 FillIt = true; 1165 1165 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { 1166 FillIt = FillIt && (!(*ListRunner)->TesselStruct->IsInside(&CurrentPosition));1166 //FillIt = FillIt && (!(*ListRunner)->TesselStruct->IsInside(&CurrentPosition)); 1167 1167 } 1168 1168 … … 2181 2181 */ 2182 2182 int Tesselation::CheckPresenceOfTriangle(ofstream *out, atom *Candidates[3]) { 2183 // TODO: use findTriangles here and return result.size(); 2183 2184 LineMap::iterator FindLine; 2184 2185 PointMap::iterator FindPoint; … … 3123 3124 */ 3124 3125 bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2) { 3126 // TODO: use get angle and remove duplicate code 3125 3127 Vector BaseLineVector, OrthogonalVector, helper; 3126 3127 3128 3129 3130 3131 3132 3133 3134 3128 if (candidate1->BaseLine != candidate2->BaseLine) { // sanity check 3129 cout << Verbose(0) << "ERROR: sortCandidates was called for two different baselines: " << candidate1->BaseLine << " and " << candidate2->BaseLine << "." << endl; 3130 //return false; 3131 exit(1); 3132 } 3133 // create baseline vector 3134 BaseLineVector.CopyVector(&(candidate1->BaseLine->endpoints[1]->node->x)); 3135 BaseLineVector.SubtractVector(&(candidate1->BaseLine->endpoints[0]->node->x)); 3136 BaseLineVector.Normalize(); 3135 3137 3136 3138 // create normal in-plane vector to cope with acos() non-uniqueness on [0,2pi] (note that is pointing in the "right" direction already, hence ">0" test!) … … 3161 3163 // return comparison 3162 3164 return phi < psi; 3165 } 3166 3167 /** 3168 * Checks whether the provided atom is within the tesselation structure. 3169 * 3170 * @param atom of which to check the position 3171 * @param tesselation structure 3172 * 3173 * @return true if the atom is inside the tesselation structure, false otherwise 3174 */ 3175 bool IsInnerAtom(atom *Atom, class Tesselation *Tess, LinkedCell* LC) { 3176 if (Tess->LinesOnBoundary.begin() == Tess->LinesOnBoundary.end()) { 3177 cout << Verbose(0) << "Error: There is no tesselation structure to compare the atom with, " 3178 << "please create one first."; 3179 exit(1); 3180 } 3181 3182 class atom *trianglePoints[3]; 3183 trianglePoints[0] = findClosestAtom(Atom, LC); 3184 // check whether closest atom is "too close" :), then it's inside 3185 if (trianglePoints[0]->x.DistanceSquared(&Atom->x) < MYEPSILON) 3186 return true; 3187 list<atom*> *connectedClosestAtoms = Tess->getClosestConnectedAtoms(trianglePoints[0], Atom); 3188 trianglePoints[1] = connectedClosestAtoms->front(); 3189 trianglePoints[2] = connectedClosestAtoms->back(); 3190 for (int i=0;i<3;i++) { 3191 if (trianglePoints[i] == NULL) { 3192 cout << Verbose(1) << "IsInnerAtom encounters serious error, point " << i << " not found." << endl; 3193 } 3194 3195 cout << Verbose(1) << "List of possible atoms:" << endl; 3196 cout << *trianglePoints[i] << endl; 3197 3198 // for(list<atom*>::iterator runner = connectedClosestAtoms->begin(); runner != connectedClosestAtoms->end(); runner++) 3199 // cout << Verbose(2) << *(*runner) << endl; 3200 } 3201 delete(connectedClosestAtoms); 3202 3203 list<BoundaryTriangleSet*> *triangles = Tess->FindTriangles(trianglePoints); 3204 3205 if (triangles->empty()) { 3206 cout << Verbose(0) << "Error: There is no nearest triangle. Please check the tesselation structure."; 3207 exit(1); 3208 } 3209 3210 Vector helper; 3211 helper.CopyVector(&Atom->x); 3212 3213 // Only in case of degeneration, there will be two different scalar products. 3214 // If at least one scalar product is positive, the point is considered to be outside. 3215 bool status = (helper.ScalarProduct(&triangles->front()->NormalVector) < 0) 3216 && (helper.ScalarProduct(&triangles->back()->NormalVector) < 0); 3217 delete(triangles); 3218 return status; 3219 } 3220 3221 /** 3222 * Finds the atom which is closest to the provided one. 3223 * 3224 * @param atom to which to find the closest other atom 3225 * @param linked cell structure 3226 * 3227 * @return atom which is closest to the provided one 3228 */ 3229 atom* findClosestAtom(const atom* Atom, LinkedCell* LC) { 3230 LinkedAtoms *List = NULL; 3231 atom* closestAtom = NULL; 3232 double distance = 1e16; 3233 Vector helper; 3234 int N[NDIM], Nlower[NDIM], Nupper[NDIM]; 3235 3236 LC->SetIndexToVector(&Atom->x); // ignore status as we calculate bounds below sensibly 3237 for(int i=0;i<NDIM;i++) // store indices of this cell 3238 N[i] = LC->n[i]; 3239 //cout << Verbose(2) << "INFO: Center cell is " << N[0] << ", " << N[1] << ", " << N[2] << " with No. " << LC->index << "." << endl; 3240 3241 LC->GetNeighbourBounds(Nlower, Nupper); 3242 //cout << endl; 3243 for (LC->n[0] = Nlower[0]; LC->n[0] <= Nupper[0]; LC->n[0]++) 3244 for (LC->n[1] = Nlower[1]; LC->n[1] <= Nupper[1]; LC->n[1]++) 3245 for (LC->n[2] = Nlower[2]; LC->n[2] <= Nupper[2]; LC->n[2]++) { 3246 List = LC->GetCurrentCell(); 3247 //cout << "The current cell " << LC->n[0] << "," << LC->n[1] << "," << LC->n[2] << endl; 3248 if (List != NULL) { 3249 for (LinkedAtoms::iterator Runner = List->begin(); Runner != List->end(); Runner++) { 3250 helper.CopyVector(&Atom->x); 3251 helper.SubtractVector(&(*Runner)->x); 3252 double currentNorm = helper. Norm(); 3253 if (currentNorm < distance) { 3254 distance = currentNorm; 3255 closestAtom = (*Runner); 3256 } 3257 } 3258 } else { 3259 cerr << "ERROR: The current cell " << LC->n[0] << "," << LC->n[1] << "," 3260 << LC->n[2] << " is invalid!" << endl; 3261 } 3262 } 3263 3264 return closestAtom; 3265 } 3266 3267 /** 3268 * Gets all atoms connected to the provided atom by triangulation lines. 3269 * 3270 * @param atom of which get all connected atoms 3271 * @param atom to be checked whether it is an inner atom 3272 * 3273 * @return list of the two atoms linked to the provided one and closest to the atom to be checked, 3274 */ 3275 list<atom*> * Tesselation::getClosestConnectedAtoms(atom* Atom, atom* AtomToCheck) { 3276 list<atom*> connectedAtoms; 3277 map<double, atom*> anglesOfAtoms; 3278 map<double, atom*>::iterator runner; 3279 LineMap::iterator findLines = LinesOnBoundary.begin(); 3280 list<atom*>::iterator listRunner; 3281 Vector center, planeNorm, currentPoint, OrthogonalVector, helper; 3282 atom* current; 3283 bool takeAtom = false; 3284 3285 planeNorm.CopyVector(&Atom->x); 3286 planeNorm.SubtractVector(&AtomToCheck->x); 3287 planeNorm.Normalize(); 3288 3289 while (findLines != LinesOnBoundary.end()) { 3290 takeAtom = false; 3291 3292 if (findLines->second->endpoints[0]->Nr == Atom->nr) { 3293 takeAtom = true; 3294 current = findLines->second->endpoints[1]->node; 3295 } else if (findLines->second->endpoints[1]->Nr == Atom->nr) { 3296 takeAtom = true; 3297 current = findLines->second->endpoints[0]->node; 3298 } 3299 3300 if (takeAtom) { 3301 connectedAtoms.push_back(current); 3302 currentPoint.CopyVector(¤t->x); 3303 currentPoint.ProjectOntoPlane(&planeNorm); 3304 center.AddVector(¤tPoint); 3305 } 3306 3307 findLines++; 3308 } 3309 3310 cout << "Summed vectors " << center << "; number of atoms " << connectedAtoms.size() 3311 << "; scale factor " << 1.0/connectedAtoms.size(); 3312 3313 center.Scale(1.0/connectedAtoms.size()); 3314 listRunner = connectedAtoms.begin(); 3315 3316 cout << " calculated center " << center << endl; 3317 3318 // construct one orthogonal vector 3319 helper.CopyVector(&AtomToCheck->x); 3320 helper.ProjectOntoPlane(&planeNorm); 3321 OrthogonalVector.MakeNormalVector(¢er, &helper, &(*listRunner)->x); 3322 while (listRunner != connectedAtoms.end()) { 3323 double angle = getAngle((*listRunner)->x, AtomToCheck->x, center, OrthogonalVector); 3324 cout << "Calculated angle " << angle << " for atom " << **listRunner << endl; 3325 anglesOfAtoms.insert(pair<double, atom*>(angle, (*listRunner))); 3326 listRunner++; 3327 } 3328 3329 list<atom*> *result = new list<atom*>; 3330 runner = anglesOfAtoms.begin(); 3331 cout << "First value is " << *runner->second << endl; 3332 result->push_back(runner->second); 3333 runner = anglesOfAtoms.end(); 3334 runner--; 3335 cout << "Second value is " << *runner->second << endl; 3336 result->push_back(runner->second); 3337 3338 cout << "List of closest atoms has " << result->size() << " elements, which are " 3339 << *(result->front()) << " and " << *(result->back()) << endl; 3340 3341 return result; 3342 } 3343 3344 /** 3345 * Finds triangles belonging to the three provided atoms. 3346 * 3347 * @param atom list, is expected to contain three atoms 3348 * 3349 * @return triangles which belong to the provided atoms, will be empty if there are none, 3350 * will usually be one, in case of degeneration, there will be two 3351 */ 3352 list<BoundaryTriangleSet*> *Tesselation::FindTriangles(atom* Points[3]) { 3353 list<BoundaryTriangleSet*> *result = new list<BoundaryTriangleSet*>; 3354 LineMap::iterator FindLine; 3355 PointMap::iterator FindPoint; 3356 TriangleMap::iterator FindTriangle; 3357 class BoundaryPointSet *TrianglePoints[3]; 3358 3359 for (int i = 0; i < 3; i++) { 3360 FindPoint = PointsOnBoundary.find(Points[i]->nr); 3361 if (FindPoint != PointsOnBoundary.end()) { 3362 TrianglePoints[i] = FindPoint->second; 3363 } else { 3364 TrianglePoints[i] = NULL; 3365 } 3366 } 3367 3368 // checks lines between the points in the Points for their adjacent triangles 3369 for (int i = 0; i < 3; i++) { 3370 if (TrianglePoints[i] != NULL) { 3371 for (int j = i; j < 3; j++) { 3372 if (TrianglePoints[j] != NULL) { 3373 FindLine = TrianglePoints[i]->lines.find(TrianglePoints[j]->node->nr); 3374 if (FindLine != TrianglePoints[i]->lines.end()) { 3375 for (; FindLine->first == TrianglePoints[j]->node->nr; FindLine++) { 3376 FindTriangle = FindLine->second->triangles.begin(); 3377 for (; FindTriangle != FindLine->second->triangles.end(); FindTriangle++) { 3378 if (( 3379 (FindTriangle->second->endpoints[0] == TrianglePoints[0]) 3380 || (FindTriangle->second->endpoints[0] == TrianglePoints[1]) 3381 || (FindTriangle->second->endpoints[0] == TrianglePoints[2]) 3382 ) && ( 3383 (FindTriangle->second->endpoints[1] == TrianglePoints[0]) 3384 || (FindTriangle->second->endpoints[1] == TrianglePoints[1]) 3385 || (FindTriangle->second->endpoints[1] == TrianglePoints[2]) 3386 ) && ( 3387 (FindTriangle->second->endpoints[2] == TrianglePoints[0]) 3388 || (FindTriangle->second->endpoints[2] == TrianglePoints[1]) 3389 || (FindTriangle->second->endpoints[2] == TrianglePoints[2]) 3390 ) 3391 ) { 3392 result->push_back(FindTriangle->second); 3393 } 3394 } 3395 } 3396 // Is it sufficient to consider one of the triangle lines for this. 3397 return result; 3398 3399 } 3400 } 3401 } 3402 } 3403 } 3404 3405 return result; 3406 } 3407 3408 /** 3409 * Gets the angle between a point and a reference relative to the provided center. 3410 * 3411 * @param point to calculate the angle for 3412 * @param reference to which to calculate the angle 3413 * @param center for which to calculate the angle between the vectors 3414 * @param OrthogonalVector helps discern between [0,pi] and [pi,2pi] in acos() 3415 * 3416 * @return angle between point and reference 3417 */ 3418 double getAngle(Vector point, Vector reference, Vector center, Vector OrthogonalVector) { 3419 Vector ReferenceVector, helper; 3420 cout << Verbose(2) << reference << " is our reference " << endl; 3421 cout << Verbose(2) << center << " is our center " << endl; 3422 // create baseline vector 3423 ReferenceVector.CopyVector(&reference); 3424 ReferenceVector.SubtractVector(¢er); 3425 if (ReferenceVector.IsNull()) 3426 return M_PI; 3427 3428 // calculate both angles and correct with in-plane vector 3429 helper.CopyVector(&point); 3430 helper.SubtractVector(¢er); 3431 if (helper.IsNull()) 3432 return M_PI; 3433 double phi = ReferenceVector.Angle(&helper); 3434 if (OrthogonalVector.ScalarProduct(&helper) > 0) { 3435 phi = 2.*M_PI - phi; 3436 } 3437 3438 cout << Verbose(2) << point << " has angle " << phi << endl; 3439 3440 return phi; 3441 } 3442 3443 /** 3444 * Checks whether the provided point is within the tesselation structure. 3445 * 3446 * This is a wrapper function for IsInnerAtom, so it can be used with a simple 3447 * vector, too. 3448 * 3449 * @param point of which to check the position 3450 * @param tesselation structure 3451 * 3452 * @return true if the point is inside the tesselation structure, false otherwise 3453 */ 3454 bool IsInnerPoint(Vector Point, class Tesselation *Tess, LinkedCell* LC) { 3455 atom *temp_atom = new atom; 3456 bool status = false; 3457 temp_atom->x.CopyVector(&Point); 3458 3459 status = IsInnerAtom(temp_atom, Tess, LC); 3460 delete(temp_atom); 3461 3462 return status; 3163 3463 } 3164 3464 … … 3248 3548 cout << Verbose(2) << "None." << endl; 3249 3549 3550 // Tests the IsInnerAtom() function. 3551 Vector x (0, 0, 0); 3552 cout << Verbose(0) << "Point to check: " << x << endl; 3553 cout << Verbose(0) << "Check: IsInnerPoint() returns " << IsInnerPoint(x, Tess, LCList) 3554 << "for vector " << x << "." << endl; 3555 atom* a = Tess->PointsOnBoundary.begin()->second->node; 3556 cout << Verbose(0) << "Point to check: " << *a << " (on boundary)." << endl; 3557 cout << Verbose(0) << "Check: IsInnerAtom() returns " << IsInnerAtom(a, Tess, LCList) 3558 << "for atom " << a << " (on boundary)." << endl; 3559 LinkedAtoms *List = NULL; 3560 for (int i=0;i<NDIM;i++) { // each axis 3561 LCList->n[i] = LCList->N[i]-1; // current axis is topmost cell 3562 for (LCList->n[(i+1)%NDIM]=0;LCList->n[(i+1)%NDIM]<LCList->N[(i+1)%NDIM];LCList->n[(i+1)%NDIM]++) 3563 for (LCList->n[(i+2)%NDIM]=0;LCList->n[(i+2)%NDIM]<LCList->N[(i+2)%NDIM];LCList->n[(i+2)%NDIM]++) { 3564 List = LCList->GetCurrentCell(); 3565 //cout << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << "." << endl; 3566 if (List != NULL) { 3567 for (LinkedAtoms::iterator Runner = List->begin();Runner != List->end();Runner++) { 3568 if (Tess->PointsOnBoundary.find((*Runner)->nr) == Tess->PointsOnBoundary.end()) { 3569 a = *Runner; 3570 i=3; 3571 for (int j=0;j<NDIM;j++) 3572 LCList->n[j] = LCList->N[j]; 3573 break; 3574 } 3575 } 3576 } 3577 } 3578 } 3579 cout << Verbose(0) << "Check: IsInnerAtom() returns " << IsInnerAtom(a, Tess, LCList) 3580 << "for atom " << a << " (inside)." << endl; 3581 3582 3250 3583 if (freeTess) 3251 3584 delete(Tess); -
src/boundary.hpp
r2319ed r0dbddc 114 114 bool InsertStraddlingPoints(ofstream *out, molecule *mol); 115 115 bool CorrectConcaveBaselines(ofstream *out); 116 list<atom*> *getClosestConnectedAtoms(atom* Atom, atom* AtomToCheck); 117 list<BoundaryTriangleSet*> *FindTriangles(atom* TrianglePoints[3]); 116 118 117 119 PointMap PointsOnBoundary; … … 144 146 bool existsIntersection(Vector point1, Vector point2, Vector point3, Vector point4); 145 147 bool sortCandidates(CandidateForTesselation* candidate1, CandidateForTesselation* candidate2); 148 bool IsInnerPoint(Vector Point, class Tesselation *Tess, LinkedCell* LC); 149 bool IsInnerAtom(atom *Atom, class Tesselation *Tess, LinkedCell* LC); 150 atom* findClosestAtom(const atom* Atom, LinkedCell* LC); 151 double getAngle(Vector point, Vector reference, Vector center, Vector OrthogonalVector); 146 152 147 153 #endif /*BOUNDARY_HPP_*/ -
src/linkedcell.cpp
r2319ed r0dbddc 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 index = n[0] * N[1] * N[2] + n[1] * N[2] + n[2]; 141 141 if (CheckBounds()) { 142 142 for (LinkedAtoms::iterator Runner = LC[index].begin(); Runner != LC[index].end(); Runner++) 143 status = status || ((*Runner) == Walker);143 status = status || ((*Runner) == &Walker); 144 144 return status; 145 145 } else { 146 cerr << Verbose(1) << "ERROR: Atom "<< *Walker << " at " << Walker->x << " is out of bounds." << endl;146 cerr << Verbose(1) << "ERROR: Atom "<< Walker << " at " << Walker.x << " is out of bounds." << endl; 147 147 return false; 148 } 149 }; 150 151 /** Calculates the interval bounds of the linked cell grid. 152 * \param *lower lower bounds 153 * \param *upper upper bounds 154 */ 155 void LinkedCell::GetNeighbourBounds(int lower[NDIM], int upper[NDIM]) 156 { 157 for (int i=0;i<NDIM;i++) { 158 lower[i] = ((n[i]-1) >= 0) ? n[i]-1 : 0; 159 upper[i] = ((n[i]+1) < N[i]) ? n[i]+1 : N[i]-1; 160 //cout << " [" << Nlower[i] << "," << Nupper[i] << "] "; 161 // check for this axis whether the point is outside of our grid 162 if (n[i] < 0) 163 upper[i] = lower[i]; 164 if (n[i] > N[i]) 165 lower[i] = upper[i]; 166 167 //cout << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl; 148 168 } 149 169 }; … … 153 173 * \return Vector is inside bounding box - true, else - false 154 174 */ 155 bool LinkedCell::SetIndexToVector( Vector *x)175 bool LinkedCell::SetIndexToVector(const Vector *x) 156 176 { 157 177 bool status = true; -
src/linkedcell.hpp
r2319ed r0dbddc 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 29 bool CheckBounds(); 30 void GetNeighbourBounds(int lower[NDIM], int upper[NDIM]); 30 31 31 32 // not implemented yet -
src/molecules.hpp
r2319ed r0dbddc 156 156 bool OutputXYZLine(ofstream *out) const; 157 157 atom *GetTrueFather(); 158 bool Compare( atom &ptr);158 bool Compare(const atom &ptr); 159 159 160 160 private: -
src/vector.cpp
r2319ed r0dbddc 348 348 }; 349 349 350 /** Checks whether vector has all components zero. 351 * @return true - vector is zero, false - vector is not 352 */ 353 bool Vector::IsNull() 354 { 355 return (fabs(x[0]+x[1]+x[2]) < MYEPSILON); 356 }; 357 350 358 /** Calculates the angle between this and another vector. 351 359 * \param *y array to second vector … … 456 464 }; 457 465 458 ostream& operator<<(ostream& ost, Vector& m)466 ostream& operator<<(ostream& ost, const Vector& m) 459 467 { 460 468 ost << "("; -
src/vector.hpp
r2319ed r0dbddc 24 24 double NormSquared() const; 25 25 double Angle(const Vector *y) const; 26 bool IsNull(); 26 27 27 28 void AddVector(const Vector *y); … … 58 59 }; 59 60 60 ostream & operator << (ostream& ost, Vector &m);61 ostream & operator << (ostream& ost, const Vector &m); 61 62 //Vector& operator+=(Vector& a, const Vector& b); 62 63 //Vector& operator*=(Vector& a, const double m);
Note:
See TracChangeset
for help on using the changeset viewer.