Changes in src/boundary.cpp [6e5084:83f176]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r6e5084 r83f176 1 /* 2 * Project: MoleCuilder 3 * Description: creates and alters molecular systems 4 * Copyright (C) 2010 University of Bonn. All rights reserved. 5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. 6 */ 7 1 8 /** \file boundary.cpp 2 9 * … … 4 11 */ 5 12 13 // include config.h 14 #ifdef HAVE_CONFIG_H 15 #include <config.h> 16 #endif 17 6 18 #include "Helpers/MemDebug.hpp" 7 19 8 20 #include "Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp" 21 #include "BoundaryPointSet.hpp" 22 #include "BoundaryLineSet.hpp" 23 #include "BoundaryTriangleSet.hpp" 24 #include "CandidateForTesselation.hpp" 25 //#include "TesselPoint.hpp" 9 26 #include "World.hpp" 10 27 #include "atom.hpp" … … 87 104 if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around 88 105 Neighbour = BoundaryPoints[axis].begin(); 89 DistanceVector = runner->second.second->x - Neighbour->second.second->x;106 DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition()); 90 107 do { // seek for neighbour pair where it flips 91 108 OldComponent = DistanceVector[Othercomponent]; … … 93 110 if (Neighbour == BoundaryPoints[axis].end()) // make it wrap around 94 111 Neighbour = BoundaryPoints[axis].begin(); 95 DistanceVector = runner->second.second->x - Neighbour->second.second->x;112 DistanceVector = (runner->second.second->getPosition()) - (Neighbour->second.second->getPosition()); 96 113 //Log() << Verbose(2) << "OldComponent is " << OldComponent << ", new one is " << DistanceVector.x[Othercomponent] << "." << endl; 97 114 } while ((runner != Neighbour) && (fabs(OldComponent / fabs( … … 105 122 //Log() << Verbose(1) << "The pair, where the sign of OtherComponent flips, is: " << *(Neighbour->second.second) << " and " << *(OtherNeighbour->second.second) << "." << endl; 106 123 // now we have found the pair: Neighbour and OtherNeighbour 107 OtherVector = runner->second.second->x - OtherNeighbour->second.second->x;124 OtherVector = (runner->second.second->getPosition()) - (OtherNeighbour->second.second->getPosition()); 108 125 //Log() << Verbose(1) << "Distances to Neighbour and OtherNeighbour are " << DistanceVector.x[component] << " and " << OtherVector.x[component] << "." << endl; 109 126 //Log() << Verbose(1) << "OtherComponents to Neighbour and OtherNeighbour are " << DistanceVector.x[Othercomponent] << " and " << OtherVector.x[Othercomponent] << "." << endl; … … 173 190 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours 174 191 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 175 ProjectedVector = (*iter)-> x- (*MolCenter);192 ProjectedVector = (*iter)->getPosition() - (*MolCenter); 176 193 ProjectedVector.ProjectOntoPlane(AxisVector); 177 194 … … 188 205 } 189 206 DoLog(1) && (Log() << Verbose(1) << "Inserting " << **iter << ": (r, alpha) = (" << radius << "," << angle << "): " << ProjectedVector << endl); 190 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, DistancePair (radius, (*iter))));207 BoundaryTestPair = BoundaryPoints[axis].insert(BoundariesPair(angle, TesselPointDistancePair (radius, (*iter)))); 191 208 if (!BoundaryTestPair.second) { // same point exists, check first r, then distance of original vectors to center of gravity 192 209 DoLog(2) && (Log() << Verbose(2) << "Encountered two vectors whose projection onto axis " << axis << " is equal: " << endl); … … 199 216 DoLog(2) && (Log() << Verbose(2) << "Keeping new vector due to larger projected distance " << ProjectedVectorNorm << "." << endl); 200 217 } else if (fabs(ProjectedVectorNorm - BoundaryTestPair.first->second.first) < MYEPSILON) { 201 helper = (*iter)->x; 202 helper -= *MolCenter; 218 helper = (*iter)->getPosition() - (*MolCenter); 203 219 const double oldhelperNorm = helper.NormSquared(); 204 helper = BoundaryTestPair.first->second.second-> x- (*MolCenter);220 helper = BoundaryTestPair.first->second.second->getPosition() - (*MolCenter); 205 221 if (helper.NormSquared() < oldhelperNorm) { 206 222 BoundaryTestPair.first->second.second = (*iter); … … 255 271 { 256 272 Vector SideA, SideB, SideC, SideH; 257 SideA = left->second.second-> x- (*MolCenter);273 SideA = left->second.second->getPosition() - (*MolCenter); 258 274 SideA.ProjectOntoPlane(AxisVector); 259 275 // Log() << Verbose(1) << "SideA: " << SideA << endl; 260 276 261 SideB = right->second.second-> x-(*MolCenter);277 SideB = right->second.second->getPosition() -(*MolCenter); 262 278 SideB.ProjectOntoPlane(AxisVector); 263 279 // Log() << Verbose(1) << "SideB: " << SideB << endl; 264 280 265 SideC = left->second.second-> x - right->second.second->x;281 SideC = left->second.second->getPosition() - right->second.second->getPosition(); 266 282 SideC.ProjectOntoPlane(AxisVector); 267 283 // Log() << Verbose(1) << "SideC: " << SideC << endl; 268 284 269 SideH = runner->second.second-> x-(*MolCenter);285 SideH = runner->second.second->getPosition() -(*MolCenter); 270 286 SideH.ProjectOntoPlane(AxisVector); 271 287 // Log() << Verbose(1) << "SideH: " << SideH << endl; … … 701 717 // sum up the atomic masses 702 718 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 703 totalmass += (*iter)-> type->mass;719 totalmass += (*iter)->getType()->getMass(); 704 720 } 705 721 DoLog(0) && (Log() << Verbose(0) << "RESULT: The summed mass is " << setprecision(10) << totalmass << " atomicmassunit." << endl); … … 800 816 // Center filler at origin 801 817 filler->CenterEdge(&Inserter); 802 filler->Center.Zero();803 818 const int FillerCount = filler->getAtomCount(); 804 819 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl); … … 857 872 858 873 // ... and put at new position 859 Inserter = (*iter)-> x;874 Inserter = (*iter)->getPosition(); 860 875 if (DoRandomRotation) 861 876 Inserter *= Rotations; … … 882 897 // copy atom ... 883 898 CopyAtoms[(*iter)->nr] = (*iter)->clone(); 884 CopyAtoms[(*iter)->nr]->x = Inserter;899 (*CopyAtoms[(*iter)->nr]).setPosition(Inserter); 885 900 Filling->AddAtom(CopyAtoms[(*iter)->nr]); 886 DoLog( 4) && (Log() << Verbose(4) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->x) << "." << endl);901 DoLog(1) && (Log() << Verbose(1) << "Filling atom " << **iter << ", translated to " << AtomTranslations << ", at final position is " << (CopyAtoms[(*iter)->nr]->getPosition()) << "." << endl); 887 902 } else { 888 903 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is inner point, within boundary or outside of MaxDistance." << endl);
Note:
See TracChangeset
for help on using the changeset viewer.