| 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 |  | 
|---|
| 8 | /* | 
|---|
| 9 | * LinkedCellUnitTest.cpp | 
|---|
| 10 | * | 
|---|
| 11 | *  Created on: Apr 9, 2010 | 
|---|
| 12 | *      Author: heber | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | // include config.h | 
|---|
| 16 | #ifdef HAVE_CONFIG_H | 
|---|
| 17 | #include <config.h> | 
|---|
| 18 | #endif | 
|---|
| 19 |  | 
|---|
| 20 | using namespace std; | 
|---|
| 21 |  | 
|---|
| 22 | #include <cppunit/CompilerOutputter.h> | 
|---|
| 23 | #include <cppunit/extensions/TestFactoryRegistry.h> | 
|---|
| 24 | #include <cppunit/ui/text/TestRunner.h> | 
|---|
| 25 |  | 
|---|
| 26 | #include <iostream> | 
|---|
| 27 | #include <stdio.h> | 
|---|
| 28 | #include <cstring> | 
|---|
| 29 |  | 
|---|
| 30 | #include "atom.hpp" | 
|---|
| 31 | #include "Descriptors/MoleculeDescriptor.hpp" | 
|---|
| 32 | #include "Element/element.hpp" | 
|---|
| 33 | #include "linkedcell.hpp" | 
|---|
| 34 | #include "molecule.hpp" | 
|---|
| 35 | #include "Element/periodentafel.hpp" | 
|---|
| 36 | #include "PointCloudAdaptor.hpp" | 
|---|
| 37 | #include "World.hpp" | 
|---|
| 38 |  | 
|---|
| 39 | #include "LinkedCellUnitTest.hpp" | 
|---|
| 40 |  | 
|---|
| 41 | #ifdef HAVE_TESTRUNNER | 
|---|
| 42 | #include "UnitTestMain.hpp" | 
|---|
| 43 | #endif /*HAVE_TESTRUNNER*/ | 
|---|
| 44 |  | 
|---|
| 45 | /********************************************** Test classes **************************************/ | 
|---|
| 46 |  | 
|---|
| 47 | // Registers the fixture into the 'registry' | 
|---|
| 48 | CPPUNIT_TEST_SUITE_REGISTRATION( LinkedCellTest ); | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 | void LinkedCellTest::setUp() | 
|---|
| 52 | { | 
|---|
| 53 | atom *Walker = NULL; | 
|---|
| 54 |  | 
|---|
| 55 | // construct element | 
|---|
| 56 | hydrogen = World::getInstance().getPeriode()->FindElement(1); | 
|---|
| 57 | CPPUNIT_ASSERT(hydrogen != NULL && "could not find element hydrogen"); | 
|---|
| 58 |  | 
|---|
| 59 | // construct molecule (water molecule) | 
|---|
| 60 | TestMolecule = World::getInstance().createMolecule(); | 
|---|
| 61 | CPPUNIT_ASSERT(TestMolecule != NULL && "could not create molecule"); | 
|---|
| 62 | for (double x=0.5;x<3;x+=1.) | 
|---|
| 63 | for (double y=0.5;y<3;y+=1.) | 
|---|
| 64 | for (double z=0.5;z<3;z+=1.) { | 
|---|
| 65 | Walker = World::getInstance().createAtom(); | 
|---|
| 66 | CPPUNIT_ASSERT(Walker != NULL && "could not create atom"); | 
|---|
| 67 | Walker->setType(hydrogen); | 
|---|
| 68 | Walker->setPosition(Vector(x, y, z )); | 
|---|
| 69 | TestMolecule->AddAtom(Walker); | 
|---|
| 70 | } | 
|---|
| 71 |  | 
|---|
| 72 | // construct linked cell | 
|---|
| 73 | PointCloudAdaptor<molecule> cloud(TestMolecule, TestMolecule->name); | 
|---|
| 74 | LC = new LinkedCell (cloud, 1.); | 
|---|
| 75 | CPPUNIT_ASSERT(LC != NULL && "could not create LinkedCell"); | 
|---|
| 76 |  | 
|---|
| 77 | // check that TestMolecule was correctly constructed | 
|---|
| 78 | CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 ); | 
|---|
| 79 | }; | 
|---|
| 80 |  | 
|---|
| 81 |  | 
|---|
| 82 | void LinkedCellTest::tearDown() | 
|---|
| 83 | { | 
|---|
| 84 | delete(LC); | 
|---|
| 85 | World::purgeInstance(); | 
|---|
| 86 | }; | 
|---|
| 87 |  | 
|---|
| 88 |  | 
|---|
| 89 | /** UnitTest for LinkedCell::CheckBounds(). | 
|---|
| 90 | */ | 
|---|
| 91 | void LinkedCellTest::CheckBoundsTest() | 
|---|
| 92 | { | 
|---|
| 93 | // check for within bounds | 
|---|
| 94 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 95 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() ); | 
|---|
| 96 | LC->n[0] = LC->n[1] = LC->n[2] = 1; | 
|---|
| 97 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() ); | 
|---|
| 98 | LC->n[0] = LC->n[1] = LC->n[2] = 2; | 
|---|
| 99 | CPPUNIT_ASSERT_EQUAL( true, LC->CheckBounds() ); | 
|---|
| 100 |  | 
|---|
| 101 | // check for out of bounds | 
|---|
| 102 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 103 | LC->n[0] = 404040; | 
|---|
| 104 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() ); | 
|---|
| 105 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 106 | LC->n[0] = 0; | 
|---|
| 107 | LC->n[1] = 5000; | 
|---|
| 108 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() ); | 
|---|
| 109 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 110 | LC->n[1] = 0; | 
|---|
| 111 | LC->n[2] = -70; | 
|---|
| 112 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() ); | 
|---|
| 113 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 114 | LC->n[0] = LC->n[1] = LC->n[2] = 3; | 
|---|
| 115 | CPPUNIT_ASSERT_EQUAL( false, LC->CheckBounds() ); | 
|---|
| 116 | }; | 
|---|
| 117 |  | 
|---|
| 118 |  | 
|---|
| 119 | /** UnitTest for LinkedCell::GetCurrentCell(). | 
|---|
| 120 | * Note that CheckBounds() is used and has to be tested already. | 
|---|
| 121 | */ | 
|---|
| 122 | void LinkedCellTest::GetCurrentCellTest() | 
|---|
| 123 | { | 
|---|
| 124 | // within bounds | 
|---|
| 125 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 126 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0 * 3*3 + 0 * 3 + 0], LC->GetCurrentCell() ); | 
|---|
| 127 | LC->n[0] = LC->n[1] = LC->n[2] = 1; | 
|---|
| 128 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[1 * 3*3 + 1 * 3 + 1], LC->GetCurrentCell() ); | 
|---|
| 129 | LC->n[0] = LC->n[1] = LC->n[2] = 2; | 
|---|
| 130 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetCurrentCell() ); | 
|---|
| 131 |  | 
|---|
| 132 | // out of bounds | 
|---|
| 133 | LC->n[0] = LC->n[1] = LC->n[2] = 3; | 
|---|
| 134 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 135 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetCurrentCell() ); | 
|---|
| 136 | LC->n[0] = LC->n[1] = LC->n[2] = -1; | 
|---|
| 137 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 138 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetCurrentCell() ); | 
|---|
| 139 | }; | 
|---|
| 140 |  | 
|---|
| 141 | /** UnitTest for LinkedCell::GetRelativeToCurrentCell(). | 
|---|
| 142 | */ | 
|---|
| 143 | void LinkedCellTest::GetRelativeToCurrentCellTest() | 
|---|
| 144 | { | 
|---|
| 145 | int offset[3]; | 
|---|
| 146 |  | 
|---|
| 147 | // offset to (0,0,0) always | 
|---|
| 148 | offset[0] = offset[1] = offset[2] = 0; | 
|---|
| 149 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 150 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 151 | offset[0] = offset[1] = offset[2] = -1; | 
|---|
| 152 | LC->n[0] = LC->n[1] = LC->n[2] = 1; | 
|---|
| 153 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 154 | offset[0] = offset[1] = offset[2] = -2; | 
|---|
| 155 | LC->n[0] = LC->n[1] = LC->n[2] = 2; | 
|---|
| 156 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[0], LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 157 |  | 
|---|
| 158 | // offset to (0,0,0) - 1.*(x/y/z) out of bounds | 
|---|
| 159 | offset[0] = offset[1] = offset[2] = 0; | 
|---|
| 160 | offset[0] = -1; | 
|---|
| 161 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 162 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 163 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 164 | offset[0] = offset[1] = offset[2] = 0; | 
|---|
| 165 | offset[1] = -1; | 
|---|
| 166 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 167 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 168 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 169 | offset[0] = offset[1] = offset[2] = 0; | 
|---|
| 170 | offset[2] = -1; | 
|---|
| 171 | LC->n[0] = LC->n[1] = LC->n[2] = 0; | 
|---|
| 172 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 173 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 174 |  | 
|---|
| 175 | // out of bounds | 
|---|
| 176 | offset[0] = offset[1] = offset[2] = -5054932; | 
|---|
| 177 | LC->n[0] = LC->n[1] = LC->n[2] = 1; | 
|---|
| 178 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 179 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 180 | offset[0] = offset[1] = offset[2] = 192345; | 
|---|
| 181 | LC->n[0] = LC->n[1] = LC->n[2] = 1; | 
|---|
| 182 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 183 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 184 |  | 
|---|
| 185 | // index is out of bounds, offset points within | 
|---|
| 186 | offset[0] = offset[1] = offset[2] = -2; | 
|---|
| 187 | LC->n[0] = LC->n[1] = LC->n[2] = 4; | 
|---|
| 188 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)&LC->LC[2 * 3*3 + 2 * 3 + 2], LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 189 |  | 
|---|
| 190 | // index is within bounds, offset points out | 
|---|
| 191 | offset[0] = offset[1] = offset[2] = 2; | 
|---|
| 192 | LC->n[0] = LC->n[1] = LC->n[2] = 2; | 
|---|
| 193 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 194 | CPPUNIT_ASSERT_EQUAL( (const TesselPointSTLList*)NULL, LC->GetRelativeToCurrentCell(offset) ); | 
|---|
| 195 | }; | 
|---|
| 196 |  | 
|---|
| 197 |  | 
|---|
| 198 | /** UnitTest for LinkedCell::SetIndexToNode(). | 
|---|
| 199 | */ | 
|---|
| 200 | void LinkedCellTest::SetIndexToNodeTest() | 
|---|
| 201 | { | 
|---|
| 202 | // check all atoms | 
|---|
| 203 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){ | 
|---|
| 204 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) ); | 
|---|
| 205 | } | 
|---|
| 206 |  | 
|---|
| 207 | // check internal vectors, returns false, because this atom is not in LC-list! | 
|---|
| 208 | atom *newAtom = World::getInstance().createAtom(); | 
|---|
| 209 | newAtom->setName("test"); | 
|---|
| 210 | newAtom->setPosition(Vector(1,1,1)); | 
|---|
| 211 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); | 
|---|
| 212 | World::getInstance().destroyAtom(newAtom); | 
|---|
| 213 |  | 
|---|
| 214 | // check out of bounds vectors | 
|---|
| 215 | newAtom = World::getInstance().createAtom(); | 
|---|
| 216 | newAtom->setName("test"); | 
|---|
| 217 | newAtom->setPosition(Vector(0,-1,0)); | 
|---|
| 218 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); | 
|---|
| 219 | World::getInstance().destroyAtom(newAtom); | 
|---|
| 220 | }; | 
|---|
| 221 |  | 
|---|
| 222 |  | 
|---|
| 223 | /** UnitTest for LinkedCell::SetIndexToVector(). | 
|---|
| 224 | */ | 
|---|
| 225 | void LinkedCellTest::SetIndexToVectorTest() | 
|---|
| 226 | { | 
|---|
| 227 | Vector tester; | 
|---|
| 228 |  | 
|---|
| 229 | // check center of each cell | 
|---|
| 230 | for (double x=0.5;x<3;x+=1.) | 
|---|
| 231 | for (double y=0.5;y<3;y+=1.) | 
|---|
| 232 | for (double z=0.5;z<3;z+=1.) { | 
|---|
| 233 | tester = Vector(x,y,z); | 
|---|
| 234 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) ); | 
|---|
| 235 | } | 
|---|
| 236 | // check corners of each cell | 
|---|
| 237 | for (double x=1.;x<4;x+=1.) | 
|---|
| 238 | for (double y=1.;y<4;y+=1.) | 
|---|
| 239 | for (double z=1.;z<4;z+=1.) { | 
|---|
| 240 | tester= Vector(x,y,z); | 
|---|
| 241 | cout << "Tester is at " << tester << "." << endl; | 
|---|
| 242 | CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToVector(tester) ); | 
|---|
| 243 | } | 
|---|
| 244 | // check out of bounds | 
|---|
| 245 | for (double x=0.5-1e-10;x<5;x+=3.1) | 
|---|
| 246 | for (double y=0.5-1e-10;y<5;y+=3.1) | 
|---|
| 247 | for (double z=0.5-1e-10;z<5;z+=3.1) { | 
|---|
| 248 | tester = Vector(x,y,z); | 
|---|
| 249 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 250 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) ); | 
|---|
| 251 | } | 
|---|
| 252 | // check nonsense vectors | 
|---|
| 253 | tester= Vector(-423598,3245978,29349); | 
|---|
| 254 | cout << "The following test is supposed to fail and produce an ERROR." << endl; | 
|---|
| 255 | CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToVector(tester) ); | 
|---|
| 256 | }; | 
|---|
| 257 |  | 
|---|
| 258 |  | 
|---|
| 259 | /** UnitTest for LinkedCell::GetNeighbourBounds(). | 
|---|
| 260 | */ | 
|---|
| 261 | void LinkedCellTest::GetNeighbourBoundsTest() | 
|---|
| 262 | { | 
|---|
| 263 | Vector tester; | 
|---|
| 264 | int lower[NDIM], upper[NDIM]; | 
|---|
| 265 |  | 
|---|
| 266 | tester= Vector(0.5,0.5,0.5); | 
|---|
| 267 | LC->SetIndexToVector(tester); | 
|---|
| 268 | LC->GetNeighbourBounds(lower, upper); | 
|---|
| 269 | for (int i=0;i<NDIM;i++) | 
|---|
| 270 | CPPUNIT_ASSERT_EQUAL( 0, lower[i]); | 
|---|
| 271 | for (int i=0;i<NDIM;i++) | 
|---|
| 272 | CPPUNIT_ASSERT_EQUAL( 1, upper[i]); | 
|---|
| 273 | }; | 
|---|
| 274 |  | 
|---|
| 275 |  | 
|---|
| 276 | /** UnitTest for LinkedCell::GetallNeighbours(). | 
|---|
| 277 | */ | 
|---|
| 278 | void LinkedCellTest::GetallNeighboursTest() | 
|---|
| 279 | { | 
|---|
| 280 | Vector tester; | 
|---|
| 281 | TesselPointSTLList *ListOfPoints = NULL; | 
|---|
| 282 | size_t size = 0; | 
|---|
| 283 |  | 
|---|
| 284 | // get all atoms | 
|---|
| 285 | tester= Vector(1.5,1.5,1.5); | 
|---|
| 286 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); | 
|---|
| 287 | ListOfPoints = LC->GetallNeighbours(); | 
|---|
| 288 | size = ListOfPoints->size(); | 
|---|
| 289 | CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); | 
|---|
| 290 |  | 
|---|
| 291 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ | 
|---|
| 292 | ListOfPoints->remove((*iter)); | 
|---|
| 293 | size--; | 
|---|
| 294 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); | 
|---|
| 295 | } | 
|---|
| 296 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size ); | 
|---|
| 297 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() ); | 
|---|
| 298 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() ); | 
|---|
| 299 | delete(ListOfPoints); | 
|---|
| 300 |  | 
|---|
| 301 | // get all atoms in one corner | 
|---|
| 302 | tester= Vector(0.5, 0.5, 0.5); | 
|---|
| 303 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); | 
|---|
| 304 | ListOfPoints = LC->GetallNeighbours(); | 
|---|
| 305 | size=ListOfPoints->size(); | 
|---|
| 306 | CPPUNIT_ASSERT_EQUAL( (size_t)8, size ); | 
|---|
| 307 | for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ | 
|---|
| 308 | if (((*iter)->at(0) <2) && ((*iter)->at(1) <2) && ((*iter)->at(2) <2)) { | 
|---|
| 309 | ListOfPoints->remove(*iter); | 
|---|
| 310 | size--; | 
|---|
| 311 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); | 
|---|
| 312 | } | 
|---|
| 313 | } | 
|---|
| 314 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size ); | 
|---|
| 315 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() ); | 
|---|
| 316 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() ); | 
|---|
| 317 | delete(ListOfPoints); | 
|---|
| 318 |  | 
|---|
| 319 | // get all atoms from one corner | 
|---|
| 320 | tester = Vector(0.5, 0.5, 0.5); | 
|---|
| 321 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); | 
|---|
| 322 | ListOfPoints = LC->GetallNeighbours(3); | 
|---|
| 323 | size=ListOfPoints->size(); | 
|---|
| 324 | CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); | 
|---|
| 325 | for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ | 
|---|
| 326 | ListOfPoints->remove(*iter); | 
|---|
| 327 | size--; | 
|---|
| 328 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); | 
|---|
| 329 | } | 
|---|
| 330 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size ); | 
|---|
| 331 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() ); | 
|---|
| 332 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() ); | 
|---|
| 333 | delete(ListOfPoints); | 
|---|
| 334 | }; | 
|---|
| 335 |  | 
|---|
| 336 |  | 
|---|
| 337 | /** UnitTest for LinkedCell::GetPointsInsideSphere(). | 
|---|
| 338 | */ | 
|---|
| 339 | void LinkedCellTest::GetPointsInsideSphereTest() | 
|---|
| 340 | { | 
|---|
| 341 | Vector tester; | 
|---|
| 342 | TesselPointSTLList *ListOfPoints = NULL; | 
|---|
| 343 | size_t size = 0; | 
|---|
| 344 |  | 
|---|
| 345 | // get all points around central arom with radius 1. | 
|---|
| 346 | tester= Vector(1.5,1.5,1.5); | 
|---|
| 347 | CPPUNIT_ASSERT_EQUAL ( true, LC->SetIndexToVector(tester) ); | 
|---|
| 348 | ListOfPoints = LC->GetPointsInsideSphere(1., &tester); | 
|---|
| 349 | size = ListOfPoints->size(); | 
|---|
| 350 | CPPUNIT_ASSERT_EQUAL( (size_t)7, size ); | 
|---|
| 351 | for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ | 
|---|
| 352 | if (((*iter)->DistanceSquared(tester) - 1.) < MYEPSILON ) { | 
|---|
| 353 | ListOfPoints->remove(*iter); | 
|---|
| 354 | size--; | 
|---|
| 355 | CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); | 
|---|
| 356 | } | 
|---|
| 357 | } | 
|---|
| 358 | CPPUNIT_ASSERT_EQUAL( (size_t)0, size ); | 
|---|
| 359 | CPPUNIT_ASSERT_EQUAL( (size_t)0, ListOfPoints->size() ); | 
|---|
| 360 | CPPUNIT_ASSERT_EQUAL( true, ListOfPoints->empty() ); | 
|---|
| 361 | delete(ListOfPoints); | 
|---|
| 362 | }; | 
|---|