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